Module: Gitchefsync::Configuration
- Included in:
- Gitchefsync
- Defined in:
- lib/gitchefsync/config.rb
Constant Summary collapse
- REL_BRANCH =
'master'
Class Method Summary collapse
Instance Method Summary collapse
- #configuration ⇒ Object
- #configure(options) ⇒ Object
- #initialize(opts) ⇒ Object
- #logger ⇒ Object
- #options ⇒ Object
- #parseAndConfigure(args) ⇒ Object
Class Method Details
.log ⇒ Object
73 74 75 76 |
# File 'lib/gitchefsync/config.rb', line 73 def self.log Gitchefsync.logger() end |
Instance Method Details
#configuration ⇒ Object
78 79 80 |
# File 'lib/gitchefsync/config.rb', line 78 def configuration @config end |
#configure(options) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/gitchefsync/config.rb', line 20 def configure() = config = [:config] @git_bin = config['git'] @berks = config['berks'] @knife = config['knife'] @git_local = [:git_local] @token = [:private_token] @stage_dir = config['stage_dir'] @rel_branch = config['release_branch'] @rel_branch ||= 'master' @stage_cb_dir = [:stage_cookbook_dir] @stage_cb_dir ||= '/tmp/cookbooks' @berks_upload = false @audit_keep_trim = config['audit_keep_trim'] @audit_keep_trim ||= 20 #backward compatibility for "sync_local" attribute if config['sync_local'].is_a? String if config['sync_local'] == "true" config['sync_local'] = true config[:sync_local] = true else config['sync_local'] = false config[:sync_local] = false end end [:syslog] ? @log = Gitchefsync::Log::SysLogger.new('gitchefsync') : @log = Logger.new(STDOUT) #json based configuration @config = config end |
#initialize(opts) ⇒ Object
15 16 17 18 |
# File 'lib/gitchefsync/config.rb', line 15 def initialize(opts) @git_bin = 'git' end |
#logger ⇒ Object
69 70 71 |
# File 'lib/gitchefsync/config.rb', line 69 def logger @log end |
#options ⇒ Object
82 83 84 |
# File 'lib/gitchefsync/config.rb', line 82 def end |
#parseAndConfigure(args) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/gitchefsync/config.rb', line 56 def parseAndConfigure(args) include Parser $args = args.clone $opts = Parser.parseOpts args configure $opts #instantiate audit #@audit = Audit.new(@config['stage_dir'] ) return $opts end |