Class: Appraisal::CLI
- Inherits:
-
Thor
- Object
- Thor
- Appraisal::CLI
show all
- Defined in:
- lib/appraisal/cli.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/appraisal/cli.rb', line 70
def method_missing(name, *args, &block)
matching_appraisal = File.new.appraisals.detect { |appraisal| appraisal.name == name.to_s }
if matching_appraisal
Command.new(args.join(' '), matching_appraisal.gemfile_path).run
else
File.each do |appraisal|
Command.new(ARGV.join(' '), appraisal.gemfile_path).run
end
end
end
|
Class Method Details
.exit_on_failure? ⇒ Boolean
31
32
33
|
# File 'lib/appraisal/cli.rb', line 31
def self.exit_on_failure?
true
end
|
.help(shell, subcommand = false) ⇒ Object
Override help command to print out usage
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/appraisal/cli.rb', line 9
def self.help(shell, subcommand = false)
shell.say strip_heredoc(<<-help)
Appraisal: Find out what your Ruby gems are worth.
Usage:
appraisal [APPRAISAL_NAME] EXTERNAL_COMMAND
If APPRAISAL_NAME is given, only run that EXTERNAL_COMMAND against the given
appraisal, otherwise it runs the EXTERNAL_COMMAND against all appraisals.
Available Appraisal(s):
help
File.each do |appraisal|
shell.say " - #{appraisal.name}"
end
shell.say
super
end
|
Instance Method Details
#clean ⇒ Object
55
56
57
|
# File 'lib/appraisal/cli.rb', line 55
def clean
FileUtils.rm_f Dir['gemfiles/*.{gemfile,gemfile.lock}']
end
|
#generate ⇒ Object
48
49
50
51
52
|
# File 'lib/appraisal/cli.rb', line 48
def generate
File.each do |appraisal|
appraisal.write_gemfile
end
end
|
#install ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'lib/appraisal/cli.rb', line 38
def install
invoke :generate, [], {}
File.each do |appraisal|
appraisal.install(options[:jobs])
appraisal.relativize
end
end
|
#update(*gems) ⇒ Object
60
61
62
63
64
65
66
|
# File 'lib/appraisal/cli.rb', line 60
def update(*gems)
invoke :generate, []
File.each do |appraisal|
appraisal.update(gems)
end
end
|