module Gitchefsync::Configuration

Constants

REL_BRANCH

Public Class Methods

log() click to toggle source
# File lib/gitchefsync/config.rb, line 91
def self.log 
  Gitchefsync.logger()
  
end
new(opts) click to toggle source
# File lib/gitchefsync/config.rb, line 31
def initialize(opts)
  @git_bin = 'git'

end

Public Instance Methods

configuration() click to toggle source
# File lib/gitchefsync/config.rb, line 96
def configuration
  @config
end
configure(options) click to toggle source
# File lib/gitchefsync/config.rb, line 36
def configure(options)
  
  @options = options
  config = options[:config]
  @git_bin = config['git']
  @berks = config['berks']
  @knife = config['knife']
  @git_local = options[:git_local]
  @token =  options[:private_token]
  @stage_dir = config['stage_dir']
  @audit_dir = config['stage_dir'] + "/audit"
  config['audit_dir'] = @audit_dir
  @rel_branch = config['release_branch']
  @rel_branch ||= 'master'
  @stage_cb_dir = options[: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
  options[:syslog] ?
    @log = Gitchefsync::Log::SysLogger.new('gitchefsync') :
    @log = Logger.new(STDOUT)
  #json based configuration
  @config = config
 
end
logger() click to toggle source
# File lib/gitchefsync/config.rb, line 87
def logger
  @log
end
options() click to toggle source
# File lib/gitchefsync/config.rb, line 100
def options
  @options
end
parseAndConfigure(args) click to toggle source
# File lib/gitchefsync/config.rb, line 74
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