blobsterix_carrierwave 0.0.7 → 1.0.4

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
  SHA1:
3
- metadata.gz: 8ea3e909ae2f9f7de7dede8bee31dcdffb2d2ad1
4
- data.tar.gz: 10456d10772b34e0200757b561ad3348e7c7fa21
3
+ metadata.gz: 5571825930a719842fb398fe30926e4c347056c1
4
+ data.tar.gz: 76feba09b117ae454252b3501a3802b1ae977b22
5
5
  SHA512:
6
- metadata.gz: 93dedde583457804200e53ffc0fe0777ae34d7a3486bb9ce010d9b096acbfa579b9e16a7c8949005c6c1bd9cad87da3c1ef43f8029ddacec778c17f5aaf4b315
7
- data.tar.gz: 9496905c70773e445d2965eb38b36ee7a1a6abfa794b418a0648ddd96b26c54a004711b302b891b552c611fe81fb9b43d7ae14e3d0b48c0985244eaaff6dbb63
6
+ metadata.gz: b09ec7994926e5c20b76ca337236c3cf36592d6fe00db2bea946be396b14f1aafacf12b04225d1c74c6f9faac0ff8449e7dd1d661f8bbb2d4a705373bc3d011d
7
+ data.tar.gz: 63747ed5dcab2209cad8dba84bea4f2f6eed0350f704f0f2e52a2ca94fb911159df640916284ad44c0a60e6b6af2cff56fa79cd33711c02eaf6299880f8d0da2
data/.gitignore CHANGED
@@ -16,5 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  .ruby-gemset
19
- .ruby-version
20
19
  .rbenv-gemsets
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.0.0-p481
data/CHANGELOG.txt CHANGED
@@ -1,3 +1,13 @@
1
+ = 1.0.0
2
+ * updated fog and carrierwave.
3
+ BREAKING CHANGES:
4
+ * in case you used the uploader version patch before you have to now include the patches/carrierwave_0100_... version of the patch.
5
+ = 0.0.9
6
+ * made the version name change optional. found in patches folder
7
+ = 0.0.8
8
+ * changed uploaded version class naming. So they can be recreated from sessions.(needs to be changed when switching carrierwave version!!)
9
+ = 0.0.7
10
+ * something
1
11
  = 0.0.6
2
12
  * just version bump
3
13
  = 0.0.5
data/README.md CHANGED
@@ -84,6 +84,12 @@ Setup:
84
84
 
85
85
  # this will generate the url and blobsterix will generate the image on the fly.
86
86
 
87
+ ## Patches
88
+
89
+ In case you want to recreate uploader from saved instances you need fixed class names. To achieve this simply do:
90
+
91
+ require "blobsterix_carrierwave/patches/carrierwave_090_uploader_version_name"
92
+
87
93
  ## Contributing
88
94
 
89
95
  1. Fork it
@@ -15,6 +15,6 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = BlobsterixCarrierwave::VERSION
17
17
 
18
- gem.add_dependency "carrierwave", "~> 0.9.0"
19
- gem.add_dependency "fog" , "~> 1.3.1"
18
+ gem.add_dependency "carrierwave", "~> 0.10.0"
19
+ gem.add_dependency "fog" , "~> 1.22.0"
20
20
  end
@@ -13,7 +13,7 @@ module BlobsterixAdhocTransforms
13
13
 
14
14
  #init the trafos
15
15
  (@options[:trafos] || []).each{|t|
16
- c.send(t[0], t[1])
16
+ self.send(t[0], t[1])
17
17
  }
18
18
  end
19
19
 
@@ -52,8 +52,9 @@ module BlobsterixAdhocTransforms
52
52
  def method_missing(method, *args)
53
53
  if BlobsterixAdhocTransforms.respond_to?(method)
54
54
  @chain << BlobsterixAdhocTransforms.send(method, *args)
55
- else
56
- #shit!
55
+ elsif uploader && uploader.respond_to?(method)
56
+ specific_trafo = uploader.send(method, *args)
57
+ @chain << specific_trafo if specific_trafo && specific_trafo.kind_of?(Hash)
57
58
  end
58
59
  self
59
60
  end
