jaxx 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/jaxx.gemspec CHANGED
@@ -17,6 +17,7 @@ Gem::Specification.new do |gem|
17
17
 
18
18
  gem.add_dependency 'fog'
19
19
  gem.add_dependency 'json'
20
+ gem.add_dependency 'mime-types'
20
21
  gem.add_development_dependency 'rake'
21
22
  gem.add_development_dependency 'guard'
22
23
  gem.add_development_dependency 'guard-rspec'
@@ -9,7 +9,7 @@ module Jaxx
9
9
  class Environment
10
10
 
11
11
  DEFAULT_ARGS = { 'service_timeout' => 1 }
12
- DEFAULT_CREDENTIALS = { :aws_access_key_id => "", :aws_secret_access_key => "", :aws_session_token => nil, :use_iam_profile => true }
12
+ DEFAULT_CREDENTIALS = { :aws_access_key_id => "", :aws_secret_access_key => "", :aws_session_token => nil, :use_iam_profile => false }
13
13
 
14
14
  attr_reader :service_timeout
15
15
 
data/lib/jaxx/upload.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'jaxx/process'
2
+ require 'mime/types'
2
3
 
3
4
  module Jaxx
4
5
  class Upload
@@ -14,11 +15,29 @@ module Jaxx
14
15
  @filename || File.basename(process.file)
15
16
  end
16
17
 
18
+ def files
19
+ if File.directory?(process.file)
20
+ Dir[File.join(process.file, "**", "*")]
21
+ .reject!{|fp| File.directory?(fp) }
22
+ .inject({}) {|hsh, fp| hsh[fp] = fp.gsub(process.file, ''); hsh }
23
+ else
24
+ { process.file => filename }
25
+ end
26
+ end
27
+
17
28
  def execute
18
29
  process.start do |storage|
19
30
  directory = storage.directories.get(process.bucket)
20
31
  directory ||= storage.directories.create(:key => process.bucket, :public => process.public?)
21
- directory.files.create(:key => filename, :body => File.read(process.file), :public => process.public?)
32
+
33
+ files.each do |file, name|
34
+ raise "File process failed: #{file}:#{name}" unless directory.files.create(
35
+ :key => name || file,
36
+ :body => File.read(file),
37
+ :public => process.public?,
38
+ :content_type => MIME::Types.type_for(file).first
39
+ )
40
+ end
22
41
  end
23
42
  end
24
43
 
data/lib/jaxx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jaxx
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jaxx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
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: 2013-02-14 00:00:00.000000000 Z
12
+ date: 2013-03-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog
@@ -43,6 +43,22 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: mime-types
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
46
62
  - !ruby/object:Gem::Dependency
47
63
  name: rake
48
64
  requirement: !ruby/object:Gem::Requirement
@@ -228,7 +244,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
228
244
  version: '0'
229
245
  segments:
230
246
  - 0
231
- hash: -3120191955893654967
247
+ hash: 3625006949931740995
232
248
  required_rubygems_version: !ruby/object:Gem::Requirement
233
249
  none: false
234
250
  requirements:
@@ -237,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
253
  version: '0'
238
254
  segments:
239
255
  - 0
240
- hash: -3120191955893654967
256
+ hash: 3625006949931740995
241
257
  requirements: []
242
258
  rubyforge_project:
243
259
  rubygems_version: 1.8.25