citrus-core 0.0.2 → 0.0.3

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
  SHA1:
3
- metadata.gz: e337f6fe4503cd22f913b58c3b405349b2095502
4
- data.tar.gz: 8ab789326e014e9b37f08786751fa69a6fc0c35f
3
+ metadata.gz: aeb750c22c512f74800f7258a5c90cadbb512e47
4
+ data.tar.gz: a6849c73bf55f7a69df1a2ef17a63f7fc4ade8dd
5
5
  SHA512:
6
- metadata.gz: 9d375c55555d424fb8c3449180e037aecdb394dbaf8b6300648b354c8665c8b0f2e600fc59d2e5ef161e943b82ee34bc60b077fbaf0665dbccf05b26d8f4651c
7
- data.tar.gz: 55c5b6cee6ee95852d10395bef0b88a2f510e115e08d7bb6eccb12b727bc67d45329899842c1d4b73f486da7c3c1f3f0fefdf9c1484ab762c5b739bac12bf08c
6
+ metadata.gz: 3d59d922560bde7b27fd8caf0616ec99e77ddca10b88c7ca80f274c4e245f8b7eed5081d86a91febcd1b21f395d12228f21eeb543bf0181355e39ba39ab93165
7
+ data.tar.gz: 9c4ecdedd36818e0b7723a6cfe6ba68090c7a72c58494655f2ac145beffd996fcff877b7975c07f2cb14d1c653c06848bf29b7612b42325421ea276aba851948
@@ -24,17 +24,20 @@ class EventSubscriber
24
24
  end
25
25
  end
26
26
 
27
- world = Citrus::Core::World.new(Dir.mktmpdir('citrus'))
27
+ root = Dir.mktmpdir('citrus')
28
+ cache_root = File.join(root, 'cache')
29
+ build_root = File.join(root, 'builds')
30
+
28
31
  github_adapter = Citrus::Core::GithubAdapter.new
29
32
  changeset = github_adapter.create_changeset_from_push_data(Pathname.new(File.dirname(__FILE__)).join('payload.json').read)
30
33
  event_subscriber = EventSubscriber.new
31
- code_fetcher = Citrus::Core::CachedCodeFetcher.new(world.cache_root)
32
- workspace_builder = Citrus::Core::WorkspaceBuilder.new(world.build_root, code_fetcher)
34
+ code_fetcher = Citrus::Core::CachedCodeFetcher.new(cache_root)
35
+ workspace_builder = Citrus::Core::WorkspaceBuilder.new(build_root, code_fetcher)
33
36
  config_loader = Citrus::Core::ConfigurationLoader.new
34
37
  test_runner = Citrus::Core::TestRunner.new
35
38
  build_service = Citrus::Core::ExecuteBuild.new(workspace_builder, config_loader, test_runner)
36
39
 
37
40
  [test_runner, build_service].each { |publisher| publisher.add_subscriber(event_subscriber) }
38
- build_service.start(Citrus::Core::Build.new(changeset))
41
+ build_service.(Citrus::Core::Build.new(changeset))
39
42
 
40
43
 
data/lib/citrus/core.rb CHANGED
@@ -4,7 +4,6 @@ module Citrus
4
4
  end
5
5
  end
6
6
 
7
- require 'citrus/core/world'
8
7
  require 'citrus/core/publisher'
9
8
  require 'citrus/core/build'
10
9
  require 'citrus/core/exit_code'
@@ -11,7 +11,7 @@ module Citrus
11
11
  @test_runner = test_runner
12
12
  end
13
13
 
14
- def start(build)
14
+ def call(build)
15
15
  workspace_path = workspace_builder.create_workspace(build)
16
16
  configuration = configuration_loader.load_from_path(workspace_path)
17
17
  notify_build_start(build)
@@ -1,5 +1,5 @@
1
1
  module Citrus
2
2
  module Core
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -21,41 +21,41 @@ describe Citrus::Core::ExecuteBuild do
21
21
  let(:exit_code) { fake(:exit_code) }
22
22
  let(:test_output) { fake(:test_output) }
23
23
 
24
- context '#start' do
24
+ context '#call' do
25
25
  before { subject.add_subscriber(subscriber) }
26
26
 
27
27
  context do
28
28
  it 'should prepare workspace for build' do
29
- subject.start(build)
29
+ subject.(build)
30
30
  expect(workspace_builder).to have_received.create_workspace(build)
31
31
  end
