jaxx 0.0.19 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -16,3 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  log/
19
+ .DS_Store
data/lib/jaxx/download.rb CHANGED
@@ -1,18 +1,20 @@
1
1
  require 'jaxx/process'
2
+ require 'fileutils'
2
3
 
3
4
  module Jaxx
4
5
  class Download
5
6
 
6
7
  attr_reader :process, :filename
7
8
 
8
- def initialize args = {}
9
+ def initialize(args = {})
9
10
  @process = Process.new(args)
10
11
  end
11
12
 
12
- def files directory
13
+ def files(directory)
13
14
  if process.file.match(%r{/$})
14
15
  directory.files.inject({}) do |hsh, f|
15
- hsh[f.key.gsub(process.file, '')] = f.key if f.key.match(process.file)
16
+ key = f.key.gsub(process.file, '')
17
+ hsh[key] = f.key if !key.empty? and f.key.match(process.file)
16
18
  hsh
17
19
  end
18
20
  else
@@ -25,9 +27,16 @@ module Jaxx
25
27
  directory = storage.directories.get(process.bucket)
26
28
 
27
29
  files(directory).each do |target, source|
30
+
31
+ # Ensure directory exists
32
+ dir = File.dirname(target)
33
+ FileUtils.mkdir_p(dir) unless File.exist?(dir)
34
+
35
+ # Create file
28
36
  File.open(target, 'wb') do |file|
29
37
  directory.files.get(source) {|chunk, byt_remain, byt_total| file.write(chunk) }
30
38
  end
39
+
31
40
  end
32
41
  end
33
42
  end
data/lib/jaxx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jaxx
2
- VERSION = "0.0.19"
2
+ VERSION = "0.0.20"
3
3
  end
@@ -5,7 +5,12 @@ module Jaxx
5
5
  describe Download do
6
6
 
7
7
  describe "#process" do
8
- let(:args) { ({ 'access_key' => 'foo', 'access_secret' => 'bar', 'file' => File.expand_path('bar.txt', __FILE__), 'bucket' => 'temp' }) }
8
+ let(:args) { ({
9
+ 'access_key' => 'foo',
10
+ 'access_secret' => 'bar',
11
+ 'file' => File.expand_path('bar.txt', __FILE__),
12
+ 'bucket' => 'temp'
13
+ }) }
9
14
 
10
15
  subject { described_class.new(args) }
11
16
 
@@ -20,5 +25,17 @@ module Jaxx
20
25
  end
21
26
  end
22
27
 
28
+ describe "#files" do
29
+
30
+ it "does not process empty filenames" do
31
+ args['file'] = "foo/"
32
+
33
+ file = mock('file', key: "foo/")
34
+ directory = double('directory', :files => [file])
35
+
36
+ subject.files(directory).should eq({})
37
+ end
38
+ end
39
+
23
40
  end
24
41
  end
metadata CHANGED
@@ -1,206 +1,218 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: jaxx
3
- version: !ruby/object:Gem::Version
4
- hash: 57
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.20
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 19
10
- version: 0.0.19
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Marc Watts
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2013-04-17 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2013-07-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: excon
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
23
17
  none: false
24
- requirements:
25
- - - "="
26
- - !ruby/object:Gem::Version
27
- hash: 79
28
- segments:
29
- - 0
30
- - 20
31
- - 0
18
+ requirements:
19
+ - - '='
20
+ - !ruby/object:Gem::Version
32
21
  version: 0.20.0
33
- prerelease: false
34
22
  type: :runtime
35
- requirement: *id001
36
- - !ruby/object:Gem::Dependency
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - '='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.20.0
30
+ - !ruby/object:Gem::Dependency
37
31
  name: fog
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
39
33
  none: false
40
- requirements:
41
- - - "="
42
- - !ruby/object:Gem::Version
43
- hash: 63
44
- segments:
45
- - 1
46
- - 10
47
- - 0
34
+ requirements:
35
+ - - '='
36
+ - !ruby/object:Gem::Version
48
37
  version: 1.10.0
49
- prerelease: false
50
38
  type: :runtime
51
- requirement: *id002
52
- - !ruby/object:Gem::Dependency
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - '='
44
+ - !ruby/object:Gem::Version
45
+ version: 1.10.0
46
+ - !ruby/object:Gem::Dependency
53
47
  name: json
54
- version_requirements: &id003 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
55
49
  none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 3
60
- segments:
61
- - 0
62
- version: "0"
63
- prerelease: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
64
54
  type: :runtime
65
- requirement: *id003
66
- - !ruby/object:Gem::Dependency
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
67
63
  name: mime-types
68
- version_requirements: &id004 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
69
65
  none: false
70
- requirements:
71
- - - ">="
72
- - !ruby/object:Gem::Version
73
- hash: 3
74
- segments:
75
- - 0
76
- version: "0"
77
- prerelease: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
78
70
  type: :runtime
79
- requirement: *id004
80
- - !ruby/object:Gem::Dependency
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
81
79
  name: rake
82
- version_requirements: &id005 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
83
81
  none: false
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- hash: 3
88
- segments:
89
- - 0
90
- version: "0"
91
- prerelease: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
92
86
  type: :development
93
- requirement: *id005
94
- - !ruby/object:Gem::Dependency
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
95
  name: guard
96
- version_requirements: &id006 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
97
97
  none: false
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- hash: 3
102
- segments:
103
- - 0
104
- version: "0"
105
- prerelease: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
106
102
  type: :development
107
- requirement: *id006
108
- - !ruby/object:Gem::Dependency
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
109
111
  name: guard-rspec
110
- version_requirements: &id007 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
111
113
  none: false
112
- requirements:
113
- - - ">="
114
- - !ruby/object:Gem::Version
115
- hash: 3
116
- segments:
117
- - 0
118
- version: "0"
119
- prerelease: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
120
118
  type: :development
121
- requirement: *id007
122
- - !ruby/object:Gem::Dependency
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
123
127
  name: rspec
124
- version_requirements: &id008 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
125
129
  none: false
126
- requirements:
127
- - - ">="
128
- - !ruby/object:Gem::Version
129
- hash: 3
130
- segments:
131
- - 0
132
- version: "0"
133
- prerelease: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
134
  type: :development
135
- requirement: *id008
136
- - !ruby/object:Gem::Dependency
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
137
143
  name: fakeweb
138
- version_requirements: &id009 !ruby/object:Gem::Requirement
144
+ requirement: !ruby/object:Gem::Requirement
139
145
  none: false
140
- requirements:
141
- - - ">="
142
- - !ruby/object:Gem::Version
143
- hash: 3
144
- segments:
145
- - 0
146
- version: "0"
147
- prerelease: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
148
150
  type: :development
149
- requirement: *id009
150
- - !ruby/object:Gem::Dependency
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ - !ruby/object:Gem::Dependency
151
159
  name: cucumber
152
- version_requirements: &id010 !ruby/object:Gem::Requirement
160
+ requirement: !ruby/object:Gem::Requirement
153
161
  none: false
154
- requirements:
155
- - - ">="
156
- - !ruby/object:Gem::Version
157
- hash: 3
158
- segments:
159
- - 0
160
- version: "0"
161
- prerelease: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
162
166
  type: :development
163
- requirement: *id010
164
- - !ruby/object:Gem::Dependency
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ - !ruby/object:Gem::Dependency
165
175
  name: aruba
166
- version_requirements: &id011 !ruby/object:Gem::Requirement
176
+ requirement: !ruby/object:Gem::Requirement
167
177
  none: false
168
- requirements:
169
- - - ">="
170
- - !ruby/object:Gem::Version
171
- hash: 3
172
- segments:
173
- - 0
174
- version: "0"
175
- prerelease: false
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
176
182
  type: :development
177
- requirement: *id011
178
- - !ruby/object:Gem::Dependency
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
188
+ - !ruby/object:Gem::Version
189
+ version: '0'
190
+ - !ruby/object:Gem::Dependency
179
191
  name: guard-cucumber
180
- version_requirements: &id012 !ruby/object:Gem::Requirement
192
+ requirement: !ruby/object:Gem::Requirement
181
193
  none: false
182
- requirements:
183
- - - ">="
184
- - !ruby/object:Gem::Version
185
- hash: 3
186
- segments:
187
- - 0
188
- version: "0"
189
- prerelease: false
194
+ requirements:
195
+ - - ! '>='
196
+ - !ruby/object:Gem::Version
197
+ version: '0'
190
198
  type: :development
191
- requirement: *id012
199
+ prerelease: false
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
202
+ requirements:
203
+ - - ! '>='
204
+ - !ruby/object:Gem::Version
205
+ version: '0'
192
206
  description: Command line wrapper for pushing files to S3
193
- email:
207
+ email:
194
208
  - marcky.sharky@googlemail.com
195
- executables:
209
+ executables:
196
210
  - jaxx-aboutme
197
211
  - jaxx-download
198
212
  - jaxx-upload
199
213
  extensions: []
200
-
201
214
  extra_rdoc_files: []
202
-
203
- files:
215
+ files:
204
216
  - .gitignore
205
217
  - .rvmrc
206
218
  - .travis.yml
@@ -237,38 +249,35 @@ files:
237
249
  - spec/spec_helper.rb
238
250
  homepage: https://github.com/marckysharky/jaxx
239
251
  licenses: []
240
-
241
252
  post_install_message:
242
253
  rdoc_options: []
243
-
244
- require_paths:
254
+ require_paths:
245
255
  - lib
246
- required_ruby_version: !ruby/object:Gem::Requirement
256
+ required_ruby_version: !ruby/object:Gem::Requirement
247
257
  none: false
248
- requirements:
249
- - - ">="
250
- - !ruby/object:Gem::Version
251
- hash: 3
252
- segments:
258
+ requirements:
259
+ - - ! '>='
260
+ - !ruby/object:Gem::Version
261
+ version: '0'
262
+ segments:
253
263
  - 0
254
- version: "0"
255
- required_rubygems_version: !ruby/object:Gem::Requirement
264
+ hash: 698514907351388838
265
+ required_rubygems_version: !ruby/object:Gem::Requirement
256
266
  none: false
257
- requirements:
258
- - - ">="
259
- - !ruby/object:Gem::Version
260
- hash: 3
261
- segments:
267
+ requirements:
268
+ - - ! '>='
269
+ - !ruby/object:Gem::Version
270
+ version: '0'
271
+ segments:
262
272
  - 0
263
- version: "0"
273
+ hash: 698514907351388838
264
274
  requirements: []
265
-
266
275
  rubyforge_project:
267
276
  rubygems_version: 1.8.25
268
277
  signing_key:
269
278
  specification_version: 3
270
279
  summary: RubyGems to allow any file to be pushed to S3 in the simplist way
271
- test_files:
280
+ test_files:
272
281
  - features/about_me.feature
273
282
  - features/download.feature
274
283
  - features/step_definitions/global_steps.rb