Commit 054fe5c8 authored by Eloy Durán's avatar Eloy Durán

Update to the latest version of CLAide.

parent 178ceade
...@@ -3,7 +3,7 @@ source "http://rubygems.org" ...@@ -3,7 +3,7 @@ source "http://rubygems.org"
gemspec gemspec
# TODO # TODO
gem "cli_aide", :git => "git://github.com/alloy/CLAide.git" gem "claide", :git => "git://github.com/alloy/CLAide.git"
group :development do group :development do
gem "xcodeproj", :git => "git://github.com/CocoaPods/Xcodeproj.git" gem "xcodeproj", :git => "git://github.com/CocoaPods/Xcodeproj.git"
......
GIT GIT
remote: git://github.com/CocoaPods/Xcodeproj.git remote: git://github.com/CocoaPods/Xcodeproj.git
revision: cc71c669a05934886c56169bbe209014a7a1af8e revision: eaab002f308e2641232630b1b5d4ab3c2f10a10a
specs: specs:
xcodeproj (0.4.0.rc1) xcodeproj (0.4.0.rc3)
activesupport (~> 3.2.6) activesupport (~> 3.2.6)
colored (~> 1.2) colored (~> 1.2)
GIT GIT
remote: git://github.com/alloy/CLAide.git remote: git://github.com/alloy/CLAide.git
revision: 914c38cabeae22c946e96952b32708edf5e5030a revision: fdcc73837ff0c67b440fa9a20dc6366c78f06f09
specs: specs:
cli_aide (0.0.1) claide (0.0.1)
GIT GIT
remote: https://github.com/alloy/kicker.git remote: https://github.com/alloy/kicker.git
...@@ -93,7 +93,7 @@ PLATFORMS ...@@ -93,7 +93,7 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
awesome_print awesome_print
bacon bacon
cli_aide! claide!
cocoapods! cocoapods!
github-markup github-markup
kicker! kicker!
......
...@@ -12,16 +12,15 @@ unless Gem::Version::Requirement.new('>= 1.4.0').satisfied_by?(Gem::Version.new( ...@@ -12,16 +12,15 @@ unless Gem::Version::Requirement.new('>= 1.4.0').satisfied_by?(Gem::Version.new(
end end
require 'cocoapods/version' require 'cocoapods/version'
require 'cli_aide'
module Pod module Pod
class PlainInformative < CLIAide::Command::Informative class PlainInformative < StandardError
end end
class Informative < PlainInformative class Informative < PlainInformative
def message def message
# TODO: remove formatting from raise calls and remove conditional # TODO: remove formatting from raise calls and remove conditional
super !~ /\[!\]/ ? "[!] #{super}\n".red : super super !~ /\[!\]/ ? "[!] #{super}".red : super
end end
end end
......
require 'colored' require 'colored'
require 'claide'
require 'active_support/core_ext/string/inflections' require 'active_support/core_ext/string/inflections'
require 'active_support/core_ext/string/strip.rb' require 'active_support/core_ext/string/strip.rb'
# TODO why does this not automatically occur even though colored is required first?
CLAide::Command.colorize_output = true
module Pod module Pod
class Command < CLIAide::Command class PlainInformative
include CLAide::Command::InformativeError
end
class Command < CLAide::Command
autoload :ErrorReport, 'cocoapods/command/error_report' autoload :ErrorReport, 'cocoapods/command/error_report'
autoload :Linter, 'cocoapods/command/linter' autoload :Linter, 'cocoapods/command/linter'
...@@ -12,76 +20,35 @@ module Pod ...@@ -12,76 +20,35 @@ module Pod
def self.options def self.options
[ [
['--silent', 'Print nothing'], ['--silent', 'Show nothing'],
['--no-color', 'Print output without color'], ['--version', 'Show the version of CocoaPods'],
['--version', 'Prints the version of CocoaPods'],
].concat(super) ].concat(super)
end end
#def self.run(argv) def self.parse(argv)
#super command = super
#p Config.instance.verbose? unless command.is_a?(Setup) || ENV['SKIP_SETUP']
#end Setup.new(CLAide::ARGV.new([])).run_if_needed
end
#def self.run(*argv) command
#sub_command = parse(*argv) end
#unless sub_command.is_a?(Setup) || ENV['SKIP_SETUP']
#Setup.new(ARGV.new).run_if_needed
#end
#sub_command.run
#UI.puts
#rescue Interrupt
#puts "[!] Cancelled".red
#Config.instance.verbose? ? raise : exit(1)
#rescue Exception => e
#if e.is_a?(PlainInformative) || ENV['COCOA_PODS_ENV'] == 'development' # also catches Informative
#puts e.message
#puts *e.backtrace if Config.instance.verbose? || ENV['COCOA_PODS_ENV'] == 'development'
#else
#puts ErrorReport.report(e)
#end
#exit 1
#end
#def self.parse(*argv)
#argv = ARGV.new(argv)
#if argv.option('--version')
#puts VERSION
#exit!(0)
#end
#show_help = argv.option('--help')
#Config.instance.silent = argv.option('--silent')
#Config.instance.verbose = argv.option('--verbose')
#String.send(:define_method, :colorize) { |string , _| string } if argv.option( '--no-color' )
#command_class = case command_argument = argv.shift_argument
#when 'install' then Install
#when 'list' then List
#when 'outdated' then Outdated
#when 'push' then Push
#when 'repo' then Repo
#when 'search' then Search
#when 'setup' then Setup
#when 'spec' then Spec
#when 'update' then Update
#end
#if command_class.nil? def self.report_error(error)
#raise Help.new(self, argv, command_argument) if error.is_a?(Interrupt)
#elsif show_help puts "[!] Cancelled".red
#raise Help.new(command_class, argv) Config.instance.verbose? ? raise : exit(1)
#else else
#command_class.new(argv) puts ErrorReport.report(error)
#end exit 1
#end end
end
def initialize(argv) def initialize(argv)
config.silent = argv.flag?('silent')
super super
config.verbose = verbose? config.verbose = self.verbose?
# TODO we should probably not even load colored unless needed
String.send(:define_method, :colorize) { |string , _| string } unless self.colorize_output?
end end
include Config::Mixin include Config::Mixin
......
module Pod module Pod
class Command class Command
class List < Command class List < Command
self.summary = 'Lists all available pods.' self.summary = 'List pods'
self.description = 'Lists all available pods.'
def self.options def self.options
[[ [[
...@@ -36,7 +37,7 @@ module Pod ...@@ -36,7 +37,7 @@ module Pod
end end
class New < List class New < List
self.summary = 'Lists the pods introduced in the master repository since the last check.' self.summary = 'Lists pods introduced in the master spec-repo since the last check'
def run def run
update_if_necessary! update_if_necessary!
......
module Pod module Pod
class Command class Command
class Outdated < Command class Outdated < Command
self.summary = 'Show outdated project dependencies.' self.summary = 'Show outdated project dependencies'
self.description = <<-DESC self.description = <<-DESC
Shows the outdated pods in the current Podfile.lock, but only those from Shows the outdated pods in the current Podfile.lock, but only those from
......
...@@ -29,7 +29,7 @@ module Pod ...@@ -29,7 +29,7 @@ module Pod
class Install < Command class Install < Command
include Project include Project
self.summary = 'Installs dependencies of a project.' self.summary = 'Install project dependencies'
self.description = <<-DESC self.description = <<-DESC
Downloads all dependencies defined in `Podfile' and creates an Xcode Downloads all dependencies defined in `Podfile' and creates an Xcode
...@@ -57,7 +57,7 @@ module Pod ...@@ -57,7 +57,7 @@ module Pod
class Update < Command class Update < Command
include Project include Project
self.summary = 'Update outdated project dependencies.' self.summary = 'Update outdated project dependencies'
def run def run
verify_podfile_exists! verify_podfile_exists!
......
...@@ -4,7 +4,7 @@ require 'active_support/core_ext/string/inflections' ...@@ -4,7 +4,7 @@ require 'active_support/core_ext/string/inflections'
module Pod module Pod
class Command class Command
class Push < Command class Push < Command
self.summary = 'Push new specifications to a spec-repo.' self.summary = 'Push new specifications to a spec-repo'
self.description = <<-DESC self.description = <<-DESC
Validates NAME.podspec or `*.podspec' in the current working dir, creates Validates NAME.podspec or `*.podspec' in the current working dir, creates
...@@ -31,7 +31,7 @@ module Pod ...@@ -31,7 +31,7 @@ module Pod
super super
end end
def validate_argv! def validate!
super super
help! "A spec-repo name is required." unless @repo help! "A spec-repo name is required." unless @repo
end end
......
...@@ -6,7 +6,7 @@ module Pod ...@@ -6,7 +6,7 @@ module Pod
self.abstract_command = true self.abstract_command = true
# TODO should not show a usage banner! # TODO should not show a usage banner!
self.summary = 'Managed spec repos.' self.summary = 'Manage spec-repositories'
class Add < Repo class Add < Repo
self.summary = 'Add a spec repo.' self.summary = 'Add a spec repo.'
...@@ -23,7 +23,7 @@ module Pod ...@@ -23,7 +23,7 @@ module Pod
super super
end end
def validate_argv! def validate!
super super
unless @name && @url unless @name && @url
help! "Adding a repo needs a `NAME' and a `URL." help! "Adding a repo needs a `NAME' and a `URL."
......
module Pod module Pod
class Command class Command
class Search < Command class Search < Command
self.summary = 'Search available pods.' self.summary = 'Search pods'
self.description = <<-DESC self.description = <<-DESC
Searches for pods, ignoring case, whose name matches `QUERY'. If the Searches for pods, ignoring case, whose name matches `QUERY'. If the
...@@ -25,7 +25,7 @@ module Pod ...@@ -25,7 +25,7 @@ module Pod
super super
end end
def validate_argv! def validate!
super super
help! "A search query is required." unless @query help! "A search query is required." unless @query
end end
......
module Pod module Pod
class Command class Command
class Setup < Command class Setup < Command
self.summary = 'Setup the CocoaPods environment.' self.summary = 'Setup the CocoaPods environment'
self.description = <<-DESC self.description = <<-DESC
Creates a directory at `~/.cocoapods' which will hold your spec-repos. Creates a directory at `~/.cocoapods' which will hold your spec-repos.
......
...@@ -5,8 +5,7 @@ require 'active_support/core_ext/string/inflections' ...@@ -5,8 +5,7 @@ require 'active_support/core_ext/string/inflections'
module Pod module Pod
class Command class Command
class Spec < Command class Spec < Command
# TODO should not show a usage banner! self.summary = 'Manage pod specs'
self.summary = 'Managing PodSpec files'
class Create < Spec class Create < Spec
self.summary = 'Create spec file stub.' self.summary = 'Create spec file stub.'
...@@ -23,7 +22,7 @@ module Pod ...@@ -23,7 +22,7 @@ module Pod
super super
end end
def validate_argv! def validate!
super super
help! "A pod name or repo URL is required." unless @name_or_url help! "A pod name or repo URL is required." unless @name_or_url
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment