gush 0.0.1 → 0.1

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.
@@ -7,21 +7,55 @@ describe Gush::Workflow do
7
7
  context "when configure option is true" do
8
8
  it "runs #configure method " do
9
9
  expect_any_instance_of(TestWorkflow).to receive(:configure)
10
- TestWorkflow.new("name", configure: true)
10
+ TestWorkflow.new(true)
11
+ end
12
+ end
13
+
14
+ context "when configure option is false" do
15
+ it "it doesn't run #configure method " do
16
+ expect_any_instance_of(TestWorkflow).to_not receive(:configure)
17
+ TestWorkflow.new(false)
11
18
  end
12
19
  end
13
20
  end
14
21
 
15
- describe "#stop!" do
22
+ describe "#save" do
23
+ context "workflow not persisted" do
24
+ it "sets persisted to true" do
25
+ flow = TestWorkflow.new
26
+ flow.save
27
+ expect(flow.persisted).to be(true)
28
+ end
29
+
30
+ it "assigns new unique id" do
31
+ flow = TestWorkflow.new
32
+ expect(flow.id).to eq(nil)
33
+ flow.save
34
+ expect(flow.id).to_not be_nil
35
+ end
36
+ end
37
+
38
+ context "workflow persisted" do
39
+ it "does not assign new id" do
40
+ flow = TestWorkflow.new
41
+ flow.save
42
+ id = flow.id
43
+ flow.save
44
+ expect(flow.id).to eq(id)
45
+ end
46
+ end
47
+ end
48
+
49
+ describe "#mark_as_stopped" do
16
50
  it "marks workflow as stopped" do
17
- expect{ subject.stop! }.to change{subject.stopped?}.from(false).to(true)
51
+ expect{ subject.mark_as_stopped }.to change{subject.stopped?}.from(false).to(true)
18
52
  end
19
53
  end
20
54
 
21
- describe "#start!" do
55
+ describe "#mark_as_started" do
22
56
  it "removes stopped flag" do
23
57
  subject.stopped = true
24
- expect{ subject.start! }.to change{subject.stopped?}.from(true).to(false)
58
+ expect{ subject.mark_as_started }.to change{subject.stopped?}.from(true).to(false)
25
59
  end
26
60
  end
27
61
 
@@ -37,25 +71,42 @@ describe Gush::Workflow do
37
71
 
38
72
  result = JSON.parse(klass.new("workflow").to_json)
39
73
  expected = {
40
- "id"=>"workflow",
74
+ "id"=>nil,
41
75
  "name" => klass.to_s,
42
76
  "klass" => klass.to_s,
43
- "status" => "Pending",
77
+ "status" => "pending",
44
78
  "total" => 2,
45
79
  "finished" => 0,
46
80
  "started_at" => nil,
47
81
  "finished_at" => nil,
48
82
  "stopped" => false,
49
- "logger_builder" => "Gush::LoggerBuilder",
50
- "nodes" => [
83
+ "jobs" => [
51
84
  {
52
- "name"=>"FetchFirstJob", "klass"=>"FetchFirstJob", "finished"=>false, "enqueued"=>false, "failed"=>false,
53
- "incoming"=>[], "outgoing"=>["PersistFirstJob"], "finished_at"=>nil, "started_at"=>nil, "failed_at"=>nil,
85
+ "name"=>"FetchFirstJob",
86
+ "klass"=>"FetchFirstJob",
87
+ "finished"=>false,
88
+ "enqueued"=>false,
89
+ "failed"=>false,
90
+ "incoming"=>[],
91
+ "outgoing"=>["PersistFirstJob"],
92
+ "finished_at"=>nil,
93
+ "started_at"=>nil,
94
+ "enqueued_at"=>nil,
95
+ "failed_at"=>nil,
54
96
  "running" => false
55
97
  },
56
98
  {
57
- "name"=>"PersistFirstJob", "klass"=>"PersistFirstJob", "finished"=>false, "enqueued"=>false, "failed"=>false,
58
- "incoming"=>["FetchFirstJob"], "outgoing"=>[], "finished_at"=>nil, "started_at"=>nil, "failed_at"=>nil,
99
+ "name"=>"PersistFirstJob",
100
+ "klass"=>"PersistFirstJob",
101
+ "finished"=>false,
102
+ "enqueued"=>false,
103
+ "failed"=>false,
104
+ "incoming"=>["FetchFirstJob"],
105
+ "outgoing"=>[],
106
+ "finished_at"=>nil,
107
+ "started_at"=>nil,
108
+ "enqueued_at"=>nil,
109
+ "failed_at"=>nil,
59
110
  "running" => false
60
111
  }
61
112
  ]
@@ -75,7 +126,7 @@ describe Gush::Workflow do
75
126
  it "adds new job with the given class as a node" do
76
127
  flow = Gush::Workflow.new("workflow")
77
128
  flow.run(Gush::Job)
78
- expect(flow.nodes.first).to be_instance_of(Gush::Job)
129
+ expect(flow.jobs.first).to be_instance_of(Gush::Job)
79
130
  end
80
131
  end
81
132
 
@@ -87,39 +138,16 @@ describe Gush::Workflow do
87
138
  tree.run(klass1)
88
139
  tree.run(klass2, after: klass1)
89
140
  tree.create_dependencies
90
- expect(tree.nodes.first).to be_an_instance_of(klass1)
91
- expect(tree.nodes.first.outgoing.first).to eq(klass2.to_s)
141
+ expect(tree.jobs.first).to be_an_instance_of(klass1)
142
+ expect(tree.jobs.first.outgoing.first).to eq(klass2.to_s)
92
143
  end
93
144
  end
94
145
  end
95
146
 
96
- describe "#logger_builder" do
97
- it 'sets logger builder for workflow' do
98
- tree = Gush::Workflow.new("workflow")
99
- tree.logger_builder(TestLoggerBuilder)
100
- expect(tree.instance_variable_get(:@logger_builder)).to eq(TestLoggerBuilder)
101
- end
102
- end
103
-
104
- describe "#build_logger_for_job" do
105
- it 'builds a logger' do
106
- job = double('job')
107
- allow(job).to receive(:name) { 'a-job' }
108
-
109
- tree = Gush::Workflow.new("workflow")
110
- tree.logger_builder(TestLoggerBuilder)
111
-
112
- logger = tree.build_logger_for_job(job, :jid)
113
- expect(logger).to be_a(TestLogger)
114
- expect(logger.jid).to eq(:jid)
115
- expect(logger.name).to eq('a-job')
116
- end
117
- end
118
-
119
147
  describe "#failed?" do
120
148
  context "when one of the jobs failed" do
121
149
  it "returns true" do
122
- subject.find_job('Prepare').failed = true
150
+ subject.find_job('Prepare').fail!
123
151
  expect(subject.failed?).to be_truthy
124
152
  end
125
153
  end
@@ -140,14 +168,14 @@ describe Gush::Workflow do
140
168
 
141
169
  context "when some jobs are enqueued" do
142
170
  it "returns true" do
143
- subject.find_job('Prepare').enqueued = true
171
+ subject.find_job('Prepare').enqueue!
144
172
  expect(subject.running?).to be_truthy
145
173
  end
146
174
  end
147
175
 
148
176
  context "when some jobs are running" do
149
177
  it "returns true" do
150
- subject.find_job('Prepare').running = true
178
+ subject.find_job('Prepare').start!
151
179
  expect(subject.running?).to be_truthy
152
180
  end
153
181
  end
@@ -159,88 +187,8 @@ describe Gush::Workflow do
159
187
  end
160
188
 
161
189
  it "returns true if all jobs are finished" do
162
- subject.nodes.each {|n| n.finished = true }
190
+ subject.jobs.each {|n| n.finish! }
163
191
  expect(subject.finished?).to be_truthy
164
192
  end
165
193
  end
166
-
167
- describe "#next_jobs" do
168
- context "when one of the dependent jobs failed" do
169
- it "returns only jobs with satisfied dependencies" do
170
- subject.find_job('Prepare').finished = true
171
- subject.find_job('FetchFirstJob').failed = true
172
- expect(subject.next_jobs.map(&:name)).to match_array(["FetchSecondJob"])
173
- end
174
- end
175
-
176
- it "returns next non-queued and unfinished jobs" do
177
- expect(subject.next_jobs.map(&:name)).to match_array(["Prepare"])
178
- end
179
-
180
- it "returns all parallel non-queued and unfinished jobs" do
181
- subject.find_job('Prepare').finished = true
182
- expect(subject.next_jobs.map(&:name)).to match_array(["FetchFirstJob", "FetchSecondJob"])
183
- end
184
-
185
- it "returns empty array when there are enqueued but unfinished jobs" do
186
- subject.find_job('Prepare').enqueued = true
187
- expect(subject.next_jobs).to match_array([])
188
- end
189
-
190
- it "returns only unfinished and non-queued jobs from a parallel level" do
191
- subject.find_job('Prepare').finished = true
192
- subject.find_job('FetchFirstJob').finished = true
193
- expect(subject.next_jobs.map(&:name)).to match_array(["PersistFirstJob", "FetchSecondJob"])
194
- end
195
-
196
- it "returns next level of unfished jobs after finished parallel level" do
197
- subject.find_job('Prepare').finished = true
198
- subject.find_job('PersistFirstJob').finished = true
199
- subject.find_job('FetchFirstJob').finished = true
200
- subject.find_job('FetchSecondJob').finished = true
201
- expect(subject.next_jobs.map(&:name)).to match_array(["NormalizeJob"])
202
- end
203
-
204
- context "when mixing parallel tasks with synchronous" do
205
- it "properly orders nested synchronous flows inside concurrent" do
206
- flow = Gush::Workflow.new("workflow")
207
-
208
- flow.run Prepare
209
- flow.run NormalizeJob
210
-
211
- flow.run FetchFirstJob, after: Prepare
212
- flow.run PersistFirstJob, after: FetchFirstJob, before: NormalizeJob
213
- flow.run FetchSecondJob, after: Prepare
214
- flow.run PersistSecondJob, after: FetchSecondJob, before: NormalizeJob
215
-
216
- flow.create_dependencies
217
- expect(flow.next_jobs.map(&:name)).to match_array(["Prepare"])
218
- flow.find_job("Prepare").finished = true
219
- expect(flow.next_jobs.map(&:name)).to match_array(["FetchFirstJob", "FetchSecondJob"])
220
- flow.find_job("FetchFirstJob").finished = true
221
- expect(flow.next_jobs.map(&:name)).to match_array(["FetchSecondJob", "PersistFirstJob"])
222
- flow.find_job("FetchSecondJob").finished = true
223
- expect(flow.next_jobs.map(&:name)).to match_array(["PersistFirstJob", "PersistSecondJob"])
224
- flow.find_job("PersistFirstJob").finished = true
225
- expect(flow.next_jobs.map(&:name)).to match_array(["PersistSecondJob"])
226
- flow.find_job("PersistSecondJob").finished = true
227
- expect(flow.next_jobs.map(&:name)).to match_array(["NormalizeJob"])
228
- end
229
- end
230
-
231
- it "fails when dependency resolution recurses too deep" do
232
- flow = Gush::Workflow.new("workflow")
233
- klass1 = Class.new(Gush::Job)
234
- klass2 = Class.new(Gush::Job)
235
- klass3 = Class.new(Gush::Job)
236
- flow.run(klass1, after: klass3)
237
- flow.run(klass2, after: klass1)
238
- flow.run(klass3, after: klass2)
239
- flow.create_dependencies
240
-
241
- expect {
242
- flow.next_jobs
243
- }.to raise_error(DependencyLevelTooDeep)
244
- end
245
- end
246
194
  end
@@ -9,7 +9,7 @@ describe Gush do
9
9
  path.delete if path.exist?
10
10
  Gush.configuration.gushfile = path
11
11
 
12
- expect { Gush.gushfile }.to raise_error(Thor::Error)
12
+ expect { Gush.gushfile }.to raise_error(Errno::ENOENT)
13
13
  end
14
14
  end
15
15
 
data/spec/spec_helper.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  require 'gush'
2
2
  require 'pry'
3
3
  require 'sidekiq/testing'
4
- require 'bbq/spawn'
5
4
 
5
+ Sidekiq::Testing.fake!
6
6
  Sidekiq::Logging.logger = nil
7
7
 
8
- class Prepare < Gush::Job; end
8
+ class Prepare < Gush::Job; end
9
9
  class FetchFirstJob < Gush::Job; end
10
10
  class FetchSecondJob < Gush::Job; end
11
11
  class PersistFirstJob < Gush::Job; end
@@ -14,21 +14,8 @@ class NormalizeJob < Gush::Job; end
14
14
 
15
15
  GUSHFILE = Pathname.new(__FILE__).parent.join("Gushfile.rb")
16
16
 
17
- TestLogger = Struct.new(:jid, :name) do
18
- def <<(msg)
19
- end
20
- end
21
-
22
- class TestLoggerBuilder < Gush::LoggerBuilder
23
- def build
24
- TestLogger.new(jid, job.name)
25
- end
26
- end
27
-
28
17
  class TestWorkflow < Gush::Workflow
29
18
  def configure
30
- logger_builder TestLoggerBuilder
31
-
32
19
  run Prepare
33
20
 
34
21
  run NormalizeJob
@@ -40,15 +27,29 @@ class TestWorkflow < Gush::Workflow
40
27
  end
41
28
  end
42
29
 
43
- module GushHelpers
44
- REDIS_URL = "redis://localhost:33333/"
30
+ class Redis
31
+ def publish(*)
32
+ end
33
+ end
34
+
35
+ REDIS_URL = "redis://localhost:6379/12"
45
36
 
37
+ module GushHelpers
46
38
  def redis
47
39
  @redis ||= Redis.new(url: REDIS_URL)
48
40
  end
41
+ end
42
+
43
+ RSpec::Matchers.define :have_jobs do |flow, jobs|
44
+ match do |actual|
45
+ expected = jobs.map do |job|
46
+ hash_including("args" => include(flow, job))
47
+ end
48
+ expect(Gush::Worker.jobs).to match_array(expected)
49
+ end
49
50
 
50
- def client
51
- @client ||= Gush::Client.new(Gush::Configuration.new(gushfile: GUSHFILE, redis_url: REDIS_URL))
51
+ failure_message do |actual|
52
+ "expected queue to have #{jobs}, but instead has: #{actual.jobs.map{ |j| j["args"][1]}}"
52
53
  end
53
54
  end
54
55
 
@@ -59,18 +60,14 @@ RSpec.configure do |config|
59
60
  mocks.verify_partial_doubles = true
60
61
  end
61
62
 
62
- orchestrator = Bbq::Spawn::Orchestrator.new
63
-
64
- config.before(:suite) do
65
- config_path = Pathname.pwd + "spec/redis.conf"
66
- executor = Bbq::Spawn::Executor.new("redis-server", config_path.to_path)
67
- orchestrator.coordinate(executor, host: '127.0.0.1', port: 33333)
68
- orchestrator.start
63
+ config.before(:each) do
64
+ Gush.configure do |config|
65
+ config.redis_url = REDIS_URL
66
+ config.environment = 'test'
67
+ config.gushfile = GUSHFILE
68
+ end
69
69
  end
70
70
 
71
- config.after(:suite) do
72
- orchestrator.stop
73
- end
74
71
 
75
72
  config.after(:each) do
76
73
  Sidekiq::Worker.clear_all
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gush
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: '0.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotrek Okoński
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-26 00:00:00.000000000 Z
11
+ date: 2015-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -16,126 +16,126 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.2.2
19
+ version: 3.3.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 3.2.2
26
+ version: 3.3.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: yajl-ruby
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 1.2.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 1.2.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: redis
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 3.0.0
47
+ version: 3.2.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 3.0.0
54
+ version: 3.2.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: hiredis
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.5.2
61
+ version: 0.6.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.5.2
68
+ version: 0.6.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: ruby-graphviz
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: 1.2.2
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: 1.2.2
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: terminal-table
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 1.4.5
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: 1.4.5
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: colorize
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 0.7.7
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
110
+ version: 0.7.7
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: thor
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '0'
117
+ version: 0.19.1
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '0'
124
+ version: 0.19.1
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: launchy
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0'
131
+ version: 2.4.3
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '0'
138
+ version: 2.4.3
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: bundler
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -188,6 +188,7 @@ extra_rdoc_files: []
188
188
  files:
189
189
  - ".gitignore"
190
190
  - ".rspec"
191
+ - ".travis.yml"
191
192
  - Gemfile
192
193
  - LICENSE.txt
193
194
  - README.md
@@ -196,26 +197,23 @@ files:
196
197
  - gush.gemspec
197
198
  - lib/gush.rb
198
199
  - lib/gush/cli.rb
200
+ - lib/gush/cli/overview.rb
199
201
  - lib/gush/client.rb
200
202
  - lib/gush/configuration.rb
201
203
  - lib/gush/errors.rb
204
+ - lib/gush/graph.rb
202
205
  - lib/gush/job.rb
203
- - lib/gush/logger_builder.rb
204
- - lib/gush/metadata.rb
205
- - lib/gush/null_logger.rb
206
- - lib/gush/version.rb
206
+ - lib/gush/json.rb
207
207
  - lib/gush/worker.rb
208
208
  - lib/gush/workflow.rb
209
209
  - spec/Gushfile.rb
210
+ - spec/features/workflows_spec.rb
210
211
  - spec/lib/gush/client_spec.rb
211
212
  - spec/lib/gush/configuration_spec.rb
212
213
  - spec/lib/gush/job_spec.rb
213
- - spec/lib/gush/logger_builder_spec.rb
214
- - spec/lib/gush/null_logger_spec.rb
215
214
  - spec/lib/gush/worker_spec.rb
216
215
  - spec/lib/gush/workflow_spec.rb
217
216
  - spec/lib/gush_spec.rb
218
- - spec/redis.conf
219
217
  - spec/spec_helper.rb
220
218
  homepage: https://github.com/pokonski/gush
221
219
  licenses:
@@ -237,20 +235,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
235
  version: '0'
238
236
  requirements: []
239
237
  rubyforge_project:
240
- rubygems_version: 2.2.2
238
+ rubygems_version: 2.4.5
241
239
  signing_key:
242
240
  specification_version: 4
243
241
  summary: Fast and distributed workflow runner using only Sidekiq and Redis
244
242
  test_files:
245
243
  - spec/Gushfile.rb
244
+ - spec/features/workflows_spec.rb
246
245
  - spec/lib/gush/client_spec.rb
247
246
  - spec/lib/gush/configuration_spec.rb
248
247
  - spec/lib/gush/job_spec.rb
249
- - spec/lib/gush/logger_builder_spec.rb
250
- - spec/lib/gush/null_logger_spec.rb
251
248
  - spec/lib/gush/worker_spec.rb
252
249
  - spec/lib/gush/workflow_spec.rb
253
250
  - spec/lib/gush_spec.rb
254
- - spec/redis.conf
255
251
  - spec/spec_helper.rb
256
252
  has_rdoc:
@@ -1,15 +0,0 @@
1
- module Gush
2
- class LoggerBuilder
3
- attr_reader :workflow, :job, :jid
4
-
5
- def initialize(workflow, job, jid)
6
- @workflow = workflow
7
- @job = job
8
- @jid = jid
9
- end
10
-
11
- def build
12
- NullLogger.new
13
- end
14
- end
15
- end
data/lib/gush/metadata.rb DELETED
@@ -1,24 +0,0 @@
1
- module Gush
2
- module Metadata
3
-
4
- def self.included(base)
5
- base.extend(ClassMethods)
6
- end
7
-
8
- module ClassMethods
9
- def metadata(params = {})
10
- @metadata = (@metadata || {}).merge(params)
11
- end
12
- end
13
-
14
- def name
15
- metadata[:name] || @name
16
- end
17
-
18
- private
19
-
20
- def metadata
21
- self.class.metadata
22
- end
23
- end
24
- end
@@ -1,6 +0,0 @@
1
- module Gush
2
- class NullLogger
3
- def method_missing(*)
4
- end
5
- end
6
- end
data/lib/gush/version.rb DELETED
@@ -1,3 +0,0 @@
1
- module Gush
2
- VERSION = "0.0.1"
3
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Gush::LoggerBuilder do
4
- it 'takes a job as an argument' do
5
- builder = Gush::LoggerBuilder.new(:workflow, :job, :jid)
6
- expect(builder.job).to eq(:job)
7
- end
8
-
9
- it 'takes a workflow as an argument' do
10
- builder = Gush::LoggerBuilder.new(:workflow, :job, :jid)
11
- expect(builder.workflow).to eq(:workflow)
12
- end
13
-
14
- it 'takes a jid as an argument' do
15
- builder = Gush::LoggerBuilder.new(:workflow, :job, :jid)
16
- expect(builder.jid).to eq(:jid)
17
- end
18
-
19
- describe "#build" do
20
- it 'returns a logger for a job' do
21
- expect(Gush::LoggerBuilder.new(:workflow, :job, :jid).build).to be_a Gush::NullLogger
22
- end
23
- end
24
- end
25
-