fclay 0.1.2 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d10bc34257d53b487c6d8761fdf7abae71dd2b13
4
- data.tar.gz: 261755f3588f9bc1e690f1df4bfa848734d2d2c7
3
+ metadata.gz: 2b7b92b7a729df3df56c94be63fa55bffa4d04ff
4
+ data.tar.gz: 48978989481aaebe63b662e03c78cb6dcd0662c1
5
5
  SHA512:
6
- metadata.gz: 1ea4d99a01dcfb4c1fbc3433236cc2daf7a6840b94943bac2a2f28b4a4d286c0ed34e4a8065f621ce35f465e2963fdde35697399a4a5b61a593e6ed450b65ba8
7
- data.tar.gz: 703f9e5f14ed0b250f6f212c9112b51a8f82999c1deb65510f0b70b2c7665edc65cf2630403599fe67f96414600555f8715ee99fa670bf2e043b989c0611a5af
6
+ metadata.gz: f055070746fab691bf25a8012b912e5152c656ab9e06cae5885a0c2be2033b01de1ca682a0e5e1023e475b231a55340427a361574b07f85c52e47f9671d8a66e
7
+ data.tar.gz: e44df41175bdad7956c76e045a2b468a0096240caaa483e5780b18ecf02a99d48a4736d59dc876984b119eb6585f38f73414c84e5bc221f2c18e884bca929f9e
@@ -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 self.file_location
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.safe_constantize
56
- return unless type
57
- uploading_object = type.find_by_id(id)
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 self.file_location
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
- else
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 && ext != false && @file.try(:original_filename)
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
@@ -1,3 +1,3 @@
1
1
  module Fclay
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.13"
3
3
  end
@@ -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.local_storage_host = 'http://mysite.com'
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.2
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-03-15 00:00:00.000000000 Z
11
+ date: 2017-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler