Class: Ballantine::CLI
- Inherits:
-
Thor
- Object
- Thor
- Ballantine::CLI
show all
- Includes:
- Printable
- Defined in:
- lib/ballantine/cli.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Printable
#cols, #puts_r, #rjust_size
Instance Attribute Details
#repo ⇒ Object
Returns the value of attribute repo.
7
8
9
|
# File 'lib/ballantine/cli.rb', line 7
def repo
@repo
end
|
Class Method Details
.exit_on_failure? ⇒ Boolean
10
|
# File 'lib/ballantine/cli.rb', line 10
def exit_on_failure?; exit(1) end
|
Instance Method Details
#config(key = nil, value = nil) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/ballantine/cli.rb', line 27
def config(key = nil, value = nil)
conf.verbose = options["verbose"]
puts "$ ballantine config #{key} #{value}" if conf.verbose
if Config::AVAILABLE_ENVIRONMENTS.map { |key| !options[key] }.reduce(:&)
raise NotAllowed, "Set environment value (#{Config::AVAILABLE_ENVIRONMENTS.map { |key| "`--#{key}'" }.join(", ")})"
elsif Config::AVAILABLE_ENVIRONMENTS.map { |key| !!options[key] }.reduce(:&)
raise NotAllowed, "Environment value must be unique."
end
env = Config::AVAILABLE_ENVIRONMENTS.find { |key| options[key] }
raise AssertionFailed, "Environment value must exist: #{env}" if env.nil?
conf.env = env
value ? conf.set_data(key, value) : conf.print_data(key)
end
|
#diff(target, source = %x(git rev-parse --abbrev-ref HEAD).chomp) ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/ballantine/cli.rb', line 48
def diff(target, source = %x(git rev-parse --abbrev-ref HEAD).chomp)
conf.verbose = options["verbose"]
puts "$ ballantine diff #{target} #{source}" if conf.verbose
validate(target, source, **options)
init_variables(target, source, **options)
check_commits(**options)
print_commits(target, source, **options)
end
|
#init ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/ballantine/cli.rb', line 16
def init
conf.init_file(force: options["force"])
puts "🥃 Initialized ballantine."
true
end
|