learn-test 2.3.3 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/learn_test.rb +1 -0
- data/lib/learn_test/learn_oauth_token_parser.rb +8 -0
- data/lib/learn_test/netrc_interactor.rb +5 -4
- data/lib/learn_test/runner.rb +16 -1
- data/lib/learn_test/strategies/jasmine.rb +5 -0
- data/lib/learn_test/strategies/java_junit.rb +1 -0
- data/lib/learn_test/strategies/karma.rb +1 -0
- data/lib/learn_test/strategies/mocha.rb +1 -0
- data/lib/learn_test/strategies/protractor.rb +1 -0
- data/lib/learn_test/strategies/python_unittest.rb +1 -0
- data/lib/learn_test/strategies/rspec.rb +1 -0
- data/lib/learn_test/strategy.rb +4 -0
- data/lib/learn_test/username_parser.rb +1 -1
- data/lib/learn_test/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: befbe9633e983c7302c3aa5955778b8fc38970dd
|
4
|
+
data.tar.gz: 5b84c70e6b27fc2c2cd5c2584328a613b1d5564e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b820e01ce5acd8d3cc8371c6937418931a6443a891ff79c18f6fc031d41c3258d9132e9f58e7d669b33f91a6dd0f257806af53c29c4824002a5af060bbfd7b19
|
7
|
+
data.tar.gz: 658d425794585202a49bd4a7dd42282ae4e0b93b3cc80f5380e4671eb1aa551694788133cd7a0931bcff4788c5ad2a167204118ba573aba28e3356a9435d8446
|
data/lib/learn_test.rb
CHANGED
@@ -8,6 +8,7 @@ require_relative 'learn_test/netrc_interactor'
|
|
8
8
|
require_relative 'learn_test/github_interactor'
|
9
9
|
require_relative 'learn_test/user_id_parser'
|
10
10
|
require_relative 'learn_test/username_parser'
|
11
|
+
require_relative 'learn_test/learn_oauth_token_parser'
|
11
12
|
require_relative 'learn_test/repo_parser'
|
12
13
|
require_relative 'learn_test/file_finder'
|
13
14
|
require_relative 'learn_test/runner'
|
@@ -2,15 +2,16 @@ require 'netrc'
|
|
2
2
|
|
3
3
|
module LearnTest
|
4
4
|
class NetrcInteractor
|
5
|
-
attr_reader :username, :user_id, :netrc
|
5
|
+
attr_reader :username, :user_id, :netrc, :machine
|
6
6
|
|
7
|
-
def initialize
|
7
|
+
def initialize(machine: 'flatiron-push')
|
8
|
+
@machine = machine
|
8
9
|
@netrc = Netrc.read
|
9
|
-
@username, @user_id = netrc[
|
10
|
+
@username, @user_id = netrc[machine]
|
10
11
|
end
|
11
12
|
|
12
13
|
def write(username, user_id)
|
13
|
-
netrc[
|
14
|
+
netrc[machine] = username, user_id
|
14
15
|
netrc.save
|
15
16
|
end
|
16
17
|
end
|
data/lib/learn_test/runner.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
1
3
|
module LearnTest
|
2
4
|
class Runner
|
3
5
|
attr_reader :repo, :options
|
@@ -33,6 +35,16 @@ module LearnTest
|
|
33
35
|
|
34
36
|
private
|
35
37
|
|
38
|
+
def augment_results!(results)
|
39
|
+
if File.exist?("#{FileUtils.pwd}/.learn")
|
40
|
+
dot_learn = YAML.load(File.read("#{FileUtils.pwd}/.learn"))
|
41
|
+
|
42
|
+
if !dot_learn['github'].nil?
|
43
|
+
results[:github] = dot_learn['github']
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
36
48
|
def connection
|
37
49
|
@connection ||= Faraday.new(url: SERVICE_URL) do |faraday|
|
38
50
|
faraday.adapter Faraday.default_adapter
|
@@ -53,11 +65,14 @@ module LearnTest
|
|
53
65
|
end
|
54
66
|
|
55
67
|
def push_results(strategy)
|
68
|
+
results = strategy.results
|
69
|
+
augment_results!(results)
|
70
|
+
|
56
71
|
begin
|
57
72
|
connection.post do |req|
|
58
73
|
req.url(strategy.service_endpoint)
|
59
74
|
req.headers['Content-Type'] = 'application/json'
|
60
|
-
req.body = Oj.dump(
|
75
|
+
req.body = Oj.dump(results, mode: :compat)
|
61
76
|
end
|
62
77
|
rescue Faraday::ConnectionFailed
|
63
78
|
puts 'There was a problem connecting to Learn. Not pushing test results.'.red
|
@@ -34,6 +34,7 @@ module LearnTest
|
|
34
34
|
@results ||= {
|
35
35
|
username: username,
|
36
36
|
github_user_id: user_id,
|
37
|
+
learn_oauth_token: learn_oauth_token,
|
37
38
|
repo_name: runner.repo,
|
38
39
|
build: {
|
39
40
|
test_suite: [{
|
@@ -68,6 +69,10 @@ module LearnTest
|
|
68
69
|
options[:skip] ? "none" : super
|
69
70
|
end
|
70
71
|
|
72
|
+
def learn_oauth_token
|
73
|
+
options[:skip] ? nil : super
|
74
|
+
end
|
75
|
+
|
71
76
|
private
|
72
77
|
|
73
78
|
def set_up_runner
|
data/lib/learn_test/strategy.rb
CHANGED
@@ -5,7 +5,7 @@ module LearnTest
|
|
5
5
|
username = parser.username
|
6
6
|
user_id = parser.user_id
|
7
7
|
|
8
|
-
if !username || user_id == 'none'
|
8
|
+
if !LearnTest::LearnOauthTokenParser.get_learn_oauth_token && (!username || user_id == 'none')
|
9
9
|
print "Enter your github username: "
|
10
10
|
username = gets.strip
|
11
11
|
user_id = LearnTest::GithubInteractor.get_user_id_for(username)
|
data/lib/learn_test/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: learn-test
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flatiron School
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -222,6 +222,7 @@ files:
|
|
222
222
|
- lib/learn_test/dependency.rb
|
223
223
|
- lib/learn_test/file_finder.rb
|
224
224
|
- lib/learn_test/github_interactor.rb
|
225
|
+
- lib/learn_test/learn_oauth_token_parser.rb
|
225
226
|
- lib/learn_test/netrc_interactor.rb
|
226
227
|
- lib/learn_test/repo_parser.rb
|
227
228
|
- lib/learn_test/runner.rb
|