backup 4.2.3 → 4.3.0

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: 5add3999b96619c0b921169ed52e635cf4b61c56
4
- data.tar.gz: 72f1c297b011a1487bc2ddb46f31cb9ce94afad6
3
+ metadata.gz: c7e4e7ea9006f973c8df272ad4520265fb5a25e1
4
+ data.tar.gz: ce45e91cc9d2b80f721cbcda2f4012fce936fb7f
5
5
  SHA512:
6
- metadata.gz: 605f7883e601a0f2552fc4db82948642ab3f839219bb671141aae99099fe8eccd51805322cfd8377d9860783f3cd4c325f04789217ab77a3e88ee19800a0ebe4
7
- data.tar.gz: 10b798e65ca1c71ebf4d17be9f8b8ea56de44ed801c11b71d57864c96512ff3d1d7092bb41c87c4eca43c590d3552e73afd8dbb3d9410eff814431e3af31795c
6
+ metadata.gz: 866350af1103a7eeb171bd80d01c73d4a728f31eda444823b4250d3788d09402f6cbca600a6dfc0d48e05c0c74a2746fd68dee230b847acff3ba7d92a2a8bb07
7
+ data.tar.gz: b0585f85c576423c12291990521ad7d33a82fc6d1cadf97b009e332bbc8e0a42840b3debb9cd382291115e2282bbaa1f5b18088fa0dd6fde98e8edacc7f90e2b
data/README.md CHANGED
@@ -14,10 +14,10 @@ was built with modularity, extensibility and simplicity in mind.
14
14
 
15
15
  Please use the Backup features [issue tracker][Features] to suggest new features.
16
16
  Only use the Backup gem [issue tracker][Issues] for bugs and other issues.
17
- We're also available on [Gitter][] for questions and problems.
17
+ We're also available on [Gitter] for questions and problems.
18
18
 
19
- **Copyright (c) 2009-2015 [Michael van Rooijen][] ( [@meskyanichi][] )**
20
- Released under the **MIT** [License](LICENSE.md).
19
+ **Copyright (c) 2009-2016 [Michael van Rooijen][] ( [@mrrooijen] )**
20
+ Released under the **MIT** [LICENSE](LICENSE).
21
21
 
22
22
  [Installation]: http://backup.github.io/backup/v4/installation
23
23
  [Release Notes]: http://backup.github.io/backup/v4/release-notes
@@ -25,5 +25,5 @@ Released under the **MIT** [License](LICENSE.md).
25
25
  [Issues]: https://github.com/backup/backup/issues
26
26
  [Features]: https://github.com/backup/backup-features/issues
27
27
  [Gitter]: https://gitter.im/backup/backup?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
28
- [Michael van Rooijen]: http://michaelvanrooijen.com
29
- [@meskyanichi]: http://twitter.com/#!/meskyanichi
28
+ [Michael van Rooijen]: http://github.com/mrrooijen
29
+ [@mrrooijen]: http://twitter.com/mrrooijen
@@ -49,6 +49,7 @@ module Backup
49
49
  autoload :SCP, File.join(STORAGE_PATH, 'scp')
50
50
  autoload :RSync, File.join(STORAGE_PATH, 'rsync')
51
51
  autoload :Local, File.join(STORAGE_PATH, 'local')
52
+ autoload :Qiniu, File.join(STORAGE_PATH, 'qiniu')
52
53
  end
53
54
 
54
55
  ##
@@ -30,7 +30,7 @@ module Backup
30
30
  ['MySQL', 'PostgreSQL', 'MongoDB', 'Redis', 'Riak', 'OpenLDAP', 'SQLite'],
31
31
  # Storages
32
32
  ['S3', 'CloudFiles', 'Ninefold', 'Dropbox', 'FTP',
33
- 'SFTP', 'SCP', 'RSync', 'Local'],
33
+ 'SFTP', 'SCP', 'RSync', 'Local', 'Qiniu'],
34
34
  # Compressors
