backup2everbox 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- backup2everbox (0.1.0)
4
+ backup2everbox (0.1.1)
5
5
  activesupport
6
6
  backup (~> 3.0)
7
7
  launchy
@@ -27,14 +27,14 @@ GEM
27
27
  debugger-ruby_core_source (>= 1.1.1)
28
28
  debugger-ruby_core_source (1.1.3)
29
29
  i18n (0.6.0)
30
- json (1.6.6)
30
+ json (1.7.3)
31
31
  launchy (2.1.0)
32
32
  addressable (~> 2.2.6)
33
33
  mime-types (1.19)
34
34
  multi_json (1.3.6)
35
35
  oauth (0.4.6)
36
36
  open4 (1.3.0)
37
- rake (0.8.7)
37
+ rake (0.9.2.2)
38
38
  rdoc (3.12)
39
39
  json (~> 1.4)
40
40
  rest-client (1.6.7)
@@ -48,5 +48,5 @@ DEPENDENCIES
48
48
  backup2everbox!
49
49
  bundler (>= 1.0.0)
50
50
  debugger
51
- rake (= 0.8.7)
51
+ rake
52
52
  rdoc
data/History.rdoc CHANGED
@@ -1,3 +1,6 @@
1
+ === 0.1.1 / 2012-06-26
2
+ * don't include debugger in code
3
+
1
4
  === 0.1.0 / 2012-06-25
2
5
  * support backup ~> 3.0
3
6
 
@@ -23,9 +23,11 @@ Gem::Specification.new do |s|
23
23
  s.add_dependency 'rest-client'
24
24
  s.add_dependency 'launchy'
25
25
  s.add_development_dependency "bundler", ">= 1.0.0"
26
- s.add_development_dependency 'rake', "0.8.7"
26
+ s.add_development_dependency 'rake'
27
27
  s.add_development_dependency 'rdoc'
28
- s.add_development_dependency 'debugger'
28
+ if (!defined?(RUBY_ENGINE) or RUBY_ENGINE == 'ruby') and RUBY_VERSION > '1.9.1'
29
+ s.add_development_dependency 'debugger'
30
+ end
29
31
 
30
32
  s.files = `git ls-files`.split("\n")
31
33
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -4,6 +4,7 @@ require 'oauth'
4
4
  require 'json'
5
5
  require 'rest_client'
6
6
 
7
+ require 'backup/logger'
7
8
 
8
9
  module Backup
9
10
  module Connection
@@ -27,7 +28,6 @@ module Backup
27
28
  @access_token = OAuth::AccessToken.from_hash(@consumer, {:oauth_token => authorizing_token, :oauth_token_secret => authorizing_secret})
28
29
  raise "@access_token.token is nil" if @access_token.token.nil?
29
30
  raise "@access_token.secret is nil" if @access_token.secret.nil?
30
- puts @access_token.inspect
31
31
  end
32
32
 
33
33
  def authorized?
@@ -49,7 +49,7 @@ module Backup
49
49
  remote_path = find_real_remote_path(remote_path)
50
50
  stat = path_stat(remote_path)
51
51
  if stat == :not_exist
52
- puts "remote dir not exist, try to create it"
52
+ Logger.message "remote dir not exist, try to create it"
53
53
  mkdir_p(remote_path)
54
54
  elsif stat == :file
55
55
  raise "remote path is a file, failed to backup"
@@ -69,7 +69,7 @@ module Backup
69
69
  raise "prepare_put failed:\n#{info}" unless info["required"].is_a?(Array)
70
70
  File.open(filename) do |f|
71
71
  info["required"].each do |x|
72
- puts "uploading block ##{x["index"]}"
72
+ Logger.message "uploading block ##{x["index"]}"
73
73
  f.seek(x["index"] * @options[:chunk_size])
74
74
  code, response = http_request x['url'], f.read(@options[:chunk_size]), :method => :put
75
75
  if code != 200
@@ -143,7 +143,7 @@ module Backup
143
143
  when :post
144
144
  response = RestClient.post url, data, :content_type => options[:content_type]
145
145
  when :put
146
- response = RestClient.put url, data
146
+ response = RestClient.put url, data, :user_agent => user_agent
147
147
  end
148
148
  body = response.body
149
149
  data = nil
@@ -165,11 +165,13 @@ module Backup
165
165
  [code, data]
166
166
  end
167
167
  end
168
+
168
169
  def fs(path)
169
170
  path = path.to_s
170
171
  path = '/' + path unless path.start_with? '/'
171
172
  @options[:fs_site] + path
172
173
  end
174
+
173
175
  def urlsafe_base64(content)
174
176
  Base64.encode64(content).strip.gsub('+', '-').gsub('/','_')
175
177
  end
@@ -183,6 +185,10 @@ module Backup
183
185
  end
184
186
  res
185
187
  end
188
+
189
+ def user_agent
190
+ "backup2everbox #{Backup2everbox::VERSION}"
191
+ end
186
192
  end
187
193
 
188
194
  attr_accessor :token, :secret
@@ -1,5 +1,4 @@
1
1
  require 'backup/connection/everbox'
2
- require 'debugger'
3
2
 
4
3
  module Backup
5
4
  module Storage
@@ -1,3 +1,3 @@
1
1
  module Backup2everbox
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -7,7 +7,4 @@ module Backup
7
7
  module Storage
8
8
  autoload :Everbox, 'backup/storage/everbox'
9
9
  end
10
- module Record
11
- autoload :Everbox, 'backup/record/everbox'
12
- end
13
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backup2everbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
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-25 00:00:00.000000000 Z
12
+ date: 2012-06-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: backup
@@ -112,17 +112,17 @@ dependencies:
112
112
  requirement: !ruby/object:Gem::Requirement
113
113
  none: false
114
114
  requirements:
115
- - - '='
115
+ - - ! '>='
116
116
  - !ruby/object:Gem::Version
117
- version: 0.8.7
117
+ version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  none: false
122
122
  requirements:
123
- - - '='
123
+ - - ! '>='
124
124
  - !ruby/object:Gem::Version
125
- version: 0.8.7
125
+ version: '0'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: rdoc
128
128
  requirement: !ruby/object:Gem::Requirement