carrierwave_backgrounder_sequel 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 508d5170e1e499558e2d35a57474a9eaad4ce240
4
+ data.tar.gz: 63d4f07404c6872a23fe84837d43f2b3729239e1
5
+ SHA512:
6
+ metadata.gz: 2ec8ba8ee582ffcfaae5a566e70547ff97d00d3f58a1d2fd45a7d2a2d60a1728fae602dc323fda35e8af8103b51f3870d07ec0854f8f30d40b8c726dc765fcc1
7
+ data.tar.gz: 02965153c9d20451ee5c30e9c73eb926859239b0c1621ed6ec2299cdbf64cfb3a9228698e39bd8e5fef8985db96d2033e8fc09e7b481c599d5040768d8a092ae
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 noah blumenthal
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,2 @@
1
+ carrierwave_backgrounder_sequel
2
+ ===============================
@@ -0,0 +1,19 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'carrierwave_backgrounder_sequel'
3
+ s.description = %q{Sequel support for CarrierWave Backgrounder}
4
+ s.summary = %q{Add support for Sequel to the carrierwave_backgrounder gem}
5
+ s.licenses = ['MIT']
6
+ s.authors = ["Noah Blumenthal"]
7
+ s.email = 'noah@hackerhasid.com'
8
+ s.homepage = 'https://github.com/hackerhasid/carrierwave_backgrounder_sequel'
9
+ s.files = `git ls-files`.split("\n")
10
+ s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
11
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
12
+ s.require_paths = ["lib"]
13
+ s.version = '0.0.2'
14
+
15
+ s.add_dependency "carrierwave_backgrounder", ["~> 0.3"]
16
+ s.add_dependency 'orm_adapter-sequel', ["~>0.1"]
17
+
18
+ s.add_development_dependency "rspec", ["~> 2.14"]
19
+ end
@@ -0,0 +1,88 @@
1
+ module CarrierWave
2
+ module Workers
3
+ class Base
4
+ def perform(*args)
5
+ set_args(*args) if args.present?
6
+ constantized_resource[id]
7
+ rescue *not_found_errors
8
+ end
9
+
10
+ private
11
+ alias :old_not_found_errors :not_found_errors
12
+ def not_found_errors
13
+ old_not_found_errors.tap do |errors|
14
+ errors << ::Sequel::NoMatchingRow if defined?(::Sequel)
15
+ end
16
+ end
17
+
18
+ end
19
+ end
20
+ end
21
+
22
+ module Sequel
23
+ module Plugins
24
+ module CarrierWaveBackgrounder
25
+ def self.apply(model, options = {})
26
+ Rails.logger.warn 'SELF.APPLY'
27
+ model.plugin :hook_class_methods
28
+ model.plugin :dirty
29
+ end
30
+
31
+ module ClassMethods
32
+ include CarrierWave::Backgrounder::ORM::Base
33
+
34
+ # use base process_in_background and add column to class variable
35
+ def process_in_background(column, worker=::CarrierWave::Workers::ProcessAsset)
36
+ super
37
+ (@@_carrierwave_process_in_background ||= {})[:"#{column}"] = worker
38
+ end
39
+
40
+ # use base store_in_background and add column to class variable
41
+ def store_in_background(column, worker=::CarrierWave::Workers::StoreAsset)
42
+ super
43
+ (@@_carrierwave_store_in_background ||= {})[:"#{column}"] = worker
44
+ end
45
+ def _define_shared_backgrounder_methods(mod, column, worker)
46
+ before_save do
47
+ send(:"set_#{column}_processing") if send(:"enqueue_#{column}_background_job?")
48
+ end
49
+
50
+ after_commit do
51
+ send(:"enqueue_#{column}_background_job") if send(:"enqueue_#{column}_background_job?")
52
+ end
53
+
54
+ super
55
+
56
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
57
+ def enqueue_#{column}_background_job
58
+ if enqueue_#{column}_background_job?
59
+ super
60
+ @#{column}_changed = false
61
+ end
62
+ end
63
+
64
+ def #{column}_updated?
65
+ @#{column}_changed
66
+ end
67
+
68
+ def #{column}=(val)
69
+ @#{column}_changed = true
70
+ super
71
+ end
72
+ RUBY
73
+ end
74
+ end # ClassMethods
75
+
76
+ module InstanceMethods
77
+ def update_attribute(col, val)
78
+ h = {}
79
+ h[col] = val
80
+ self.set(h)
81
+ self.save(:columns=>[col], :validate=>false)
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
87
+
88
+ Sequel::Model.plugin :carrier_wave_backgrounder
@@ -0,0 +1,9 @@
1
+ module CarrierWave
2
+ module Backgrounder
3
+ class Railtie < Rails::Railtie
4
+ initializer "carrierwave_backgrounder.sequel" do
5
+ require 'backgrounder/orm/sequel' if defined?(Sequel)
6
+ end
7
+ end
8
+ end
9
+ end
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: carrierwave_backgrounder_sequel
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Noah Blumenthal
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: carrierwave_backgrounder
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.3'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: orm_adapter-sequel
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.14'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.14'
55
+ description: Sequel support for CarrierWave Backgrounder
56
+ email: noah@hackerhasid.com
57
+ executables: []
58
+ extensions: []
59
+ extra_rdoc_files: []
60
+ files:
61
+ - ".gitignore"
62
+ - Gemfile
63
+ - LICENSE
64
+ - README.md
65
+ - carrierwave_backgrounder_sequel.gemspec
66
+ - lib/backgrounder/orm/sequel.rb
67
+ - lib/backgrounder/railtie.rb
68
+ homepage: https://github.com/hackerhasid/carrierwave_backgrounder_sequel
69
+ licenses:
70
+ - MIT
71
+ metadata: {}
72
+ post_install_message:
73
+ rdoc_options: []
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ requirements: []
87
+ rubyforge_project:
88
+ rubygems_version: 2.2.0
89
+ signing_key:
90
+ specification_version: 4
91
+ summary: Add support for Sequel to the carrierwave_backgrounder gem
92
+ test_files: []