Class: VersacommerceAppGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- VersacommerceAppGenerator
- Defined in:
- lib/generators/versacommerce_app/versacommerce_app_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_config_variables ⇒ Object
- #add_routes ⇒ Object
- #copy_files ⇒ Object
- #remove_static_index ⇒ Object
- #show_readme ⇒ Object
Class Method Details
.source_root ⇒ Object
10 11 12 |
# File 'lib/generators/versacommerce_app/versacommerce_app_generator.rb', line 10 def self.source_root File.join(File.dirname(__FILE__), 'templates') end |
Instance Method Details
#add_config_variables ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/generators/versacommerce_app/versacommerce_app_generator.rb', line 24 def add_config_variables return if api_key.blank? || secret.blank? append_file 'config/versacommerce_api.yml', <<-DATA development: api_key: #{api_key} secret: #{secret} test: api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx production: api_key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx DATA end |
#add_routes ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/generators/versacommerce_app/versacommerce_app_generator.rb', line 42 def add_routes unless [:skip_routes] route_without_newline "root :to => 'home#index'" route "end" route_without_newline " delete '/logout' => :destroy" route_without_newline " post '/login' => :create" route_without_newline " get '/login' => :new" route_without_newline " get '/finalize' => :finalize" route_without_newline "controller :sessions do" end end |
#copy_files ⇒ Object
14 15 16 17 18 |
# File 'lib/generators/versacommerce_app/versacommerce_app_generator.rb', line 14 def copy_files directory 'app' directory 'public' directory 'config' end |
#remove_static_index ⇒ Object
20 21 22 |
# File 'lib/generators/versacommerce_app/versacommerce_app_generator.rb', line 20 def remove_static_index remove_file 'public/index.html' end |
#show_readme ⇒ Object
54 55 56 57 |
# File 'lib/generators/versacommerce_app/versacommerce_app_generator.rb', line 54 def show_readme `bundle install` readme '../README' end |