apartment-activejob-que 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: 8a815443205c8f6a2acbd44b143cce18eee21f26
4
+ data.tar.gz: 157c1fe07a90216a085e733cc5fb9b16a44dc01c
5
+ SHA512:
6
+ metadata.gz: 94dc7144b1a3e1b13dc0580c3efabfbb1f5de5b6ef470af4021af123b2a67c3dd4c04977bef70067a48f7f1aeb26b4ad10b25ac90aabe051bb6bd1651121d583
7
+ data.tar.gz: 667a6d9b9815353b5db676515116b8f8c51a13d4d28e40d82183add0e62fc316e5199009da5711aac174d05e11a999b51bffb1c3206d09501382a40a5aa3930c
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in apartment-activejob.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Influitive Corporation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, 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,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,45 @@
1
+ # Apartment::Activejob
2
+
3
+ ActiveJob support for Apartment with Que support
4
+
5
+ All credit goes to the original gem [apartment-activejob](https://github.com/influitive/apartment-activejob)
6
+
7
+ I have only added support for using this with [Que](https://github.com/chanks/que).
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'apartment-activejob-que'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install apartment-activejob-que
24
+
25
+ ## Usage
26
+
27
+ Create a new initialization file active_job.rb in your project with the contents
28
+
29
+ ```ruby
30
+ class ActiveJob::Base
31
+ include Apartment::ActiveJob
32
+ end
33
+ ```
34
+
35
+ You will need to restart your rails server for this to take effect.
36
+
37
+ Enqueuing jobs will automatically place them in the public tenant. When the job is worked, it will be worked on the tenant it was created on.
38
+
39
+ ## Contributing
40
+
41
+ 1. Fork it ( https://github.com/[my-github-username]/apartment-activejob/fork )
42
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
43
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
44
+ 4. Push to the branch (`git push origin my-new-feature`)
45
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'apartment/active_job/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "apartment-activejob-que"
8
+ spec.version = Apartment::ActiveJob::VERSION
9
+ spec.authors = ["Zulfiqar Ali", "James Carbine"]
10
+ spec.email = ["zulfiqar@influitive.com", "jamescarbine@gmail.com"]
11
+ spec.summary = %q{ActiveJob support for Apartment with Que support}
12
+ spec.description = %q{Enable ActiveJob to work with Apartment multi-tenancy with Que support}
13
+ spec.homepage = "https://github.com/bfcoder/apartment-activejob"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "apartment"
22
+ spec.add_dependency "activesupport"
23
+
24
+ spec.add_development_dependency "bundler", "> 1.7"
25
+ spec.add_development_dependency "rake", "> 10.0"
26
+ end
@@ -0,0 +1,4 @@
1
+ require "apartment/active_job"
2
+
3
+
4
+
@@ -0,0 +1,28 @@
1
+ module Apartment
2
+ module ActiveJob
3
+ extend ActiveSupport::Concern
4
+
5
+ class_methods do
6
+ def execute(job_data)
7
+ Apartment::Tenant.switch(job_data['tenant']) do
8
+ super
9
+ end
10
+ end
11
+ end
12
+
13
+ def initialize(*arguments)
14
+ @tenant = Apartment::Tenant.current
15
+ super(*arguments)
16
+ end
17
+
18
+ def enqueue(*arguments)
19
+ Apartment::Tenant.switch('public') do
20
+ super(*arguments)
21
+ end
22
+ end
23
+
24
+ def serialize
25
+ super.merge('tenant' => @tenant)
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,5 @@
1
+ module Apartment
2
+ module ActiveJob
3
+ VERSION = "0.0.2"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,111 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: apartment-activejob-que
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Zulfiqar Ali
8
+ - James Carbine
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2017-12-11 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: apartment
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: activesupport
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: bundler
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">"
47
+ - !ruby/object:Gem::Version
48
+ version: '1.7'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">"
54
+ - !ruby/object:Gem::Version
55
+ version: '1.7'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rake
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">"
61
+ - !ruby/object:Gem::Version
62
+ version: '10.0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">"
68
+ - !ruby/object:Gem::Version
69
+ version: '10.0'
70
+ description: Enable ActiveJob to work with Apartment multi-tenancy with Que support
71
+ email:
72
+ - zulfiqar@influitive.com
73
+ - jamescarbine@gmail.com
74
+ executables: []
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - ".gitignore"
79
+ - Gemfile
80
+ - LICENSE
81
+ - README.md
82
+ - Rakefile
83
+ - apartment-activejob.gemspec
84
+ - lib/apartment-activejob.rb
85
+ - lib/apartment/active_job.rb
86
+ - lib/apartment/active_job/version.rb
87
+ homepage: https://github.com/bfcoder/apartment-activejob
88
+ licenses:
89
+ - MIT
90
+ metadata: {}
91
+ post_install_message:
92
+ rdoc_options: []
93
+ require_paths:
94
+ - lib
95
+ required_ruby_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ requirements: []
106
+ rubyforge_project:
107
+ rubygems_version: 2.6.11
108
+ signing_key:
109
+ specification_version: 4
110
+ summary: ActiveJob support for Apartment with Que support
111
+ test_files: []