Skip to content
Newer
Older
100644 80 lines (66 sloc) 2.1 KB
3b83f2a @fabiopelosin [colors] Added colors to install
fabiopelosin authored Mar 28, 2012
1 require 'colored'
054fe5c @alloy Update to the latest version of CLAide.
alloy authored Oct 25, 2012
2 require 'claide'
86c03f4 @alloy First pass at using the extracted CLI lib CLAide.
alloy authored Oct 22, 2012
3 require 'active_support/core_ext/string/inflections'
4 require 'active_support/core_ext/string/strip.rb'
3b83f2a @fabiopelosin [colors] Added colors to install
fabiopelosin authored Mar 28, 2012
5
054fe5c @alloy Update to the latest version of CLAide.
alloy authored Oct 24, 2012
6 # TODO why does this not automatically occur even though colored is required first?
7 CLAide::Command.colorize_output = true
8
c9e64e3 @alloy Add stubs for comamnd classes.
alloy authored Aug 14, 2011
9 module Pod
054fe5c @alloy Update to the latest version of CLAide.
alloy authored Oct 24, 2012
10 class PlainInformative
11 include CLAide::Command::InformativeError
12 end
13
14 class Command < CLAide::Command
a08e913 @alloy Print a template for a new ticket when an error occurs. See #163.
alloy authored Mar 15, 2012
15 autoload :ErrorReport, 'cocoapods/command/error_report'
28c5029 @fabiopelosin [Linter] Extracted the Linter and added `pod repo lint`.
fabiopelosin authored Aug 6, 2012
16 autoload :Linter, 'cocoapods/command/linter'
fa5d18a @alloy Dynamically justify options in help output.
alloy authored Apr 7, 2012
17
86c03f4 @alloy First pass at using the extracted CLI lib CLAide.
alloy authored Oct 22, 2012
18 self.abstract_command = true
19 self.description = 'CocoaPods, the Objective-C library package manager.'
3326215 @alloy Work on the command help system.
alloy authored Sep 14, 2011
20
21 def self.options
fa5d18a @alloy Dynamically justify options in help output.
alloy authored Apr 7, 2012
22 [
054fe5c @alloy Update to the latest version of CLAide.
alloy authored Oct 24, 2012
23 ['--silent', 'Show nothing'],
24 ['--version', 'Show the version of CocoaPods'],
86c03f4 @alloy First pass at using the extracted CLI lib CLAide.
alloy authored Oct 22, 2012
25 ].concat(super)
bdb96b1 @alloy Rescue all exceptions and try to be a bit more helpful when they occur.
alloy authored Sep 14, 2011
26 end
27
054fe5c @alloy Update to the latest version of CLAide.
alloy authored Oct 24, 2012
28 def self.parse(argv)
29 command = super
30 unless command.is_a?(Setup) || ENV['SKIP_SETUP']
31 Setup.new(CLAide::ARGV.new([])).run_if_needed
32 end
33 command
34 end
86c03f4 @alloy First pass at using the extracted CLI lib CLAide.
alloy authored Oct 22, 2012
35
054fe5c @alloy Update to the latest version of CLAide.
alloy authored Oct 24, 2012
36 def self.report_error(error)
37 if error.is_a?(Interrupt)
38 puts "[!] Cancelled".red
39 Config.instance.verbose? ? raise : exit(1)
40 else
41 puts ErrorReport.report(error)
42 exit 1
43 end
44 end
3326215 @alloy Work on the command help system.
alloy authored Sep 13, 2011
45
86c03f4 @alloy First pass at using the extracted CLI lib CLAide.
alloy authored Oct 22, 2012
46 def initialize(argv)
054fe5c @alloy Update to the latest version of CLAide.
alloy authored Oct 24, 2012
47 config.silent = argv.flag?('silent')
86c03f4 @alloy First pass at using the extracted CLI lib CLAide.
alloy authored Oct 22, 2012
48 super
054fe5c @alloy Update to the latest version of CLAide.
alloy authored Oct 24, 2012
49 config.verbose = self.verbose?
50 # TODO we should probably not even load colored unless needed
51 String.send(:define_method, :colorize) { |string , _| string } unless self.colorize_output?
c9e64e3 @alloy Add stubs for comamnd classes.
alloy authored Aug 14, 2011
52 end
7ce508b @alloy Implement the setup command.
alloy authored Aug 14, 2011
53
3326215 @alloy Work on the command help system.
alloy authored Sep 13, 2011
54 include Config::Mixin
55
aa887ea @fabiopelosin [Command] Output cosmetics.
fabiopelosin authored May 29, 2012
56 private
57
5b562bb @alloy Refactor and cleanup command source files.
alloy authored Aug 23, 2012
58 def verify_podfile_exists!
59 unless config.podfile
60 raise Informative, "No `Podfile' found in the current working directory."
61 end
62 end
63
64 def verify_lockfile_exists!
65 unless config.lockfile
66 raise Informative, "No `Podfile.lock' found in the current working directory, run `pod install'."
67 end
68 end
c9e64e3 @alloy Add stubs for comamnd classes.
alloy authored Aug 14, 2011
69 end
70 end
9ba5654 @alloy Add a `spec create NAME` command which creates a stub file.
alloy authored Sep 19, 2011
71
86c03f4 @alloy First pass at using the extracted CLI lib CLAide.
alloy authored Oct 22, 2012
72 require 'cocoapods/command/list'
73 require 'cocoapods/command/outdated'
74 require 'cocoapods/command/project'
75 require 'cocoapods/command/push'
76 require 'cocoapods/command/repo'
77 require 'cocoapods/command/search'
78 require 'cocoapods/command/setup'
79 require 'cocoapods/command/spec'
Something went wrong with that request. Please try again.