backup2qiniu 0.0.1 → 0.1.0

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- backup2qiniu (0.0.1)
4
+ backup2qiniu (0.1.0)
5
5
  backup (~> 3.0)
6
6
  qiniu-rs (~> 2.0)
7
7
 
@@ -14,7 +14,7 @@ GEM
14
14
  json (1.7.3)
15
15
  mime-types (1.19)
16
16
  open4 (1.3.0)
17
- qiniu-rs (2.0.1)
17
+ qiniu-rs (2.0.5)
18
18
  json (~> 1.7.3)
19
19
  mime-types (~> 1.19)
20
20
  rest-client (~> 1.6.7)
data/NEWS.md ADDED
@@ -0,0 +1,9 @@
1
+ # NEWS
2
+
3
+ ## 0.1.0 (2012-06-29)
4
+
5
+ * use qiniu ruby SDK v2.
6
+
7
+ ## 0.0.1 (2012-06-28)
8
+
9
+ * initial version.
data/README.md CHANGED
@@ -7,6 +7,7 @@
7
7
  * 运行 gem install backup2qiniu
8
8
  * 运行 backup generate:config
9
9
  * 运行 backup generate:model --trigger=mysql_backup_qiniu
10
+ * 访问 https://dev.qiniutek.com/account/keys, 找到你的 "Access Key" 和 "Access Secret"
10
11
  * 修改 ~/Backup/models/mysql_backup_qiniu.rb, 改为如下的形式
11
12
 
12
13
  ```
@@ -27,13 +28,13 @@ Backup::Model.new(:mysql_backup_qiniu, 'example backup to qiniu') do
27
28
  end
28
29
 
29
30
  store_with Qiniu do |eb|
30
- eb.username = 'username'
31
- eb.password = 's3cret'
31
+ eb.access_key = 'replace with access key'
32
+ eb.access_secret = 'replace with access secret'
32
33
  eb.bucket = 'backup'
33
34
  end
34
35
  end
35
36
  ```
36
37
 
37
- * 运行 sudo backup perform -t mysql_backup_everbox
38
+ * 运行 sudo backup perform -t mysql_backup_qiniu
38
39
  * backup 支持备份目录,数据库等多种源,并且支持非对称密钥加密来保护数据安全,
39
40
  具体可以参考 backup 的文档: https://github.com/meskyanichi/backup
@@ -5,7 +5,7 @@ module Backup
5
5
  module Storage
6
6
  class Qiniu < Base
7
7
 
8
- attr_accessor :username, :password
8
+ attr_accessor :access_key, :access_secret
9
9
  attr_accessor :bucket
10
10
 
11
11
  def initialize(model, storage_id = nil, &block)
@@ -21,16 +21,15 @@ module Backup
21
21
  end
22
22
 
23
23
  def transfer!
24
- ::Qiniu::RS.establish_connection! :access_key => "3fPHl_SLkPXdioqI_A8_NGngPWVJhlDk2ktRjogH",
25
- :secret_key => "bXTPMDJrVYRJUiSDRFtFYwycVD_mjXxYWrCYlDHy"
26
-
27
- raise "login failed" unless ::Qiniu::RS.login!(username, password)
24
+ ::Qiniu::RS.establish_connection! :access_key => access_key,
25
+ :secret_key => access_secret
28
26
 
29
27
  remote_path = remote_path_for(@package)
30
28
  files_to_transfer_for(@package) do |local_file, remote_file|
31
29
  Logger.message "#{storage_name} started transferring " +
32
30
  "'#{ local_file }'."
33
31
  remote_upload_url = ::Qiniu::RS.put_auth
32
+ raise "auth failed" if ! remote_upload_url
34
33
  key = File.join(remote_path, remote_file)
35
34
  ::Qiniu::RS.upload :url => remote_upload_url,
36
35
  :file => File.join(local_path, local_file),
@@ -1,3 +1,3 @@
1
1
  module Backup2qiniu
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backup2qiniu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.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: 2012-06-28 00:00:00.000000000 Z
12
+ date: 2012-06-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: backup
@@ -54,6 +54,7 @@ files:
54
54
  - Gemfile
55
55
  - Gemfile.lock
56
56
  - LICENSE
57
+ - NEWS.md
57
58
  - README.md
58
59
  - Rakefile
59
60
  - backup2qiniu.gemspec