evrone-ci-common 0.2.0.pre6 → 0.2.0.pre7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/evrone-ci-common.gemspec +1 -0
- data/lib/evrone/ci/common/amqp.rb +44 -0
- data/lib/evrone/ci/common/env_file.rb +26 -0
- data/lib/evrone/ci/common/error_notifier.rb +34 -0
- data/lib/evrone/ci/common/version.rb +1 -1
- data/lib/evrone/ci/common.rb +2 -0
- metadata +20 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34e7ad806a783a7203df40b378dc90c3e16700cf
|
4
|
+
data.tar.gz: 7e71ac7ff4ccf0f03392190f814ce4f05a74af64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b42f472d5229fdb8f49746a62d4240cd99324afc61199fb27f0da14df026f437a7d0e4624285dbe74c500ec4beccd5d15fa8819432e6a3faa7b9da233e5f5ab
|
7
|
+
data.tar.gz: 20fd73133bdd25ff76d204f49634d24c92502be0ecc7ca2b0c9a2afca5e589aad6ac346d8aa39fa4ab4cf61e6879e5d40b3132861d5e73b1894cda0d9b67c4e2
|
data/evrone-ci-common.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_runtime_dependency 'evrone-common-spawn', '0.0.6'
|
22
22
|
spec.add_runtime_dependency 'evrone-common-rack-builder', '0.0.2'
|
23
|
+
spec.add_runtime_dependency 'airbrake', '~> 3.1.14'
|
23
24
|
|
24
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
25
26
|
spec.add_development_dependency "rspec"
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'evrone/common/amqp'
|
2
|
+
require 'evrone/ci/common/error_notifier'
|
3
|
+
|
4
|
+
module Evrone
|
5
|
+
module CI
|
6
|
+
module Common
|
7
|
+
|
8
|
+
class AMQP
|
9
|
+
class << self
|
10
|
+
|
11
|
+
def setup(logger, options = {})
|
12
|
+
Evrone::Common::AMQP.configure do |c|
|
13
|
+
|
14
|
+
c.before_subscribe do |e|
|
15
|
+
logger.warn "[#{e[:name]}] subsribing #{e[:exchange].name}"
|
16
|
+
end
|
17
|
+
|
18
|
+
c.after_subscribe do |e|
|
19
|
+
logger.warn "[#{e[:name]}] shutdown"
|
20
|
+
end
|
21
|
+
|
22
|
+
c.before_recieve do |e|
|
23
|
+
logger.warn "[#{e[:name]}] payload recieved #{e[:payload].inspect[0..60]}"
|
24
|
+
end
|
25
|
+
|
26
|
+
c.after_recieve do |e|
|
27
|
+
logger.warn "[#{e[:name]}] commit message"
|
28
|
+
end
|
29
|
+
|
30
|
+
c.on_error do |e|
|
31
|
+
Evrone::CI::Common::ErrorNotifier.notify(e)
|
32
|
+
end
|
33
|
+
|
34
|
+
c.content_type = 'application/x-protobuf'
|
35
|
+
c.logger = nil
|
36
|
+
c.url = options[:url]
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Evrone
|
2
|
+
module CI
|
3
|
+
module Common
|
4
|
+
module EnvFile
|
5
|
+
|
6
|
+
def read_env_file(file = nil)
|
7
|
+
file ||= '/etc/evrone/ci'
|
8
|
+
file = File.expand_path(file)
|
9
|
+
|
10
|
+
if File.readable?(file)
|
11
|
+
buf = File.read(file)
|
12
|
+
|
13
|
+
buf.split("\n").each do |line|
|
14
|
+
next if line.strip.empty?
|
15
|
+
|
16
|
+
env, value = line.split("=").map(&:strip)
|
17
|
+
::ENV[env] = value
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'airbrake'
|
2
|
+
|
3
|
+
module Evrone
|
4
|
+
module CI
|
5
|
+
module Common
|
6
|
+
|
7
|
+
class ErrorNotifier
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def notify(error)
|
11
|
+
if setup
|
12
|
+
::Airbrake.notify(error)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def setup
|
17
|
+
@configured ||= begin
|
18
|
+
return false unless ENV['AIRBRAKE_API_KEY']
|
19
|
+
|
20
|
+
::Airbrake.configure do |config|
|
21
|
+
config.api_key = ENV['AIRBRAKE_API_KEY']
|
22
|
+
config.host = ENV['AIRBRAKE_HOST']
|
23
|
+
config.port = ENV['AIRBRAKE_PORT'] || 80
|
24
|
+
config.secure = config.port == 443
|
25
|
+
end
|
26
|
+
true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/evrone/ci/common.rb
CHANGED
@@ -11,6 +11,8 @@ module Evrone
|
|
11
11
|
end
|
12
12
|
|
13
13
|
autoload :OutputBuffer, File.expand_path("../common/output_buffer", __FILE__)
|
14
|
+
autoload :EnvFile, File.expand_path("../common/env_file", __FILE__)
|
15
|
+
autoload :ErrorNotifier, File.expand_path("../common/error_notifier", __FILE__)
|
14
16
|
end
|
15
17
|
|
16
18
|
module SCM
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: evrone-ci-common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.0.
|
4
|
+
version: 0.2.0.pre7
|
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-
|
11
|
+
date: 2013-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: evrone-common-spawn
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.0.2
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: airbrake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.1.14
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.1.14
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,6 +137,9 @@ files:
|
|
123
137
|
- Rakefile
|
124
138
|
- evrone-ci-common.gemspec
|
125
139
|
- lib/evrone/ci/common.rb
|
140
|
+
- lib/evrone/ci/common/amqp.rb
|
141
|
+
- lib/evrone/ci/common/env_file.rb
|
142
|
+
- lib/evrone/ci/common/error_notifier.rb
|
126
143
|
- lib/evrone/ci/common/helper/middlewares.rb
|
127
144
|
- lib/evrone/ci/common/helper/shell.rb
|
128
145
|
- lib/evrone/ci/common/helper/upload_sh_command.rb
|
@@ -157,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
174
|
version: 1.3.1
|
158
175
|
requirements: []
|
159
176
|
rubyforge_project:
|
160
|
-
rubygems_version: 2.
|
177
|
+
rubygems_version: 2.1.9
|
161
178
|
signing_key:
|
162
179
|
specification_version: 4
|
163
180
|
summary: Common code for ci
|