delayed_job_maintenance 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4a6a047839e720b1804f931baeeea23c316aa220
4
+ data.tar.gz: 950eeee5f16fd791269d98086530502e93068f6a
5
+ SHA512:
6
+ metadata.gz: 51fa7da64c3d98b4d67d278b8665a88f334dcf009158bb066c4f80711e160af81c6726259716e793d1579574b6841bb83ef92a81bf1bf3653cfc99191b3cd369
7
+ data.tar.gz: 831185187025ab0654ff1a55209936e2c6d2092c0b314b23d725164fc044aedbe1b1f062c16a3a94e1f2878c8fa7017e7a1f7e709a5dcb5f3acf60c3b796211f
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2018 John Naegle
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,59 @@
1
+ # Delayed Job Maintenance
2
+
3
+ Extends [capistrano-maitenance](https://github.com/capistrano/maintenance) to stop delayed job while the maintenance page is displayed.
4
+
5
+ ## Usage
6
+
7
+ After capistrano-maintenence is installed and configured, your application's web
8
+ interface will be disabled when the maintenance page is written to the server. To
9
+ also disable backend processing in delayed job, you need to configure
10
+ capistrano-maintenance to also write to the delayed-job servers.
11
+
12
+ In your deployment configuration, add the queue server, or whichever role you
13
+ use for capistrano deployments to your delayed job servers:
14
+
15
+ ```ruby
16
+ set :maintenance_roles, -> { roles([:web, :queue]) }
17
+ ```
18
+
19
+ By default, capistrano-maintnance will write the maintenance template to
20
+ `"#{shared_path}/public/system"`. However, `shared_path` is a capistrano variable
21
+ and is not available in delayed_job. If this is different than `Rails.root.join("public", "system")`
22
+ or you are using a different maintenance file, you will need to configure the maintenance file:
23
+
24
+ Add this as an initializer:
25
+ ```ruby
26
+ DelayedJobMaintenance.configure do |config|
27
+ config.maintenance_file = Rails.root.join("public", "system", "maintenance.html")
28
+ end
29
+ ```
30
+
31
+ ## Installation
32
+ Add this line to your application's Gemfile:
33
+
34
+ ```ruby
35
+ gem 'delayed_job_maintenance'
36
+ ```
37
+
38
+ And then execute:
39
+ ```bash
40
+ $ bundle
41
+ ```
42
+
43
+ Or install it yourself as:
44
+ ```bash
45
+ $ gem install delayed_job_maintenance
46
+ ```
47
+
48
+
49
+ ## Contributing
50
+
51
+ Bug reports and pull requests are welcome on GitHub at https://github.com/GoodMeasuresLLC/delayed_job_maintenance. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
52
+
53
+ ## License
54
+
55
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
56
+
57
+ ## Code of Conduct
58
+
59
+ Everyone interacting in the project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/GoodMeasuresLLC/delayed_job_maintenance/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,28 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'DelayedJobMaintenance'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ require 'bundler/gem_tasks'
18
+
19
+ require 'rake/testtask'
20
+
21
+ Rake::TestTask.new(:test) do |t|
22
+ t.libs << 'test'
23
+ t.pattern = 'test/**/*_test.rb'
24
+ t.verbose = false
25
+ end
26
+
27
+
28
+ task default: :test
@@ -0,0 +1,22 @@
1
+ module DelayedJobMaintenance
2
+ class << self
3
+ attr_accessor :configuration
4
+ end
5
+
6
+ def self.configure
7
+ self.configuration ||= Configuration.new
8
+ yield configuration
9
+ end
10
+
11
+ class Configuration
12
+ def maintenance_file=(value)
13
+ @maintenance_file = value
14
+ end
15
+
16
+ def maintenance_file
17
+ @maintenance_file ||= Rails.root.join("public", "system", "maintenance.html")
18
+ end
19
+ end
20
+ end
21
+
22
+ DelayedJobMaintenance.configure {}
@@ -0,0 +1,5 @@
1
+ module Delayed
2
+ class Worker
3
+ prepend Delayed::Maintenance
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ module Delayed
2
+ module Maintenance
3
+ def work_off(num=100)
4
+ if File.exist?(DelayedJobMaintenance.configuration.maintenance_file)
5
+ return [0,0]
6
+ end
7
+
8
+ super(num)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ module DelayedJobMaintenance
2
+ VERSION = '0.1.0'
3
+ end
@@ -0,0 +1,4 @@
1
+ require 'delayed_job_maintenance/configuration'
2
+ require 'delayed_job_maintenance/maintenance'
3
+ require 'delayed_job_maintenance/extensions'
4
+
metadata ADDED
@@ -0,0 +1,123 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: delayed_job_maintenance
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - John Naegle
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-04-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: delayed_job
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '4.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '4.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: sqlite3
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: delayed_job_active_record
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '9.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '9.0'
83
+ description: In conjunction with capistrano-maintenance, stop delayed jobs during
84
+ maintenance
85
+ email:
86
+ - john.naegle@gmail.com
87
+ executables: []
88
+ extensions: []
89
+ extra_rdoc_files: []
90
+ files:
91
+ - MIT-LICENSE
92
+ - README.md
93
+ - Rakefile
94
+ - lib/delayed_job_maintenance.rb
95
+ - lib/delayed_job_maintenance/configuration.rb
96
+ - lib/delayed_job_maintenance/extensions.rb
97
+ - lib/delayed_job_maintenance/maintenance.rb
98
+ - lib/delayed_job_maintenance/version.rb
99
+ homepage: https://github.com/goodmeasures/delayed_job_maintenance
100
+ licenses:
101
+ - MIT
102
+ metadata: {}
103
+ post_install_message:
104
+ rdoc_options: []
105
+ require_paths:
106
+ - lib
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ requirements: []
118
+ rubyforge_project:
119
+ rubygems_version: 2.6.13
120
+ signing_key:
121
+ specification_version: 4
122
+ summary: In conjunction with capistrano-maintenance, stop delayed jobs during maintenance
123
+ test_files: []