Class: Stickler::Client
- Inherits:
-
Object
- Object
- Stickler::Client
- Defined in:
- lib/stickler/client.rb,
lib/stickler/client/list.rb,
lib/stickler/client/push.rb,
lib/stickler/client/yank.rb,
lib/stickler/client/config.rb,
lib/stickler/client/delete.rb,
lib/stickler/client/mirror.rb,
lib/stickler/client/unyank.rb,
lib/stickler/client/config_file.rb,
lib/stickler/client/latest-version.rb
Defined Under Namespace
Classes: Config, ConfigFile, Delete, LatestVersion, List, Mirror, Push, Unyank, 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
Create a new client.
- #parse(argv) ⇒ Object
- #parser ⇒ Object
- #remote_repo_for(opts) ⇒ Object
Constructor Details
#initialize(argv = ARGV) ⇒ Client
Create a new client
Takes an argv like array as a parameter.
17 18 19 |
# File 'lib/stickler/client.rb', line 17 def initialize( argv = ARGV ) @argv = argv.collect { |e| e.dup } end |
Instance Attribute Details
#argv ⇒ Object (readonly)
Returns the value of attribute argv.
7 8 9 |
# File 'lib/stickler/client.rb', line 7 def argv @argv end |
#sources ⇒ Object (readonly)
Returns the value of attribute sources.
8 9 10 |
# File 'lib/stickler/client.rb', line 8 def sources @sources end |
Class Method Details
.config ⇒ Object
10 11 12 |
# File 'lib/stickler/client.rb', line 10 def self.config ::Stickler::Client::ConfigFile.new end |
Instance Method Details
#parse(argv) ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'lib/stickler/client.rb', line 30 def parse( argv ) opts = Trollop::with_standard_exception_handling( parser ) do o = parser.parse( argv ) yield( parser, o ) if block_given? return o end return opts end |
#parser ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/stickler/client.rb', line 21 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
39 40 41 |
# File 'lib/stickler/client.rb', line 39 def remote_repo_for( opts ) Stickler::Repository::Remote.new( opts[:server], :debug => opts[:debug] ) end |