Class: Codestyle::ConfigGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/codestyle/config/config_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_gemObject



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_configObject



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_versionObject



24
25
26
# File 'lib/generators/codestyle/config/config_generator.rb', line 24

def ruby_version
  (/\d\.\d/.match `ruby -v`)[0]
end

#run_bundleObject



20
21
22
# File 'lib/generators/codestyle/config/config_generator.rb', line 20

def run_bundle
  run('bundle install')
end

#setupObject



6
7
8
# File 'lib/generators/codestyle/config/config_generator.rb', line 6

def setup
  @rubyversion = ruby_version
end