evrone-ci-router 0.2.0.pre1 → 0.2.0.pre3

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
  SHA1:
3
- metadata.gz: edee6c03fb2fd412081abfcc5d0a1728f18a277b
4
- data.tar.gz: 8de6b06ce57d13adff8d12ead02ac3a0560436d7
3
+ metadata.gz: fbdfc3042cc3a96d761347400e67482f9517fd19
4
+ data.tar.gz: 2f2e905f4511aa5da16dd819c6d25840568311af
5
5
  SHA512:
6
- metadata.gz: 41e077af700321ee78461ced593a229000544e47372fc88dc2c18fa46318de8c1747204460fb990c60297b06edc7f8db43397bc70065cde1cf22a7db2fb23d0a
7
- data.tar.gz: 553fe1631f488f868241ff00ca844a20ae049fe054712d47bc66d91854b14e086454c0f2b14a6c02d93afd5ac52081d30cdcff0feb3f9dea1b12a2973deb6546
6
+ metadata.gz: 9be6a237a177cc2b04d3df19189f4e47b202e26914eb3a1e942b454bed71b211a8666f095cecf6ac930eb645e5eff9230d517d76e042570af77e192601cbb8ef
7
+ data.tar.gz: 6fe0b6691129097ed73b6809ec5d1687036a45d1ae5d0f5297f48eca41cd5f03ae78bf86bc891e206d0de3d76d3c38b372c056f85deb04590af8038c22f296bf
data/Rakefile CHANGED
@@ -6,9 +6,11 @@ require "bundler/gem_tasks"
6
6
 
7
7
  RSpec::Core::RakeTask.new(:spec)
8
8
 
9
+ desc "download test repo and run spec"
9
10
  task :default => ["test:create_repo", :spec]
10
11
 
11
12
  namespace :test do
13
+ desc "download test repo"
12
14
  task :create_repo do
13
15
  dir = "fixtures/repo"
14
16
  unless File.directory? dir
@@ -19,4 +21,5 @@ namespace :test do
19
21
  end
20
22
  end
21
23
 
24
+ desc "run travis build"
22
25
  task :travis => :default
@@ -13,21 +13,23 @@ module Evrone
13
13
  include Router::Helper::Logger
14
14
  include Router::Helper::Config
15
15
 
16
- attr_reader :message, :output
17
- attr_accessor :matrix, :jobs_count, :commit_info
16
+ attr_reader :message, :output, :output_counter
17
+ attr_accessor :jobs_count, :commit_info
18
18
 
19
19
  def initialize(perform_build_message)
20
- @output = ''
21
- @message = perform_build_message
20
+ @output_counter = 0
21
+ @output = ''
22
+ @message = perform_build_message
22
23
  end
23
24
 
24
25
  def to_perform_job_message(travis, job_id)
25
26
  script_builder = travis.to_script_builder
27
+ sha = (commit_info && commit_info.sha) || message.sha
26
28
  job_message = Message::PerformJob.new(
27
29
  id: message.id,
28
30
  name: message.name,
29
31
  src: message.src,
30
- sha: message.sha,
32
+ sha: sha,
31
33
  pull_request_id: message.pull_request_id,
32
34
  deploy_key: message.deploy_key,
33
35
  job_id: job_id,
@@ -45,7 +47,6 @@ module Evrone
45
47
  status: status,
46
48
  tm: tm.to_i,
47
49
  tm_usec: tm.usec,
48
- matrix: matrix || [],
49
50
  jobs_count: jobs_count || 0,
50
51
  }
51
52
 
@@ -71,11 +72,10 @@ module Evrone
71
72
  end
72
73
 
73
74
  def create_build_log_message(data)
74
- tm = Time.now
75
+ @output_counter += 1
75
76
  Message::BuildLog.new(
76
77
  build_id: message.id,
77
- tm: tm.to_i,
78
- tm_usec: tm.usec,
78
+ tm: @output_counter,
79
79
  log: data
80
80
  )
81
81
  end
@@ -13,7 +13,7 @@ module Evrone
13
13
  i << 'eval "$(rbenv init -)" || true'
14
14
  i << "rbenv shell #{make_rbenv_version_command env}"
15
15
  i << 'export BUNDLE_GEMFILE=${PWD}/Gemfile'
16
- i << 'export GEM_HOME=/tmp/.rubygems'
16
+ i << 'export GEM_HOME=$HOME/cached/rubygems'
17
17
  end
18
18
 
19
19
  env.before_install.tap do |b|
@@ -24,7 +24,7 @@ module Evrone
24
24
  end
25
25
 
26
26
  env.install.tap do |i|
27
- i << trace_sh_command("bundle install")
27
+ i << trace_sh_command("bundle install && bundle clean --force")
28
28
  end
29
29
  end
30
30
 
@@ -1,7 +1,7 @@
1
1
  module Evrone
2
2
  module CI
3
3
  class Router
4
- VERSION = "0.2.0.pre1"
4
+ VERSION = "0.2.0.pre3"
5
5
  end
6
6
  end
7
7
  end
@@ -94,7 +94,6 @@ module Evrone
94
94
 
95
95
  def create_and_delivery_build_matrix
96
96
  matrix = BuildMatrix.new travis
97
- build.matrix = matrix.keys
98
97
  build.jobs_count = matrix.travises.size
99
98
 
100
99
  matrix.travises.each_with_index do |travis, idx|
