balloon 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/upload.rb +4 -1
- data/lib/balloon/base.rb +8 -0
- data/lib/balloon/storage/file.rb +13 -3
- data/lib/balloon/up.rb +18 -0
- data/lib/balloon/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c867d95dbb5c4a0d87faf47ccaf9e893388b46abd615a8d9f98801241fb6bde
|
4
|
+
data.tar.gz: 6f950eec27013a0f257bae84e848269c5e0a2693d9795ac622f1be572d7c4d95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82a9c414d16d7f2435e854568d1d6be4de522e4cda381a129d4ea5deba49c95ad6507098feb18528e369576e96bc13884bd694f688632c140b15d01a3c31510a
|
7
|
+
data.tar.gz: a6a4163b12edf1c43acd3bf42ea9646de72dd72644105a94a52b9cc3e4a912108519147aacd03fcb2239ee249d3d67795bdaeb674ca5d48093bffcb51a755376
|
data/examples/upload.rb
CHANGED
data/lib/balloon/base.rb
CHANGED
@@ -40,6 +40,14 @@ module Balloon
|
|
40
40
|
storage_engine.retrieve!(size_name)
|
41
41
|
end
|
42
42
|
|
43
|
+
def path(size_name = nil)
|
44
|
+
storage_engine.path!(size_name)
|
45
|
+
end
|
46
|
+
|
47
|
+
def local_path(size_name = nil)
|
48
|
+
storage_engine.local_path!(size_name)
|
49
|
+
end
|
50
|
+
|
43
51
|
def upload_delete
|
44
52
|
storage_engine.delete!
|
45
53
|
end
|
data/lib/balloon/storage/file.rb
CHANGED
@@ -31,11 +31,21 @@ module Balloon
|
|
31
31
|
return { filename: original_file, basename: store_name}
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
34
|
+
def path!(size_name = nil)
|
35
35
|
return "" if !upload_file
|
36
36
|
path = ::File.join upload_dir, store_filename(size_name)
|
37
|
-
return "
|
38
|
-
|
37
|
+
return "/#{path}"
|
38
|
+
end
|
39
|
+
|
40
|
+
def local_path!(size_name = nil)
|
41
|
+
path = ::File.join @uploader.store_dir, path!(size_name)
|
42
|
+
return ::File.expand_path(::File.join(@uploader.root, path))
|
43
|
+
end
|
44
|
+
|
45
|
+
def retrieve!(size_name = nil)
|
46
|
+
path = path!(size_name)
|
47
|
+
return path if @uploader.asset_host.nil?
|
48
|
+
return "#{@uploader.asset_host}#{path}"
|
39
49
|
end
|
40
50
|
|
41
51
|
def delete!
|
data/lib/balloon/up.rb
CHANGED
@@ -90,6 +90,24 @@ module Balloon
|
|
90
90
|
storage_engine.retrieve!(size_name)
|
91
91
|
end
|
92
92
|
|
93
|
+
def path(size_name = nil)
|
94
|
+
return "" if !respond_to?(:file_name) || file_name.nil?
|
95
|
+
extension = self.file_name.to_s.match(%r"(?!\\.{1})\\w{2,}$")
|
96
|
+
basename = self.file_name.to_s.gsub(%r"\\.{1}\\w{2,}$",'')
|
97
|
+
@meta = { basename: basename, extension: extension.to_s }
|
98
|
+
set_storage_engine
|
99
|
+
storage_engine.path!(size_name)
|
100
|
+
end
|
101
|
+
|
102
|
+
def local_path(size_name = nil)
|
103
|
+
return "" if !respond_to?(:file_name) || file_name.nil?
|
104
|
+
extension = self.file_name.to_s.match(%r"(?!\\.{1})\\w{2,}$")
|
105
|
+
basename = self.file_name.to_s.gsub(%r"\\.{1}\\w{2,}$",'')
|
106
|
+
@meta = { basename: basename, extension: extension.to_s }
|
107
|
+
set_storage_engine
|
108
|
+
storage_engine.local_path!(size_name)
|
109
|
+
end
|
110
|
+
|
93
111
|
def uploader_delete
|
94
112
|
return if !respond_to?(:file_name) || file_name.nil?
|
95
113
|
extension = self.file_name.to_s.match(%r"(?!\\.{1})\\w{2,}$")
|
data/lib/balloon/version.rb
CHANGED