35
35
  ['Gzip', 'Bzip2', 'Custom', 'Pbzip2', 'Lzma'],
36
36
  # Encryptors
@@ -215,11 +215,8 @@ module Backup
215
215
  when 'test' then {}
216
216
  end
217
217
 
218
- ::Mail.defaults do
219
- delivery_method method.to_sym, options
220
- end
221
-
222
218
  email = ::Mail.new
219
+ email.delivery_method method.to_sym, options
223
220
  email.to = to
224
221
  email.from = from
225
222
  email.cc = cc
@@ -210,27 +210,3 @@ module Backup
210
210
  end
211
211
  end
212
212
  end
213
-
214
- # Patch for dropbox-ruby-sdk-1.5.1
215
- class DropboxClient
216
- class ChunkedUploader
217
- def upload(chunk_size = 1024**2 * 4)
218
- while @offset < @total_size
219
- @file_obj.seek(@offset) unless @file_obj.pos == @offset
220
- data = @file_obj.read(chunk_size)
221
-
222
- begin
223
- resp = @client.parse_response(
224
- @client.partial_chunked_upload(data, @upload_id, @offset)
225
- )
226
- rescue DropboxError => err
227
- resp = JSON.parse(err.http_response.body) rescue {}
228
- raise err unless resp['offset']
229
- end
230
-
231
- @offset = resp['offset']
232
- @upload_id ||= resp['upload_id']
233
- end
234
- end
235
- end
236
- end
@@ -0,0 +1,65 @@
1
+ # encoding: utf-8
2
+ require 'qiniu'
3
+
4
+ module Backup
5
+ module Storage
6
+ class Qiniu < Base
7
+ include Storage::Cycler
8
+ class Error < Backup::Error; end
9
+
10
+ ##
11
+ # Qiniu API credentials
12
+ attr_accessor :access_key, :secret_key
13
+
14
+ ##
15
+ # Qiniu bucket name
16
+ attr_accessor :bucket
17
+
18
+ def initialize(model, storage_id = nil)
19
+ super
20
+
21
+ @path ||= 'backups'
22
+
23
+ check_configuration
24
+ config_credentials
25
+ end
26
+
27
+ private
28
+ def transfer!
29
+ package.filenames.each do |filename|
30
+ src = File.join(Config.tmp_path, filename)
31
+ dest = File.join(remote_path, filename)
32
+ Logger.info "Storing '#{ dest }'..."
33
+
34
+ ::Qiniu.upload_file(uptoken: ::Qiniu.generate_upload_token,
35
+ bucket: bucket,
36
+ file: src,
37
+ key: dest)
38
+ end
39
+ end
40
+
41
+ # Called by the Cycler.
42
+ # Any error raised will be logged as a warning.
43
+ def remove!(package)
44
+ Logger.info "Removing backup package dated #{ package.time }..."
45
+ remote_path = remote_path_for(package)
46
+ package.filenames.each do |filename|
47
+ ::Qiniu.delete(bucket, File.join(remote_path, filename))
48
+ end
49
+ end
50
+
51
+ def check_configuration
52
+ required = %w{ access_key secret_key bucket }
53
+
54
+ raise Error, <<-EOS if required.map {|name| send(name) }.any?(&:nil?)
55
+ Configuration Error
56
+ #{ required.map {|name| "##{ name }"}.join(', ') } are all required
57
+ EOS
58
+ end
59
+
60
+ def config_credentials
61
+ ::Qiniu.establish_connection!(access_key: access_key, secret_key: secret_key)
62
+ end
63
+ end
64
+ end
65
+ end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Backup
4
- VERSION = '4.2.3'
4
+ VERSION = '4.3.0'
5
5
  end
