Module: Autowow::Features::Gem

Includes:
Commands::Gem, Commands::Vcs, Executor, EasyLogging, ReflectionUtils::CreateModuleFunctions
Defined in:
lib/autowow/features/gem.rb

Instance Method Summary collapse

Methods included from Executor

#pretty, #pretty_with_output, #quiet, #tty_params

Methods included from Commands::Vcs

#add_remote, #branch, #branch_force_delete, #branch_list, #changes_not_on_remote, #checkout, #cmd, #create, #current_branch, #fetch, #git_status, #merge, #pull, #push, #rebase, #remotes, #set_upstream, #stash, #stash_pop, #terminal_options

Methods included from Commands::Gem

#be, #clean, #release, #rubocop_autocorrect, #rubocop_parallel

Instance Method Details

#bundle_exec(cmd) ⇒ Object



45
46
47
# File 'lib/autowow/features/gem.rb', line 45

def bundle_exec(cmd)
  Autowow::Executor.pretty_with_output.run(["bundle", "exec"] + cmd)
end

#gem_cleanObject



29
30
31
# File 'lib/autowow/features/gem.rb', line 29

def gem_clean
  pretty_with_output.run(clean)
end

#gem_releaseObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/autowow/features/gem.rb', line 14

def gem_release
  pretty_with_output.run(git_status)
  start_branch = Vcs.working_branch
  logger.error("Not on master.") and return unless start_branch.eql?("master")
  pretty.run(push)

  Vcs.on_branch("release") do
    pretty.run(pull)
    pretty.run(rebase(start_branch))
    pretty_with_output.run(release)
  end

  pretty_with_output.run(git_status)
end

#rubocop_parallel_autocorrectObject



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/autowow/features/gem.rb', line 33

def rubocop_parallel_autocorrect
  pastel = Pastel.new
  result = pretty_with_output.run!(rubocop_parallel)
  if result.failed?
    filtered = result.out.each_line.select { |line| line.match(%r{(.*):([0-9]*):([0-9]*):}) }
                 .map { |line| line.split(":")[0] }
                 .uniq
                 .map { |line| pastel.strip(line) }
    pretty_with_output.run(rubocop_autocorrect(filtered)) if filtered.any?
  end
end