rails-assets-for-upyun 0.0.3 → 0.0.5
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 +3 -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: 19e6b840e95be0dd2bb2d65f46a9f7b152b876e6
|
4
|
+
data.tar.gz: e13a023541c496eb1f6af0210a29b1838d2c9ced
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a098a18a59d1e23a3d90bb8d3151e287c454a71732984de267a65e9457d51cc58078dd3154514bf26d9f4e605b045c658fdd8601094b90405967bb5ace355cb0
|
7
|
+
data.tar.gz: a9f65456c7d618ec2e379736d02c5ca4851ced152ba0ff5a4b65fc5fbfda5640572331ec81dccf2d2b53cf9042bdcf04d4b34fab2a1599c72002567ae81c98ce
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
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
|
+
# http://stackoverflow.com/questions/357754/can-i-traverse-symlinked-directories-in-ruby-with-a-glob
|
4
|
+
Dir[File.join localpath, "**{,/*/**}/*"].select{|f| File.file? f}.each do |file|
|
4
5
|
url = URI.encode "/#{bucket}#{bucket_path}#{file[localpath.to_s.size + 1 .. -1]}"
|
5
6
|
date = Time.now.httpdate
|
6
7
|
size = RestClient.head("#{upyun_ap}#{url}", {\
|
@@ -15,7 +16,7 @@ class RailsAssetsForUpyun
|
|
15
16
|
end
|
16
17
|
unless size == (file_size = File.size file)
|
17
18
|
file_content = File.read(file)
|
18
|
-
|
19
|
+
puts "uploading #{file}.."
|
19
20
|
RestClient.put("#{upyun_ap}#{url}", file_content,{\
|
20
21
|
Authorization: "UpYun #{username}:#{signature 'PUT', url, date, file_size, password}",
|
21
22
|
Date: date,
|
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.5
|
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-
|
11
|
+
date: 2014-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|