rhino_project_jobs 0.20.0.alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +28 -0
- data/Rakefile +22 -0
- data/app/assets/config/rhino_jobs_manifest.js +0 -0
- data/config/routes.rb +11 -0
- data/lib/generators/rhino_jobs/install/install_generator.rb +39 -0
- data/lib/generators/rhino_jobs/install/templates/resque.rb +5 -0
- data/lib/generators/rhino_jobs/install/templates/resque_schedule.yml +9 -0
- data/lib/rhino_jobs/engine.rb +26 -0
- data/lib/rhino_jobs/schedule.rb +20 -0
- data/lib/rhino_jobs/version.rb +17 -0
- data/lib/rhino_project_jobs.rb +7 -0
- data/lib/tasks/rhino_jobs.rake +27 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a169296563e70907961015e471338826803fc33edb725cb2e68a9007fa4d1253
|
4
|
+
data.tar.gz: 3d5f8c658e43a518329a989b5448db4d57c068fbf3942237a0ccb957e962a859
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7c3df9cd70189df35f767a6105b48c4a44e7639a26ca7c25c9927271b7dac075052068a6d5147e58efa1577d6eed4ec8514a12a78fce42014665de8dac0ccb56
|
7
|
+
data.tar.gz: 9b182671022caa4d07e67062327e24d8e07ad94dc1f759bc5e15adb7d809a4212c24b975dcae5d99152e1eeff3a981798e5686c989f99d39cf5c479f7625e97d
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2020-present Codalio Inc.
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# RhinoJobs
|
2
|
+
Short description and motivation.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
How to use my plugin.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'rhino_jobs'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
```bash
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
```bash
|
21
|
+
$ gem install rhino_jobs
|
22
|
+
```
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
Contribution directions go here.
|
26
|
+
|
27
|
+
## License
|
28
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rake/testtask"
|
4
|
+
require 'rdoc/task'
|
5
|
+
|
6
|
+
task default: :test
|
7
|
+
|
8
|
+
task :package
|
9
|
+
|
10
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
11
|
+
rdoc.rdoc_dir = 'rdoc'
|
12
|
+
rdoc.title = 'RhinoJobs'
|
13
|
+
rdoc.options << '--line-numbers'
|
14
|
+
rdoc.rdoc_files.include('README.md')
|
15
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
16
|
+
end
|
17
|
+
|
18
|
+
Rake::TestTask.new do |t|
|
19
|
+
t.pattern = "test/**/*_test.rb"
|
20
|
+
t.verbose = true
|
21
|
+
t.warning = false
|
22
|
+
end
|
File without changes
|
data/config/routes.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'resque/server'
|
2
|
+
require 'resque-scheduler'
|
3
|
+
require 'resque/scheduler/server'
|
4
|
+
|
5
|
+
Rails.application.routes.draw do
|
6
|
+
RhinoJobs::Schedule.load if Rails.configuration.active_job.queue_adapter == :resque
|
7
|
+
|
8
|
+
authenticate :admin_user do
|
9
|
+
mount Resque::Server, at: '/jobs'
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RhinoJobs
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < ::Rails::Generators::Base
|
6
|
+
source_root File.expand_path('templates', __dir__)
|
7
|
+
|
8
|
+
def install
|
9
|
+
template 'resque.rb', 'config/initializers/resque.rb'
|
10
|
+
template 'resque_schedule.yml', 'config/resque_schedule.yml'
|
11
|
+
gsub_file 'config/environments/production.rb', /# config.active_job.queue_adapter.*/, 'config.active_job.queue_adapter = :resque'
|
12
|
+
end
|
13
|
+
|
14
|
+
def update_procfile
|
15
|
+
inject_into_file 'Procfile' do
|
16
|
+
"worker: COUNT=1 QUEUE=* bin/rails resque:workers\n"
|
17
|
+
end
|
18
|
+
inject_into_file 'Procfile' do
|
19
|
+
"scheduler: bin/rails resque:scheduler\n"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def update_heroku_yml
|
24
|
+
data = <<-'RUBY'
|
25
|
+
run:
|
26
|
+
worker:
|
27
|
+
image: web
|
28
|
+
command:
|
29
|
+
- COUNT=1 QUEUE=* bin/rails resque:workers
|
30
|
+
scheduler:
|
31
|
+
image: web
|
32
|
+
command:
|
33
|
+
- bin/rails resque:scheduler
|
34
|
+
RUBY
|
35
|
+
inject_into_file 'heroku.yml', optimize_indentation(data, 0)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rhino/engine"
|
4
|
+
require "rhino_jobs/version"
|
5
|
+
|
6
|
+
# https://guides.rubyonrails.org/engines.html#other-gem-dependencies
|
7
|
+
require "resque"
|
8
|
+
require "resque-scheduler"
|
9
|
+
require "resque-heroku-signals"
|
10
|
+
require "active_scheduler"
|
11
|
+
|
12
|
+
module RhinoJobs
|
13
|
+
class Engine < ::Rails::Engine
|
14
|
+
config.autoload_paths << File.expand_path("../../lib", __dir__)
|
15
|
+
|
16
|
+
initializer "rhino_jobs.register_module" do
|
17
|
+
config.after_initialize do
|
18
|
+
if File.exist?(Rails.root.join("config/initializers/resque.rb"))
|
19
|
+
Rhino.registered_modules[:rhino_jobs] = {
|
20
|
+
version: RhinoJobs::VERSION::STRING
|
21
|
+
}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "resque-scheduler"
|
4
|
+
|
5
|
+
# https://github.com/rails/rails/issues/16933
|
6
|
+
module RhinoJobs
|
7
|
+
module Schedule
|
8
|
+
module_function
|
9
|
+
|
10
|
+
SCHEDULE_FILE = Rails.root.join("config/resque_schedule.yml")
|
11
|
+
|
12
|
+
def load
|
13
|
+
return unless File.exist?(SCHEDULE_FILE)
|
14
|
+
|
15
|
+
yaml_schedule = YAML.load_file(SCHEDULE_FILE) || {}
|
16
|
+
wrapped_schedule = ActiveScheduler::ResqueWrapper.wrap yaml_schedule
|
17
|
+
Resque.schedule = wrapped_schedule
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RhinoJobs
|
4
|
+
# Returns the currently loaded version of Rhino core as a +Gem::Version+.
|
5
|
+
def self.gem_version
|
6
|
+
Gem::Version.new VERSION::STRING
|
7
|
+
end
|
8
|
+
|
9
|
+
module VERSION
|
10
|
+
MAJOR = 0
|
11
|
+
MINOR = 20
|
12
|
+
TINY = 0
|
13
|
+
PRE = "alpha.0"
|
14
|
+
|
15
|
+
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'resque/tasks'
|
4
|
+
require 'resque/scheduler/tasks'
|
5
|
+
|
6
|
+
namespace :resque do
|
7
|
+
# Ensure initializers for resque:work so redis url is set
|
8
|
+
task setup: :environment
|
9
|
+
|
10
|
+
task setup_schedule: :setup do
|
11
|
+
RhinoJobs::Schedule.load
|
12
|
+
end
|
13
|
+
|
14
|
+
task scheduler: :setup_schedule
|
15
|
+
end
|
16
|
+
|
17
|
+
namespace :rhino_jobs do
|
18
|
+
# Prevent migration installation task from showing up twice.
|
19
|
+
Rake::Task['rhino_jobs_engine:install:migrations'].clear_comments if Rake::Task.task_defined?('rhino_jobs_engine:install:migrations')
|
20
|
+
|
21
|
+
desc 'Install rhino_jobs'
|
22
|
+
task install: :environment do
|
23
|
+
Rake::Task['rhino_jobs_engine:install:migrations'].invoke if Rake::Task.task_defined?('rhino_jobs_engine:install:migrations')
|
24
|
+
|
25
|
+
Rails::Command.invoke :generate, ['rhino_jobs:install']
|
26
|
+
end
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rhino_project_jobs
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.20.0.alpha.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- JP Rosevear
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-08-08 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: 7.1.0
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 7.1.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 7.1.0
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 7.1.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rhino_project_core
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - '='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 0.20.0.alpha.0
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - '='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.20.0.alpha.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: resque
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - '='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 2.6.0
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - '='
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 2.6.0
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: resque-scheduler
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - '='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 4.10.2
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - '='
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 4.10.2
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: resque-heroku-signals
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - '='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 2.6.0
|
82
|
+
type: :runtime
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - '='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 2.6.0
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: active_scheduler
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - '='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 0.7.0
|
96
|
+
type: :runtime
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - '='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 0.7.0
|
103
|
+
description: ''
|
104
|
+
email:
|
105
|
+
- jp@codalio.com
|
106
|
+
executables: []
|
107
|
+
extensions: []
|
108
|
+
extra_rdoc_files: []
|
109
|
+
files:
|
110
|
+
- LICENSE
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- app/assets/config/rhino_jobs_manifest.js
|
114
|
+
- config/routes.rb
|
115
|
+
- lib/generators/rhino_jobs/install/install_generator.rb
|
116
|
+
- lib/generators/rhino_jobs/install/templates/resque.rb
|
117
|
+
- lib/generators/rhino_jobs/install/templates/resque_schedule.yml
|
118
|
+
- lib/rhino_jobs/engine.rb
|
119
|
+
- lib/rhino_jobs/schedule.rb
|
120
|
+
- lib/rhino_jobs/version.rb
|
121
|
+
- lib/rhino_project_jobs.rb
|
122
|
+
- lib/tasks/rhino_jobs.rake
|
123
|
+
homepage: ''
|
124
|
+
licenses:
|
125
|
+
- MIT
|
126
|
+
metadata: {}
|
127
|
+
post_install_message:
|
128
|
+
rdoc_options: []
|
129
|
+
require_paths:
|
130
|
+
- lib
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ">="
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ">="
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: '0'
|
141
|
+
requirements: []
|
142
|
+
rubygems_version: 3.5.11
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: ''
|
146
|
+
test_files: []
|