heroku_cloud_backup 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46fa6b7d02e63f4e0b7f7b9e079e5d7fd2789c69
4
- data.tar.gz: 7bc2897e71b6aa4a6a19323316170b642a6ca418
3
+ metadata.gz: 86f1065241b1b2639c0a0f4574a3628c37e44ce7
4
+ data.tar.gz: b2484d2e557de82ac81321a56d1dbaf076f969cc
5
5
  SHA512:
6
- metadata.gz: b6bc4415214c6c7cf14407b63c848013412cdc1491f34e0c00219ec42abb311146678dd319a1f0b453f2d92b013e42ed4891ee371571140b96a851fdb30965c2
7
- data.tar.gz: 2b8d028584c1f5f1795be74fb5fbda52a828fefebcb6f25c953ba19e4344695784aee57341673a515ece754d4a41f391450d2eda69ec0a361e4363e784ac1acf
6
+ metadata.gz: 903de573fbce10d153e16ff271eb46cbed06e51c8933108ea34032232139380ae9f5a0eccc57fe9d28a3d15d4e7c61e7c705faf0eb9f7a0361e30ef8bb7c9ab7
7
+ data.tar.gz: f4f69e08c0d640618a6688dcfb5a064f263c22c644fc52ac332239933b2ea345b22fdf230ebf8b9660c2f7e2c06b479c5900fb06209b1403ab9d5736a2a20beb
@@ -1,11 +1,14 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.8.7
4
- - 1.9.2
5
3
  - 1.9.3
6
4
  - 2.0.0
7
- - jruby-18mode # JRuby in 1.8 mode
8
- - jruby-19mode # JRuby in 1.9 mode
9
- - rbx-18mode
10
- - rbx-19mode
11
- - ree
5
+ - 2.1.5
6
+ - 2.2.0
7
+ - rbx
8
+ - ruby-head
9
+ - jruby-head
10
+
11
+ matrix:
12
+ allow_failures:
13
+ - rvm: ruby-head
14
+ - rvm: jruby-head
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in heroku_cloud_backup.gemspec
4
4
  gemspec
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011-2012 Jack Chu
1
+ Copyright (c) 2011-2013 Jack Chu
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -55,17 +55,23 @@ HCB_MAX (Defaults to no limit) - The number of backups to store before the scrip
55
55
 
56
56
  heroku config:add HCB_MAX=10
57
57
 
58
+ HCB_REGION (AWS defaults 'us-east-1', Rackspace defaults to :dfw) - The region of the provider. **Optional**
59
+
60
+ heroku config:add HCB_REGION=us-west-1
61
+
58
62
  Depending on which provider you specify, you'll need to provide different login credentials.
59
63
 
60
64
  For Amazon:
61
65
 
62
66
  heroku config:add HCB_KEY1="aws_access_key_id"
63
67
  heroku config:add HCB_KEY2="aws_secret_access_key"
68
+ heroku config:add HCB_REGION="us-east-1"
64
69
 
65
70
  For Rackspace:
66
71
 
67
72
  heroku config:add HCB_KEY1="rackspace_username"
68
73
  heroku config:add HCB_KEY2="rackspace_api_key"
74
+ heroku config:add HCB_REGION="dfw"
69
75
 
70
76
  For Google Storage:
71
77
 
@@ -82,17 +88,3 @@ You can run this manually like this:
82
88
  I would recommend you create a temporarily public url from your cloud storage. I do this with Cyberduck. It has a neat feature where you can right click on a file and it'll generate temporarily accessible urls to that file, with the auth params for it. So once you have that url you can store like this:
83
89
 
84
90
  heroku pgbackups:restore 'http://my-bucket-name.s3.amazonaws.com/db/DATABASE_URL/2011-06-09-014500.dump?authparameters'
85
-
86
- ## Note on Patches/Pull Requests
87
-
88
- * Fork the project.
89
- * Make your feature addition or bug fix.
90
- * Add tests for it. This is important so I don't break it in a
91
- future version unintentionally.
92
- * Commit, do not mess with rakefile, version, or history.
93
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
94
- * Send me a pull request. Bonus points for topic branches.
95
-
96
- ### Copyright
97
-
98
- Copyright (c) 2011-2012 Jack Chu. See LICENSE for details.
@@ -12,6 +12,7 @@ Gem::Specification.new do |s|
12
12
  s.homepage = "http://jackchu.com/blog/2011/06/10/automated-heroku-database-backups-to-amazon-s3/"
13
13
  s.summary = %q{Backup pg dumps to the cloud}
14
14
  s.description = %q{PG backups into the cloud with fog}
15
+ s.license = "MIT"
15
16
 
16
17
  s.rubyforge_project = "heroku_cloud_backup"
17
18
 
@@ -23,7 +23,7 @@ module HerokuCloudBackup
23
23
  end
24
24
 
25
25
  if !directory
26
- directory = connection.directories.create(:key => bucket_name)
26
+ directory = connection.directories.create(key: bucket_name)
27
27
  end
28
28
 
29
29
  public_url = b["public_url"]
