Class: Artemis::InstallGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- Artemis::InstallGenerator
- Defined in:
- lib/generators/artemis/install/install_generator.rb
Instance Method Summary collapse
Instance Method Details
#download_schema ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/generators/artemis/install/install_generator.rb', line 42 def download_schema say " downloading GraphQL schema from #{endpoint_url}..." if ['authorization'].present? rake "graphql:schema:update SERVICE=#{file_name} AUTHORIZATION='#{['authorization']}'" else rake "graphql:schema:update SERVICE=#{file_name}" end end |
#generate_client ⇒ Object
11 12 13 14 |
# File 'lib/generators/artemis/install/install_generator.rb', line 11 def generate_client template "client.rb", client_file_name create_file query_dir_gitkeep, "" end |
#generate_config ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/generators/artemis/install/install_generator.rb', line 16 def generate_config in_root do if behavior == :invoke && !File.exist?(config_file_name) template "graphql.yml", config_file_name else inject_into_file config_file_name, <<-YAML, after: "development:\n" #{file_name}: <<: *default url: #{endpoint_url}\n YAML inject_into_file config_file_name, <<-YAML, after: "test:\n", force: true #{file_name}: <<: *default url: #{endpoint_url}\n YAML inject_into_file config_file_name, <<-YAML, after: "production:\n", force: true #{file_name}: <<: *default url: #{endpoint_url}\n YAML end end end |