jobly 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +49 -14
- data/lib/jobly/commands/config.rb +1 -1
- data/lib/jobly/commands/run.rb +2 -2
- data/lib/jobly/jobs.rb +4 -3
- data/lib/jobly/server.rb +6 -4
- data/lib/jobly/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: efd28d722eeb4dc40024eda54bcc5f302a61db6a0036ce836435aeeafb6402e0
|
4
|
+
data.tar.gz: 949714c32284267a829dd32be6277739e3fb097a4343cbcecd3aa6805a03065f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7438be9408c00d912ea9ebf1f80cbb38e74463c37a87da2b2e85c491dec526450e8d22f15f8a65e6ee45a1daf98df2f7955a5bcd59068102b5f38b4c976727f
|
7
|
+
data.tar.gz: 852d6c6a6b0d3f224856a5c027f83d417bc9431edb766dc80ae653afd4d5eecba4cf6e0e3c71b720382fe5ffe98a42fbb3203802bb1a4989bfd11d8202215bbb
|
data/README.md
CHANGED
@@ -1,12 +1,17 @@
|
|
1
|
+
<div align='center'>
|
2
|
+
|
3
|
+
<img src='/assets/logo.svg' width=300>
|
4
|
+
|
1
5
|
Jobly
|
2
6
|
==================================================
|
3
7
|
|
8
|
+
Compact job server with API, CLI, Web UI and a Sidekiq heart.
|
9
|
+
|
4
10
|
[![Gem Version](https://badge.fury.io/rb/jobly.svg)](https://badge.fury.io/rb/jobly)
|
5
11
|
[![Build Status](https://travis-ci.com/DannyBen/jobly.svg?branch=master)](https://travis-ci.com/DannyBen/jobly)
|
12
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/b3932ebd153d831583e2/maintainability)](https://codeclimate.com/github/DannyBen/jobly/maintainability)
|
6
13
|
|
7
|
-
|
8
|
-
|
9
|
-
Job server toolbelt with API, CLI, Web UI and a Sidekiq heart.
|
14
|
+
</div>
|
10
15
|
|
11
16
|
---
|
12
17
|
|
@@ -16,6 +21,7 @@ Installation
|
|
16
21
|
$ gem install jobly
|
17
22
|
|
18
23
|
|
24
|
+
|
19
25
|
What's in the Box
|
20
26
|
--------------------------------------------------
|
21
27
|
|
@@ -27,15 +33,19 @@ sidekiq backgronud jobs system. It includes the following components:
|
|
27
33
|
- **Web API** - for executing jobs.
|
28
34
|
- **Web Dashboard** - including job progress and status.
|
29
35
|
|
30
|
-
|
36
|
+
|
37
|
+
|
38
|
+
Quick Start
|
31
39
|
--------------------------------------------------
|
32
40
|
|
33
|
-
|
41
|
+
Follow one of these annotated [examples](/examples).
|
42
|
+
|
34
43
|
|
35
44
|
|
36
45
|
Usage
|
37
46
|
--------------------------------------------------
|
38
47
|
|
48
|
+
|
39
49
|
### Server
|
40
50
|
|
41
51
|
To start the server run `jobly server` and open <http://localhost:3000/>
|
@@ -44,7 +54,7 @@ in your browser.
|
|
44
54
|
This will start a webserver with two primary entrypoints:
|
45
55
|
|
46
56
|
- `/` (root) - a dashboard for your background job processes.
|
47
|
-
- `/do
|
57
|
+
- `/do/JobName?param=value` - an API for executing jobs
|
48
58
|
|
49
59
|
|
50
60
|
### Worker
|
@@ -59,18 +69,43 @@ There are three ways to run a job from the command line:
|
|
59
69
|
Run the job locally, without going through any of the background job
|
60
70
|
processing chain:
|
61
71
|
|
62
|
-
|
63
|
-
|
64
|
-
```
|
72
|
+
$ jobly run JobName param:value
|
73
|
+
|
65
74
|
|
66
75
|
Run the job locally, but wait for a worker to process it.
|
67
76
|
|
68
|
-
|
69
|
-
|
70
|
-
```
|
77
|
+
$ jobly run --later JobName param:value
|
78
|
+
|
71
79
|
|
72
80
|
Send a job through the API (either localhost or remote).
|
73
81
|
|
74
|
-
|
75
|
-
|
82
|
+
$ jobly send JobName param:value
|
83
|
+
|
84
|
+
|
85
|
+
### Running jobs through the API
|
86
|
+
|
87
|
+
The API supports running jobs either by GET or by POST in the following URL
|
88
|
+
structure:
|
89
|
+
|
90
|
+
<http://localhost:3000/do/JobName>
|
91
|
+
|
92
|
+
Using GET:
|
93
|
+
|
94
|
+
```
|
95
|
+
$ curl localhost:3000/do/Build?deploy=no
|
96
|
+
# => {"status":"received","job":"Build","params":{"deploy":"no"}}
|
97
|
+
```
|
98
|
+
|
99
|
+
Using POST:
|
100
|
+
|
101
|
+
```
|
102
|
+
$ curl -XPOST localhost:3000/do/Build -d deploy=yes
|
103
|
+
{"status":"received","job":"Build","params":{"deploy":"yes"}}
|
76
104
|
```
|
105
|
+
|
106
|
+
|
107
|
+
Building Jobs
|
108
|
+
--------------------------------------------------
|
109
|
+
|
110
|
+
TODO
|
111
|
+
|
@@ -8,7 +8,7 @@ module Jobly
|
|
8
8
|
usage "jobly config (-h|--help)"
|
9
9
|
|
10
10
|
def run
|
11
|
-
line "custom config file", short_config_path, Jobly.custom_config?
|
11
|
+
line "custom config file", short_config_path, !Jobly.custom_config?
|
12
12
|
Jobly.options.each do |key, value|
|
13
13
|
if key.to_s.end_with? '_path'
|
14
14
|
line key, value, !Dir.exist?(value)
|
data/lib/jobly/commands/run.rb
CHANGED
@@ -20,7 +20,7 @@ module Jobly
|
|
20
20
|
job_class = Jobs.get_class! job
|
21
21
|
|
22
22
|
if args['--later']
|
23
|
-
say "!txtgrn
|
23
|
+
say "Scheduling !txtgrn!#{job_class}"
|
24
24
|
if params.empty?
|
25
25
|
job_class.perform_async
|
26
26
|
else
|
@@ -28,7 +28,7 @@ module Jobly
|
|
28
28
|
end
|
29
29
|
|
30
30
|
else
|
31
|
-
say "!txtgrn
|
31
|
+
say "Running !txtgrn!#{job_class}"
|
32
32
|
job_class.new.perform params
|
33
33
|
end
|
34
34
|
end
|
data/lib/jobly/jobs.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module Jobly
|
2
2
|
module Jobs
|
3
3
|
def self.get_class(job)
|
4
|
-
Object.const_get
|
4
|
+
Object.const_get full_job_name(job) rescue nil
|
5
5
|
end
|
6
6
|
|
7
7
|
def self.get_class!(job)
|
8
|
-
Object.const_get
|
8
|
+
Object.const_get full_job_name(job)
|
9
9
|
rescue NameError
|
10
10
|
raise JobNotFound, job
|
11
11
|
end
|
@@ -15,7 +15,8 @@ module Jobly
|
|
15
15
|
Dir["#{Jobly.full_jobs_path}/**/*.rb"].each { |file| require file }
|
16
16
|
end
|
17
17
|
|
18
|
-
def self.
|
18
|
+
def self.full_job_name(job)
|
19
|
+
job = job.gsub '/', '::'
|
19
20
|
if Jobly.jobs_namespace
|
20
21
|
"#{Jobly.jobs_namespace}::#{job}"
|
21
22
|
else
|
data/lib/jobly/server.rb
CHANGED
@@ -29,13 +29,15 @@ module Jobly
|
|
29
29
|
}.to_json
|
30
30
|
end
|
31
31
|
|
32
|
-
get '
|
33
|
-
job = params.
|
32
|
+
get '/*' do
|
33
|
+
job = params[:splat].first
|
34
|
+
params.delete :splat
|
34
35
|
add_job job, params
|
35
36
|
end
|
36
37
|
|
37
|
-
post '
|
38
|
-
job = params.
|
38
|
+
post '/*' do
|
39
|
+
job = params[:splat].first
|
40
|
+
params.delete :splat
|
39
41
|
add_job job, params
|
40
42
|
end
|
41
43
|
|
data/lib/jobly/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jobly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mister_bin
|
@@ -204,7 +204,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
204
204
|
requirements:
|
205
205
|
- - ">="
|
206
206
|
- !ruby/object:Gem::Version
|
207
|
-
version: 2.
|
207
|
+
version: 2.5.0
|
208
208
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
209
209
|
requirements:
|
210
210
|
- - ">="
|