Class: Capricorn::Actors::Sqlite3Actor

Inherits:
Capricorn::Actor show all
Defined in:
lib/capricorn/actors/sqlite3_actor.rb

Instance Attribute Summary

Attributes inherited from Capricorn::Actor

#satellite, #system

Instance Method Summary collapse

Methods inherited from Capricorn::Actor

#initialize

Methods included from Capricorn::Actor::Actions

included, #run_callbacks!, #run_callbacks_in_fase!

Constructor Details

This class inherits a constructor from Capricorn::Actor

Instance Method Details

#write_config_fileObject

write the database.yml config file.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/capricorn/actors/sqlite3_actor.rb', line 9

def write_config_file
  system.as_user(system.web_user, system.web_group) do
    
    config = %{# SQLite version 3.x
#   gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
  adapter: sqlite3
  database: db/system/development.sqlite3
  pool: 5
  timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/system/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/system/production.sqlite3
  pool: 5
  timeout: 5000
}
    
    db_file = File.join(system.satellite_root, 'config', 'database.yml')
    File.open(db_file, 'w+') { |f| f.write config }
    
  end
end