testcube 0.1.0 → 0.1.1

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: c4efe39bf13999143ee88fc92aba4315b915fc94
4
- data.tar.gz: f9b8b4e2ab3845492326ed4ab0b5fad21b9389c5
3
+ metadata.gz: 88794f98d433913fb1f2d0de36f0cb191b18d9ae
4
+ data.tar.gz: 3fd0ad9fc7d0d9aa95b34db4e055d1895904fd41
5
5
  SHA512:
6
- metadata.gz: 035f9bfddbda70489f9745b1348a3a3896c493ec113d39860e52edd86a0784fbe97731d3ce368bfd3ddceb668d4b9d608f7a7f8fb5ad219f5976ccc608807869
7
- data.tar.gz: 4dd9dbd36fac7873e756401d863468fc219620e742f62449ae661efe5e6a52875d4155308764fb23a84d93e16f1664a35d3db0b6ba038ad2c9fe440168f8a455
6
+ metadata.gz: d2250ad2a0d214ed3648690800404946499e58c28505d0ffb2fad4ffcc4e29bfaf2e7b9f19f73a708dd50d7134a472cb4a33db384a0a646635151a622846780c
7
+ data.tar.gz: 1373df9b34c278f5ea8afc38a974f89858c780e5b92c1bd8c613d9b6d0c4682cf92742facce4228586f2881cad3bd1949dd52b5a0f5e5159e73d5e3ff357ca33
data/Gemfile.lock CHANGED
@@ -2,13 +2,26 @@ PATH
2
2
  remote: .
3
3
  specs:
4
4
  testcube (0.1.0)
5
- httprb
5
+ http (~> 4.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
+ addressable (2.5.2)
11
+ public_suffix (>= 2.0.2, < 4.0)
10
12
  diff-lcs (1.3)
11
- httprb (0.1.5)
13
+ domain_name (0.5.20180417)
14
+ unf (>= 0.0.5, < 1.0.0)
15
+ http (4.0.0)
16
+ addressable (~> 2.3)
17
+ http-cookie (~> 1.0)
18
+ http-form_data (~> 2.0)
19
+ http_parser.rb (~> 0.6.0)
20
+ http-cookie (1.0.3)
21
+ domain_name (~> 0.5)
22
+ http-form_data (2.1.1)
23
+ http_parser.rb (0.6.0)
24
+ public_suffix (3.0.3)
12
25
  rake (10.5.0)
13
26
  rspec (3.8.0)
14
27
  rspec-core (~> 3.8.0)
@@ -23,6 +36,9 @@ GEM
23
36
  diff-lcs (>= 1.2.0, < 2.0)
24
37
  rspec-support (~> 3.8.0)
25
38
  rspec-support (3.8.0)
39
+ unf (0.1.4)
40
+ unf_ext
41
+ unf_ext (0.0.7.5)
26
42
 
27
43
  PLATFORMS
28
44
  ruby
@@ -1,16 +1,14 @@
1
+ require "time"
2
+
1
3
  module Testcube
2
4
  class BuildEnv
3
5
  def self.current
4
- sha, author, author_email, commit_message = git_show
5
- # TODO master fork sha
6
6
  # TODO could also get some of this data from github api
7
7
  {
8
- sha: sha,
9
- author: author,
10
- author_email: author_email,
11
- commit_message: commit_message,
12
8
  branch: branch,
13
9
  build_url: build_url,
10
+ head: parse_from_git('HEAD'),
11
+ merge_base: parse_from_git(merge_base)
14
12
  }
15
13
  end
16
14
 
@@ -23,17 +21,22 @@ module Testcube
23
21
  ENV['BUILDKITE_BUILD_URL']
24
22
  end
25
23
 
26
- def self.git_show
27
- out = git('show --format=short --no-patch')
28
- return [nil, nil, nil, nil] if !out
24
+ def self.parse_from_git(sha)
25
+ out = git("show #{sha} --no-patch")
26
+ return {} if !out
29
27
 
30
28
  # TODO: dont rescue nil
31
- sha = out.match(/commit ([0-9a-f]+)\n/)[1] rescue nil
32
- author = out.match(/Author: (.*?) <(.*)>\n/)[1] rescue nil
33
- author_email = out.match(/Author: (.*?) <(.*)>\n/)[2] rescue nil
34
- message = out.lines[2..(out.lines.length)].find { |l| l.strip.length > 0 }.strip rescue nil
29
+ return {
30
+ sha: (out.match(/commit ([0-9a-f]+)\n/)[1] rescue nil),
31
+ author: (out.match(/Author: (.*?) <(.*)>\n/)[1] rescue nil),
32
+ ts: (Time.parse(out.match(/Date: (.*?)\n/)[1].strip).to_i rescue nil),
33
+ author_email: (out.match(/Author: (.*?) <(.*)>\n/)[2] rescue nil),
34
+ message: (out.lines[3..(out.lines.length)].find { |l| l.strip.length > 0 }.strip[0..50] rescue nil)
35
+ }
36
+ end
35
37
 
36
- return [sha, author, author_email, message]
38
+ def self.merge_base
39
+ git("merge-base HEAD master")
37
40
  end
38
41
 
39
42
  def self.git(cmd)
@@ -41,8 +41,6 @@ module Testcube
41
41
  Testcube.logger.warn("Failed to upload to testcube!")
42
42
  return
43
43
  end
44
-
45
- Testcube.logger.info("#{res.status}, #{res.code}, #{res.body}")
46
44
  end
47
45
  end
48
46
  end
@@ -1,3 +1,3 @@
1
1
  module Testcube
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/testcube.gemspec CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
32
32
  spec.require_paths = ["lib"]
33
33
 
34
- spec.add_dependency "http"
34
+ spec.add_dependency "http", "~> 4.0"
35
35
 
36
36
  spec.add_development_dependency "bundler", "~> 1.16"
37
37
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testcube
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ankur
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-20 00:00:00.000000000 Z
11
+ date: 2018-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '4.0'
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'
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement