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_bootstrap_gem ⇒ Object
- #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_bootstrap_gem ⇒ Object
34 35 36 37 38 39 |
# File 'lib/generators/shopify_app/shopify_app_generator.rb', line 34 def add_bootstrap_gem gem_group :development, :test do gem "less-rails-bootstrap" gem 'therubyracer', :platforms => :ruby end end |
#add_config_variables ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/generators/shopify_app/shopify_app_generator.rb', line 23 def add_config_variables return if api_key.blank? || secret.blank? inject_into_file 'config/application.rb', <<-DATA, :after => "class Application < Rails::Application\n" # Shopify API connection credentials: config.shopify.api_key = '#{api_key}' config.shopify.secret = '#{secret}' DATA end |
#add_routes ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/generators/shopify_app/shopify_app_generator.rb', line 41 def add_routes unless [:skip_routes] route_without_newline "root :to => 'home#index'" route "end" route_without_newline " delete 'logout' => :destroy" route_without_newline " get 'auth/shopify/callback' => :show" route_without_newline " post 'login' => :create" route_without_newline " get 'login' => :new" route_without_newline "controller :sessions do" route "get 'design' => 'home#design'" route_without_newline "get 'welcome' => 'home#welcome'" end end |
#copy_files ⇒ Object
13 14 15 16 17 |
# File 'lib/generators/shopify_app/shopify_app_generator.rb', line 13 def copy_files directory 'app' directory 'public' directory 'config' end |
#display_readme ⇒ Object
55 56 57 58 |
# File 'lib/generators/shopify_app/shopify_app_generator.rb', line 55 def display_readme `bundle install` readme '../README' end |
#remove_static_index ⇒ Object
19 20 21 |
# File 'lib/generators/shopify_app/shopify_app_generator.rb', line 19 def remove_static_index remove_file 'public/index.html' end |