fclay 0.1.32 → 0.1.33

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: 617b2ade10dd98cdc08901e6668f7227ab1d027d
4
- data.tar.gz: 530b54c36a3d8b4dd96d849ff23b5151f116a655
3
+ metadata.gz: 108744d0ed9af40db54c6f50de1766747560f5cd
4
+ data.tar.gz: c063c8c9dd569de1c838f3af2cbf63d4f93f74b1
5
5
  SHA512:
6
- metadata.gz: e9a5062ddbb2101d5a3f0c4529ebd20e0dd0908eeb81187be3c3571f2612c397f868db0ac53c1c166d75854af7c3698ee94e2323bc5def5ba91fbabc0a743db9
7
- data.tar.gz: 13984e0cd0a7416cd7180a070f49cfd4016293ec4b9219f28a5d42886a1b28cf1b1481ae0f121622d83b718a90f1a95cd0e932f4a535734a4589a7ffa7fa190a
6
+ metadata.gz: 00cec2b28094d4c4946c3345f63dc771077328082764b1832cde0f55f2680d65ad923d458cb3f9f9f1887ca2deed60859bf46fac13918b2a03b5563d2a0fb4f7
7
+ data.tar.gz: c70b0c4f7119ede4cb2b437bc60f5d9bfd40e25918a0ec9bdbb7371d35d0067f8b0c03f7afab29a9deaf7040f867c940a654ddd6dab19b2de36ca8e56e66b358
@@ -44,7 +44,7 @@ module Fclay
44
44
 
45
45
  def upload_later
46
46
 
47
- self.try(:log,"upload_later called, need_upload: #{need_upload}")
47
+ self.try(:log,"upload_later() called, need_upload: #{need_upload}")
48
48
  if need_upload
49
49
  job = Fclay::UploadJob.perform_later(self.class.name,self.id)
50
50
  self.try(:log,"sheduled! job id: #{job.provider_job_id}")
@@ -57,27 +57,30 @@ module Fclay
57
57
  end
58
58
 
59
59
  def self.upload type,id
60
-
61
- type = type.safe_constantize
62
- return unless type
63
- uploading_object = type.find_by_id(id)
64
- return if !uploading_object || !uploading_object.need_upload
65
- content_type = uploading_object.try(:content_type)
66
- bucket = Fclay.remote_storage.bucket_object
67
-
68
- (uploading_object.class.fclay_options[:styles] || [nil]).each do |style|
69
- obj = bucket.object(uploading_object.remote_file_path(style))
70
- obj.put({
71
- body: File.read(uploading_object.local_file_path(style)),
72
- acl: "public-read",
73
- content_type: uploading_object.class.fclay_options[:content_type]
74
- })
75
- end
60
+ self.try(:log,"upload('#{type}',#{id}) called")
61
+ type = type.safe_constantize
62
+ return unless type
63
+ uploading_object = type.find_by_id(id)
64
+ self.try(:log,"uploading_object: #{uploading_object} uploading_object.need_upload: #{uploading_object.need_upload}")
65
+ return if !uploading_object || !uploading_object.need_upload
66
+ content_type = uploading_object.try(:content_type)
67
+ bucket = Fclay.remote_storage.bucket_object
76
68
 
77
- # uploading_object.update_attributes(:file_status => 'idle', :file_location => Fclay.remote_storage.name)
69
+ self.try(:log,"Start uploading")
70
+ (uploading_object.class.fclay_options[:styles] || [nil]).each do |style|
71
+ obj = bucket.object(uploading_object.remote_file_path(style))
72
+ obj.put({
73
+ body: File.read(uploading_object.local_file_path(style)),
74
+ acl: "public-read",
75
+ content_type: uploading_object.class.fclay_options[:content_type]
76
+ })
77
+ end
78
+
78
79
  type.where(:id => id).update_all(:file_status => 'idle', :file_location => Fclay.remote_storage.name)
80
+ self.try(:log,"Sucessful uploaded! file_status: 'idle', file_location: #{Fclay.remote_storage.name}")
79
81
  uploading_object.delete_local_files
80
82
  uploading_object.try(:uploaded)
83
+
81
84
 
82
85
  end
83
86
 
@@ -1,3 +1,3 @@
1
1
  module Fclay
2
- VERSION = "0.1.32"
2
+ VERSION = "0.1.33"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fclay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.32
4
+ version: 0.1.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rustam Galiev