mumukit-bridge 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MmNlZThkYjM3YzYxOWMxM2M5Y2MwNWE5MmNhNGI1YWRiMjViZDY1Mw==
5
+ data.tar.gz: !binary |-
6
+ YzZlNmQ4ZGEzOWU3ZTI1ZjUyYjhlMmYyNGI0OTE3MDY1MWIyMjNhMA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ YmNhYjU4ZGQ0ZjUwMTE2ZjA4OWFiMTRmM2RiODZiNTc3NjM4MzYyYmYxOTBm
10
+ ZjkwMGY2MzIwNDg4NTgxMThlNmIxYjAzMDAzZDM4NzY0NGIwYjdiYmE5ZjMz
11
+ OTMxMTU0YWJmN2YxZGI2NWEwNGE2MDAyOTBmZjUzOWQ0Y2Q1NmE=
12
+ data.tar.gz: !binary |-
13
+ MGYyM2U5ZmM0NGNiNTFmMDg0Njg2Y2I4ZDc5NDQ4YWI4NjhjYmFjNjIyNWQ0
14
+ ZGRiZDZlZWI4NTM4OGZhMWJjZTcyZGVkMThlMWJkNWUxYmM5NTk1MTA1ODJi
15
+ YjJkMzZjMmMxZDgxNzRkZTBhMDc4M2E2ZWM1YmIwYjRlYmI1NGE=
@@ -0,0 +1,45 @@
1
+ require 'mumukit/bridge/version'
2
+ require 'rest_client'
3
+
4
+ module Mumukit
5
+ module Bridge
6
+ class Bridge
7
+ attr_accessor :test_runner_url
8
+
9
+ def initialize(test_runner_url)
10
+ @test_runner_url = test_runner_url
11
+ end
12
+
13
+ # Expects a hash
14
+ # {test: string, extra: string, content: string, expectations: [{binding:string, inspection: string})]}
15
+ # Returns a hash
16
+ # {result: string, status: string, expectation_results: [{binding:string, inspection:string, result:symbol}], feedback: string}
17
+ def run_tests!(request)
18
+ response = post_to_server(request)
19
+
20
+ {result: response['out'],
21
+ status: response['exit'],
22
+ expectation_results: parse_expectation_results(response['expectationResults'] || []),
23
+ feedback: response['feedback'] || ''}
24
+
25
+ rescue Exception => e
26
+ {result: e.message, status: :failed}
27
+ end
28
+
29
+ def parse_expectation_results(results)
30
+ results.map do |it|
31
+ {binding: it['expectation']['binding'],
32
+ inspection: it['expectation']['inspection'],
33
+ result: it['result'] ? :passed : :failed}
34
+ end
35
+ end
36
+
37
+ def post_to_server(request)
38
+ JSON.parse RestClient.post(
39
+ "#{test_runner_url}/test",
40
+ request.to_json,
41
+ content_type: :json)
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,5 @@
1
+ module Mumukit
2
+ module Bridge
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mumukit-bridge
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Franco Leonardo Bulgarelli
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-07-02 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '2'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rest-client
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description:
70
+ email:
71
+ - flbulgarelli@yahoo.com.ar
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - lib/mumukit/bridge.rb
77
+ - lib/mumukit/bridge/version.rb
78
+ homepage: http://github.com/uqbar-project/mumukit-bridge
79
+ licenses:
80
+ - MIT
81
+ metadata: {}
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ! '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 2.4.5
99
+ signing_key:
100
+ specification_version: 4
101
+ summary: Library for connecting to a Mumuki test runner
102
+ test_files: []