kuroko2 0.4.0 → 0.4.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 +2 -0
- data/app/models/kuroko2/job_definition.rb +6 -4
- data/lib/autoload/kuroko2/workflow/node.rb +6 -6
- data/lib/kuroko2/engine.rb +1 -1
- data/lib/kuroko2/version.rb +1 -1
- data/spec/settings_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 051e564e4aaa5ec04697344bfe05aec09352b497
|
4
|
+
data.tar.gz: b0564f4086668ce4d6d200fd8d9bca0feb4c2282
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0446977e4059b15f880a905e0a2fde9949b4c676d791984f29ea2ec15cbd4e855fa9e4e73543b79fbf57b65031f13ca84b4017525de03bbdf7d810d46eb50ea7'
|
7
|
+
data.tar.gz: df867061f7bc67b6486959ef33f2a2555b817b88c53e7029d0997dc4173515b0eb07f698b89171464d214f6e6092ae66b9cbe279b74ae213267374981e7d82d9
|
data/README.md
CHANGED
@@ -67,10 +67,12 @@ class Kuroko2::JobDefinition < Kuroko2::ApplicationRecord
|
|
67
67
|
validate :script_syntax
|
68
68
|
validate :validate_number_of_admins
|
69
69
|
validates :hipchat_additional_text, length: { maximum: 180 }
|
70
|
-
validates :slack_channel,
|
71
|
-
|
72
|
-
|
73
|
-
|
70
|
+
validates :slack_channel,
|
71
|
+
length: { maximum: 22, too_long: ' is too long (maximum is 21 characters without `#` symbol at the head)' },
|
72
|
+
format: {
|
73
|
+
with: /\A#[^\.\s]+\z/, allow_blank: true,
|
74
|
+
message: ' must start with # and must not include any dots or spaces'
|
75
|
+
}
|
74
76
|
validates :webhook_url, format: { with: /\A#{URI::regexp(%w(http https))}\z/, allow_blank: true }
|
75
77
|
|
76
78
|
def proceed_multi_instance?
|
@@ -2,7 +2,7 @@ module Kuroko2
|
|
2
2
|
module Workflow
|
3
3
|
class Node
|
4
4
|
PATH_REGEXP = %r(\A(?:/|(?:/\d+-[a-z0-9_]+)+)\z)
|
5
|
-
|
5
|
+
TASK_REGISTRY = {
|
6
6
|
root: Task::Sequence,
|
7
7
|
noop: Task::Noop,
|
8
8
|
sequence: Task::Sequence,
|
@@ -28,20 +28,20 @@ module Kuroko2
|
|
28
28
|
def self.register(key: nil, klass:)
|
29
29
|
key ||= klass.to_s.demodulize.underscore.to_sym
|
30
30
|
|
31
|
-
unless
|
32
|
-
|
31
|
+
unless TASK_REGISTRY.has_key?(key)
|
32
|
+
TASK_REGISTRY.store(key, klass)
|
33
33
|
else
|
34
|
-
Kuroko2.logger.warn("Unable to add '#{klass}' to task
|
34
|
+
Kuroko2.logger.warn("Unable to add '#{klass}' to task registry. '#{TASK_REGISTRY[key]}' is already registered.")
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
38
|
def self.deregister(key)
|
39
|
-
|
39
|
+
TASK_REGISTRY.delete(key)
|
40
40
|
end
|
41
41
|
|
42
42
|
def initialize(type, option = nil)
|
43
43
|
@type = type.to_sym
|
44
|
-
@task_klass =
|
44
|
+
@task_klass = TASK_REGISTRY.fetch(@type, nil)
|
45
45
|
@option = option.try(:strip)
|
46
46
|
@parent = nil
|
47
47
|
@children = []
|
data/lib/kuroko2/engine.rb
CHANGED
@@ -31,7 +31,7 @@ module Kuroko2
|
|
31
31
|
|
32
32
|
if Kuroko2.config.custom_tasks
|
33
33
|
Kuroko2.config.custom_tasks.each do |key, klass|
|
34
|
-
unless Workflow::Node::
|
34
|
+
unless Workflow::Node::TASK_REGISTRY.has_key?(key)
|
35
35
|
Workflow::Node.register(
|
36
36
|
key: key.to_sym,
|
37
37
|
klass: Workflow::Task.const_get(klass, false)
|
data/lib/kuroko2/version.rb
CHANGED
data/spec/settings_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'rails_helper'
|
|
3
3
|
module Kuroko2
|
4
4
|
describe 'Check if settings is loaded' do
|
5
5
|
it 'loads custom tasks' do
|
6
|
-
expect(Workflow::Node::
|
6
|
+
expect(Workflow::Node::TASK_REGISTRY).to have_key(:custom_task1)
|
7
7
|
expect(Workflow::ScriptParser.new('custom_task1:').parse).to be_a(Workflow::Node)
|
8
8
|
end
|
9
9
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kuroko2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naoto Takai
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-05-
|
12
|
+
date: 2017-05-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|