upyun-paperclip 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,7 @@ module Paperclip
14
14
  @upyun_username = @options[:upyun_username] || Paperclip::Storage::Upyun::Config[:upyun_username]
15
15
  @upyun_password = @options[:upyun_password] || Paperclip::Storage::Upyun::Config[:upyun_password]
16
16
  @upyun_domain = @options[:upyun_domain] || Paperclip::Storage::Upyun::Config[:upyun_domain]
17
- @upyun_api_host = @options[:upyun_api_host] || Paperclip::Storage::Upyun::Config[:upyun_api_host] || 'http://v1.api.upyun.com/'
17
+ @upyun_api_host = @options[:upyun_api_host] || ( defined? Paperclip::Storage::Upyun::Config || Paperclip::Storage::Upyun::Config[:upyun_api_host].nil?) ? 'http://v1.api.upyun.com/' : Paperclip::Storage::Upyun::Config[:upyun_api_host]
18
18
 
19
19
  @options[:path] = @options[:path].gsub(/:url/, @options[:url]).gsub(/^:rails_root\/public/, @upyun_domain)
20
20
  @options[:url] = @upyun_domain + @options[:url]
@@ -41,15 +41,7 @@ module Paperclip
41
41
  @queued_for_write.each do |style_name, file|
42
42
  current_path = ''
43
43
  relative_path = path(style_name).gsub(@upyun_domain, '')
44
- path_array = relative_path.split('/')
45
- path_array.pop
46
- path_array.reject!{|p| p == ''}
47
- path_array.each do |p|
48
- current_path = current_path + p + '/'
49
- @resource[current_path].post '', :folder => true
50
- end
51
- @resource[relative_path].post File.read(file)
52
-
44
+ @resource[relative_path].post File.read(file), {'Expect' => '', 'Mkdir' => 'true'}
53
45
  end
54
46
 
55
47
  after_flush_writes # allows attachment to clean up temp files
@@ -68,9 +60,6 @@ module Paperclip
68
60
  @queued_for_delete = []
69
61
  end
70
62
 
71
-
72
-
73
-
74
63
  end
75
64
  end
76
65
  end
@@ -1,5 +1,5 @@
1
1
  module Upyun
2
2
  module Paperclip
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  end
data/spec/dummy/Gemfile CHANGED
@@ -17,9 +17,9 @@ group :assets do
17
17
  end
18
18
 
19
19
  gem "nifty-generators"
20
- gem 'paperclip', :path => '~/github/paperclip'
21
- gem 'upyun-paperclip', :path => '~/github/upyun-paperclip'
22
- gem 'ruby-debug19'
20
+ gem 'paperclip', :git => 'git://github.com/thoughtbot/paperclip.git'
21
+ gem 'upyun-paperclip',:git => 'git://github.com/frankel/upyun-paperclip.git'
22
+ gem 'ruby-debug19', :require => 'ruby-debug'
23
23
 
24
24
  gem 'jquery-rails'
25
25
 
@@ -1,2 +1,2 @@
1
1
  <h1>Home#index</h1>
2
- <p>Find me in app/views/home/index.html.erb</p>
2
+ <p><a href="/users">Users</a></p>
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 4
9
- version: 0.1.4
8
+ - 5
9
+ version: 0.1.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - frankel
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-01-06 00:00:00 +08:00
17
+ date: 2012-01-14 00:00:00 +08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency