Class: RspecSprint::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/rspec_sprint/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/rspec_sprint/cli.rb', line 10

def self.exit_on_failure?
  true
end

Instance Method Details

#compare(*rspec_args) ⇒ Object



50
51
52
53
54
# File 'lib/rspec_sprint/cli.rb', line 50

def compare(*rspec_args)
  result = Collector.new(rspec_args: rspec_args).run
  puts Doctor.diagnose(result, no_snapshot: options[:no_snapshot],
                               save_baseline: options[:save_baseline])
end

#doctor(*rspec_args) ⇒ Object



29
30
31
32
33
# File 'lib/rspec_sprint/cli.rb', line 29

def doctor(*rspec_args)
  result = Collector.new(rspec_args: rspec_args).run
  puts Doctor.diagnose(result, no_snapshot: options[:no_snapshot],
                               compare_last: options[:compare_last])
end

#fix(target = "let-it-be") ⇒ Object



80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/rspec_sprint/cli.rb', line 80

def fix(target = "let-it-be")
  unless target == "let-it-be"
    puts "未対応の TARGET です。現在は let-it-be のみ対応しています。"
    return
  end
  result = Collector.new(rspec_args: []).run
  if options[:dry_run]
    puts Fix.dry_run(result, dir: ".")
  else
    puts Fix.apply(result, dir: ".", limit: options[:limit], all: options[:all])
  end
end