Class: Vendor::CLI::App
- Inherits:
-
Thor
- Object
- Thor
- Vendor::CLI::App
- Defined in:
- lib/vendor/cli/app.rb
Defined Under Namespace
Classes: Library
Class Method Summary collapse
-
.exit_on_failure? ⇒ Boolean
Exit with 1 if thor encounters an error (such as command missing).
Instance Method Summary collapse
- #auth ⇒ Object
- #console ⇒ Object
- #init ⇒ Object
-
#initialize ⇒ App
constructor
A new instance of App.
- #install ⇒ Object
- #version ⇒ Object
Constructor Details
Class Method Details
.exit_on_failure? ⇒ Boolean
Exit with 1 if thor encounters an error (such as command missing)
132 133 134 |
# File 'lib/vendor/cli/app.rb', line 132 def self.exit_on_failure? true end |
Instance Method Details
#auth ⇒ Object
109 110 111 112 113 114 115 116 117 |
# File 'lib/vendor/cli/app.rb', line 109 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.}" end end |
#console ⇒ Object
120 121 122 123 124 |
# File 'lib/vendor/cli/app.rb', line 120 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 |
#init ⇒ Object
104 105 106 |
# File 'lib/vendor/cli/app.rb', line 104 def init Vendor::Template.copy "Vendorfile" end |
#install ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/vendor/cli/app.rb', line 74 def install vendorfile = File.("Vendorfile") unless File.exist?(vendorfile) Vendor.ui.error "Could not find Vendorfile" exit 1 end projects = Dir["*.xcodeproj"] if projects.length > 1 Vendor.ui.error "Mutiple projects found #{projects.join(', ')}. I don't know how to deal with this yet." exit 1 end project = Vendor::XCode::Project.new(projects.first) loader = Vendor::VendorFile::Loader.new loader.load vendorfile loader.install project if project.dirty? project.save Vendor.ui.success "Finished installing into #{project.name}" else Vendor.ui.info "No changes were made to #{project.name}" end end |