Class: Codestyle::ConfigGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Codestyle::ConfigGenerator
- Defined in:
- lib/generators/codestyle/config/config_generator.rb
Instance Method Summary collapse
- #add_gem ⇒ Object
- #create_rubocop_config ⇒ Object
- #ruby_version ⇒ Object
- #run_bundle ⇒ Object
- #setup ⇒ Object
Instance Method Details
#add_gem ⇒ Object
10 11 12 |
# File 'lib/generators/codestyle/config/config_generator.rb', line 10 def add_gem gem 'rubocop', group: i[test development] end |
#create_rubocop_config ⇒ Object
14 15 16 17 18 |
# File 'lib/generators/codestyle/config/config_generator.rb', line 14 def create_rubocop_config directory('rubocop_config', '.rubocop_config') template 'rubocop_todo.yml', '.rubocop_todo.yml' template 'rubocop.yml', '.rubocop.yml' end |
#ruby_version ⇒ Object
24 25 26 |
# File 'lib/generators/codestyle/config/config_generator.rb', line 24 def ruby_version (/\d\.\d/.match `ruby -v`)[0] end |
#run_bundle ⇒ Object
20 21 22 |
# File 'lib/generators/codestyle/config/config_generator.rb', line 20 def run_bundle run('bundle install') end |
#setup ⇒ Object
6 7 8 |
# File 'lib/generators/codestyle/config/config_generator.rb', line 6 def setup @rubyversion = ruby_version end |