Module: Integrity

Defined in:
lib/integrity.rb,
lib/integrity/scm.rb,
lib/integrity/build.rb,
lib/integrity/builder.rb,
lib/integrity/project.rb,
lib/integrity/scm/git.rb,
lib/integrity/notifier.rb,
lib/integrity/scm/git/uri.rb,
lib/integrity/notifier/base.rb

Defined Under Namespace

Modules: SCM Classes: Build, Builder, LogFormatter, Notifier, Project

Class Method Summary collapse

Class Method Details

.configObject



46
47
48
# File 'lib/integrity.rb', line 46

def self.config
  @config ||= default_configuration
end

.config=(file) ⇒ Object



50
51
52
# File 'lib/integrity.rb', line 50

def self.config=(file)
  @config = default_configuration.merge(YAML.load_file(file))
end

.default_configurationObject



37
38
39
40
41
42
43
44
# File 'lib/integrity.rb', line 37

def self.default_configuration
  @defaults ||= { :database_uri      => 'sqlite3::memory:',
                  :export_directory  => root / 'exports',
                  :log               => STDOUT,
                  :base_uri          => 'http://localhost:8910',
                  :use_basic_auth    => false,
                  :build_all_commits => true}
end

.log(message, &block) ⇒ Object



54
55
56
# File 'lib/integrity.rb', line 54

def self.log(message, &block)
  logger.info(message, &block)
end

.loggerObject



58
59
60
61
62
# File 'lib/integrity.rb', line 58

def self.logger
  @logger ||= Logger.new(config[:log], "daily").tap do |logger|
    logger.formatter = LogFormatter.new
  end
end

.new(config_file = nil) ⇒ Object



28
29
30
31
# File 'lib/integrity.rb', line 28

def self.new(config_file = nil)
  self.config = config_file unless config_file.nil?
  DataMapper.setup(:default, config[:database_uri])
end

.rootObject



33
34
35
# File 'lib/integrity.rb', line 33

def self.root
  File.expand_path(File.join(File.dirname(__FILE__), ".."))
end