@@ -48,7 +48,7 @@ module Blobsterix
48
48
  # puts "Do: #{method} with #{args.inspect}"
49
49
  # trafos.send(method, *args)
50
50
  # end
51
- BlobsterixAdhocTransforms::Generator.new(:trafos => self.class.processors.map{|method, args, condition|[method, args]}).transform(encrypt)
51
+ BlobsterixAdhocTransforms::Generator.new(:uploader => self,:trafos => self.class.processors.map{|method, args, condition|[method, args]}).transform(encrypt)
52
52
  else
53
53
  ""
54
54
  end
@@ -59,7 +59,7 @@ module Blobsterix
59
59
  if enable_processing and version_name
60
60
  current_processor = self.class
61
61
  remote_processor_array = []
62
- until current_processor.parent == Object
62
+ until current_processor.parent.parent == Object
63
63
  remote_processor_array+=current_processor.processors.map{|method, args, condition|[method, args]}
64
64
  current_processor = current_processor.parent
65
65
  end
@@ -53,7 +53,7 @@ module CarrierWave
53
53
  :key => path,
54
54
  :public => @uploader.fog_public,
55
55
  :collection => directory.files,
56
- :connection => directory.files.connection
56
+ :service => directory.files.service
57
57
  }.merge(@uploader.fog_attributes))
58
58
  @file.metadata={"x-amz-meta-trafo" => @uploader.remote_process!(false)}
59
59
  @file.save()
@@ -66,11 +66,22 @@ module CarrierWave
66
66
  end
67
67
 
68
68
  def read
69
- super()
69
+ @read||=load_file_from_blobsterix
70
+ end
71
+
72
+ def load_file_from_blobsterix
73
+ uri = URI(public_url)
74
+ body = Net::HTTP.start(uri.host, uri.port) do |http|
75
+ response = http.get uri.path
76
+ response.body
77
+ end
78
+ body||""
70
79
  end
80
+
71
81
  def size
72
- super()
82
+ read.size
73
83
  end
84
+
74
85
  def delete
75
86
  super()
76
87
  end
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  class BlobsterixUploader < CarrierWave::Uploader::Base
3
3
 
4
- include CarrierWave::MimeTypes
4
+ #include CarrierWave::MimeTypes
5
5
  include Blobsterix::CarrierWave
6
6
 
7
7
  #storage :file
@@ -9,16 +9,6 @@ class BlobsterixUploader < CarrierWave::Uploader::Base
9
9
 
10
10
  include BlobsterixTransforms
11
11
 
12
- after :store, :done_store
13
- before :store, :before_store
14
-
15
- def before_store obj
16
- #puts "Start with storing"
17
- end
18
- def done_store obj
19
- #puts "Done with storing"
20
- end
21
-
22
12
  # Override the directory where uploaded files will be stored.
23
13
  # This is a sensible default for uploaders that are meant to be mounted:
24
14
  def store_dir
