heroku-db-sync 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/heroku-db-sync.rb +1 -0
- data/lib/heroku-db-sync/deploy_and_migrate.rb +23 -0
- data/lib/heroku-db-sync/task_helper.rb +1 -0
- data/lib/heroku-db-sync/version.rb +1 -1
- data/lib/tasks/{heroku-db-sync_tasks.rake → heroku_sync_db_tasks.rake} +2 -2
- data/lib/tasks/heroku_sync_deploy.rake +8 -0
- data/test/dummy/log/test.log +9 -0
- metadata +5 -3
data/lib/heroku-db-sync.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
module HerokuDbSync
|
2
|
+
module Deploy
|
3
|
+
|
4
|
+
def self.deploy arguments
|
5
|
+
Bundler.with_clean_env do
|
6
|
+
remote = arguments[:remote]
|
7
|
+
raise "must specify git remote. 'production' 'staging' or 'heroku'" unless remote
|
8
|
+
branch = arguments[:localbranch] || 'master'
|
9
|
+
|
10
|
+
execute "git push #{remote} #{branch}:master"
|
11
|
+
execute "heroku run rake db:migrate --remote #{remote}"
|
12
|
+
execute "heroku restart --remote #{remote}"
|
13
|
+
puts "\nSUCCESS. Go to your web site for a paranoid sanity check.\nPop a beer\n"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.execute(cmd)
|
18
|
+
puts "===================================================\nExecuting: #{cmd}\n==================================================="
|
19
|
+
system(cmd) || raise("\n FAILED FAILED FAILED FAILED \n handle manually!\n Server may be down. Don't panic, remember your towel\n\n========")
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
|
-
namespace :
|
2
|
+
namespace :heroku do
|
3
3
|
namespace :sync do
|
4
|
-
namespace :
|
4
|
+
namespace :db do
|
5
5
|
desc 'sync local DB with heroku. set [from_remote] to pull from other than production'
|
6
6
|
task :local, [:from_remote, :host, :database, :username] => :environment do | task, arguments |
|
7
7
|
HerokuDbSync::TaskHelper.perform_sync arguments.to_hash.merge({to_remote: nil})
|
data/test/dummy/log/test.log
CHANGED
@@ -7,3 +7,12 @@ Connecting to database specified by database.yml
|
|
7
7
|
Connecting to database specified by database.yml
|
8
8
|
[1m[36m (0.3ms)[0m [1mbegin transaction[0m
|
9
9
|
[1m[35m (0.0ms)[0m rollback transaction
|
10
|
+
Connecting to database specified by database.yml
|
11
|
+
[1m[36m (4.4ms)[0m [1mbegin transaction[0m
|
12
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
13
|
+
Connecting to database specified by database.yml
|
14
|
+
[1m[36m (0.3ms)[0m [1mbegin transaction[0m
|
15
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
16
|
+
Connecting to database specified by database.yml
|
17
|
+
[1m[36m (0.3ms)[0m [1mbegin transaction[0m
|
18
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroku-db-sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-12-
|
12
|
+
date: 2013-12-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -50,10 +50,12 @@ executables: []
|
|
50
50
|
extensions: []
|
51
51
|
extra_rdoc_files: []
|
52
52
|
files:
|
53
|
+
- lib/heroku-db-sync/deploy_and_migrate.rb
|
53
54
|
- lib/heroku-db-sync/task_helper.rb
|
54
55
|
- lib/heroku-db-sync/version.rb
|
55
56
|
- lib/heroku-db-sync.rb
|
56
|
-
- lib/tasks/
|
57
|
+
- lib/tasks/heroku_sync_db_tasks.rake
|
58
|
+
- lib/tasks/heroku_sync_deploy.rake
|
57
59
|
- MIT-LICENSE
|
58
60
|
- Rakefile
|
59
61
|
- README.md
|