rails-assets-for-upyun 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/rails-assets-for-upyun.rb +2 -2
- data/rails-assets-for-upyun.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba82698c0095d6b9c9c98518256c415a9b8524c1
|
4
|
+
data.tar.gz: e4eebb71945f26496d8e528628445c2e8f5ca1a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a591fa1e1fb0edf29e92640e2b5a6032cd028b68851e0a2281c6bdfc68bd0c84bc32c4cb3dfdb0381d8ea24ae6cfce20d467a183272bb97a754da3ee761869c
|
7
|
+
data.tar.gz: f72b8c573fc2c40a0bf3e34b47c295662a8db03ccecfc56805d21122f75b73260c5ca9879238e12b706a45e4e416cead1a4aef0f6b1942258082b302398b8255
|
data/README.md
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
class RailsAssetsForUpyun
|
2
2
|
def self.publish(bucket, username, password, bucket_path="/", localpath='public', upyun_ap="http://v0.api.upyun.com")
|
3
3
|
Dir[File.join localpath, "**", "*"].select{|f| File.file? f }.each do |file|
|
4
|
-
url = "/#{bucket}#{bucket_path}#{file[localpath.to_s.size + 1 .. -1]}"
|
4
|
+
url = URI.encode "/#{bucket}#{bucket_path}#{file[localpath.to_s.size + 1 .. -1]}"
|
5
5
|
date = Time.now.httpdate
|
6
6
|
size = RestClient.head("#{upyun_ap}#{url}", {\
|
7
7
|
Authorization: "UpYun #{username}:#{signature 'HEAD', url, date, 0, password}",
|
8
8
|
Date: date}) do |response, request, result, &block|
|
9
9
|
case response.code
|
10
10
|
when 200
|
11
|
-
response.headers[:x_upyun_file_size]
|
11
|
+
response.headers[:x_upyun_file_size].to_i
|
12
12
|
when 404
|
13
13
|
nil
|
14
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-assets-for-upyun
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Yin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|