@@ -0,0 +1,62 @@
1
+ # encoding: utf-8
2
+
3
+ module CarrierWave
4
+ module Uploader
5
+ module Versions
6
+ module ClassMethods
7
+ def build_version(name, options)
8
+ uploader = Class.new(self)
9
+ const_set("Uploader#{name}".gsub('-', '_'), uploader)
10
+ uploader.version_names += [name]
11
+ uploader.versions = {}
12
+ uploader.processors = []
13
+
14
+ uploader.class_eval <<-RUBY, __FILE__, __LINE__ + 1
15
+ # Define the enable_processing method for versions so they get the
16
+ # value from the parent class unless explicitly overwritten
17
+ def self.enable_processing(value=nil)
18
+ self.enable_processing = value if value
19
+ if !@enable_processing.nil?
20
+ @enable_processing
21
+ else
22
+ superclass.enable_processing
23
+ end
24
+ end
25
+
26
+ # Regardless of what is set in the parent uploader, do not enforce the
27
+ # move_to_cache config option on versions because it moves the original
28
+ # file to the version's target file.
29
+ #
30
+ # If you want to enforce this setting on versions, override this method
31
+ # in each version:
32
+ #
33
+ # version :thumb do
34
+ # def move_to_cache
35
+ # true
36
+ # end
37
+ # end
38
+ #
39
+ def move_to_cache
40
+ false
41
+ end
42
+ RUBY
43
+
44
+ class_eval <<-RUBY
45
+ def #{name}
46
+ versions[:#{name}]
47
+ end
48
+ RUBY
49
+
50
+ # Add the current version hash to class attribute :versions
51
+ current_version = {
52
+ name => {
53
+ :uploader => uploader,
54
+ :options => options
55
+ }
56
+ }
57
+ self.versions = versions.merge(current_version)
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,72 @@
1
+ # encoding: utf-8
2
+
3
+ module CarrierWave
4
+ module Uploader
5
+ module Versions
6
+ module ClassMethods
7
+ def version(name, options = {}, &block)
8
+ name = name.to_sym
9
+ unless versions[name]
10
+ uploader = Class.new(self)
11
+ const_set("Uploader#{name}".gsub('-', '_'), uploader)
12
+ uploader.versions = {}
13
+
14
+ # Define the enable_processing method for versions so they get the
15
+ # value from the parent class unless explicitly overwritten
16
+ uploader.class_eval <<-RUBY, __FILE__, __LINE__ + 1
17
+ def self.enable_processing(value=nil)
18
+ self.enable_processing = value if value
19
+ if !@enable_processing.nil?
20
+ @enable_processing
21
+ else
22
+ superclass.enable_processing
23
+ end
24
+ end
25
+ RUBY
26
+
27
+ # Regardless of what is set in the parent uploader, do not enforce the
28
+ # move_to_cache config option on versions because it moves the original
29
+ # file to the version's target file.
30
+ #
31
+ # If you want to enforce this setting on versions, override this method
32
+ # in each version:
33
+ #
34
+ # version :thumb do
35
+ # def move_to_cache
36
+ # true
37
+ # end
38
+ # end
39
+ #
40
+ uploader.class_eval <<-RUBY
41
+ def move_to_cache
42
+ false
43
+ end
44
+ RUBY
45
+
46
+ # Add the current version hash to class attribute :versions
47
+ current_version = {}
48
+ current_version[name] = {
49
+ :uploader => uploader,
50
+ :options => options
51
+ }
52
+ self.versions = versions.merge(current_version)
53
+
54
+ versions[name][:uploader].version_names += [name]
55
+
56
+ class_eval <<-RUBY
57
+ def #{name}
58
+ versions[:#{name}]
59
+ end
60
+ RUBY
61
+ # as the processors get the output from the previous processors as their
62
+ # input we must not stack the processors here
63
+ versions[name][:uploader].processors = versions[name][:uploader].processors.dup
64
+ versions[name][:uploader].processors.clear
65
+ end
66
+ versions[name][:uploader].class_eval(&block) if block
67
+ versions[name]
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -1,4 +1,4 @@
1
1
  module BlobsterixCarrierwave
2
- VERSION = "0.0.7"
2
+ VERSION = "1.0.4"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blobsterix_carrierwave
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Sudmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-10 00:00:00.000000000 Z
11
+ date: 2014-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carrierwave
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 0.9.0
19
+ version: 0.10.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 0.9.0
26
+ version: 0.10.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: fog
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 1.3.1
33
+ version: 1.22.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: 1.3.1
40
+ version: 1.22.0
41
41
  description: This gem is used to create a carrierwave binding to a blobsterix server
42
42
  email:
43
43
  - suddani@googlemail.com
@@ -47,6 +47,7 @@ extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
49
  - .gitignore
50
+ - .ruby-version
50
51
  - CHANGELOG.txt
51
52
  - Gemfile
52
53
  - LICENSE
@@ -61,6 +62,8 @@ files:
61
62
  - lib/blobsterix_carrierwave/blobsterix_storage.rb
62
63
  - lib/blobsterix_carrierwave/blobsterix_transforms.rb
63
64
  - lib/blobsterix_carrierwave/blobsterix_uploader.rb
65
+ - lib/blobsterix_carrierwave/patches/carrierwave_0100_uploader_version_name.rb
66
+ - lib/blobsterix_carrierwave/patches/carrierwave_090_uploader_version_name.rb
64
67
  - lib/blobsterix_carrierwave/version.rb
65
68
  homepage: http://experteer.com
66
69
  licenses: []