Class: Refinery::DummyGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Refinery::DummyGenerator
- Defined in:
- lib/generators/refinery/dummy/dummy_generator.rb
Constant Summary collapse
- PASSTHROUGH_OPTIONS =
[ :skip_active_record, :skip_javascript, :skip_action_cable, :skip_action_mailer, :database, :javascript, :quiet, :pretend, :force, :skip ]
Instance Attribute Summary collapse
-
#database ⇒ Object
readonly
Returns the value of attribute database.
Class Method Summary collapse
Instance Method Summary collapse
- #generate_test_dummy ⇒ Object
- #test_dummy_clean ⇒ Object
- #test_dummy_config ⇒ Object
- #test_dummy_inherited_templates ⇒ Object
Instance Attribute Details
#database ⇒ Object (readonly)
Returns the value of attribute database.
68 69 70 |
# File 'lib/generators/refinery/dummy/dummy_generator.rb', line 68 def database @database end |
Class Method Details
.source_paths ⇒ Object
10 11 12 13 14 |
# File 'lib/generators/refinery/dummy/dummy_generator.rb', line 10 def self.source_paths paths = self.superclass.source_paths paths << File.('../templates', __FILE__) paths.flatten end |
Instance Method Details
#generate_test_dummy ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/generators/refinery/dummy/dummy_generator.rb', line 20 def generate_test_dummy opts = ( || {}).slice(*PASSTHROUGH_OPTIONS) opts[:database] = 'sqlite3' if opts[:database].blank? opts[:force] = true opts[:skip_bundle] = true opts[:skip_action_cable] = true opts[:skip_action_mailer] = true invoke Rails::Generators::AppGenerator, [ File.(dummy_path, destination_root) ], opts end |
#test_dummy_clean ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/generators/refinery/dummy/dummy_generator.rb', line 44 def test_dummy_clean inside dummy_path do remove_file ".gitignore" remove_file "doc" remove_file "Gemfile" remove_file "lib/tasks" remove_file "app/assets/images/rails.png" remove_file "public/index.html" remove_file "public/robots.txt" remove_file "README" remove_file "test" remove_file "vendor" end end |
#test_dummy_config ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/generators/refinery/dummy/dummy_generator.rb', line 31 def test_dummy_config @database = [:database] template "rails/database.yml", "#{dummy_path}/config/database.yml", :force => true template "rails/boot.rb.erb", "#{dummy_path}/config/boot.rb", :force => true template "rails/application.rb.erb", "#{dummy_path}/config/application.rb", :force => true template "rails/routes.rb", "#{dummy_path}/config/routes.rb", :force => true template "rails/Rakefile", "#{dummy_path}/Rakefile", :force => true template "rails/application.js", "#{dummy_path}/app/assets/javascripts/application.js", :force => true template 'rails/blank.png', "#{dummy_path}/public/apple-touch-icon.png", :force => true template 'rails/blank.png', "#{dummy_path}/public/apple-touch-icon-precomposed.png", :force => true end |
#test_dummy_inherited_templates ⇒ Object
59 60 61 62 63 64 65 66 |
# File 'lib/generators/refinery/dummy/dummy_generator.rb', line 59 def test_dummy_inherited_templates template "rails/search_form.html.erb", "#{dummy_path}/app/views/application/_search_form.html.erb", :force => true template "rails/searchable.html.erb", "#{dummy_path}/app/views/refinery/pages/searchable.html.erb", :force => true end |