Class: Avm::Ruby::Rubocop
- Defined in:
- lib/avm/ruby/rubocop.rb,
lib/avm/ruby/rubocop/_envvar.rb,
lib/avm/ruby/rubocop/_gemfile.rb,
lib/avm/ruby/rubocop/_configured.rb
Constant Summary collapse
- RUBOCOP_COMMAND_ENVVAR_NAME =
'RUBOCOP_COMMAND'
Instance Method Summary collapse
- #configured_rubocop_command_by_command ⇒ Object
- #configured_rubocop_command_by_gemfile ⇒ Object
- #configured_rubocop_command_uncached ⇒ Object
- #env_rubocop_command ⇒ Object
- #gemfile_rubocop_command ⇒ Object
- #rubocop_command_by_gemfile_path(path) ⇒ Object
- #rubocop_gemfile? ⇒ Boolean
- #run ⇒ Object
Instance Method Details
#configured_rubocop_command_by_command ⇒ Object
12 13 14 |
# File 'lib/avm/ruby/rubocop/_configured.rb', line 12 def configured_rubocop_command_by_command configuration.if_present(&:rubocop_command) end |
#configured_rubocop_command_by_gemfile ⇒ Object
16 17 18 19 20 |
# File 'lib/avm/ruby/rubocop/_configured.rb', line 16 def configured_rubocop_command_by_gemfile configuration.if_present(&:rubocop_gemfile).if_present do |v| rubocop_command_by_gemfile_path(v.parent) end end |
#configured_rubocop_command_uncached ⇒ Object
8 9 10 |
# File 'lib/avm/ruby/rubocop/_configured.rb', line 8 def configured_rubocop_command_uncached configured_rubocop_command_by_command || configured_rubocop_command_by_gemfile end |
#env_rubocop_command ⇒ Object
11 12 13 |
# File 'lib/avm/ruby/rubocop/_envvar.rb', line 11 def env_rubocop_command ENV[RUBOCOP_COMMAND_ENVVAR_NAME].present? ? cmd(ENV[RUBOCOP_COMMAND_ENVVAR_NAME]) : nil end |
#gemfile_rubocop_command ⇒ Object
10 11 12 13 14 |
# File 'lib/avm/ruby/rubocop/_gemfile.rb', line 10 def gemfile_rubocop_command return nil unless rubocop_gemfile? rubocop_command_by_gemfile_path(mygem.root) end |
#rubocop_command_by_gemfile_path(path) ⇒ Object
16 17 18 |
# File 'lib/avm/ruby/rubocop/_gemfile.rb', line 16 def rubocop_command_by_gemfile_path(path) ::EacRubyGemsUtils::Gem.new(path).bundle('exec', 'rubocop').chdir_root end |
#rubocop_gemfile? ⇒ Boolean
20 21 22 23 24 25 |
# File 'lib/avm/ruby/rubocop/_gemfile.rb', line 20 def rubocop_gemfile? return false if mygem.blank? mygem.bundle('install').execute! mygem.gemfile_lock_gem_version('rubocop').present? end |
#run ⇒ Object
17 18 19 20 |
# File 'lib/avm/ruby/rubocop.rb', line 17 def run run_rubocop end |