32
32
 
33
33
  it 'should read build configuration from workspace' do
34
- subject.start(build)
34
+ subject.(build)
35
35
  expect(configuration_loader).to have_received.load_from_path(path)
36
36
  end
37
37
 
38
38
  it 'should execute build script' do
39
- subject.start(build)
39
+ subject.(build)
40
40
  expect(test_runner).to have_received.start(build, configuration, path)
41
41
  end
42
42
 
43
43
  it 'should publish build_started event when starting build' do
44
- subject.start(build)
44
+ subject.(build)
45
45
  expect(subscriber).to have_received.build_started(build)
46
46
  end
47
47
 
48
48
  it 'should publish build_succeeded event when build has succeeded' do
49
49
  stub(exit_code).success? { true }
50
50
  stub(test_runner).start(any_args) { exit_code }
51
- subject.start(build)
51
+ subject.(build)
52
52
  expect(subscriber).to have_received.build_succeeded(build, exit_code)
53
53
  end
54
54
 
55
55
  it 'should publish build_failed event when build has failed' do
56
56
  stub(exit_code).failure? { true }
57
57
  stub(test_runner).start(any_args) { exit_code }
58
- subject.start(build)
58
+ subject.(build)
59
59
  expect(subscriber).to have_received.build_failed(build, exit_code)
60
60
  end
61
61
  end
@@ -65,7 +65,7 @@ describe Citrus::Core::ExecuteBuild do
65
65
 
66
66
  before do
67
67
  stub(configuration_loader).load_from_path(path) { raise reason }
68
- expect { subject.start(build) }.to raise_error(Citrus::Core::ConfigurationError)
68
+ expect { subject.(build) }.to raise_error(Citrus::Core::ConfigurationError)
69
69
  end
70
70
 
71
71
  it 'should publish build_aborted event when unable to start build due to invalid configuration' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: citrus-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paweł Pacana
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-24 00:00:00.000000000 Z
11
+ date: 2013-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: childprocess
@@ -132,7 +132,6 @@ files:
132
132
  - lib/citrus/core/test_runner.rb
133
133
  - lib/citrus/core/version.rb
134
134
  - lib/citrus/core/workspace_builder.rb
135
- - lib/citrus/core/world.rb
136
135
  - spec/citrus/core/build_spec.rb
137
136
  - spec/citrus/core/cached_code_fetcher_spec.rb
138
137
  - spec/citrus/core/changeset_spec.rb
@@ -150,7 +149,6 @@ files:
150
149
  - spec/citrus/core/test_output_spec.rb
151
150
  - spec/citrus/core/test_runner_spec.rb
152
151
  - spec/citrus/core/workspace_builder_spec.rb
153
- - spec/citrus/core/world_spec.rb
154
152
  - spec/fixtures/github_push_data.json
155
153
  - spec/fixtures/repo/.citrus/config.rb
156
154
  - spec/spec_helper.rb
@@ -173,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
171
  version: '0'
174
172
  requirements: []
175
173
  rubyforge_project:
176
- rubygems_version: 2.0.6
174
+ rubygems_version: 2.1.5
177
175
  signing_key:
178
176
  specification_version: 4
179
177
  summary: Citrus continous integration core components.
@@ -195,7 +193,6 @@ test_files:
195
193
  - spec/citrus/core/test_output_spec.rb
196
194
  - spec/citrus/core/test_runner_spec.rb
197
195
  - spec/citrus/core/workspace_builder_spec.rb
198
- - spec/citrus/core/world_spec.rb
199
196
  - spec/fixtures/github_push_data.json
200
197
  - spec/fixtures/repo/.citrus/config.rb
201
198
  - spec/spec_helper.rb
@@ -1,21 +0,0 @@
1
- module Citrus
2
- module Core
3
- class World
4
-
5
- attr_reader :root
6
-
7
- def initialize(root)
8
- @root = root
9
- end
10
-
11
- def cache_root
12
- File.join(root, 'cache')
13
- end
14
-
15
- def build_root
16
- File.join(root, 'builds')
17
- end
18
-
19
- end
20
- end
21
- end
@@ -1,11 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Citrus::Core::World do
4
-
5
- let(:world) { described_class.new(root) }
6
- let(:root) { '/world' }
7
-
8
- specify { expect(world.cache_root).to eq('/world/cache') }
9
- specify { expect(world.build_root).to eq('/world/builds') }
10
-
11
- end