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
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/appraisal/cli.rb', line 98
def method_missing(name, *args, &block)
matching_appraisal = AppraisalFile.new.appraisals.detect do |appraisal|
appraisal.name == name.to_s
end
if matching_appraisal
Command.new(args, :gemfile => matching_appraisal.gemfile_path).run
else
AppraisalFile.each do |appraisal|
Command.new(ARGV, :gemfile => appraisal.gemfile_path).run
end
end
end
|
Class Method Details
.exit_on_failure? ⇒ Boolean
36
37
38
|
# File 'lib/appraisal/cli.rb', line 36
def self.exit_on_failure?
true
end
|
.help(shell, subcommand = false) ⇒ Object
Override help command to print out usage
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/appraisal/cli.rb', line 11
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.
help
if File.exist?('Appraisals')
shell.say
shell.say 'Available Appraisal(s):'
AppraisalFile.each do |appraisal|
shell.say " - #{appraisal.name}"
end
end
shell.say
super
end
|
Instance Method Details
#clean ⇒ Object
73
74
75
|
# File 'lib/appraisal/cli.rb', line 73
def clean
FileUtils.rm_f Dir['gemfiles/*.{gemfile,gemfile.lock}']
end
|
#install ⇒ Object
49
50
51
52
53
54
55
56
|
# File 'lib/appraisal/cli.rb', line 49
def install
invoke :generate, [], {}
AppraisalFile.each do |appraisal|
appraisal.install(options)
appraisal.relativize
end
end
|
#list ⇒ Object
87
88
89
|
# File 'lib/appraisal/cli.rb', line 87
def list
AppraisalFile.new.appraisals.each { |appraisal| puts appraisal.name }
end
|
#update(*gems) ⇒ Object
78
79
80
81
82
83
84
|
# File 'lib/appraisal/cli.rb', line 78
def update(*gems)
invoke :generate, []
AppraisalFile.each do |appraisal|
appraisal.update(gems)
end
end
|
#version ⇒ Object
92
93
94
|
# File 'lib/appraisal/cli.rb', line 92
def version
puts "Appraisal #{VERSION}"
end
|