@@ -0,0 +1,12 @@
1
+ ##
2
+ # Qiniu [Storage]
3
+ #
4
+ store_with Qiniu do |qiniu|
5
+ # Qiniu Credentials
6
+ qiniu.access_key = "my_access_key"
7
+ qiniu.secret_key = "my_secret_key"
8
+
9
+ qiniu.bucket = "bucket-name"
10
+ qiniu.keep = 5
11
+ qiniu.path = "path/to/backups"
12
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.3
4
+ version: 4.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael van Rooijen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-18 00:00:00.000000000 Z
11
+ date: 2016-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: CFPropertyList
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - '='
130
130
  - !ruby/object:Gem::Version
131
- version: 1.5.1
131
+ version: 1.6.5
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - '='
137
137
  - !ruby/object:Gem::Version
138
- version: 1.5.1
138
+ version: 1.6.5
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: equalizer
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -576,14 +576,14 @@ dependencies:
576
576
  requirements:
577
577
  - - '='
578
578
  - !ruby/object:Gem::Version
579
- version: 2.5.4
579
+ version: 2.6.3
580
580
  type: :runtime
581
581
  prerelease: false
582
582
  version_requirements: !ruby/object:Gem::Requirement
583
583
  requirements:
584
584
  - - '='
585
585
  - !ruby/object:Gem::Version
586
- version: 2.5.4
586
+ version: 2.6.3
587
587
  - !ruby/object:Gem::Dependency
588
588
  name: memoizable
589
589
  requirement: !ruby/object:Gem::Requirement
@@ -604,14 +604,14 @@ dependencies:
604
604
  requirements:
605
605
  - - '='
606
606
  - !ruby/object:Gem::Version
607
- version: 1.25.1
607
+ version: 2.4.3
608
608
  type: :runtime
609
609
  prerelease: false
610
610
  version_requirements: !ruby/object:Gem::Requirement
611
611
  requirements:
612
612
  - - '='
613
613
  - !ruby/object:Gem::Version
614
- version: 1.25.1
614
+ version: 2.4.3
615
615
  - !ruby/object:Gem::Dependency
616
616
  name: mini_portile
617
617
  requirement: !ruby/object:Gem::Requirement
@@ -702,14 +702,28 @@ dependencies:
702
702
  requirements:
703
703
  - - '='
704
704
  - !ruby/object:Gem::Version
705
- version: 2.9.2
705
+ version: 3.2.0
706
706
  type: :runtime
707
707
  prerelease: false
708
708
  version_requirements: !ruby/object:Gem::Requirement
709
709
  requirements:
710
710
  - - '='
711
711
  - !ruby/object:Gem::Version
712
- version: 2.9.2
712
+ version: 3.2.0
713
+ - !ruby/object:Gem::Dependency
714
+ name: netrc
715
+ requirement: !ruby/object:Gem::Requirement
716
+ requirements:
717
+ - - '='
718
+ - !ruby/object:Gem::Version
719
+ version: 0.11.0
720
+ type: :runtime
721
+ prerelease: false
722
+ version_requirements: !ruby/object:Gem::Requirement
723
+ requirements:
724
+ - - '='
725
+ - !ruby/object:Gem::Version
726
+ version: 0.11.0
713
727
  - !ruby/object:Gem::Dependency
714
728
  name: nokogiri
715
729
  requirement: !ruby/object:Gem::Requirement
@@ -753,75 +767,89 @@ dependencies:
753
767
  - !ruby/object:Gem::Version
754
768
  version: 2.0.0
755
769
  - !ruby/object:Gem::Dependency
756
- name: polyglot
770
+ name: qiniu
757
771
  requirement: !ruby/object:Gem::Requirement
758
772
  requirements:
759
773
  - - '='
760
774
  - !ruby/object:Gem::Version
761
- version: 0.3.3
775
+ version: 6.5.1
762
776
  type: :runtime
763
777
  prerelease: false
764
778
  version_requirements: !ruby/object:Gem::Requirement
765
779
  requirements:
766
780
  - - '='
767
781
  - !ruby/object:Gem::Version
768
- version: 0.3.3
782
+ version: 6.5.1
769
783
  - !ruby/object:Gem::Dependency
