Module: Shipit
- Defined in:
- lib/shipit.rb,
lib/shipit/app.rb,
lib/shipit/job.rb,
lib/shipit/tasks.rb,
lib/shipit/version.rb,
lib/shipit/repository.rb,
lib/shipit/environment.rb
Defined Under Namespace
Modules: Tasks
Classes: App, Environment, Job, Repository
Constant Summary
collapse
- VERSION =
"0.0.2"
Class Method Summary
collapse
Class Method Details
.app ⇒ Object
38
39
40
41
42
|
# File 'lib/shipit.rb', line 38
def app
@app ||= Rack::Builder.new {
run Shipit::App
}
end
|
.enable_mock! ⇒ Object
44
45
46
|
# File 'lib/shipit.rb', line 44
def enable_mock!
Job.enable_mock!
end
|
.setup(settings) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/shipit.rb', line 14
def setup(settings)
env = settings["RACK_ENV"]
if env.nil? || env.empty?
raise Error, "RACK_ENV is required"
end
if env != "production"
settings["DATABASE_URL"] ||= "mysql2://root@localhost/shipit_#{env}"
end
database = URI(settings["DATABASE_URL"])
adapter = database.scheme == "postgres" ? "postgresql" : database.scheme
connection = {
:adapter => adapter,
:host => database.host,
:database => database.path[1..-1],
:username => database.user,
:password => database.password,
:reconnect => true,
}
ActiveRecord::Base.establish_connection(connection)
end
|