Class: Stickler::Client::Config

Inherits:
Stickler::Client show all
Defined in:
lib/stickler/client/config.rb

Instance Attribute Summary

Attributes inherited from Stickler::Client

#argv, #sources

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Stickler::Client

config, #initialize, #parse, #remote_repo_for

Constructor Details

This class inherits a constructor from Stickler::Client

Class Method Details



4
5
6
7
8
9
10
11
12
# File 'lib/stickler/client/config.rb', line 4

def self.banner
<<-_
Access or update the Stickler client configuration.  

Usage: stickler config [options] 

  Options:
_
end

Instance Method Details

#dump_config(opts) ⇒ Object



24
25
26
27
# File 'lib/stickler/client/config.rb', line 24

def dump_config( opts )
  puts "  server : #{Client.config.server}"
  puts "upstream : #{Client.config.upstream}"
end

#parserObject



14
15
16
17
18
19
20
21
22
# File 'lib/stickler/client/config.rb', line 14

def parser
  unless @parser then
    @parser = super
    @parser.opt( :upstream, "The upstream gem server from which to pull", :type => :string, :default => Client.config.upstream )
    @parser.opt( :add, "Add upstream and/or server to the configuration", :type => :boolean )
    @parser.opt( :list, "display the current configuration", :type => :boolean )
  end
  return @parser
end

#runObject



29
30
31
32
# File 'lib/stickler/client/config.rb', line 29

def run
  opts = parse( self.argv )
  dump_config( opts ) if Client.config.update( opts ) || opts[:list]
end