trestle-active_job 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +59 -0
- data/.travis.yml +24 -0
- data/Gemfile +5 -0
- data/LICENSE +21 -0
- data/README.md +17 -0
- data/Rakefile +6 -0
- data/app/admin/trestle/active_job/active_job_admin.rb +36 -0
- data/app/assets/stylesheets/trestle/active_job.css +17 -0
- data/app/views/admin/trestle/active_job/active_job/index.html.erb +27 -0
- data/app/views/trestle/active_job/_header.html.erb +1 -0
- data/config/initializers/trestle.rb +9 -0
- data/config/locales/en.yml +5 -0
- data/config/locales/fr.yml +5 -0
- data/lib/trestle/active_job/engine.rb +7 -0
- data/lib/trestle/active_job/version.rb +5 -0
- data/lib/trestle/active_job.rb +5 -0
- data/trestle-active_job.gemspec +29 -0
- metadata +116 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0f05100e01298bbd87a391caf60c444f42fae34a242a478ffe59f5f5926d91c4
|
4
|
+
data.tar.gz: 26c2da28b2ba309385c06ce649ba7f419dbae9592bac3a7c34da41eed61589d0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5aa48037b01cc03a0a170f9412cdfd7d5d7052a9145b82619bc488c1e896b0a9d86649c87a3054017a9cd9ae46b9c5fad2394cfa94b973c40da3a472b9147140
|
7
|
+
data.tar.gz: b0a7f7d78b47fe36c1f2b23105b1e41a16b106e78497613e5eb10d6f65928c516782a30cd348b5be32443b0e10045a4cf61f0ccd0624d90f316cec72fe4b1c9e
|
data/.gitignore
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
.DS_Store
|
2
|
+
*.gem
|
3
|
+
*.rbc
|
4
|
+
/.config
|
5
|
+
/coverage/
|
6
|
+
/InstalledFiles
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/spec/examples.txt
|
10
|
+
/test/tmp/
|
11
|
+
/test/version_tmp/
|
12
|
+
/tmp/
|
13
|
+
|
14
|
+
# Used by dotenv library to load environment variables.
|
15
|
+
# .env
|
16
|
+
|
17
|
+
# Ignore Byebug command history file.
|
18
|
+
.byebug_history
|
19
|
+
|
20
|
+
## Specific to RubyMotion:
|
21
|
+
.dat*
|
22
|
+
.repl_history
|
23
|
+
build/
|
24
|
+
*.bridgesupport
|
25
|
+
build-iPhoneOS/
|
26
|
+
build-iPhoneSimulator/
|
27
|
+
|
28
|
+
## Specific to RubyMotion (use of CocoaPods):
|
29
|
+
#
|
30
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
31
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
32
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
33
|
+
#
|
34
|
+
# vendor/Pods/
|
35
|
+
|
36
|
+
## Documentation cache and generated files:
|
37
|
+
/.yardoc/
|
38
|
+
/_yardoc/
|
39
|
+
/doc/
|
40
|
+
/rdoc/
|
41
|
+
|
42
|
+
## Environment normalization:
|
43
|
+
/.bundle/
|
44
|
+
/vendor/bundle
|
45
|
+
/lib/bundler/man/
|
46
|
+
|
47
|
+
# for a library or gem, you might want to ignore these files since the code is
|
48
|
+
# intended to run in multiple environments; otherwise, check them in:
|
49
|
+
# Gemfile.lock
|
50
|
+
# .ruby-version
|
51
|
+
# .ruby-gemset
|
52
|
+
|
53
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
54
|
+
.rvmrc
|
55
|
+
|
56
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
57
|
+
# .rubocop-https?--*
|
58
|
+
|
59
|
+
.idea
|
data/.travis.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
cache: bundler
|
4
|
+
|
5
|
+
before_install:
|
6
|
+
- gem update --system
|
7
|
+
- gem install bundler
|
8
|
+
|
9
|
+
rvm:
|
10
|
+
- 2.6.5
|
11
|
+
|
12
|
+
gemfile:
|
13
|
+
- gemfiles/rails-5.0.gemfile
|
14
|
+
- gemfiles/rails-5.1.gemfile
|
15
|
+
- gemfiles/rails-5.2.gemfile
|
16
|
+
- gemfiles/rails-6.0.gemfile
|
17
|
+
- gemfiles/rails-6.1.gemfile
|
18
|
+
- gemfiles/rails-6.2.gemfile
|
19
|
+
|
20
|
+
jobs:
|
21
|
+
include:
|
22
|
+
gemfile: gemfiles/rails-4.2.gemfile
|
23
|
+
before_install:
|
24
|
+
- gem install bundler -v '< 2'
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2022 Matthieu "Ezveus" Ciappara
|
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,17 @@
|
|
1
|
+
# Trestle ActiveJob (trestle-active_job)
|
2
|
+
|
3
|
+
> Add an interface to Trestle to perform ActiveJobs
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
These instructions assume you have a working Trestle application. To integrate trestle-active_job, first add it to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'trestle-active_job'
|
11
|
+
```
|
12
|
+
|
13
|
+
Run `bundle install`, and then restart your Rails server.
|
14
|
+
|
15
|
+
## License
|
16
|
+
|
17
|
+
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,36 @@
|
|
1
|
+
Trestle.admin(:active_job, scope: Trestle::ActiveJob, path: 'active_job') do
|
2
|
+
routes do
|
3
|
+
post :perform_job
|
4
|
+
end
|
5
|
+
|
6
|
+
controller do
|
7
|
+
before_action :fetch_jobs
|
8
|
+
|
9
|
+
def index
|
10
|
+
end
|
11
|
+
|
12
|
+
def perform_job
|
13
|
+
job = params[:job]
|
14
|
+
|
15
|
+
if @jobs.include?(job)
|
16
|
+
job.constantize.perform_later
|
17
|
+
redirect_to admin.path(:index),
|
18
|
+
notice: I18n.t('perform_success', scope: 'trestle_active_job',
|
19
|
+
default: "'%{job_name}' is scheduled",
|
20
|
+
job_name: I18n.t(job, scope: 'trestle_active_job', default: job))
|
21
|
+
else
|
22
|
+
redirect_to admin.path(:index),
|
23
|
+
notice: I18n.t('unknown_job', scope: 'trestle_active_job',
|
24
|
+
default: "'%{job_name}' does not exists",
|
25
|
+
job_name: I18n.t(job, scope: 'trestle_active_job', default: job))
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def fetch_jobs
|
32
|
+
@jobs = ObjectSpace.each_object(Class).select { |c| c.ancestors.include?(ActiveJob::Base) }
|
33
|
+
.map(&:to_s)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
.trestle-active-job-header-button {
|
2
|
+
float: right;
|
3
|
+
margin: 6px 16px;
|
4
|
+
font-size: 26px;
|
5
|
+
}
|
6
|
+
|
7
|
+
.trestle-active-job-grid {
|
8
|
+
display: grid;
|
9
|
+
gap: 1rem;
|
10
|
+
grid-template-columns: 7fr 3fr;
|
11
|
+
grid-template-rows: auto;
|
12
|
+
margin-top: 1rem;
|
13
|
+
}
|
14
|
+
|
15
|
+
.trestle-active-job-grid .trestle-active-job-name {
|
16
|
+
margin-left: 1rem;
|
17
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%= content_for(:title, "Active jobs") %>
|
2
|
+
|
3
|
+
<% if flash[:notice] %>
|
4
|
+
<div class="alert alert-dismissible alert-success">
|
5
|
+
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
6
|
+
<span aria-hidden="true">×</span>
|
7
|
+
</button>
|
8
|
+
<div class="text-center d-flex align-items-center justify-content-center">
|
9
|
+
<i class="fa fa-check-circle fa-2x margin-right-md"></i>
|
10
|
+
<span><%= flash[:notice] %></span>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<div class="trestle-active-job-grid">
|
16
|
+
<% @jobs.each do |job| %>
|
17
|
+
<div class="trestle-active-job-name">
|
18
|
+
<%= t(job, scope: 'trestle_active_job', default: job) %>
|
19
|
+
</div>
|
20
|
+
<div class="trestle-active-job-perform">
|
21
|
+
<%= form_tag admin.path(:perform_job), id: "update_#{job}_form", method: :post, class: 'form-inline mb-2', style: 'width: 100%;' do %>
|
22
|
+
<%= hidden_field_tag('job', job, id: "job_#{job}", class: 'form-check-input') %>
|
23
|
+
<%= submit_tag(t('perform', scope: 'trestle_active_job', default: 'Perform'), class: 'btn btn-success') %>
|
24
|
+
<% end %>
|
25
|
+
</div>
|
26
|
+
<% end %>
|
27
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= link_to icon("fa fa-clock"), Trestle::ActiveJob::ActiveJobAdmin.path, class: "trestle-active-job-header-button", title: "ActiveJob", data: { toggle: "tooltip", placement: "bottom" } %>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require_relative 'lib/trestle/active_job/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "trestle-active_job"
|
5
|
+
spec.version = Trestle::ActiveJob::VERSION
|
6
|
+
|
7
|
+
spec.authors = ["Matthieu Ciappara"]
|
8
|
+
spec.email = ["matthieu.ciappara@outlook.com"]
|
9
|
+
|
10
|
+
spec.summary = "Add an interface to Trestle to spawn ActiveJobs"
|
11
|
+
spec.homepage = "https://github.com/Ezveus/trestle-active_job.git"
|
12
|
+
spec.license = "MIT"
|
13
|
+
|
14
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
15
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
|
16
|
+
end
|
17
|
+
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
21
|
+
|
22
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
23
|
+
spec.metadata["source_code_uri"] = "https://github.com/Ezveus/trestle-active_job"
|
24
|
+
|
25
|
+
spec.add_dependency 'rails', '>= 5.2', '< 8'
|
26
|
+
spec.add_dependency "trestle", "~> 0.9.0", ">= 0.9.3"
|
27
|
+
|
28
|
+
spec.add_development_dependency "rspec-rails", "~> 4.0"
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: trestle-active_job
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matthieu Ciappara
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-06-14 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: '5.2'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '8'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '5.2'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '8'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: trestle
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 0.9.0
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 0.9.3
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 0.9.0
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 0.9.3
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: rspec-rails
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '4.0'
|
60
|
+
type: :development
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - "~>"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '4.0'
|
67
|
+
description:
|
68
|
+
email:
|
69
|
+
- matthieu.ciappara@outlook.com
|
70
|
+
executables: []
|
71
|
+
extensions: []
|
72
|
+
extra_rdoc_files: []
|
73
|
+
files:
|
74
|
+
- ".gitignore"
|
75
|
+
- ".travis.yml"
|
76
|
+
- Gemfile
|
77
|
+
- LICENSE
|
78
|
+
- README.md
|
79
|
+
- Rakefile
|
80
|
+
- app/admin/trestle/active_job/active_job_admin.rb
|
81
|
+
- app/assets/stylesheets/trestle/active_job.css
|
82
|
+
- app/views/admin/trestle/active_job/active_job/index.html.erb
|
83
|
+
- app/views/trestle/active_job/_header.html.erb
|
84
|
+
- config/initializers/trestle.rb
|
85
|
+
- config/locales/en.yml
|
86
|
+
- config/locales/fr.yml
|
87
|
+
- lib/trestle/active_job.rb
|
88
|
+
- lib/trestle/active_job/engine.rb
|
89
|
+
- lib/trestle/active_job/version.rb
|
90
|
+
- trestle-active_job.gemspec
|
91
|
+
homepage: https://github.com/Ezveus/trestle-active_job.git
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata:
|
95
|
+
homepage_uri: https://github.com/Ezveus/trestle-active_job.git
|
96
|
+
source_code_uri: https://github.com/Ezveus/trestle-active_job
|
97
|
+
post_install_message:
|
98
|
+
rdoc_options: []
|
99
|
+
require_paths:
|
100
|
+
- lib
|
101
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: 2.3.0
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
requirements: []
|
112
|
+
rubygems_version: 3.0.3.1
|
113
|
+
signing_key:
|
114
|
+
specification_version: 4
|
115
|
+
summary: Add an interface to Trestle to spawn ActiveJobs
|
116
|
+
test_files: []
|