@@ -32,7 +32,7 @@ module HerokuCloudBackup
32
32
  name = "#{created_at.strftime('%Y-%m-%d-%H%M%S')}.dump"
33
33
  begin
34
34
  log "creating #{@backup_path}/#{b["from_name"]}/#{name}"
35
- directory.files.create(:key => "#{backup_path}/#{b["from_name"]}/#{name}", :body => open(public_url))
35
+ directory.files.create(key: "#{backup_path}/#{b["from_name"]}/#{name}", body: open(public_url))
36
36
  rescue Exception => e
37
37
  raise HerokuCloudBackup::Errors::UploadError.new(e.message)
38
38
  end
@@ -52,20 +52,25 @@ module HerokuCloudBackup
52
52
  begin
53
53
  case provider
54
54
  when 'aws'
55
- Fog::Storage.new(:provider => 'AWS',
56
- :aws_access_key_id => key1,
57
- :aws_secret_access_key => key2
58
- )
55
+ Fog::Storage.new(
56
+ provider: 'AWS',
57
+ aws_access_key_id: key1,
58
+ aws_secret_access_key: key2,
59
+ region: region,
60
+ )
59
61
  when 'rackspace'
60
- Fog::Storage.new(:provider => 'Rackspace',
61
- :rackspace_username => key1,
62
- :rackspace_api_key => key2
63
- )
62
+ Fog::Storage.new(
63
+ provider: 'Rackspace',
64
+ rackspace_username: key1,
65
+ rackspace_api_key: key2,
66
+ rackspace_region: region.to_sym,
67
+ )
64
68
  when 'google'
65
- Fog::Storage.new(:provider => 'Google',
66
- :google_storage_secret_access_key => key1,
67
- :google_storage_access_key_id => key2
68
- )
69
+ Fog::Storage.new(
70
+ provider: 'Google',
71
+ google_storage_secret_access_key: key1,
72
+ google_storage_access_key_id: key2,
73
+ )
69
74
  else
70
75
  raise "Your provider was invalid. Valid values are 'aws', 'rackspace', or 'google'"
71
76
  end
@@ -103,6 +108,18 @@ module HerokuCloudBackup
103
108
  ENV['HCB_KEY2'] || raise(HerokuCloudBackup::Errors::NotFound.new("Please provide a 'HCB_KEY2' config variable."))
104
109
  end
105
110
 
111
+ def region
112
+ region = case provider
113
+ when 'aws'
114
+ 'us-east-1'
115
+ when 'rackspace'
116
+ 'dfw'
117
+ else
118
+ nil
119
+ end
120
+ ENV['HCB_REGION'] || region
121
+ end
122
+
106
123
  def log(message)
107
124
  puts "[#{Time.now}] #{message}"
108
125
  end
@@ -111,7 +128,7 @@ module HerokuCloudBackup
111
128
  number_of_files = ENV['HCB_MAX']
112
129
  if number_of_files && number_of_files.to_i > 0
113
130
  directory = connection.directories.get(bucket_name)
114
- files = directory.files.all(:prefix => backup_path)
131
+ files = directory.files.all(prefix: backup_path)
115
132
  file_count = 0
116
133
  files.reverse.each do |file|
117
134
  if file.key =~ Regexp.new("/#{backup_path}\/\d{4}-\d{2}-\d{2}-\d{6}\.sql\.gz$/i")
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module HerokuCloudBackup
4
- VERSION = "0.1.2"
4
+ VERSION = "0.1.3"
5
5
  end
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku_cloud_backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Chu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-03 00:00:00.000000000 Z
11
+ date: 2015-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.6.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.6.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: heroku
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 2.32.14
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.32.14
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: PG backups into the cloud with fog
@@ -73,8 +73,8 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - .gitignore
77
- - .travis.yml
76
+ - ".gitignore"
77
+ - ".travis.yml"
78
78
  - CHANGELOG.md
79
79
  - Gemfile
80
80
  - LICENSE
@@ -88,7 +88,8 @@ files:
88
88
  - lib/heroku_cloud_backup/version.rb
89
89
  - spec/heroku_cloud_backup_spec.rb
90
90
  homepage: http://jackchu.com/blog/2011/06/10/automated-heroku-database-backups-to-amazon-s3/
91
- licenses: []
91
+ licenses:
92
+ - MIT
92
93
  metadata: {}
93
94
  post_install_message:
94
95
  rdoc_options: []
@@ -96,17 +97,17 @@ require_paths:
96
97
  - lib
97
98
  required_ruby_version: !ruby/object:Gem::Requirement
98
99
  requirements:
99
- - - '>='
100
+ - - ">="
100
101
  - !ruby/object:Gem::Version
101
102
  version: '0'
102
103
  required_rubygems_version: !ruby/object:Gem::Requirement
103
104
  requirements:
104
- - - '>='
105
+ - - ">="
105
106
  - !ruby/object:Gem::Version
106
107
  version: '0'
107
108
  requirements: []
108
109
  rubyforge_project: heroku_cloud_backup
109
- rubygems_version: 2.0.0
110
+ rubygems_version: 2.4.5
110
111
  signing_key:
111
112
  specification_version: 4
112
113
  summary: Backup pg dumps to the cloud