mina-data_sync 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mina/data_sync/helpers.rb +2 -2
- data/lib/mina/data_sync/tasks.rb +10 -6
- data/lib/mina/data_sync/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: d81b2449d778519f0bc36481e98d133f0ce590a7
         | 
| 4 | 
            +
              data.tar.gz: 5ad76b08d901c913992b7ef637e080bcab124c85
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: fd0c4965dd1a7401ab673e6d9346507241992cd886dfa5473218f054535d6793c6f787b100306db404e48d627c01ae45fce95d7364f0b8edc75cb34962f6c0d7
         | 
| 7 | 
            +
              data.tar.gz: 88ec9c154662ba21ac8454c0e56161d95f9da8a13a6d085d7f82400a2c31edebfc2968380ad94652e674d0125776a99ffcc7d008485bc77add8576e80c2e0164
         | 
| @@ -10,13 +10,13 @@ COMMAND = <<-RUBY | |
| 10 10 | 
             
              arguments = ""
         | 
| 11 11 | 
             
              case adapter.to_s
         | 
| 12 12 | 
             
              when "postgresql"
         | 
| 13 | 
            -
                arguments += "PGPASSWORD=" + password if password
         | 
| 13 | 
            +
                arguments += "PGPASSWORD=" + password + " " if password
         | 
| 14 14 | 
             
                arguments += method == "dump" ? "pg_dump" : "psql -q"
         | 
| 15 15 | 
             
                arguments += " -d " + database if database
         | 
| 16 16 | 
             
                arguments += " -h " + host if host
         | 
| 17 17 | 
             
                arguments += " -U " + username if username
         | 
| 18 18 | 
             
                arguments += " -p " + port.to_s if port
         | 
| 19 | 
            -
                arguments += " -O -c"
         | 
| 19 | 
            +
                arguments += method == "dump" ? " -O -c" : ""
         | 
| 20 20 | 
             
              when "mysql2"
         | 
| 21 21 | 
             
                arguments += method == "dump" ? "mysqldump" : "mysql"
         | 
| 22 22 | 
             
                arguments += " " + database if database
         | 
    
        data/lib/mina/data_sync/tasks.rb
    CHANGED
    
    | @@ -11,16 +11,18 @@ namespace :data_sync do | |
| 11 11 | 
             
                queue "#{DATA_SYNC}"
         | 
| 12 12 | 
             
                queue "mkdir -p #{remote_backup_path}"
         | 
| 13 13 | 
             
                queue "CONFIG=$(#{rails} runner 'puts ActiveRecord::Base.connection.instance_variable_get(:@config).to_json')"
         | 
| 14 | 
            -
                queue | 
| 14 | 
            +
                queue %(data_sync "dump" "#{remote_backup_path}/#{backup_file}" "$CONFIG")
         | 
| 15 | 
            +
                queue %(eval $(data_sync "dump" "#{remote_backup_path}/#{backup_file}" "$CONFIG"))
         | 
| 15 16 |  | 
| 16 17 | 
             
                to :after_hook do
         | 
| 17 18 | 
             
                  queue "echo '-----> Copying backup'"
         | 
| 18 19 | 
             
                  queue "mkdir -p #{local_backup_path}"
         | 
| 19 20 | 
             
                  queue "#{DATA_SYNC}"
         | 
| 20 | 
            -
                  queue | 
| 21 | 
            +
                  queue "rsync --progress -e 'ssh -p #{port}' #{user}@#{domain}:#{deploy_to}/#{current_path}/#{remote_backup_path}/#{backup_file} #{local_backup_path}/#{backup_file}"
         | 
| 21 22 | 
             
                  if restore_data == 'true'
         | 
| 22 23 | 
             
                    queue "echo '-----> Restoring database'"
         | 
| 23 | 
            -
                    queue "CONFIG=$(#{ | 
| 24 | 
            +
                    queue "CONFIG=$(RAILS_ENV=development #{bundle_bin} exec rails runner 'puts ActiveRecord::Base.connection.instance_variable_get(:@config).to_json')"
         | 
| 25 | 
            +
                    queue %(data_sync "restore" "#{local_backup_path}/#{backup_file}" "$CONFIG")
         | 
| 24 26 | 
             
                    queue %(eval $(data_sync "restore" "#{local_backup_path}/#{backup_file}" "$CONFIG"))
         | 
| 25 27 | 
             
                  end
         | 
| 26 28 | 
             
                end
         | 
| @@ -32,16 +34,18 @@ namespace :data_sync do | |
| 32 34 | 
             
                to :before_hook do
         | 
| 33 35 | 
             
                  queue "echo '-----> Dumping database'"
         | 
| 34 36 | 
             
                  queue "#{DATA_SYNC}"
         | 
| 35 | 
            -
                  queue "CONFIG=$(#{ | 
| 36 | 
            -
                  queue | 
| 37 | 
            +
                  queue "CONFIG=$(RAILS_ENV=development #{bundle_bin} exec rails runner 'puts ActiveRecord::Base.connection.instance_variable_get(:@config).to_json')"
         | 
| 38 | 
            +
                  queue %(data_sync "dump" "#{local_backup_path}/#{backup_file}" "$CONFIG")
         | 
| 39 | 
            +
                  queue %(eval $(data_sync "dump" "#{local_backup_path}/#{backup_file}" "$CONFIG"))
         | 
| 37 40 | 
             
                  queue "echo '-----> Copying backup'"
         | 
| 38 | 
            -
                  queue | 
| 41 | 
            +
                  queue "rsync --progress -e 'ssh -p #{port}' #{local_backup_path}/#{backup_file} #{user}@#{domain}:#{deploy_to}/#{current_path}/#{remote_backup_path}/#{backup_file}"
         | 
| 39 42 | 
             
                end
         | 
| 40 43 |  | 
| 41 44 | 
             
                if restore_data == 'true'
         | 
| 42 45 | 
             
                  queue "echo '-----> Restoring database'"
         | 
| 43 46 | 
             
                  queue "cd #{deploy_to}/#{current_path}"
         | 
| 44 47 | 
             
                  queue "CONFIG=$(#{rails} runner 'puts ActiveRecord::Base.connection.instance_variable_get(:@config).to_json')"
         | 
| 48 | 
            +
                  queue %(data_sync "restore" "#{remote_backup_path}/#{backup_file}" "$CONFIG")
         | 
| 45 49 | 
             
                  queue %(eval $(data_sync "restore" "#{remote_backup_path}/#{backup_file}" "$CONFIG"))
         | 
| 46 50 | 
             
                end
         | 
| 47 51 | 
             
              end
         |