Class: RrxDev::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- RrxDev::InstallGenerator
- Defined in:
- lib/generators/rrx_dev/install_generator.rb
Constant Summary collapse
- GEM_SPEC_APP_NAME =
'dummy'- GEM_SPEC_APP_ROOT =
'spec/dummy'
Instance Method Summary collapse
- #install_environment ⇒ Object
- #install_rspec ⇒ Object
- #install_rules ⇒ Object
- #install_spec_app ⇒ Object
Instance Method Details
#install_environment ⇒ Object
15 16 17 |
# File 'lib/generators/rrx_dev/install_generator.rb', line 15 def install_environment directory 'config' end |
#install_rspec ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/generators/rrx_dev/install_generator.rb', line 19 def install_rspec copy_file 'rspec', '.rspec' empty_directory 'spec/factories' empty_directory 'spec/support' empty_directory 'spec/models' empty_directory 'spec/requests' copy_file 'spec/spec_helper.rb' remove_file 'spec/rails_helper.rb' # # Override rails_helper and make sure it loads the Rails environment for the app # # or the gem's spec dummy app # copy_file 'spec/rails_helper.rb' do |content| # content.sub '../config/environment', "../#{app_config}/environment" # end end |
#install_rules ⇒ Object
10 11 12 13 |
# File 'lib/generators/rrx_dev/install_generator.rb', line 10 def install_rules copy_file 'editorconfig', '.editorconfig' copy_file 'rubocop.yml', '.rubocop.yml' end |
#install_spec_app ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/generators/rrx_dev/install_generator.rb', line 35 def install_spec_app return unless gem? in_root do unless app_path.exist? inside('spec') do run 'rails new --api -G --skip-docker -M --skip-active-job --skip-bootsnap -C -A -J -T -B dummy' end %w[development test production].each do |environment| remove_file app_environments.join("#{environment}.rb") end end end end |