orc-cli 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,7 @@ module CTT::Cli
4
4
  class ClientCollector
5
5
 
6
6
  def initialize(command, suite, runner)
7
+ @log = runner.log
7
8
  @url = runner.url
8
9
  @info = {}
9
10
  @suite = suite
@@ -26,8 +27,11 @@ module CTT::Cli
26
27
  3.times do
27
28
  begin
28
29
  response = RestClient.post("#{@url}/upload", payload)
30
+ @log.debug("post results. URL: #{@url}/upload, payload: #{payload}," +
31
+ " response code: #{response.code}")
29
32
  break if response.code == 200
30
- rescue
33
+ rescue Exception => e
34
+ @log.error("post results. URL: #{@url}/upload. Error: #{e.to_s}")
31
35
  end
32
36
  end
33
37
  FileUtils.rm(payload[:file].path)
@@ -37,10 +41,10 @@ module CTT::Cli
37
41
  get_os
38
42
  get_ruby_version
39
43
  get_test_reports
44
+ get_git_info
40
45
  get_uuid
41
46
  get_timestamp
42
47
  get_hostname
43
- get_username
44
48
  get_ipaddr
45
49
  end
46
50
 
@@ -48,10 +52,6 @@ module CTT::Cli
48
52
  @info[:hostname] = `hostname`.strip
49
53
  end
50
54
 
51
- def get_username
52
- @info[:username] = Etc.getlogin
53
- end
54
-
55
55
  def get_ipaddr
56
56
  @info[:ip] = UDPSocket.open {|s| s.connect("64.233.187.99", 1); s.addr.last}
57
57
  end
@@ -77,12 +77,25 @@ module CTT::Cli
77
77
  end
78
78
  end
79
79
 
80
+ def get_git_info
81
+ pwd = Dir.pwd
82
+ Dir.chdir(@suite_path)
83
+ begin
84
+ @info[:git_hash] = `git log --oneline -n 1`
85
+ @info[:email] = `git config --get user.email`
86
+ @info[:username] = `git config --get user.name`
87
+ rescue
88
+ end
89
+ Dir.chdir(pwd)
90
+ end
91
+
80
92
  def get_ruby_version
81
93
  @info[:ruby_version] = `ruby -v`
82
94
  end
83
95
 
84
96
  def get_test_reports
85
- suite_config_path = File.absolute_path(File.join(@suites.suites["suites"][@suite], TEST_SUITE_CONFIG_FILE))
97
+ @suite_path = File.absolute_path(@suites.suites["suites"][@suite])
98
+ suite_config_path = File.join(@suite_path, TEST_SUITE_CONFIG_FILE)
86
99
  suite_config = YAML.load_file(suite_config_path)
87
100
  unless suite_config["results"]
88
101
  say("no results field in #{suite_config_path}. abort!", :red)
data/lib/cli/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  module CTT
3
3
  module Cli
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orc-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-21 00:00:00.000000000Z
12
+ date: 2013-01-05 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json_pure