Class: Omochi::CLI
- Inherits:
-
Thor
show all
- Includes:
- Util
- Defined in:
- lib/omochi/cli.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Util
#find_spec_file, #github_diff_path, #local_diff_path, #process_missing_spec_file, #process_spec_file, #remote_diff_path
Class Method Details
.exit_on_failure? ⇒ Boolean
16
17
18
|
# File 'lib/omochi/cli.rb', line 16
def exit_on_failure?
true
end
|
Instance Method Details
#verify ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/omochi/cli.rb', line 24
def verify
is_gh_action = options[:github] == 'github'
is_gl_ci_runner = false
create_spec = options[:create] == 'create'
perfect = true
diff_paths = case [is_gh_action, is_gl_ci_runner]
when [true, false]
github_diff_path
when [false, true]
remote_diff_path
when [false, false]
local_diff_path
end
diff_paths.reject! { |s| !s.end_with?('.rb') || s.end_with?('_spec.rb') }
p "Verify File List: #{diff_paths}"
diff_paths.each do |diff_path|
if find_spec_file(diff_path)
p 'specファイルあり'
p 'There are spec files.'
perfect = process_spec_file(diff_path, create_spec, perfect)
else
p 'specファイルなし'
p 'There is no spec file.'
perfect = process_missing_spec_file(diff_path, create_spec, perfect)
end
end
exit(perfect ? 0 : 1)
end
|