Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Isolate CLI required resources #84

Merged
merged 1 commit into from

2 participants

@mhupman

This change allows for programmatic usage of cupertino without including Term and Commander. The Commander include was particularly tricky for programmatic usage as it requires that you set :version, :description, and automatically adds an at_exit {} block. Previous to this change, my code that used cupertino looked like this:

# Required by Cupertino
require 'term/ansicolor'

# Required by Cupertino
require 'commander/import'
program :version, '1.0.0' # Required by Commander
program :description, '.' # Required by Commander
# Suppress Commander's at_exit block that will always throw an error since this isn't a real Commander program
at_exit { exit! }

require 'cupertino/provisioning_portal'

[...code...]
@mattt mattt merged commit b9ce097 into from
@mattt
Owner

Ah, thanks for this, @mhupman! It was always my intention to allow Cupertino to be incorporated as a regular Ruby gem, but I guess I never went so far as to kick the tires myself. Much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 13, 2013
  1. @mhupman
This page is out of date. Refresh to see the latest.
View
1  bin/ios
@@ -19,3 +19,4 @@ program :help_formatter, :compact
default_command :help
require 'cupertino/provisioning_portal'
+require 'cupertino/provisioning_portal/commands'
View
4 lib/cupertino/provisioning_portal.rb
@@ -46,6 +46,4 @@ def to_s
end
end
-require 'cupertino/provisioning_portal/helpers'
-require 'cupertino/provisioning_portal/agent'
-require 'cupertino/provisioning_portal/commands'
+require 'cupertino/provisioning_portal/agent'
View
2  lib/cupertino/provisioning_portal/commands.rb
@@ -1,4 +1,6 @@
include Cupertino::ProvisioningPortal
+
+require 'cupertino/provisioning_portal/helpers'
include Cupertino::ProvisioningPortal::Helpers
global_option('-u', '--username USER', 'Username') { |arg| agent.username = arg unless arg.nil? }
Something went wrong with that request. Please try again.