Class: Stickler::Client
- Inherits:
-
Object
- Object
- Stickler::Client
- Defined in:
- lib/stickler/client.rb,
lib/stickler/client/push.rb,
lib/stickler/client/yank.rb,
lib/stickler/client/config.rb,
lib/stickler/client/mirror.rb,
lib/stickler/client/config_file.rb
Defined Under Namespace
Classes: Config, ConfigFile, Mirror, Push, Yank
Instance Attribute Summary collapse
-
#argv ⇒ Object
readonly
Returns the value of attribute argv.
-
#sources ⇒ Object
readonly
Returns the value of attribute sources.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv = ARGV) ⇒ Client
constructor
A new instance of Client.
- #parse(argv) ⇒ Object
- #parser ⇒ Object
- #remote_repo_for(opts) ⇒ Object
Constructor Details
#initialize(argv = ARGV) ⇒ Client
Returns a new instance of Client.
15 16 17 |
# File 'lib/stickler/client.rb', line 15 def initialize( argv = ARGV ) @argv = argv end |
Instance Attribute Details
#argv ⇒ Object (readonly)
Returns the value of attribute argv.
8 9 10 |
# File 'lib/stickler/client.rb', line 8 def argv @argv end |
#sources ⇒ Object (readonly)
Returns the value of attribute sources.
9 10 11 |
# File 'lib/stickler/client.rb', line 9 def sources @sources end |
Class Method Details
.config ⇒ Object
11 12 13 |
# File 'lib/stickler/client.rb', line 11 def self.config ::Stickler::Client::ConfigFile.new end |
Instance Method Details
#parse(argv) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/stickler/client.rb', line 28 def parse( argv ) opts = Trollop::with_standard_exception_handling( parser ) do raise Trollop::HelpNeeded if argv.empty? # show help screen o = parser.parse( argv ) yield parser if block_given? return o end return opts end |
#parser ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/stickler/client.rb', line 19 def parser me = self # scoping forces this @parser ||= Trollop::Parser.new do me.class. opt :server, "The gem or stickler server URL", :type => :string, :default => Client.config.server opt :debug, "Output debug information for the server interaction", :default => false end end |
#remote_repo_for(opts) ⇒ Object
38 39 40 |
# File 'lib/stickler/client.rb', line 38 def remote_repo_for( opts ) Stickler::Repository::Remote.new( opts[:server], :debug => opts[:debug] ) end |