jobly 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf08c47fecadf75defd8d0a560c3c8e95f5ba559861bfb1eb86044e3a67bd3a6
4
- data.tar.gz: 395dfe0c8d754f68ddbf469144b8f37748cd825de226e525c51b07b383858d8b
3
+ metadata.gz: 3a7926c9fb8795e011f9580a3f56a11cdab1c2107204a93e7b831d6bfa0953a3
4
+ data.tar.gz: 41e7bc1e01dfeaf5bb20b3aff721585fa4e75cbbd55215eb7b6f6769ea736741
5
5
  SHA512:
6
- metadata.gz: ae2434f84001134c6763c90f1eef5d0c9b00b8755bcf3a9817f2e588ce3e953e6fa23e97d08f207d95ef35db518164d6a322096f9af4eeac644648410b6c9c8d
7
- data.tar.gz: 5c402c8ef8f2cce341ddf70e6630ef8335db8a067f3de3d07f5a0b64f0525d9e755013ed76b8b694db8818ad80089d40e5259759f1178402f7e2c2150f1267e6
6
+ metadata.gz: afd149cf0b665da6791b77bba10c7a6c72d0510f2c2721b4c383427876b1a00749c7ae472cd476801a5ac8fc74d6f4c1846d7f738983720aced8a1f5a551165c
7
+ data.tar.gz: d4b4627453c13796d584f759e523fd4f214684ec7d02e2eb205dd87752145b60b30553d3c8ebb5a9a13d308e7f62b0b0a9c254c2a938942b7b57c9e32f2dd21d
data/README.md CHANGED
@@ -40,14 +40,17 @@ sidekiq backgronud jobs system. It includes the following components:
40
40
  and for running jobs.
41
41
  - **Web API** - for executing jobs.
42
42
  - **Web Dashboard** - including job progress and status.
43
-
43
+ - **Remote Syslog Support** - send output to Papertrail or remote syslog.
44
+ - **Slack Notifications** - report job progress to Slack.
44
45
 
45
46
 
46
47
  Documentation
47
48
  --------------------------------------------------
48
49
 
49
- Visit the [Jobly Documentation][1].
50
+ - Visit the [Jobly documentation][1].
51
+ - Visit the [interactive demo on Katacoda][3].
50
52
 
51
53
 
52
54
  [1]: https://jobly.dannyb.co
53
- [2]: https://github.com/dannyben/docker-jobly
55
+ [2]: https://github.com/dannyben/docker-jobly
56
+ [3]: https://www.katacoda.com/dannyb/scenarios/jobly
@@ -10,6 +10,7 @@ module Jobly
10
10
  def run
11
11
  line "custom config file", short_config_path, !Jobly.custom_config?
12
12
  Jobly.options.each do |key, value|
13
+ next unless value
13
14
  if key.to_s.end_with? '_path'
14
15
  line key, value, !Dir.exist?(value)
15
16
  else
@@ -21,7 +22,7 @@ module Jobly
21
22
  private
22
23
 
23
24
  def short_config_path
24
- Jobly.config_file.sub "#{Dir.pwd}", '.'
25
+ Jobly.config_file.sub "#{Dir.pwd}/", ''
25
26
  end
26
27
 
27
28
  def line(key, value, attention=false)
@@ -5,6 +5,9 @@ module Jobly
5
5
  include JobExtensions::OptionAccessors
6
6
  include JobExtensions::Actions
7
7
  include JobExtensions::Solo
8
+ include JobExtensions::Slack
9
+ include JobExtensions::Shell
10
+
8
11
  using KeywordArgs
9
12
  using ToSlug
10
13
 
@@ -0,0 +1,11 @@
1
+ require 'tty-command'
2
+
3
+ module Jobly
4
+ module JobExtensions
5
+ module Shell
6
+ def shell
7
+ @shell ||= TTY::Command.new(output: logger, color: false)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,45 @@
1
+ require 'slack-notifier'
2
+
3
+ module Jobly
4
+ module JobExtensions
5
+ module Slack
6
+ def self.included(base)
7
+ base.extend ClassMethods
8
+ end
9
+
10
+ module ClassMethods
11
+ def slack_channel(channel = nil)
12
+ if channel
13
+ @slack_channel = channel
14
+ else
15
+ @slack_channel ||= Jobly.slack_channel
16
+ end
17
+ end
18
+
19
+ def slack_user(user = nil)
20
+ if user
21
+ @slack_user = user
22
+ else
23
+ @slack_user ||= Jobly.slack_user
24
+ end
25
+ end
26
+ end
27
+
28
+ def slack
29
+ @slack ||= slack!
30
+ end
31
+
32
+ private
33
+
34
+ def slack!
35
+ raise ArgumentError, "Slack webhook is not set" unless Jobly.slack_webhook
36
+ opts = {
37
+ channel: self.class.slack_channel,
38
+ username: self.class.slack_user
39
+ }
40
+ ::Slack::Notifier.new Jobly.slack_webhook, opts
41
+ end
42
+
43
+ end
44
+ end
45
+ end
@@ -17,6 +17,9 @@ module Jobly
17
17
  redis_url: ENV['JOBLY_REDIS_URL'] || "redis://localhost:6379/0",
18
18
  status_expiration: ENV['JOBLY_STATUS_EXPIRATION']&.to_i || 30,
19
19
  jobs_namespace: ENV['JOBLY_JOBS_NAMESPACE'],
20
+ slack_channel: ENV['JOBLY_SLACK_CHANNEL'] || "#general",
21
+ slack_user: ENV['JOBLY_SLACK_USER'] || "Jobly",
22
+ slack_webhook: ENV['JOBLY_SLACK_WEBHOOK'],
20
23
  log: ENV['JOBLY_LOG'],
21
24
  auth: ENV['JOBLY_AUTH'],
22
25
  mounts: nil,
@@ -1,3 +1,3 @@
1
1
  module Jobly
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
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.2.5
4
+ version: 0.2.6
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-20 00:00:00.000000000 Z
11
+ date: 2019-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mister_bin
@@ -164,6 +164,34 @@ dependencies:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: '2.0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: tty-command
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '0.8'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '0.8'
181
+ - !ruby/object:Gem::Dependency
182
+ name: slack-notifier
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - "~>"
186
+ - !ruby/object:Gem::Version
187
+ version: '2.3'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - "~>"
193
+ - !ruby/object:Gem::Version
194
+ version: '2.3'
167
195
  description: Execute background jobs and build tasks on this sidekiq-based job server
168
196
  email: db@dannyben.com
169
197
  executables:
@@ -190,6 +218,8 @@ files:
190
218
  - lib/jobly/job.rb
191
219
  - lib/jobly/job_extensions/actions.rb
192
220
  - lib/jobly/job_extensions/option_accessors.rb
221
+ - lib/jobly/job_extensions/shell.rb
222
+ - lib/jobly/job_extensions/slack.rb
193
223
  - lib/jobly/job_extensions/solo.rb
194
224
  - lib/jobly/jobs.rb
195
225
  - lib/jobly/log.rb