Class: ShopifyAppGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- ShopifyAppGenerator
- Defined in:
- lib/generators/shopify_app/shopify_app_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_config_variables ⇒ Object
- #add_routes ⇒ Object
- #copy_files ⇒ Object
- #display_readme ⇒ Object
- #remove_static_index ⇒ Object
Class Method Details
.source_root ⇒ Object
9 10 11 |
# File 'lib/generators/shopify_app/shopify_app_generator.rb', line 9 def self.source_root File.join(File.dirname(__FILE__), 'templates') end |
Instance Method Details
#add_config_variables ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/generators/shopify_app/shopify_app_generator.rb', line 22 def add_config_variables api_key_str = api_key.nil? ? "ENV['SHOPIFY_API_KEY']" : api_key.inspect api_secret_str = secret.nil? ? "ENV['SHOPIFY_API_SECRET']" : secret.inspect inject_into_file 'config/application.rb', <<-DATA, :after => "class Application < Rails::Application\n" # Shopify API connection credentials: config.shopify.api_key = #{api_key_str} config.shopify.secret = #{api_secret_str} DATA end |
#add_routes ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/generators/shopify_app/shopify_app_generator.rb', line 35 def add_routes unless [:skip_routes] route "match 'login/logout' => 'login#logout'" route "match 'login/finalize' => 'login#finalize'" route "match 'login/authenticate' => 'login#authenticate'" route "match 'login' => 'login#index'" route "match 'design' => 'home#design'" route "match 'welcome' => 'home#welcome'" route "root :to => 'home#index'" end end |
#copy_files ⇒ Object
13 14 15 16 |
# File 'lib/generators/shopify_app/shopify_app_generator.rb', line 13 def copy_files directory 'app' directory 'public' end |
#display_readme ⇒ Object
47 48 49 |
# File 'lib/generators/shopify_app/shopify_app_generator.rb', line 47 def display_readme readme '../README' end |
#remove_static_index ⇒ Object
18 19 20 |
# File 'lib/generators/shopify_app/shopify_app_generator.rb', line 18 def remove_static_index remove_file 'public/index.html' end |