handy 0.0.18 → 0.0.19

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.
@@ -7,7 +7,7 @@ namespace :handy do
7
7
  %w(y yes).include? STDIN.gets.chomp.downcase
8
8
  end
9
9
 
10
- desc "Delete herokou apps."
10
+ desc "Deletes herokou applications belonging to your account. Be very very careful. There is no going back."
11
11
  task :delete_apps do
12
12
  output = `heroku apps`
13
13
  output.split(/\r?\n/).each do |record|
@@ -1,23 +1,27 @@
1
1
  def execute(cmd)
2
2
  puts cmd
3
+ Rails.logger.info(cmd) if defined?(Rails)
3
4
  system cmd
4
5
  end
5
6
 
6
7
  namespace :handy do
7
8
 
8
9
  namespace :heroku do
9
- desc "Copy production data to development"
10
+
11
+ desc "Takes snapshot of production db and copies production data to development"
10
12
  task :prod2development, :app do |t, args|
11
13
  export2local "#{heroku_app_name(t, args)}-production"
12
14
  end
13
15
 
14
- desc "Copy staging data to development"
16
+ desc "Takes snapshot of staging db and copies staging data to development"
15
17
  task :staging2development, :app do |t, args|
16
18
  export2local "#{heroku_app_name(t, args)}-staging"
17
19
  end
18
20
 
19
- desc "Copy production data to staging"
21
+ desc "Takes snapshot of production db and copies production data to staging"
20
22
  task :prod2staging, :app do |t, args|
23
+ take_current_snapshot "#{heroku_app_name(t, args)}-production"
24
+
21
25
  heroku_app_name = heroku_app_name(t, args)
22
26
  src_app_name = "#{heroku_app_name}-production"
23
27
  dst_app_name = "#{heroku_app_name}-staging"
@@ -28,11 +32,15 @@ namespace :handy do
28
32
 
29
33
 
30
34
  def export2local(app_name)
31
- execute "heroku pgbackups:capture --expire --app #{app_name}"
35
+ take_current_snapshot(app_name)
32
36
  execute "curl -o latest.dump `heroku pgbackups:url --app #{app_name}`"
33
37
  execute restore_command + "; rm latest.dump"
34
38
  end
35
39
 
40
+ def take_current_snapshot(app_name)
41
+ execute "heroku pgbackups:capture --expire --app #{app_name}"
42
+ end
43
+
36
44
  def heroku_app_name t, args
37
45
  args[:app] || ENV['APP_NAME'] || Rails.root.basename || abort(<<ERROR_MSG)
38
46
  Error: heroku app name is missing. This rake task should be invoked like this:
data/lib/handy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Handy
2
- VERSION = "0.0.18"
2
+ VERSION = "0.0.19"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: handy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.19
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-05-10 00:00:00.000000000 Z
12
+ date: 2013-05-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hashr
@@ -62,7 +62,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
62
62
  version: '0'
63
63
  segments:
64
64
  - 0
65
- hash: 3926813291287448041
65
+ hash: 154135609376602962
66
66
  required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  none: false
68
68
  requirements:
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  version: '0'
72
72
  segments:
73
73
  - 0
74
- hash: 3926813291287448041
74
+ hash: 154135609376602962
75
75
  requirements: []
76
76
  rubyforge_project:
77
77
  rubygems_version: 1.8.23