Class: Database
- Inherits:
-
Object
- Object
- Database
- Defined in:
- lib/capistrano/tasks/database.rb
Instance Method Summary collapse
- #dump ⇒ Object
-
#initialize(config_file = fetch(:filename) || 'config/database.yml') ⇒ Database
constructor
A new instance of Database.
- #sync_dir ⇒ Object
Constructor Details
#initialize(config_file = fetch(:filename) || 'config/database.yml') ⇒ Database
Returns a new instance of Database.
6 7 8 |
# File 'lib/capistrano/tasks/database.rb', line 6 def initialize(config_file = fetch(:filename) || 'config/database.yml') @config_file = config_file end |
Instance Method Details
#dump ⇒ Object
10 11 12 13 14 |
# File 'lib/capistrano/tasks/database.rb', line 10 def dump #dump_file = "dump.local.#{Time.now.strftime '%Y-%m-%d_%H-%M-%S'}.sql" #username, password, database, host = database_config('development') #system "mysqldump -u #{username} --password=#{password} #{database} > #{dump_file}" end |
#sync_dir ⇒ Object
16 17 18 |
# File 'lib/capistrano/tasks/database.rb', line 16 def sync_dir execute :mkdir, "-p #{shared_path}/sync" end |