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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89bc6b2f3af3d0f77235b2ca38bc17851f0a3850a4742d14dfb462d5d32fb11d
4
- data.tar.gz: f110eedc9a0e2ba8dde12785401755c0b4f5e264c707a4184dd35ca1a0e88aee
3
+ metadata.gz: 7c867d95dbb5c4a0d87faf47ccaf9e893388b46abd615a8d9f98801241fb6bde
4
+ data.tar.gz: 6f950eec27013a0f257bae84e848269c5e0a2693d9795ac622f1be572d7c4d95
5
5
  SHA512:
6
- metadata.gz: 1228ab4477df6a100db7046cffb4436775e8f851db17009fdb18b90a645b4eeb2e7cdfc48cb6cdfaff32af44dc73f4c6ae33a4968b8cd0f583a622d715662097
7
- data.tar.gz: 60473bbaf1ab5804eb39e23d6f2577fd475c445d82486605696e34b43026a67c5f5c7ab7cd05c04e1c646c51b9594daf28576b94d2336006bcda4c90d9477fd4
6
+ metadata.gz: 82a9c414d16d7f2435e854568d1d6be4de522e4cda381a129d4ea5deba49c95ad6507098feb18528e369576e96bc13884bd694f688632c140b15d01a3c31510a
7
+ data.tar.gz: a6a4163b12edf1c43acd3bf42ea9646de72dd72644105a94a52b9cc3e4a912108519147aacd03fcb2239ee249d3d67795bdaeb674ca5d48093bffcb51a755376
data/examples/upload.rb CHANGED
@@ -16,4 +16,7 @@ class Upload < Balloon::Base
16
16
  end
17
17
 
18
18
  upload = Upload.new("input.jpg")
19
- upload.upload_store
19
+ p upload.upload_store
20
+ p upload.from_store
21
+ p upload.path
22
+ p upload.local_path
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
@@ -31,11 +31,21 @@ module Balloon
31
31
  return { filename: original_file, basename: store_name}
32
32
  end
33
33
 
34
- def retrieve!(size_name = nil)
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 "/" + path if @uploader.asset_host.nil?
38
- @uploader.asset_host + "/" + path
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,}$")
@@ -1,3 +1,3 @@
1
1
  module Balloon
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: balloon
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - yeeli