Class: Vendor::CLI::App

Inherits:
Thor
  • Object
show all
Defined in:
lib/vendor/cli/app.rb

Defined Under Namespace

Classes: Library

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeApp

Returns a new instance of App.



58
59
60
61
62
63
# File 'lib/vendor/cli/app.rb', line 58

def initialize(*)
  super
  the_shell = (options["no-color"] ? Thor::Shell::Basic.new : shell)
  Vendor.ui = UI::Shell.new(the_shell)
  Vendor.ui.debug! if options["verbose"]
end

Class Method Details

.exit_on_failure?Boolean

Exit with 1 if thor encounters an error (such as command missing)

Returns:

  • (Boolean)


128
129
130
# File 'lib/vendor/cli/app.rb', line 128

def self.exit_on_failure?
  true
end

Instance Method Details

#authObject



105
106
107
108
109
110
111
112
113
# File 'lib/vendor/cli/app.rb', line 105

def auth
  begin
    Vendor::CLI::Auth.with_api_key do |api_key|
      Vendor.ui.success "Successfully authenticated"
    end
  rescue Vendor::API::Error => e
    Vendor.ui.error "Error: #{e.message}"
  end
end

#consoleObject



116
117
118
119
120
# File 'lib/vendor/cli/app.rb', line 116

def console
  # Need to clear the arguments otherwise they are passed through to RIPL
  ARGV.clear
  Ripl.start :binding => Vendor::CLI::Console.instance_eval{ binding }
end

#initObject



100
101
102
# File 'lib/vendor/cli/app.rb', line 100

def init
  Vendor::Template.copy "Vendorfile"
end

#installObject



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/vendor/cli/app.rb', line 74

def install
  vendorfile = File.expand_path("Vendorfile")
  
  unless File.exist?(vendorfile)
    Vendor.ui.error "Could not find Vendorfile"
    exit 1
  end
  
  project_paths = Dir["*.xcodeproj"]

  loader = Vendor::VendorFile::Loader.new
  loader.load vendorfile
  
  project_paths.each do |project_path|
    Vendor.ui.info "Examining #{project_path}"
    
    loader.libraries_to_install do |library,targets|
      library.download
      Vendor::XCode::Project.new(project_path).install(library,targets)
    end
    
  end

end

#versionObject



123
124
125
# File 'lib/vendor/cli/app.rb', line 123

def version
  Vendor.ui.info Vendor.version
end