770
- name: simple_oauth
784
+ name: rest-client
771
785
  requirement: !ruby/object:Gem::Requirement
772
786
  requirements:
773
787
  - - '='
774
788
  - !ruby/object:Gem::Version
775
- version: 0.2.0
789
+ version: 1.7.3
776
790
  type: :runtime
777
791
  prerelease: false
778
792
  version_requirements: !ruby/object:Gem::Requirement
779
793
  requirements:
780
794
  - - '='
781
795
  - !ruby/object:Gem::Version
782
- version: 0.2.0
796
+ version: 1.7.3
783
797
  - !ruby/object:Gem::Dependency
784
- name: thor
798
+ name: ruby-hmac
785
799
  requirement: !ruby/object:Gem::Requirement
786
800
  requirements:
787
801
  - - '='
788
802
  - !ruby/object:Gem::Version
789
- version: 0.18.1
803
+ version: 0.4.0
790
804
  type: :runtime
791
805
  prerelease: false
792
806
  version_requirements: !ruby/object:Gem::Requirement
793
807
  requirements:
794
808
  - - '='
795
809
  - !ruby/object:Gem::Version
796
- version: 0.18.1
810
+ version: 0.4.0
797
811
  - !ruby/object:Gem::Dependency
798
- name: thread_safe
812
+ name: simple_oauth
799
813
  requirement: !ruby/object:Gem::Requirement
800
814
  requirements:
801
815
  - - '='
802
816
  - !ruby/object:Gem::Version
803
- version: 0.1.3
817
+ version: 0.2.0
804
818
  type: :runtime
805
819
  prerelease: false
806
820
  version_requirements: !ruby/object:Gem::Requirement
807
821
  requirements:
808
822
  - - '='
809
823
  - !ruby/object:Gem::Version
810
- version: 0.1.3
824
+ version: 0.2.0
811
825
  - !ruby/object:Gem::Dependency
812
- name: treetop
826
+ name: thor
813
827
  requirement: !ruby/object:Gem::Requirement
814
828
  requirements:
815
829
  - - '='
816
830
  - !ruby/object:Gem::Version
817
- version: 1.4.15
831
+ version: 0.18.1
818
832
  type: :runtime
819
833
  prerelease: false
820
834
  version_requirements: !ruby/object:Gem::Requirement
821
835
  requirements:
822
836
  - - '='
823
837
  - !ruby/object:Gem::Version
824
- version: 1.4.15
838
+ version: 0.18.1
839
+ - !ruby/object:Gem::Dependency
840
+ name: thread_safe
841
+ requirement: !ruby/object:Gem::Requirement
842
+ requirements:
843
+ - - '='
844
+ - !ruby/object:Gem::Version
845
+ version: 0.1.3
846
+ type: :runtime
847
+ prerelease: false
848
+ version_requirements: !ruby/object:Gem::Requirement
849
+ requirements:
850
+ - - '='
851
+ - !ruby/object:Gem::Version
852
+ version: 0.1.3
825
853
  - !ruby/object:Gem::Dependency
826
854
  name: twitter
827
855
  requirement: !ruby/object:Gem::Requirement
@@ -890,7 +918,6 @@ executables:
890
918
  extensions: []
891
919
  extra_rdoc_files: []
892
920
  files:
893
- - LICENSE.md
894
921
  - README.md
895
922
  - bin/backup
896
923
  - lib/backup.rb
@@ -952,7 +979,7 @@ files:
952
979
  - lib/backup/storage/dropbox.rb
953
980
  - lib/backup/storage/ftp.rb
954
981
  - lib/backup/storage/local.rb
955
- - lib/backup/storage/ninefold.rb
982
+ - lib/backup/storage/qiniu.rb
956
983
  - lib/backup/storage/rsync.rb
957
984
  - lib/backup/storage/s3.rb
958
985
  - lib/backup/storage/scp.rb
