Class: Capistrano::DBSync::Configuration
- Inherits:
-
Object
- Object
- Capistrano::DBSync::Configuration
- Extended by:
- Forwardable
- Defined in:
- lib/capistrano/db_sync/configuration.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
->(cap) do { # Hash mapping a table name to a query or nil in case no data is wanted for a table. # E.g.: { # posts: "SELECT * FROM posts WHERE created_at > NOW() - interval '60 days'", # comments: "SELECT * FROM comments WHERE created_at > NOW() - interval '30 days'", # likes: nil # } data_selection: {}, data_sync_confirmation: true, # Ask for user input confirmation local: { cleanup: false, # If the downloaded dump directory should be removed after restored pg_jobs: 1, # Number of jobs to run in parallel on pg_restore working_dir: Dir.tmpdir, env: ENV.fetch('RAILS_ENV', 'development'), }, remote: { cleanup: true, # If the remote dump directory should be removed after downloaded working_dir: cap.fetch(:tmp_dir, "/tmp"), env: cap.fetch(:stage).to_s, }, } end
Instance Method Summary collapse
- #data_sync_confirmed? ⇒ Boolean
-
#initialize(cap_instance = Capistrano.env) ⇒ Configuration
constructor
A new instance of Configuration.
- #load_options ⇒ Object
Constructor Details
#initialize(cap_instance = Capistrano.env) ⇒ Configuration
Returns a new instance of Configuration.
38 39 40 41 |
# File 'lib/capistrano/db_sync/configuration.rb', line 38 def initialize(cap_instance = Capistrano.env) @cap = cap_instance @options = end |
Instance Method Details
#data_sync_confirmed? ⇒ Boolean
49 50 51 52 |
# File 'lib/capistrano/db_sync/configuration.rb', line 49 def data_sync_confirmed? skip = [:data_sync_confirmation].to_s.downcase == "false" skip || prompt("Confirm replace local database with remote database?") end |
#load_options ⇒ Object
43 44 45 46 47 |
# File 'lib/capistrano/db_sync/configuration.rb', line 43 def = cap.fetch(:db_sync_options) = .reject { |_, v| v.nil? } DEFAULT_OPTIONS.call(cap).deep_merge() end |