producer-core 0.1.9 → 0.1.10
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 +4 -4
- data/Guardfile +1 -1
- data/lib/producer/core/action.rb +6 -0
- data/lib/producer/core/actions/echo.rb +1 -1
- data/lib/producer/core/actions/file_writer.rb +1 -1
- data/lib/producer/core/actions/shell_command.rb +1 -1
- data/lib/producer/core/cli.rb +1 -1
- data/lib/producer/core/recipe/dsl.rb +4 -8
- data/lib/producer/core/recipe.rb +1 -1
- data/lib/producer/core/remote/environment.rb +1 -1
- data/lib/producer/core/remote/fs.rb +1 -1
- data/lib/producer/core/task/dsl.rb +4 -4
- data/lib/producer/core/task.rb +2 -2
- data/lib/producer/core/tests/has_env.rb +1 -1
- data/lib/producer/core/tests/has_file.rb +1 -1
- data/lib/producer/core/version.rb +1 -1
- data/lib/producer/core/{interpreter.rb → worker.rb} +1 -1
- data/lib/producer/core.rb +1 -1
- data/spec/producer/core/action_spec.rb +21 -1
- data/spec/producer/core/actions/echo_spec.rb +1 -1
- data/spec/producer/core/actions/file_writer_spec.rb +2 -2
- data/spec/producer/core/actions/shell_command_spec.rb +5 -7
- data/spec/producer/core/recipe/dsl_spec.rb +16 -12
- data/spec/producer/core/recipe_spec.rb +7 -29
- data/spec/producer/core/remote/environment_spec.rb +3 -3
- data/spec/producer/core/remote/fs_spec.rb +4 -4
- data/spec/producer/core/task/dsl_spec.rb +11 -7
- data/spec/producer/core/task_spec.rb +4 -4
- data/spec/producer/core/tests/has_env_spec.rb +4 -4
- data/spec/producer/core/tests/has_file_spec.rb +2 -2
- data/spec/producer/core/{interpreter_spec.rb → worker_spec.rb} +6 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c778784a6586dca4a73ef7c76bbb345ed990d3d4
|
4
|
+
data.tar.gz: 05ae1a88da59938098403eb45a4e98457ef6c68b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22156c33ab610cebd1ee5f82c3f6cf60f50f3a3b2c5c7d0a6194d30fcb958635201e34b86af415b3d6885a1d0b3cbeb3c38e52a752f7457626164d37c463d379
|
7
|
+
data.tar.gz: 8669e86c30cb7a8be71420f85f4280c0a8b67ef61520e5c8c7f37c849a0eedaed3c1184d385ff039c3920aabef6c08f17981f199dfe22c19b133bb21545b0bda
|
data/Guardfile
CHANGED
@@ -4,7 +4,7 @@ guard :cucumber, cli: '--format pretty --quiet' do
|
|
4
4
|
watch(%r{\Afeatures/step_definitions/.+_steps\.rb\z}) { 'features' }
|
5
5
|
end
|
6
6
|
|
7
|
-
guard :rspec do
|
7
|
+
guard :rspec, cmd: 'rspec -f doc', all_after_pass: true do
|
8
8
|
watch(%r{\Aspec/.+_spec\.rb\z})
|
9
9
|
watch(%r{\Alib/(.+)\.rb\z}) { |m| "spec/#{m[1]}_spec.rb" }
|
10
10
|
watch('spec/spec_helper.rb') { 'spec' }
|
data/lib/producer/core/action.rb
CHANGED
data/lib/producer/core/cli.rb
CHANGED
@@ -2,16 +2,16 @@ module Producer
|
|
2
2
|
module Core
|
3
3
|
class Recipe
|
4
4
|
class DSL
|
5
|
-
attr_reader :tasks
|
5
|
+
attr_reader :env, :tasks
|
6
6
|
|
7
|
-
def initialize(code = nil, &block)
|
7
|
+
def initialize(env, code = nil, &block)
|
8
|
+
@env = env
|
8
9
|
@code = code
|
9
10
|
@block = block
|
10
11
|
@tasks = []
|
11
12
|
end
|
12
13
|
|
13
|
-
def evaluate
|
14
|
-
@env = env
|
14
|
+
def evaluate
|
15
15
|
if @code
|
16
16
|
instance_eval @code
|
17
17
|
else
|
@@ -22,10 +22,6 @@ module Producer
|
|
22
22
|
|
23
23
|
private
|
24
24
|
|
25
|
-
def env
|
26
|
-
@env
|
27
|
-
end
|
28
|
-
|
29
25
|
def source(filepath)
|
30
26
|
instance_eval File.read("./#{filepath}.rb"), "#{filepath}.rb"
|
31
27
|
end
|
data/lib/producer/core/recipe.rb
CHANGED
@@ -15,16 +15,16 @@ module Producer
|
|
15
15
|
|
16
16
|
define_action :file_write, Actions::FileWriter
|
17
17
|
|
18
|
-
attr_accessor :actions
|
18
|
+
attr_accessor :env, :actions
|
19
19
|
|
20
|
-
def initialize(&block)
|
20
|
+
def initialize(env, &block)
|
21
|
+
@env = env
|
21
22
|
@block = block
|
22
23
|
@actions = []
|
23
24
|
@condition = true
|
24
25
|
end
|
25
26
|
|
26
|
-
def evaluate(
|
27
|
-
@env = env
|
27
|
+
def evaluate(*args)
|
28
28
|
instance_exec *args, &@block
|
29
29
|
end
|
30
30
|
|
data/lib/producer/core/task.rb
CHANGED
data/lib/producer/core.rb
CHANGED
@@ -14,7 +14,6 @@ require 'producer/core/condition'
|
|
14
14
|
require 'producer/core/condition/dsl'
|
15
15
|
require 'producer/core/env'
|
16
16
|
require 'producer/core/errors'
|
17
|
-
require 'producer/core/interpreter'
|
18
17
|
require 'producer/core/recipe'
|
19
18
|
require 'producer/core/recipe/dsl'
|
20
19
|
require 'producer/core/remote'
|
@@ -23,3 +22,4 @@ require 'producer/core/remote/fs'
|
|
23
22
|
require 'producer/core/task'
|
24
23
|
require 'producer/core/task/dsl'
|
25
24
|
require 'producer/core/version'
|
25
|
+
require 'producer/core/worker'
|
@@ -2,7 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Producer::Core
|
4
4
|
describe Action do
|
5
|
-
let(:
|
5
|
+
let(:output) { StringIO.new }
|
6
|
+
let(:env) { Env.new(output: output) }
|
6
7
|
let(:arguments) { [:some, :arguments] }
|
7
8
|
subject(:action) { Action.new(env, *arguments) }
|
8
9
|
|
@@ -17,5 +18,24 @@ module Producer::Core
|
|
17
18
|
expect(action.arguments).to eq arguments
|
18
19
|
end
|
19
20
|
end
|
21
|
+
|
22
|
+
describe '#output' do
|
23
|
+
it 'delegates to env output' do
|
24
|
+
action.output.puts 'some content'
|
25
|
+
expect(output.string).to eq "some content\n"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#remote' do
|
30
|
+
it 'returns env remote' do
|
31
|
+
expect(action.remote).to be action.env.remote
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '#fs' do
|
36
|
+
it 'returns env remote fs' do
|
37
|
+
expect(action.fs).to be action.env.remote.fs
|
38
|
+
end
|
39
|
+
end
|
20
40
|
end
|
21
41
|
end
|
@@ -7,7 +7,7 @@ module Producer::Core
|
|
7
7
|
subject(:echo) { Actions::Echo.new(env, text) }
|
8
8
|
|
9
9
|
describe '#apply' do
|
10
|
-
it 'writes the given string to env
|
10
|
+
it 'writes the given string to env output with a record separator' do
|
11
11
|
echo.apply
|
12
12
|
expect(env.output.string).to eq "hello\n"
|
13
13
|
end
|
@@ -8,8 +8,8 @@ module Producer::Core
|
|
8
8
|
subject(:writer) { Actions::FileWriter.new(env, path, content) }
|
9
9
|
|
10
10
|
describe '#apply' do
|
11
|
-
it '
|
12
|
-
expect(
|
11
|
+
it 'writes content to file on remote filesystem' do
|
12
|
+
expect(writer.fs).to receive(:file_write).with(path, content)
|
13
13
|
writer.apply
|
14
14
|
end
|
15
15
|
end
|
@@ -8,17 +8,15 @@ module Producer::Core
|
|
8
8
|
subject(:sh) { Actions::ShellCommand.new(env, command) }
|
9
9
|
|
10
10
|
describe '#apply' do
|
11
|
-
|
12
|
-
|
13
|
-
it 'delegates the call to env.remote.execute method' do
|
14
|
-
expect(env.remote).to receive(:execute).with(command)
|
11
|
+
it 'executes the remote command' do
|
12
|
+
expect(sh.remote).to receive(:execute).with(command)
|
15
13
|
sh.apply
|
16
14
|
end
|
17
15
|
|
18
|
-
it 'writes the returned output
|
19
|
-
allow(
|
16
|
+
it 'writes the returned output with a record separator' do
|
17
|
+
allow(sh.remote).to receive(:execute) { command_args }
|
20
18
|
sh.apply
|
21
|
-
expect(
|
19
|
+
expect(sh.output.string).to eq "#{command_args}\n"
|
22
20
|
end
|
23
21
|
end
|
24
22
|
end
|
@@ -6,16 +6,20 @@ module Producer::Core
|
|
6
6
|
|
7
7
|
let(:code) { proc { :some_recipe_code } }
|
8
8
|
let(:env) { double('env').as_null_object }
|
9
|
-
subject(:dsl) { Recipe::DSL.new(&code) }
|
9
|
+
subject(:dsl) { Recipe::DSL.new(env, &code) }
|
10
10
|
|
11
11
|
describe '#initialize' do
|
12
|
+
it 'assigns the given env' do
|
13
|
+
expect(dsl.env).to be env
|
14
|
+
end
|
15
|
+
|
12
16
|
it 'assigns no task' do
|
13
|
-
expect(dsl.
|
17
|
+
expect(dsl.tasks).to be_empty
|
14
18
|
end
|
15
19
|
|
16
20
|
context 'when a string of code is given as argument' do
|
17
21
|
let(:code) { 'some_code' }
|
18
|
-
subject(:dsl) { Recipe::DSL.new(code) }
|
22
|
+
subject(:dsl) { Recipe::DSL.new(env, code) }
|
19
23
|
|
20
24
|
it 'assigns the string of code' do
|
21
25
|
expect(dsl.instance_eval { @code }).to eq code
|
@@ -30,44 +34,44 @@ module Producer::Core
|
|
30
34
|
end
|
31
35
|
|
32
36
|
describe '#tasks' do
|
33
|
-
let(:code) { proc { task(:some_task) {
|
37
|
+
let(:code) { proc { task(:some_task) {} } }
|
34
38
|
|
35
39
|
it 'returns registered tasks' do
|
36
|
-
dsl.evaluate
|
40
|
+
dsl.evaluate
|
37
41
|
expect(dsl.tasks[0].name).to eq :some_task
|
38
42
|
end
|
39
43
|
end
|
40
44
|
|
41
45
|
describe '#evaluate' do
|
42
46
|
it 'evaluates its code' do
|
43
|
-
dsl = Recipe::DSL.new { throw :recipe_code }
|
44
|
-
expect { dsl.evaluate
|
47
|
+
dsl = Recipe::DSL.new(env) { throw :recipe_code }
|
48
|
+
expect { dsl.evaluate }.to throw_symbol :recipe_code
|
45
49
|
end
|
46
50
|
|
47
51
|
it 'returns itself' do
|
48
|
-
expect(dsl.evaluate
|
52
|
+
expect(dsl.evaluate).to eq dsl
|
49
53
|
end
|
50
54
|
end
|
51
55
|
|
52
56
|
context 'DSL specific methods' do
|
53
|
-
subject(:dsl) { Recipe::DSL.new(&code).evaluate
|
57
|
+
subject(:dsl) { Recipe::DSL.new(env, &code).evaluate }
|
54
58
|
|
55
59
|
describe '#env' do
|
56
60
|
let(:code) { proc { env.some_message } }
|
57
61
|
|
58
62
|
it 'returns the current environment' do
|
59
63
|
expect(env).to receive :some_message
|
60
|
-
dsl.evaluate
|
64
|
+
dsl.evaluate
|
61
65
|
end
|
62
66
|
end
|
63
67
|
|
64
68
|
describe '#source' do
|
65
69
|
let(:filepath) { fixture_path_for 'recipes/throw' }
|
66
70
|
let(:code) { "source '#{filepath}'" }
|
67
|
-
subject(:dsl) { Recipe::DSL.new(code) }
|
71
|
+
subject(:dsl) { Recipe::DSL.new(env, code) }
|
68
72
|
|
69
73
|
it 'sources the recipe given as argument' do
|
70
|
-
expect { dsl.evaluate
|
74
|
+
expect { dsl.evaluate }.to throw_symbol :recipe_code
|
71
75
|
end
|
72
76
|
end
|
73
77
|
|
@@ -7,35 +7,13 @@ module Producer::Core
|
|
7
7
|
subject(:recipe) { Recipe.new }
|
8
8
|
|
9
9
|
describe '.evaluate_from_file' do
|
10
|
-
let(:env)
|
11
|
-
let(:filepath)
|
12
|
-
|
10
|
+
let(:env) { double 'env' }
|
11
|
+
let(:filepath) { fixture_path_for 'recipes/some_recipe.rb' }
|
12
|
+
subject(:recipe) { Recipe.evaluate_from_file(filepath, env) }
|
13
13
|
|
14
|
-
it '
|
15
|
-
expect(
|
16
|
-
Recipe.evaluate_from_file(filepath, env)
|
14
|
+
it 'returns an evaluated recipe' do
|
15
|
+
expect(recipe.tasks.map(&:name)).to eq [:some_task, :another_task]
|
17
16
|
end
|
18
|
-
|
19
|
-
it 'evaluates the DSL sandbox code with given environment' do
|
20
|
-
dsl = double('dsl').as_null_object
|
21
|
-
allow(Recipe::DSL).to receive(:new) { dsl }
|
22
|
-
expect(dsl).to receive(:evaluate).with(env)
|
23
|
-
Recipe.evaluate_from_file(filepath, env)
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'builds a recipe with evaluated tasks' do
|
27
|
-
dsl = Recipe::DSL.new { task(:some_task) { } }
|
28
|
-
allow(Recipe::DSL).to receive(:new) { dsl }
|
29
|
-
expect(Recipe).to receive(:new).with(dsl.tasks)
|
30
|
-
Recipe.evaluate_from_file(filepath, env)
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'returns the recipe' do
|
34
|
-
recipe = double('recipe').as_null_object
|
35
|
-
allow(Recipe).to receive(:new) { recipe }
|
36
|
-
expect(Recipe.evaluate_from_file(filepath, env)).to be recipe
|
37
|
-
end
|
38
|
-
|
39
17
|
end
|
40
18
|
|
41
19
|
describe '#initialize' do
|
@@ -46,8 +24,8 @@ module Producer::Core
|
|
46
24
|
end
|
47
25
|
|
48
26
|
context 'when tasks are given as argument' do
|
49
|
-
let(:tasks)
|
50
|
-
|
27
|
+
let(:tasks) { [double('task')] }
|
28
|
+
subject(:recipe) { Recipe.new(tasks) }
|
51
29
|
|
52
30
|
it 'assigns the tasks' do
|
53
31
|
expect(recipe.tasks).to eq tasks
|
@@ -33,13 +33,13 @@ module Producer::Core
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
describe '#
|
36
|
+
describe '#key?' do
|
37
37
|
let(:key) { 'SOME_KEY' }
|
38
38
|
|
39
39
|
it 'forwards the message to @variables' do
|
40
40
|
expect(environment.instance_eval { @variables })
|
41
|
-
.to receive(:
|
42
|
-
environment.
|
41
|
+
.to receive(:key?).with(key)
|
42
|
+
environment.key? key
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -33,7 +33,7 @@ module Producer::Core
|
|
33
33
|
|
34
34
|
# FIXME: We rely a lot on mocking net-sftp heavily, while we already use a
|
35
35
|
# part of net-ssh story helpers, which are more close to integration tests.
|
36
|
-
describe '#
|
36
|
+
describe '#file?', :ssh do
|
37
37
|
let(:file_path) { 'some_file_path' }
|
38
38
|
let(:stat) { double 'stat' }
|
39
39
|
|
@@ -47,7 +47,7 @@ module Producer::Core
|
|
47
47
|
before { allow(stat).to receive(:file?) { true } }
|
48
48
|
|
49
49
|
it 'returns true' do
|
50
|
-
expect(fs.
|
50
|
+
expect(fs.file? file_path).to be true
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -55,7 +55,7 @@ module Producer::Core
|
|
55
55
|
before { allow(stat).to receive(:file?) { false } }
|
56
56
|
|
57
57
|
it 'returns false' do
|
58
|
-
expect(fs.
|
58
|
+
expect(fs.file? file_path).to be false
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
@@ -68,7 +68,7 @@ module Producer::Core
|
|
68
68
|
end
|
69
69
|
|
70
70
|
it 'returns false' do
|
71
|
-
expect(fs.
|
71
|
+
expect(fs.file? file_path).to be false
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
@@ -2,9 +2,9 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module Producer::Core
|
4
4
|
describe Task::DSL do
|
5
|
-
let(:block) { proc {
|
5
|
+
let(:block) { proc {} }
|
6
6
|
let(:env) { double 'env' }
|
7
|
-
subject(:dsl) { Task::DSL.new(&block) }
|
7
|
+
subject(:dsl) { Task::DSL.new(env, &block) }
|
8
8
|
|
9
9
|
%w[echo sh file_write].each do |action|
|
10
10
|
it "has `#{action}' action defined" do
|
@@ -20,6 +20,10 @@ module Producer::Core
|
|
20
20
|
end
|
21
21
|
|
22
22
|
describe '#initialize' do
|
23
|
+
it 'assigns the given env' do
|
24
|
+
expect(dsl.env).to be env
|
25
|
+
end
|
26
|
+
|
23
27
|
it 'assigns no action' do
|
24
28
|
expect(dsl.actions).to be_empty
|
25
29
|
end
|
@@ -49,7 +53,7 @@ module Producer::Core
|
|
49
53
|
let(:block) { proc { throw :task_code } }
|
50
54
|
|
51
55
|
it 'evaluates its code' do
|
52
|
-
expect { dsl.evaluate
|
56
|
+
expect { dsl.evaluate }
|
53
57
|
.to throw_symbol :task_code
|
54
58
|
end
|
55
59
|
|
@@ -57,7 +61,7 @@ module Producer::Core
|
|
57
61
|
let(:block) { proc { |e| throw e } }
|
58
62
|
|
59
63
|
it 'passes arguments as block parameters' do
|
60
|
-
expect { dsl.evaluate
|
64
|
+
expect { dsl.evaluate :some_argument }
|
61
65
|
.to throw_symbol :some_argument
|
62
66
|
end
|
63
67
|
end
|
@@ -68,7 +72,7 @@ module Producer::Core
|
|
68
72
|
|
69
73
|
before do
|
70
74
|
Task::DSL.define_action(:some_action, some_action_class)
|
71
|
-
dsl.evaluate
|
75
|
+
dsl.evaluate
|
72
76
|
end
|
73
77
|
|
74
78
|
it 'registers the action' do
|
@@ -82,7 +86,7 @@ module Producer::Core
|
|
82
86
|
end
|
83
87
|
|
84
88
|
context 'DSL specific methods' do
|
85
|
-
subject(:dsl) { Task::DSL.new(&block).evaluate
|
89
|
+
subject(:dsl) { Task::DSL.new(env, &block).evaluate }
|
86
90
|
|
87
91
|
describe '#condition' do
|
88
92
|
context 'when a block is given' do
|
@@ -90,7 +94,7 @@ module Producer::Core
|
|
90
94
|
|
91
95
|
it 'builds a new evaluated condition' do
|
92
96
|
expect(Condition)
|
93
|
-
.to receive
|
97
|
+
.to receive :evaluate do |&b|
|
94
98
|
expect(b.call).to eq :some_value
|
95
99
|
end
|
96
100
|
dsl
|
@@ -12,19 +12,19 @@ module Producer::Core
|
|
12
12
|
let(:args) { [:some, :arguments] }
|
13
13
|
let(:block) { proc { :some_task_code } }
|
14
14
|
|
15
|
-
it 'builds a new DSL sandbox with given code' do
|
15
|
+
it 'builds a new DSL sandbox with given env and code' do
|
16
16
|
dsl = double('dsl').as_null_object
|
17
|
-
expect(Task::DSL).to receive(:new).with(
|
17
|
+
expect(Task::DSL).to receive(:new).with(env) do |&b|
|
18
18
|
expect(b).to be block
|
19
19
|
dsl
|
20
20
|
end
|
21
21
|
Task.evaluate(name, env, *args, &block)
|
22
22
|
end
|
23
23
|
|
24
|
-
it 'evaluates the DSL sandbox code with given
|
24
|
+
it 'evaluates the DSL sandbox code with given arguments' do
|
25
25
|
dsl = double('dsl').as_null_object
|
26
26
|
allow(Task::DSL).to receive(:new) { dsl }
|
27
|
-
expect(dsl).to receive(:evaluate).with(
|
27
|
+
expect(dsl).to receive(:evaluate).with(*args)
|
28
28
|
Task.evaluate(name, env, *args, &block)
|
29
29
|
end
|
30
30
|
|
@@ -18,22 +18,22 @@ module Producer::Core
|
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'stringifies the queried variable name' do
|
21
|
-
expect(environment).to receive(:
|
21
|
+
expect(environment).to receive(:key?).with(kind_of(String))
|
22
22
|
has_env.verify
|
23
23
|
end
|
24
24
|
|
25
25
|
it 'upcases the queried variable name' do
|
26
|
-
expect(environment).to receive(:
|
26
|
+
expect(environment).to receive(:key?).with('SOME_VARIABLE_NAME')
|
27
27
|
has_env.verify
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'returns true when remote environment var is defined' do
|
31
|
-
allow(environment).to receive(:
|
31
|
+
allow(environment).to receive(:key?) { true }
|
32
32
|
expect(has_env.verify).to be true
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'returns false when remote environment var is not defined' do
|
36
|
-
allow(environment).to receive(:
|
36
|
+
allow(environment).to receive(:key?) { false }
|
37
37
|
expect(has_env.verify).to be false
|
38
38
|
end
|
39
39
|
end
|
@@ -14,13 +14,13 @@ module Producer::Core
|
|
14
14
|
before { sftp_story }
|
15
15
|
|
16
16
|
it 'delegates the call on remote FS' do
|
17
|
-
expect(env.remote.fs).to receive(:
|
17
|
+
expect(env.remote.fs).to receive(:file?).with(filepath)
|
18
18
|
has_file.verify
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'returns the file existence' do
|
22
22
|
existence = double 'existence'
|
23
|
-
allow(env.remote.fs).to receive(:
|
23
|
+
allow(env.remote.fs).to receive(:file?) { existence }
|
24
24
|
expect(has_file.verify).to be existence
|
25
25
|
end
|
26
26
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
module Producer::Core
|
4
|
-
describe
|
5
|
-
subject(:
|
4
|
+
describe Worker do
|
5
|
+
subject(:worker) { described_class.new }
|
6
6
|
|
7
7
|
describe '#process' do
|
8
8
|
it 'processes each task' do
|
9
|
-
expect(
|
10
|
-
|
9
|
+
expect(worker).to receive(:process_task).with(:some_task)
|
10
|
+
worker.process [:some_task]
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -18,7 +18,7 @@ module Producer::Core
|
|
18
18
|
context 'when task condition is met' do
|
19
19
|
it 'applies the actions' do
|
20
20
|
expect(action).to receive :apply
|
21
|
-
|
21
|
+
worker.process_task task
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -27,7 +27,7 @@ module Producer::Core
|
|
27
27
|
|
28
28
|
it 'does not apply the actions' do
|
29
29
|
expect(action).not_to receive :apply
|
30
|
-
|
30
|
+
worker.process_task task
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: producer-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thibault Jouan
|
@@ -140,7 +140,6 @@ files:
|
|
140
140
|
- lib/producer/core/condition/dsl.rb
|
141
141
|
- lib/producer/core/env.rb
|
142
142
|
- lib/producer/core/errors.rb
|
143
|
-
- lib/producer/core/interpreter.rb
|
144
143
|
- lib/producer/core/recipe.rb
|
145
144
|
- lib/producer/core/recipe/dsl.rb
|
146
145
|
- lib/producer/core/remote.rb
|
@@ -152,6 +151,7 @@ files:
|
|
152
151
|
- lib/producer/core/tests/has_env.rb
|
153
152
|
- lib/producer/core/tests/has_file.rb
|
154
153
|
- lib/producer/core/version.rb
|
154
|
+
- lib/producer/core/worker.rb
|
155
155
|
- producer-core.gemspec
|
156
156
|
- spec/fixtures/recipes/empty.rb
|
157
157
|
- spec/fixtures/recipes/some_recipe.rb
|
@@ -164,7 +164,6 @@ files:
|
|
164
164
|
- spec/producer/core/condition/dsl_spec.rb
|
165
165
|
- spec/producer/core/condition_spec.rb
|
166
166
|
- spec/producer/core/env_spec.rb
|
167
|
-
- spec/producer/core/interpreter_spec.rb
|
168
167
|
- spec/producer/core/recipe/dsl_spec.rb
|
169
168
|
- spec/producer/core/recipe_spec.rb
|
170
169
|
- spec/producer/core/remote/environment_spec.rb
|
@@ -175,6 +174,7 @@ files:
|
|
175
174
|
- spec/producer/core/test_spec.rb
|
176
175
|
- spec/producer/core/tests/has_env_spec.rb
|
177
176
|
- spec/producer/core/tests/has_file_spec.rb
|
177
|
+
- spec/producer/core/worker_spec.rb
|
178
178
|
- spec/spec_helper.rb
|
179
179
|
- spec/support/exit_helpers.rb
|
180
180
|
- spec/support/fixtures_helpers.rb
|
@@ -237,7 +237,6 @@ test_files:
|
|
237
237
|
- spec/producer/core/condition/dsl_spec.rb
|
238
238
|
- spec/producer/core/condition_spec.rb
|
239
239
|
- spec/producer/core/env_spec.rb
|
240
|
-
- spec/producer/core/interpreter_spec.rb
|
241
240
|
- spec/producer/core/recipe/dsl_spec.rb
|
242
241
|
- spec/producer/core/recipe_spec.rb
|
243
242
|
- spec/producer/core/remote/environment_spec.rb
|
@@ -248,6 +247,7 @@ test_files:
|
|
248
247
|
- spec/producer/core/test_spec.rb
|
249
248
|
- spec/producer/core/tests/has_env_spec.rb
|
250
249
|
- spec/producer/core/tests/has_file_spec.rb
|
250
|
+
- spec/producer/core/worker_spec.rb
|
251
251
|
- spec/spec_helper.rb
|
252
252
|
- spec/support/exit_helpers.rb
|
253
253
|
- spec/support/fixtures_helpers.rb
|