@@ -1004,7 +1031,7 @@ files:
1004
1031
  - templates/cli/storages/dropbox
1005
1032
  - templates/cli/storages/ftp
1006
1033
  - templates/cli/storages/local
1007
- - templates/cli/storages/ninefold
1034
+ - templates/cli/storages/qiniu
1008
1035
  - templates/cli/storages/rsync
1009
1036
  - templates/cli/storages/s3
1010
1037
  - templates/cli/storages/scp
data/LICENSE.md DELETED
@@ -1,24 +0,0 @@
1
-
2
- Copyright (c) 2009-2013 Michael van Rooijen ( [@meskyanichi](http://twitter.com/#!/meskyanichi) )
3
- =================================================================================================
4
-
5
- The "Backup" RubyGem is released under the **MIT LICENSE**
6
- ----------------------------------------------------------
7
-
8
- Permission is hereby granted, free of charge, to any person obtaining a copy
9
- of this software and associated documentation files (the "Software"), to deal
10
- in the Software without restriction, including without limitation the rights
11
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
- copies of the Software, and to permit persons to whom the Software is
13
- furnished to do so, subject to the following conditions:
14
-
15
- The above copyright notice and this permission notice shall be included in
16
- all copies or substantial portions of the Software.
17
-
18
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
- THE SOFTWARE.
@@ -1,74 +0,0 @@
1
- # encoding: utf-8
2
- require 'fog'
3
-
4
- module Backup
5
- module Storage
6
- class Ninefold < Base
7
- include Storage::Cycler
8
- class Error < Backup::Error; end
9
-
10
- ##
11
- # Ninefold Credentials
12
- attr_accessor :storage_token, :storage_secret
13
-
14
- def initialize(model, storage_id = nil)
15
- super
16
-
17
- @path ||= 'backups'
18
- path.sub!(/^\//, '')
19
- end
20
-
21
- private
22
-
23
- def connection
24
- @connection ||= Fog::Storage.new(
25
- :provider => 'Ninefold',
26
- :ninefold_storage_token => storage_token,
27
- :ninefold_storage_secret => storage_secret
28
- )
29
- end
30
-
31
- def transfer!
32
- directory = directory_for(remote_path, true)
33
- package.filenames.each do |filename|
34
- src = File.join(Config.tmp_path, filename)
35
- dest = File.join(remote_path, filename)
36
- Logger.info "Storing '#{ dest }'..."
37
- File.open(src, 'r') do |file|
38
- directory.files.create(:key => filename, :body => file)
39
- end
40
- end
41
- end
42
-
43
- ##
44
- # Queries the connection for the directory for the given +remote_path+
45
- # Returns nil if not found, or creates the directory if +create+ is true.
46
- def directory_for(remote_path, create = false)
47
- directory = connection.directories.get(remote_path)
48
- if directory.nil? && create
49
- directory = connection.directories.create(:key => remote_path)
50
- end
51
- directory
52
- end
53
-
54
- # Called by the Cycler.
55
- # Any error raised will be logged as a warning.
56
- def remove!(package)
57
- Logger.info "Removing backup package dated #{ package.time }..."
58
-
59
- remote_path = remote_path_for(package)
60
- directory = directory_for(remote_path)
61
-
62
- raise Error, "Directory at '#{ remote_path }' not found" unless directory
63
-
64
- package.filenames.each do |filename|
65
- file = directory.files.get(filename)
66
- file.destroy if file
67
- end
68
-
69
- directory.destroy
70
- end
71
-
72
- end
73
- end
74
- end
@@ -1,10 +0,0 @@
1
- ##
2
- # Ninefold Cloud Storage [Storage]
3
- #
4
- store_with Ninefold do |nf|
5
- nf.storage_token = "my_storage_token"
6
- nf.storage_secret = "my_storage_secret"
7
- nf.path = "/path/to/my/backups"
8
- nf.keep = 10
9
- # nf.keep = Time.now - 2592000 # Remove all backups older than 1 month.
10
- end