Class: RelevanceFileGenerator
- Inherits:
-
Rails::Generators::NamedBase
- Object
- Rails::Generators::NamedBase
- RelevanceFileGenerator
- Defined in:
- lib/generators/relevance_file/relevance_file_generator.rb
Instance Method Summary collapse
- #copy_gemfile ⇒ Object
- #copy_spec_helper ⇒ Object
- #create_application_layout ⇒ Object
- #create_database_example_yml ⇒ Object
- #create_readme_markdown ⇒ Object
- #create_rspec ⇒ Object
- #create_rvmrc ⇒ Object
- #fix_session_store ⇒ Object
- #fix_wrap_parameters ⇒ Object
Instance Method Details
#copy_gemfile ⇒ Object
11 12 13 |
# File 'lib/generators/relevance_file/relevance_file_generator.rb', line 11 def copy_gemfile template "Gemfile.erb", "Gemfile" end |
#copy_spec_helper ⇒ Object
33 34 35 |
# File 'lib/generators/relevance_file/relevance_file_generator.rb', line 33 def copy_spec_helper copy_file 'spec_helper.rb', 'spec/spec_helper.rb' end |
#create_application_layout ⇒ Object
19 20 21 |
# File 'lib/generators/relevance_file/relevance_file_generator.rb', line 19 def create_application_layout template 'application.html.haml.erb', 'app/views/layouts/application.html.haml' end |
#create_database_example_yml ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'lib/generators/relevance_file/relevance_file_generator.rb', line 37 def create_database_example_yml if database == 'mysql' template 'database.example.yml.mysql.erb', 'config/database.example.yml' elsif database == 'postgresql' template 'database.example.yml.postgresql.erb', 'config/database.example.yml' else create_file 'database.example.yml', "Don't know how to make a template for database: #{database}" end end |
#create_readme_markdown ⇒ Object
15 16 17 |
# File 'lib/generators/relevance_file/relevance_file_generator.rb', line 15 def create_readme_markdown template "README.markdown.erb", "README.markdown" end |
#create_rspec ⇒ Object
29 30 31 |
# File 'lib/generators/relevance_file/relevance_file_generator.rb', line 29 def create_rspec create_file '.rspec', '--colour' end |
#create_rvmrc ⇒ Object
23 24 25 26 27 |
# File 'lib/generators/relevance_file/relevance_file_generator.rb', line 23 def create_rvmrc if ENV['rvm_path'] create_file ".rvmrc", "rvm use #{RelevanceRails.ruby_version}@#{name}" end end |
#fix_session_store ⇒ Object
47 48 49 |
# File 'lib/generators/relevance_file/relevance_file_generator.rb', line 47 def fix_session_store gsub_file 'config/initializers/session_store.rb', 'key:', ':key =>' end |
#fix_wrap_parameters ⇒ Object
51 52 53 |
# File 'lib/generators/relevance_file/relevance_file_generator.rb', line 51 def fix_wrap_parameters gsub_file 'config/initializers/wrap_parameters.rb', 'format:', ':format =>' end |