Top Level Namespace
Defined Under Namespace
Modules: Mina
Instance Method Summary collapse
- #backup_file ⇒ Object
- #dump ⇒ Object
- #options ⇒ Object
- #read_conf(path, rails_env) ⇒ Object
- #restore ⇒ Object
Instance Method Details
#backup_file ⇒ Object
5 6 7 |
# File 'lib/mina/data_sync/helpers.rb', line 5 def backup_file "#{@conf['database']}-#{Date.today}.sql" end |
#dump ⇒ Object
9 10 11 12 13 14 |
# File 'lib/mina/data_sync/helpers.rb', line 9 def dump case @conf['adapter'] when 'postgresql' then 'pg_dump' when 'mysql2' then 'mysqldump' end end |
#options ⇒ Object
23 24 25 26 27 28 |
# File 'lib/mina/data_sync/helpers.rb', line 23 def case @conf['adapter'] when 'postgresql' then '-O -c' when 'mysql2' then '' end end |
#read_conf(path, rails_env) ⇒ Object
1 2 3 |
# File 'lib/mina/data_sync/helpers.rb', line 1 def read_conf(path, rails_env) @conf ||= YAML.load(ERB.new(File.read(path)).result)[rails_env] end |
#restore ⇒ Object
16 17 18 19 20 21 |
# File 'lib/mina/data_sync/helpers.rb', line 16 def restore case @conf['adapter'] when 'postgresql' then 'psql -q' when 'mysql2' then 'mysql' end end |