limited_red 0.3.9 → 0.3.10
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +20 -0
- data/lib/limited_red.rb +4 -0
- data/lib/limited_red/client.rb +15 -4
- data/lib/limited_red/plugins/rspec.rb +20 -18
- data/lib/limited_red/rspec/metadata.rb +64 -0
- data/lib/limited_red/version.rb +1 -1
- metadata +8 -7
- data/README.rdoc +0 -17
data/Readme.md
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# Limited Red Ruby Client
|
2
|
+
|
3
|
+
[![Build Status](https://secure.travis-ci.org//limited-red/limited_red_rb.png?branch=master)](https://secure.travis-ci.org//limited-red/limited_red_rb.png?branch=master)
|
4
|
+
|
5
|
+
|
6
|
+
## Docs
|
7
|
+
|
8
|
+
https://github.com/limited-red/limited_red_rb/wikis
|
9
|
+
|
10
|
+
## Running tests
|
11
|
+
|
12
|
+
rake
|
13
|
+
|
14
|
+
## Authors
|
15
|
+
* Joseph Wilk <joe@josephwilk.net>
|
16
|
+
|
17
|
+
|
18
|
+
## Copyright
|
19
|
+
|
20
|
+
Copyright (c) 2010,2011,2012 Joseph Wilk. See LICENSE for details.
|
data/lib/limited_red.rb
CHANGED
@@ -18,6 +18,10 @@ module LimitedRed
|
|
18
18
|
autoload :HttParty, "#{ROOT}/limited_red/adapter/httparty"
|
19
19
|
end
|
20
20
|
|
21
|
+
module Rspec
|
22
|
+
autoload :Metadata, "#{ROOT}/limited_red/rspec/metadata"
|
23
|
+
end
|
24
|
+
|
21
25
|
module Cucumber
|
22
26
|
module Formatter
|
23
27
|
autoload :Stats, "#{ROOT}/limited_red/cucumber/formatter/stats"
|
data/lib/limited_red/client.rb
CHANGED
@@ -17,10 +17,10 @@ module LimitedRed
|
|
17
17
|
:version => LimitedRed::Version::STRING,
|
18
18
|
:token => token_for(data.merge(:build_id => build_id))})
|
19
19
|
|
20
|
-
|
20
|
+
#@thread_pool.with_a_thread_run do
|
21
21
|
response = @adapter.post("/projects/#{@project_id}/builds/#{build_id}/results", :body => data)
|
22
22
|
log(response) if error?(response)
|
23
|
-
|
23
|
+
#end
|
24
24
|
end
|
25
25
|
|
26
26
|
def log_build(build_id, data)
|
@@ -29,10 +29,10 @@ module LimitedRed
|
|
29
29
|
:version => LimitedRed::Version::STRING,
|
30
30
|
:build_id => build_id, :token => token_for(data)})
|
31
31
|
|
32
|
-
|
32
|
+
#@thread_pool.with_a_thread_run do
|
33
33
|
response = @adapter.post("/projects/#{@project_id}/builds", :body => data)
|
34
34
|
log(response) if response && error?(response)
|
35
|
-
|
35
|
+
#end
|
36
36
|
end
|
37
37
|
|
38
38
|
def find_failing_features
|
@@ -59,6 +59,7 @@ module LimitedRed
|
|
59
59
|
build_data_string(data[:fails]) +
|
60
60
|
build_data_string(data[:passes]) +
|
61
61
|
(data[:result] ? data[:result] : "") +
|
62
|
+
pass_string(data[:pass]) +
|
62
63
|
(data[:build_id].to_s) +
|
63
64
|
LimitedRed::Version::STRING +
|
64
65
|
@api_key.to_s
|
@@ -67,6 +68,16 @@ module LimitedRed
|
|
67
68
|
digest = sha512.digest(data_string)
|
68
69
|
Digest.hexencode(digest)
|
69
70
|
end
|
71
|
+
|
72
|
+
def pass_string(pass)
|
73
|
+
if pass.nil?
|
74
|
+
return ""
|
75
|
+
elsif pass
|
76
|
+
return true.to_s
|
77
|
+
else
|
78
|
+
return false.to_s
|
79
|
+
end
|
80
|
+
end
|
70
81
|
|
71
82
|
def build_data_string(data)
|
72
83
|
data == "" || data.nil? ? "" : data.join("")
|
@@ -1,35 +1,37 @@
|
|
1
1
|
require 'limited_red'
|
2
|
-
require 'limited_red/client'
|
3
2
|
|
4
3
|
RSpec.configure do |config|
|
5
|
-
CLIENT = LimitedRed::Client.new(LimitedRed::Config.load_and_validate_config(
|
6
|
-
BUILD_ID = Time.now
|
4
|
+
CLIENT = LimitedRed::Client.new(LimitedRed::Config.load_and_validate_config('rspec'))
|
5
|
+
BUILD_ID = Time.now.to_i
|
7
6
|
|
8
7
|
fails = []
|
9
8
|
passes = []
|
10
9
|
|
11
10
|
config.after(:each) do
|
12
|
-
metadata = example.metadata
|
13
|
-
full_description = example.metadata[:full_description]
|
14
|
-
file, line = *(example.metadata[:example_group_block].source_location)
|
15
|
-
|
16
|
-
json = {:file => file,
|
17
|
-
:line => line,
|
18
|
-
:uri => full_description}.to_json
|
11
|
+
metadata = LimitedRed::Rspec::Metadata.new(example.metadata)
|
19
12
|
|
20
13
|
if example.exception #Fail
|
21
|
-
fails <<
|
22
|
-
|
23
|
-
|
14
|
+
fails << metadata.file_and_line
|
15
|
+
|
16
|
+
metadata.add_exception(example.exception)
|
17
|
+
|
18
|
+
FakeWeb.allow_net_connect = true if defined?(FakeWeb)
|
19
|
+
CLIENT.log_result(BUILD_ID, :result => metadata.to_json)
|
20
|
+
#CLIENT.log_result(BUILD_ID, :result => metadata.to_json, :pass => false)
|
21
|
+
FakeWeb.allow_net_connect = false if defined?(FakeWeb)
|
24
22
|
else # Pass
|
25
|
-
passes <<
|
26
|
-
|
27
|
-
|
23
|
+
passes << metadata.file_and_line
|
24
|
+
FakeWeb.allow_net_connect = true
|
25
|
+
CLIENT.log_result(BUILD_ID, :result => metadata.to_json)
|
26
|
+
#CLIENT.log_result(BUILD_ID, :result => metadata.to_json, :pass => true)
|
27
|
+
FakeWeb.allow_net_connect = false
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
config.after(:
|
31
|
+
config.after(:suite) do
|
32
|
+
FakeWeb.allow_net_connect = true if defined?(FakeWeb)
|
32
33
|
CLIENT.log_build(BUILD_ID, {:fails => fails,
|
33
34
|
:passes => passes})
|
35
|
+
FakeWeb.allow_net_connect = false if defined?(FakeWeb)
|
34
36
|
end
|
35
|
-
end
|
37
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module LimitedRed
|
4
|
+
module Rspec
|
5
|
+
class Metadata
|
6
|
+
def initialize(metadata)
|
7
|
+
@metadata = metadata
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_json
|
11
|
+
hash = {:file => file,
|
12
|
+
:line => line,
|
13
|
+
:uri => uri,
|
14
|
+
:pretty_name => full_description,
|
15
|
+
:scopes => scopes}
|
16
|
+
if @exception
|
17
|
+
hash = hash.merge({:error => {:message => @exception,
|
18
|
+
:type => @exception.class}})
|
19
|
+
end
|
20
|
+
hash.to_json
|
21
|
+
end
|
22
|
+
|
23
|
+
def add_exception(exception)
|
24
|
+
@exception = exception
|
25
|
+
end
|
26
|
+
|
27
|
+
def file_and_line
|
28
|
+
"#{file}:#{line}"
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
def uri
|
33
|
+
scopes.map{|s| s.to_s.downcase.gsub(/\s+/, '-')}.join("-")
|
34
|
+
end
|
35
|
+
|
36
|
+
def full_description
|
37
|
+
@metadata[:full_description]
|
38
|
+
end
|
39
|
+
|
40
|
+
def file
|
41
|
+
file = @metadata[:file_path]
|
42
|
+
file = file.gsub("#{Dir.pwd}/", '')
|
43
|
+
file
|
44
|
+
end
|
45
|
+
|
46
|
+
def line
|
47
|
+
@metadata[:line_number]
|
48
|
+
end
|
49
|
+
|
50
|
+
def scopes
|
51
|
+
extract_scopes_from(@metadata)
|
52
|
+
end
|
53
|
+
|
54
|
+
def extract_scopes_from(metadata)
|
55
|
+
if metadata.has_key?(:example_group)
|
56
|
+
extract_scopes_from(metadata[:example_group]) + metadata[:description_args]
|
57
|
+
else
|
58
|
+
metadata[:description_args]
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/lib/limited_red/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: limited_red
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 10
|
10
|
+
version: 0.3.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Joseph Wilk
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-03-
|
18
|
+
date: 2012-03-28 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: httparty
|
@@ -57,7 +57,7 @@ extensions: []
|
|
57
57
|
|
58
58
|
extra_rdoc_files:
|
59
59
|
- LICENSE
|
60
|
-
-
|
60
|
+
- Readme.md
|
61
61
|
files:
|
62
62
|
- lib/limited_red/adapter/httparty.rb
|
63
63
|
- lib/limited_red/client.rb
|
@@ -66,12 +66,13 @@ files:
|
|
66
66
|
- lib/limited_red/gzip.rb
|
67
67
|
- lib/limited_red/plugins/cucumber.rb
|
68
68
|
- lib/limited_red/plugins/rspec.rb
|
69
|
+
- lib/limited_red/rspec/metadata.rb
|
69
70
|
- lib/limited_red/stats.rb
|
70
71
|
- lib/limited_red/thread_pool.rb
|
71
72
|
- lib/limited_red/version.rb
|
72
73
|
- lib/limited_red.rb
|
73
74
|
- LICENSE
|
74
|
-
-
|
75
|
+
- Readme.md
|
75
76
|
homepage: http://www.limited-red.com
|
76
77
|
licenses:
|
77
78
|
- MIT
|
@@ -101,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
102
|
requirements: []
|
102
103
|
|
103
104
|
rubyforge_project:
|
104
|
-
rubygems_version: 1.8.
|
105
|
+
rubygems_version: 1.8.21
|
105
106
|
signing_key:
|
106
107
|
specification_version: 3
|
107
108
|
summary: Client for www.limited-red.com service
|
data/README.rdoc
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
= Limited Red Client
|
2
|
-
|
3
|
-
== Docs
|
4
|
-
|
5
|
-
https://github.com/josephwilk/limited-red-client/wikis
|
6
|
-
|
7
|
-
== Running tests
|
8
|
-
|
9
|
-
rake
|
10
|
-
|
11
|
-
== Authors
|
12
|
-
* Joseph Wilk <joe@josephwilk.net>
|
13
|
-
|
14
|
-
|
15
|
-
== Copyright
|
16
|
-
|
17
|
-
Copyright (c) 2010,2011 Joseph Wilk. See LICENSE for details.
|