2cdn 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/auto-ali-cdn/oss.rb +3 -2
- data/lib/auto-ali-cdn/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 679a88b1224ae0a22b399878f26db8a7f29b953f
|
4
|
+
data.tar.gz: 6f594d2515bd4872c910e230a0b28d586225bba7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd4f930d5076d7c58346ba4b4bc64ec27b869f1349e0d903288073982072ed66f5e0e81bf81577231edc6dcdbd0f0068e7bf6fba7c8a3215728378690a7433e4
|
7
|
+
data.tar.gz: 4caa111d1e5b95b5ab740bc719e082928f39734b79653a52cf14bd58500da63971adb8164ea29a3df8795d6693a8dabadb0b51b315f3937eb2c7e06f06a11de5
|
data/lib/auto-ali-cdn/oss.rb
CHANGED
@@ -36,7 +36,7 @@ module AutoAliCDN
|
|
36
36
|
end
|
37
37
|
|
38
38
|
#upload local files to server
|
39
|
-
def self.oss_upload(config_path, app_path)
|
39
|
+
def self.oss_upload(config_path, app_path,rename=false)
|
40
40
|
config = oss_config(config_path)
|
41
41
|
|
42
42
|
images_path = app_path+'/images'
|
@@ -69,7 +69,8 @@ module AutoAliCDN
|
|
69
69
|
file_md5 = Digest::MD5.hexdigest(File.read(file_path))
|
70
70
|
res_type = res_path.gsub(/^.*\//, '')
|
71
71
|
suffix = "."+name.split(/\./).last
|
72
|
-
|
72
|
+
new_name = rename ? name.gsub(/#{suffix}$/, "-#{file_md5}#{suffix}"): name
|
73
|
+
object_key = config.site_resource_path+"/#{res_type}/#{new_name}"
|
73
74
|
if bucket.object_exists?(object_key)
|
74
75
|
puts "#{name} --> #{object_key}".color(:dimgray)
|
75
76
|
replace_res_path.call(res_type+'/'+name, config.domain_name+'/'+object_key)
|
data/lib/auto-ali-cdn/version.rb
CHANGED