@@ -109,6 +108,7 @@ module Evrone
109
108
 
110
109
  def load_travis
111
110
  @travis = Travis.from_file repo_dir.join(".travis.yml")
111
+ @travis
112
112
  end
113
113
 
114
114
  def create_repo_dir
@@ -7,30 +7,31 @@ describe Evrone::CI::Router::Build do
7
7
  subject { build }
8
8
 
9
9
  context "just created" do
10
- its(:message) { should eq msg }
11
- its(:output) { should eq '' }
10
+ its(:message) { should eq msg }
11
+ its(:output) { should eq '' }
12
+ its(:output_counter) { should eq 0 }
12
13
  end
13
14
 
14
15
  context "create_build_log_message" do
15
- let(:tm) { Time.new(2012, 12, 10, 15, 45) }
16
16
  let(:data) { 'log' }
17
17
  subject { build.create_build_log_message data }
18
18
 
19
- before do
20
- mock(Time).now { tm }
21
- end
22
-
23
19
  it { should be_an_instance_of(Evrone::CI::Message::BuildLog) }
24
20
  its(:build_id) { should eq build.message.id }
25
- its(:tm) { should eq tm.to_i }
21
+ its(:tm) { should eq 1 }
26
22
  its(:log) { should eq data }
23
+
24
+ it "should increment counter" do
25
+ expect {
26
+ subject
27
+ }.to change(build, :output_counter).by(1)
28
+ end
27
29
  end
28
30
 
29
31
  context "to_build_status_message" do
30
32
  subject { build.to_build_status_message Evrone::CI::Router::Build::STARTED }
31
33
 
32
34
  before do
33
- build.matrix = ["rvm"]
34
35
  build.jobs_count = 1
35
36
  end
36
37
 
@@ -39,7 +40,6 @@ describe Evrone::CI::Router::Build do
39
40
  its(:status) { should eq 2 }
40
41
  its(:tm) { should be }
41
42
  its(:tm_usec) { should be }
42
- its(:matrix) { should eq %w{ rvm } }
43
43
  its(:jobs_count) { should eq 1 }
44
44
 
45
45
  context "when commit_info exists" do
@@ -65,11 +65,19 @@ describe Evrone::CI::Router::Build do
65
65
  subject { build.add_to_output(data) ; build }
66
66
 
67
67
  its(:output) { should eq data }
68
+
68
69
  it "should delivery message" do
69
70
  expect {
70
71
  subject
71
72
  }.to change(messages, :size).by(1)
72
73
  end
74
+
75
+ it "should increment output_counter" do
76
+ expect {
77
+ subject
78
+ }.to change(build, :output_counter).by(1)
79
+ expect(messages.first.tm).to eq 1
80
+ end
73
81
  end
74
82
 
75
83
  context "add_command_to_output" do
@@ -78,11 +86,19 @@ describe Evrone::CI::Router::Build do
78
86
  subject { build.add_command_to_output(data) ; build }
79
87
 
80
88
  its(:output) { should eq "$ #{data}\n" }
89
+
81
90
  it "should delivery message" do
82
91
  expect {
83
92
  subject
84
93
  }.to change(messages, :size).by(1)
85
94
  end
95
+
96
+ it "should increment output_counter" do
97
+ expect {
98
+ subject
99
+ }.to change(build, :output_counter).by(1)
100
+ expect(messages.first.tm).to eq 1
101
+ end
86
102
  end
87
103
 
88
104
  context ".to_perform_job_message" do
@@ -104,5 +120,14 @@ describe Evrone::CI::Router::Build do
104
120
  its(:script) { should be }
105
121
  its(:matrix_keys) { should eq ['rvm:2.0.0'] }
106
122
  end
123
+
124
+ context "when commit_info.sha exists" do
125
+ before do
126
+ build.commit_info = OpenStruct.new sha: "commit info sha"
127
+ end
128
+
129
+ its(:sha) { should eq 'commit info sha' }
130
+
131
+ end
107
132
  end
108
133
  end
@@ -17,13 +17,13 @@ describe Evrone::CI::Router::ScriptBuilder do
17
17
  tail -n1)
18
18
  }.compact
19
19
  s << 'export BUNDLE_GEMFILE=${PWD}/Gemfile'
20
- s << "export GEM_HOME=/tmp/.rubygems"
20
+ s << "export GEM_HOME=$HOME/cached/rubygems"
21
21
  trace s, "env"
22
22
  s << "gem query -q -in '^bundler$' > /dev/null || gem install bundler -q --no-rdoc --no-ri"
23
23
  trace s, "ruby --version"
24
24
  trace s, "gem --version"
25
25
  trace s, "bundle --version"
26
- trace s, "bundle install"
26
+ trace s, "bundle install && bundle clean --force"
27
27
  trace s, "echo before_script"
28
28
  s.join("\n")
29
29
  }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evrone-ci-router
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.pre1
4
+ version: 0.2.0.pre3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Galinsky
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-03 00:00:00.000000000 Z
11
+ date: 2013-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: evrone-ci-common
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.0.pre1
19
+ version: 0.2.0.pre3
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: 0.2.0.pre1
26
+ version: 0.2.0.pre3
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: evrone-ci-message
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.2.0.pre1
33
+ version: 0.2.0.pre3
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.2.0.pre1
40
+ version: 0.2.0.pre3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: evrone-common-amqp
43
43
  requirement: !ruby/object:Gem::Requirement