capistrano-ghostinspector 0.1.2 → 0.2.0.rc
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/capistrano-ghostinspector.gemspec +1 -0
- data/lib/capistrano/ghostinspector.rb +6 -2
- data/lib/capistrano/ghostinspector/analytics.rb +33 -0
- data/lib/capistrano/ghostinspector/api.rb +59 -25
- data/lib/capistrano/ghostinspector/config.rb +13 -0
- data/lib/capistrano/ghostinspector/version.rb +1 -1
- metadata +20 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f2f6e5c14918854e600a4948d6e89e129dfd678
|
4
|
+
data.tar.gz: 03e2e2f1195a2592292017e6242236c2ace087ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5ae805e1a27347f674762e6169ab89c41fab16dc32d1caea478de6ebad7eb5c92f320b491898fcb501334e67c6c740e6a67b1f0f7b39df7a8223c265100d5ff
|
7
|
+
data.tar.gz: 5db5de9ef603a0b8c321246853df5bb35e9c2f6143c356d90947addd4a400446110f65fabed33e5e92dc529bba24c95db93544acc7f6fbe08027d227b333dbf4
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Capistrano::Ghostinspector
|
2
2
|
|
3
|
-
[![Scrutinizer Code Quality](https://www2.scrutinizer-ci.com/g/richdynamix/capistrano-ghostinspector/badges/quality-score.png?b=develop)](https://www2.scrutinizer-ci.com/g/richdynamix/capistrano-ghostinspector/?branch=develop) [![Build Status](https://www2.scrutinizer-ci.com/g/richdynamix/capistrano-ghostinspector/badges/build.png?b=develop)](https://www2.scrutinizer-ci.com/g/richdynamix/capistrano-ghostinspector/build-status/develop)
|
3
|
+
[![Scrutinizer Code Quality](https://www2.scrutinizer-ci.com/g/richdynamix/capistrano-ghostinspector/badges/quality-score.png?b=develop)](https://www2.scrutinizer-ci.com/g/richdynamix/capistrano-ghostinspector/?branch=develop) [![Build Status](https://www2.scrutinizer-ci.com/g/richdynamix/capistrano-ghostinspector/badges/build.png?b=develop)](https://www2.scrutinizer-ci.com/g/richdynamix/capistrano-ghostinspector/build-status/develop) [![Gem Version](https://badge.fury.io/rb/capistrano-ghostinspector.svg)](https://badge.fury.io/rb/capistrano-ghostinspector)
|
4
4
|
|
5
5
|
|
6
6
|
[Ghost Inspector](https://ghostinspector.com/ "Ghost Inspector") is an automated website regression testing tool. This [Capistrano](http://capistranorb.com/ "Capistrano") plugin is a simple, configurable gem that will provide the following features.
|
@@ -15,8 +15,12 @@ module Capistrano
|
|
15
15
|
|
16
16
|
set :giconfig, YAML::load(File.read("gi_config.yaml"))
|
17
17
|
|
18
|
+
# Ghost Inspector API key
|
18
19
|
set :gi_api_key, giconfig["APIKEY"]
|
19
20
|
|
21
|
+
# Google Analytics Tracking Property
|
22
|
+
set :ga_property, giconfig["ga_property"]
|
23
|
+
|
20
24
|
# Get tests and suites from command line
|
21
25
|
set :gitest, fetch(:gitest, nil)
|
22
26
|
set :gisuite, fetch(:gisuite, nil)
|
@@ -32,13 +36,13 @@ module Capistrano
|
|
32
36
|
# run each test
|
33
37
|
Capistrano::Ghostinspector.getTests(gitest, giconfig["tests"]).each do |test|
|
34
38
|
puts "* * * Running Ghost Inspector Test * * *"
|
35
|
-
set :passing, Capistrano::Ghostinspector.executeApi("tests", test, gi_api_key, domain, rollback)
|
39
|
+
set :passing, Capistrano::Ghostinspector::Api.executeApi("tests", test, gi_api_key, domain, rollback, ga_property, current_revision[0,7])
|
36
40
|
end
|
37
41
|
|
38
42
|
# run each suite
|
39
43
|
Capistrano::Ghostinspector.getTests(gisuite, giconfig["suites"]).each do |suite|
|
40
44
|
puts "* * * Running Ghost Inspector Suite * * *"
|
41
|
-
set :passing, Capistrano::Ghostinspector.executeApi("suites", suite, gi_api_key, domain, rollback)
|
45
|
+
set :passing, Capistrano::Ghostinspector::Api.executeApi("suites", suite, gi_api_key, domain, rollback, ga_property, current_revision[0,7])
|
42
46
|
end
|
43
47
|
|
44
48
|
# If any test fails and the stage allows rollbacks then
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "capistrano/ghostinspector/analytics"
|
2
|
+
require "staccato"
|
3
|
+
|
4
|
+
module Capistrano
|
5
|
+
module Ghostinspector
|
6
|
+
module Analytics
|
7
|
+
def self.pushDeployment(ga_property, current_revision)
|
8
|
+
|
9
|
+
tracker = Staccato.tracker(ga_property)
|
10
|
+
|
11
|
+
# inform GA of a new deployment
|
12
|
+
tracker.event(category: 'deployment', action: "deploy", label: current_revision, non_interactive: true)
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.pushErrors(ga_property, current_revision, data)
|
17
|
+
|
18
|
+
tracker = Staccato.tracker(ga_property)
|
19
|
+
|
20
|
+
data['steps'].each do |step|
|
21
|
+
|
22
|
+
if (step['passing'] == false)
|
23
|
+
# send the errors to GA
|
24
|
+
tracker.event(category: 'error', action: step['error'], label: "Command: #{step['command']} - Target: #{step['target']}", non_interactive: true)
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,31 +1,65 @@
|
|
1
|
+
require "capistrano/ghostinspector/analytics"
|
1
2
|
require 'net/https'
|
2
3
|
require 'json'
|
3
4
|
|
4
5
|
module Capistrano
|
5
6
|
module Ghostinspector
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
immediate =
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
7
|
+
module Api
|
8
|
+
def self.executeApi(type, test, gi_api_key, domain, rollback, ga_property, current_revision)
|
9
|
+
|
10
|
+
# Determine if we should get results to
|
11
|
+
# check for any failed tests
|
12
|
+
immediate = self.includeResults(rollback, ga_property)
|
13
|
+
|
14
|
+
# Default all tests pass
|
15
|
+
passing = true
|
16
|
+
|
17
|
+
# Lets push the deployment in GA if the configuration allows it.
|
18
|
+
Capistrano::Ghostinspector::Analytics.pushDeployment(ga_property, current_revision)
|
19
|
+
|
20
|
+
# # Perform the API request and get the results
|
21
|
+
results = self.sendRequest(type, test, gi_api_key, domain, immediate)
|
22
|
+
|
23
|
+
# Check the data returned for failed tests
|
24
|
+
if (rollback == true)
|
25
|
+
passing = self.getPassing(type, results, ga_property)
|
26
|
+
end
|
27
|
+
|
28
|
+
if (passing == false && ga_property != "")
|
29
|
+
Capistrano::Ghostinspector::Analytics.pushErrors(ga_property, current_revision, results['data'])
|
30
|
+
end
|
31
|
+
|
32
|
+
return passing
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.includeResults(rollback, ga_property)
|
37
|
+
# Determine if we should get results to
|
38
|
+
# check for any failed tests
|
39
|
+
if (rollback == false && ga_property == "")
|
40
|
+
immediate = "&immediate=1"
|
41
|
+
else
|
42
|
+
immediate = ""
|
43
|
+
puts "* * * Gathering results. This could take a few minutes. * * *"
|
44
|
+
end
|
45
|
+
|
46
|
+
return immediate
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.sendRequest(type, test, gi_api_key, domain, immediate)
|
50
|
+
|
51
|
+
# execute the Ghost Inspector API call
|
52
|
+
uri = URI("https://api.ghostinspector.com/v1/#{type}/#{test}/execute/?apiKey=#{gi_api_key}&startUrl=http://#{domain}/#{immediate}")
|
53
|
+
data = Net::HTTP.get(uri)
|
54
|
+
|
26
55
|
results = JSON.parse(data)
|
27
56
|
|
28
|
-
|
57
|
+
return results
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.getPassing(type, results, ga_property)
|
61
|
+
|
62
|
+
if (type == "suite")
|
29
63
|
results['data'].each do |testItem|
|
30
64
|
passing = testItem['passing']
|
31
65
|
end
|
@@ -33,10 +67,10 @@ module Capistrano
|
|
33
67
|
passing = results['data']['passing']
|
34
68
|
end
|
35
69
|
|
36
|
-
|
70
|
+
return passing
|
71
|
+
|
72
|
+
end
|
37
73
|
|
38
|
-
|
39
|
-
|
40
|
-
end
|
74
|
+
end
|
41
75
|
end
|
42
76
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-ghostinspector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0.rc
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Richardson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 2.15.5
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: staccato
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,8 +108,10 @@ files:
|
|
94
108
|
- Rakefile
|
95
109
|
- capistrano-ghostinspector.gemspec
|
96
110
|
- lib/capistrano/ghostinspector.rb
|
111
|
+
- lib/capistrano/ghostinspector/analytics.rb
|
97
112
|
- lib/capistrano/ghostinspector/api.rb
|
98
113
|
- lib/capistrano/ghostinspector/arrays.rb
|
114
|
+
- lib/capistrano/ghostinspector/config.rb
|
99
115
|
- lib/capistrano/ghostinspector/version.rb
|
100
116
|
- spec/capistrano-ghostinspector_spec.rb
|
101
117
|
- spec/spec_helper.rb
|
@@ -115,9 +131,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
115
131
|
version: '0'
|
116
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
133
|
requirements:
|
118
|
-
- - "
|
134
|
+
- - ">"
|
119
135
|
- !ruby/object:Gem::Version
|
120
|
-
version:
|
136
|
+
version: 1.3.1
|
121
137
|
requirements: []
|
122
138
|
rubyforge_project:
|
123
139
|
rubygems_version: 2.4.5
|