rhino_project_jobs 0.20.0.beta.22

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
+ SHA256:
3
+ metadata.gz: a39076097e0c7779899b0ad7bd26d2ce8e9c3a7bac13ed1ba263b8b2c5b50996
4
+ data.tar.gz: e00441cf5a51ed7dc1bee8ca078fef34d2423dfc49065a6a621e882e04ff7c47
5
+ SHA512:
6
+ metadata.gz: fee654e6096ad63322dc8b9a07965313e058ec9316d5e516c93bf7647928e7a6c8e1b0729bf992c04003ece3fc1cba71ce640a7f4fe721335ef0ce920eae0a68
7
+ data.tar.gz: cfb2eaa4d15856b38be439a8ab08710a12050311933e78b463e1bff108b12a6d90f83dd5fa1b562c9100d11b0546930c70d951c69f9051f8326364b8ff81a650
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020-present Nubinary, 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,5 @@
1
+ require "bundler/setup"
2
+
3
+ require "bundler/gem_tasks"
4
+
5
+ task :package
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=* bundle exec rails resque:workers\n"
17
+ end
18
+ inject_into_file 'Procfile' do
19
+ "scheduler: bundle exec 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=* bundle exec rails resque:workers
30
+ scheduler:
31
+ image: web
32
+ command:
33
+ - bundle exec 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,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ Rails.application.configure do
4
+ Resque.redis = ENV['REDIS_URL'] || 'localhost:6379'
5
+ end
@@ -0,0 +1,9 @@
1
+ # See https://github.com/JustinAiken/active_scheduler
2
+ #
3
+ # simple_job:
4
+ # every: "30s"
5
+ # queue: "simple"
6
+ # class: "SimpleJob"
7
+ # args:
8
+ # -
9
+ # description: "It's a simple job."
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rhino/engine'
4
+
5
+ module RhinoJobs
6
+ class Engine < ::Rails::Engine
7
+ config.autoload_paths << File.expand_path('../../lib', __dir__)
8
+
9
+ initializer 'rhino_jobs.register_module' do
10
+ config.after_initialize do
11
+ if File.exist?(Rails.root.join('config/initializers/resque.rb'))
12
+ Rhino.registered_modules[:rhino_jobs] = {
13
+ version: RhinoJobs::VERSION
14
+ }
15
+ end
16
+ end
17
+ end
18
+ end
19
+ 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 Rhino
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 = "beta.22"
14
+
15
+ STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
+ end
17
+ end
data/lib/rhino_jobs.rb ADDED
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rhino_jobs/engine"
4
+
5
+ module RhinoJobs
6
+ # Your code goes here...
7
+ 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,90 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rhino_project_jobs
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.20.0.beta.22
5
+ platform: ruby
6
+ authors:
7
+ - JP Rosevear
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-02-27 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.0.0
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 7.0.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.0.0
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 7.0.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.beta.22
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.beta.22
47
+ description: ''
48
+ email:
49
+ - jprosevear@gmail.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - LICENSE
55
+ - README.md
56
+ - Rakefile
57
+ - app/assets/config/rhino_jobs_manifest.js
58
+ - config/routes.rb
59
+ - lib/generators/rhino_jobs/install/install_generator.rb
60
+ - lib/generators/rhino_jobs/install/templates/resque.rb
61
+ - lib/generators/rhino_jobs/install/templates/resque_schedule.yml
62
+ - lib/rhino_jobs.rb
63
+ - lib/rhino_jobs/engine.rb
64
+ - lib/rhino_jobs/schedule.rb
65
+ - lib/rhino_jobs/version.rb
66
+ - lib/tasks/rhino_jobs.rake
67
+ homepage: ''
68
+ licenses:
69
+ - MIT
70
+ metadata: {}
71
+ post_install_message:
72
+ rdoc_options: []
73
+ require_paths:
74
+ - lib
75
+ required_ruby_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">"
83
+ - !ruby/object:Gem::Version
84
+ version: 1.3.1
85
+ requirements: []
86
+ rubygems_version: 3.3.26
87
+ signing_key:
88
+ specification_version: 4
89
+ summary: ''
90
+ test_files: []