fclay 0.1.2 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fclay/attachment.rb +9 -12
- data/lib/fclay/version.rb +1 -1
- data/lib/generators/fclay/config/config_generator.rb +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: 2b7b92b7a729df3df56c94be63fa55bffa4d04ff
|
4
|
+
data.tar.gz: 48978989481aaebe63b662e03c78cb6dcd0662c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f055070746fab691bf25a8012b912e5152c656ab9e06cae5885a0c2be2033b01de1ca682a0e5e1023e475b231a55340427a361574b07f85c52e47f9671d8a66e
|
7
|
+
data.tar.gz: e44df41175bdad7956c76e045a2b468a0096240caaa483e5780b18ecf02a99d48a4736d59dc876984b119eb6585f38f73414c84e5bc221f2c18e884bca929f9e
|
data/lib/fclay/attachment.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'base64'
|
2
|
-
|
3
1
|
module Fclay
|
4
2
|
module Attachment
|
5
3
|
|
@@ -29,7 +27,7 @@ module Fclay
|
|
29
27
|
|
30
28
|
def delete_files
|
31
29
|
|
32
|
-
case
|
30
|
+
case file_location
|
33
31
|
when 's3'
|
34
32
|
delete_remote_files
|
35
33
|
when 'local'
|
@@ -52,10 +50,9 @@ module Fclay
|
|
52
50
|
|
53
51
|
def self.upload type,id
|
54
52
|
|
55
|
-
type = type.
|
56
|
-
|
57
|
-
|
58
|
-
return if !uploading_object || !uploading_object.need_upload
|
53
|
+
type = type.constantize
|
54
|
+
uploading_object = type.find(id)
|
55
|
+
return unless uploading_object.need_upload
|
59
56
|
content_type = uploading_object.try(:content_type)
|
60
57
|
bucket = Fclay.remote_storage.bucket_object
|
61
58
|
|
@@ -85,13 +82,15 @@ module Fclay
|
|
85
82
|
end
|
86
83
|
|
87
84
|
def file_url(style=nil)
|
88
|
-
case
|
85
|
+
case file_location
|
89
86
|
when "external_link"
|
90
87
|
self.file_name
|
91
88
|
when "local"
|
92
89
|
local_file_url(style)
|
93
|
-
|
90
|
+
when "s3"
|
94
91
|
remote_file_url(style)
|
92
|
+
else
|
93
|
+
""
|
95
94
|
end
|
96
95
|
end
|
97
96
|
|
@@ -161,9 +160,7 @@ module Fclay
|
|
161
160
|
create_dirs
|
162
161
|
fetch_file_name
|
163
162
|
|
164
|
-
|
165
163
|
FileUtils.mv(path,local_file_path)
|
166
|
-
|
167
164
|
`chmod 0755 #{local_file_path}`
|
168
165
|
|
169
166
|
delete_tmp_file
|
@@ -176,7 +173,7 @@ module Fclay
|
|
176
173
|
def fetch_file_name
|
177
174
|
|
178
175
|
ext = self.class.fclay_options[:extension]
|
179
|
-
if ext
|
176
|
+
if ext != false || (ext == nil && @file.original_filename)
|
180
177
|
filename_part = @file.original_filename.split(".")
|
181
178
|
ext = filename_part.last if filename_part.size > 1
|
182
179
|
end
|
data/lib/fclay/version.rb
CHANGED
@@ -5,7 +5,7 @@ class Fclay::ConfigGenerator < Rails::Generators::Base
|
|
5
5
|
def create_initializer_file
|
6
6
|
create_file "config/initializers/fclay.rb" do
|
7
7
|
"Fclay.configure do |config|
|
8
|
-
#config.
|
8
|
+
#config.local_storage_assets_host = 'http://mysite.com'
|
9
9
|
#config.storage_policy = :s3
|
10
10
|
#config.storages do |storages|
|
11
11
|
# storages[:s3] = {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fclay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rustam Galiev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|