Module: Integrity
- Included in:
- App
- Defined in:
- lib/integrity.rb,
lib/integrity/app.rb,
lib/integrity/scm.rb,
lib/integrity/build.rb,
lib/integrity/author.rb,
lib/integrity/commit.rb,
lib/integrity/helpers.rb,
lib/integrity/project.rb,
lib/integrity/scm/git.rb,
lib/integrity/notifier.rb,
lib/integrity/installer.rb,
lib/integrity/migrations.rb,
lib/integrity/scm/git/uri.rb,
lib/integrity/helpers/urls.rb,
lib/integrity/project/push.rb,
lib/integrity/notifier/base.rb,
lib/integrity/notifier/test.rb,
lib/integrity/project_builder.rb,
lib/integrity/helpers/rendering.rb,
lib/integrity/helpers/resources.rb,
lib/integrity/project/notifiers.rb,
lib/integrity/helpers/breadcrumbs.rb,
lib/integrity/helpers/authorization.rb,
lib/integrity/helpers/pretty_output.rb,
lib/integrity/notifier/test/hpricot_matcher.rb
Defined Under Namespace
Modules: Helpers, Migrations, SCM
Classes: App, Author, Build, Commit, Installer, LogFormatter, Notifier, Project, ProjectBuilder
Class Method Summary
collapse
Class Method Details
55
56
57
|
# File 'lib/integrity.rb', line 55
def self.config
@config ||= default_configuration.dup
end
|
.config=(options) ⇒ Object
59
60
61
|
# File 'lib/integrity.rb', line 59
def self.config=(options)
@config = default_configuration.merge(options)
end
|
.database_adapter ⇒ Object
26
27
28
|
# File 'lib/integrity/migrations.rb', line 26
def self.database_adapter
DataMapper.repository(:default).adapter
end
|
.default_configuration ⇒ Object
45
46
47
48
49
50
51
52
53
|
# File 'lib/integrity.rb', line 45
def self.default_configuration
@defaults ||= { :database_uri => "sqlite3::memory:",
:export_directory => "/tmp/exports",
:log => STDOUT,
:base_uri => "http://localhost:8910",
:use_basic_auth => false,
:build_all_commits => true,
:log_debug_info => false }
end
|
.log(message, &block) ⇒ Object
63
64
65
|
# File 'lib/integrity.rb', line 63
def self.log(message, &block)
logger.info(message, &block)
end
|
.migrate_db ⇒ Object
5
6
7
8
|
# File 'lib/integrity/migrations.rb', line 5
def self.migrate_db
setup_initial_migration if pre_migrations?
Integrity::Migrations.migrate_up!
end
|
.new(config = nil) ⇒ Object
35
36
37
38
39
40
41
42
43
|
# File 'lib/integrity.rb', line 35
def self.new(config=nil)
if config.is_a?(String) && File.file?(config)
self.config = YAML.load_file(config)
elsif config.is_a?(Hash)
self.config = config
end
DataMapper.setup(:default, self.config[:database_uri])
end
|
.pre_migrations? ⇒ Boolean
15
16
17
18
19
20
|
# File 'lib/integrity/migrations.rb', line 15
def self.pre_migrations?
!table_exists?("migration_info") &&
( table_exists?("integrity_projects") &&
table_exists?("integrity_builds") &&
table_exists?("integrity_notifiers") )
end
|
.setup_initial_migration ⇒ Object
10
11
12
13
|
# File 'lib/integrity/migrations.rb', line 10
def self.setup_initial_migration
database_adapter.execute %q(CREATE TABLE "migration_info" ("migration_name" VARCHAR(255));)
database_adapter.execute %q(INSERT INTO "migration_info" ("migration_name") VALUES ("initial"))
end
|
.table_exists?(table_name) ⇒ Boolean
22
23
24
|
# File 'lib/integrity/migrations.rb', line 22
def self.table_exists?(table_name)
database_adapter.storage_exists?(table_name)
end
|