jobly 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: efd28d722eeb4dc40024eda54bcc5f302a61db6a0036ce836435aeeafb6402e0
4
- data.tar.gz: 949714c32284267a829dd32be6277739e3fb097a4343cbcecd3aa6805a03065f
3
+ metadata.gz: c291317ad0589ae8edc781249eed56684185e31e7b376a71c426ca31cade67f9
4
+ data.tar.gz: 5bf18f622297cc8446e7e5c3ec3fcc28584cc41a5d80f611fde5e339f44f09ed
5
5
  SHA512:
6
- metadata.gz: e7438be9408c00d912ea9ebf1f80cbb38e74463c37a87da2b2e85c491dec526450e8d22f15f8a65e6ee45a1daf98df2f7955a5bcd59068102b5f38b4c976727f
7
- data.tar.gz: 852d6c6a6b0d3f224856a5c027f83d417bc9431edb766dc80ae653afd4d5eecba4cf6e0e3c71b720382fe5ffe98a42fbb3203802bb1a4989bfd11d8202215bbb
6
+ metadata.gz: db20fe73b659b6a90234537a5058d908ed857e1c1b11092afae45d60bb9bfc4565c8d865a104f54c931518197c6fb834d65fe0c1f36734b3e77ffb6daee81ac0
7
+ data.tar.gz: 96757bbd1e809d05d6a752cce7bfc4a9c0967d83a78ef913f1ed9c807575dc6c415c31d2a7c6ce4adc629c7aade641bbcb088ff5e5c00b130b5df26c964aba19
data/README.md CHANGED
@@ -15,6 +15,20 @@ Compact job server with API, CLI, Web UI and a Sidekiq heart.
15
15
 
16
16
  ---
17
17
 
18
+ * [Installation](#installation)
19
+ * [What's in the Box](#whats-in-the-box)
20
+ * [Quick Start](#quick-start)
21
+ * [Usage](#usage)
22
+ * [Server](#server)
23
+ * [Worker](#worker)
24
+ * [Running jobs from the command line](#running-jobs-from-the-command-line)
25
+ * [Running jobs through the API](#running-jobs-through-the-api)
26
+ * [Building Jobs](#building-jobs)
27
+ * [Loading Additional Code](#loading-additional-code)
28
+ * [Configuration](#configuration)
29
+
30
+ ---
31
+
18
32
  Installation
19
33
  --------------------------------------------------
20
34
 
@@ -107,5 +121,55 @@ $ curl -XPOST localhost:3000/do/Build -d deploy=yes
107
121
  Building Jobs
108
122
  --------------------------------------------------
109
123
 
110
- TODO
124
+ To build a jobs "workspace", start in an empty folder and create a `./jobs`
125
+ subfolder inside it. All your job classes go in this folder (configurable).
126
+
127
+ All job classes will be loaded by any of Jobly's commands.
128
+
129
+ A job class is a simple Ruby class inheriting from
130
+ `[Jobly::Job](/lib/jobly/job.rb)`.
131
+
132
+ The only requirement is that your class implements an `execute` method that
133
+ optionally accepts keyword arguments (recommended), or a hash.
134
+
135
+ Example:
136
+
137
+ ```ruby
138
+ class Hello < Jobly::Job
139
+ def execute(name: 'bob')
140
+ puts "Hello #{name}"
141
+ logger.info "said hello to #{name}"
142
+ end
143
+ end
144
+ ```
145
+
146
+ Note that these classes are simply Jobly-flavored sidekiq jobs, with these
147
+ differences:
148
+
149
+ - You need to implement `execute` instead of `perform`
150
+ - Job arguments are defined as keyword arguments, instead of positional
151
+ arguments.
152
+
153
+
154
+
155
+ Loading Additional Code
156
+ --------------------------------------------------
157
+
158
+ In case your jobs require additional functionality, you may create the
159
+ `./app` folder as a sibling to the `./jobs` folder (configurable).
160
+
161
+ Any ruby files in this folder (and subfolders) will be autmatically loaded
162
+ and available to your jobs.
163
+
164
+
165
+ Configuration
166
+ --------------------------------------------------
167
+
168
+ Configuring Jobly can be done by one of two methods:
169
+
170
+ 1. Setting environment variables.
171
+ 2. Adding a `./config/jobly.rb` file.
111
172
 
173
+ See this [example config file](/examples/02-full/config/jobly.rb) for a full
174
+ annotated configuration example and a list of options with their respective
175
+ environment variables.
@@ -16,7 +16,7 @@ module Jobly
16
16
  def run
17
17
  job = args['JOB']
18
18
  params = args['PARAMS'].to_params
19
- url = "#{Jobly.api_base}/#{job}"
19
+ url = "#{Jobly.api_url}/#{job}"
20
20
 
21
21
  response = if params.empty?
22
22
  HTTP.get url
@@ -10,7 +10,7 @@ module Jobly
10
10
  def self.default_options
11
11
  {
12
12
  environment: ENV['JOBLY_ENVIRONMENT'] || 'development',
13
- api_base: ENV['JOBLY_API_URL'] || 'http://localhost:3000/do',
13
+ api_url: ENV['JOBLY_API_URL'] || 'http://localhost:3000/do',
14
14
  app_path: ENV['JOBLY_APP_PATH'] || 'app',
15
15
  jobs_path: ENV['JOBLY_JOBS_PATH'] || "jobs",
16
16
  config_path: ENV['JOBLY_CONFIG_PATH'] || "config",
data/lib/jobly/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jobly
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jobly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danny Ben Shitrit