photofy 0.2.1 → 0.2.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/photofy/core.rb +6 -6
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 15f222df7c291febdb3847b0099effdf613ea939
4
- data.tar.gz: faa98040b22f84fe1f0dcd2ffeb670b6e5bb9051
3
+ metadata.gz: 01170cecbe978f73d3a6b5f1c9aad979149a89f2
4
+ data.tar.gz: dd71457da82f23d3c9121e5ff2c60f86b716309b
5
5
  SHA512:
6
- metadata.gz: 8af8641aeeee7f6d530c72c6667f5ab7d42ee617033e2bf63c8b7c38c1244afd67102c1b86b8dbc56f63796394141366eb2af6aedc97d2a8cffb0a231a75e55c
7
- data.tar.gz: 0eb747f7c0c34f5eeb6ecc16da48c3ef54f573cc3887bb59cc94d5bd6513d97c303661939002acb5a13dbf1974a26558f8b69bb26b4aa068884ce815249fdd79
6
+ metadata.gz: 38b61e941bb7cd41fc9bd4df289c3f0d14860b33e45e8004415b8c1374f2d8b75cbceb31c7c0280681ca1df97eb92d243258f871493dfe3f46eb205be0acf31f
7
+ data.tar.gz: 67ac931b404622c32caf7cde528013d9165f8438b61283157a5b0e2bcb459c6095a2078a0057aa355b48fd11ca2e9c900f6b46df7445e14c287ce13db82437ca
@@ -64,10 +64,10 @@ module Photofy
64
64
  _path = File.join(directory_path, self.send(self.class.primary_key).to_s)
65
65
  _path.gsub!(/^#{Rails.root}\//, "")
66
66
 
67
- (_s3_objects = s3_bucket.objects.with_prefix("#{_path}_")).count > 0 ? _s3_objects.collect(&:key)[0] : nil
67
+ (_s3_objects = s3_bucket.objects.with_prefix("#{_path}_")).count > 0 ? _s3_objects.collect(&:key)[0] : ''
68
68
  else
69
69
  (guessed_file = Dir[File.join(directory_path, "#{self.send(self.class.primary_key).to_s}_*")].first).nil? ?
70
- nil : guessed_file.to_s
70
+ '' : guessed_file.to_s
71
71
  end
72
72
  end
73
73
 
@@ -157,7 +157,7 @@ module Photofy
157
157
  #Loading content from parent_photo_field if specified
158
158
  unless parent_photo_field.nil?
159
159
  if s3_connected?
160
- unless send("#{parent_photo_field}_path").nil?
160
+ unless send("#{parent_photo_field}_path").empty?
161
161
  _parent_file_path = send("#{parent_photo_field}_path")
162
162
  _temp_file_path = File.join(Rails.root, File.basename(_parent_file_path))
163
163
  file = File.open(_temp_file_path, 'wb')
@@ -169,14 +169,14 @@ module Photofy
169
169
  File.delete(file.path)
170
170
  end
171
171
  else
172
- send("#{photo_field}=", File.open(send("#{parent_photo_field}_path"))) unless send("#{parent_photo_field}_path").nil?
172
+ send("#{photo_field}=", File.open(send("#{parent_photo_field}_path"))) unless send("#{parent_photo_field}_path").empty?
173
173
  end
174
174
  end
175
175
 
176
176
  unless @photo_file_buffer[photo_field].nil?
177
177
 
178
178
  if s3_connected?
179
- s3_bucket.objects[send("#{photo_field}_path")].try(:delete) if (not send("#{photo_field}_path").nil?) and (s3_bucket.objects.with_prefix(send("#{photo_field}_path")).count > 0)
179
+ s3_bucket.objects[send("#{photo_field}_path")].try(:delete) if (not send("#{photo_field}_path").empty?) and (s3_bucket.objects.with_prefix(send("#{photo_field}_path")).count > 0)
180
180
  s3_bucket.objects[send("#{photo_field}_path_to_write")].write(@photo_file_buffer[photo_field])
181
181
 
182
182
  unless proc.nil?
@@ -192,7 +192,7 @@ module Photofy
192
192
  file.unlink # deletes the temp file
193
193
  end
194
194
  else
195
- File.delete(send("#{photo_field}_path")) if ((not send("#{photo_field}_path").nil?) and File.exist?(send("#{photo_field}_path"))) #Clearing any existing file at the path
195
+ File.delete(send("#{photo_field}_path")) if File.exist?(send("#{photo_field}_path")) #Clearing any existing file at the path
196
196
  File.open(send("#{photo_field}_path_to_write"), "wb+") { |f| f.puts(@photo_file_buffer[photo_field]) }
197
197
 
198
198
  unless proc.nil?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: photofy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Praveen Kumar Sinha