mumukit-bridge 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzUzZTM3OGI5NGUxM2U2YWM5ZWNjOTAyYzZhNGQ4ODJhZWRiZGI4Ng==
4
+ NzRjMDkwNzQ1ZTVkMWE2ZTc2ZTNiNDc3ZDQ4OTZjZTlmYzk4ZjVkMA==
5
5
  data.tar.gz: !binary |-
6
- ZGExZWQ2NzhjMGU1MWNkNzI0OGFhZDkxZmZhOTQ3N2FhNjU0YTJjOA==
6
+ ZTdkZmE3NzZkYjVkOTVhY2YxNmFhZWZmYTM2YWZhYjgzZGUyM2Y4ZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzJiNjhmMWIxMzRiZDEzMTMzMjI1OWNiODFkY2Q3YzJkOWY1NmJiNTgzN2Qx
10
- YzgyMDBmYjZjMTlkOWQ0NGM5OGQxNmQ3ZTkyNDk0OTZiYTE4NzA1MTFmMDMz
11
- OGVkZjUzNzg5NTFjOWI5NzdlOGIwMjI2OTdiZWIzOTRjNmJhYjQ=
9
+ YjYxZmExNmIyNmYxZDU3NjJjNDJmNmMzYWFiN2VmOWU3ZTBlZDljYjk2ODMy
10
+ NjkwMDVmNzM4ZDg0MzU2YzgwNDM0MDcxOWY2YWU0MDkxODFlMGY1NmI5NTYw
11
+ OWViMzU3ZDk1ZjkxODE1ZjVkMzc5M2ZhYjE4YWZhZDQ2M2I2ZmY=
12
12
  data.tar.gz: !binary |-
13
- NjMwMjg2MWU2N2YxNjU2NmRiNDg1MWY0OTlmYmU4ODE0ZjFlNjIzOTI3YzNl
14
- N2NjN2UyODhjZjBhNDA3ZTFkNjQ4N2IxZjdkNmY3MGJkZmIwMTgwNGY2OTZi
15
- MmI3NTIxM2FhZGI3NDU1MzZkMzYwNmUwMDk2Y2E5MzQ2ZjUzMmU=
13
+ ZTBiN2EzMzQ3NTY5NGY5NzNhMDM1ZjQzNDZlMGVkODdiM2ZlMDU0NTZmMTBh
14
+ OTI3NDZmNjFhMTVmZTQ1OTBmYzJjZmIyNDNjMDRhYzVjNjY0NzZlN2RlZGMx
15
+ NThjYWE0OGQzMmMzZGVjY2FkMTZmZGRmZDc0NmY5YjkyMzA0MTY=
@@ -1,55 +1,12 @@
1
- require 'mumukit/bridge/version'
2
- require 'mumukit/bridge/response_type'
3
- require 'mumukit/bridge/array'
4
- require 'mumukit/bridge/boolean'
5
-
6
1
  require 'rest_client'
7
-
8
2
  require 'active_support/core_ext/object'
9
3
 
10
- module Mumukit
11
- module Bridge
12
- class Bridge
13
- attr_accessor :test_runner_url
14
-
15
- def initialize(test_runner_url)
16
- @test_runner_url = test_runner_url
17
- end
4
+ require_relative './bridge/version'
5
+ require_relative './bridge/runner'
6
+ require_relative './bridge/bibliotheca'
18
7
 
19
- # Expects a hash
20
- # {test: string, extra: string, content: string, expectations: [{binding:string, inspection: string})]}
21
- # Returns a hash
22
- # {result: string,
23
- # test_results: [{title:string, status:symbol, result:string}],
24
- # status: :passed|:failed|:errored|:aborted|:passed_with_warnings,
25
- # expectation_results: [{binding:string, inspection:string, result:symbol}],
26
- # feedback: string}
27
- def run_tests!(request)
28
- with_sever_response request, 'test' do |response|
29
- response_type = ResponseType.for_response response
30
- response_type.parse response
31
- end
32
- end
33
8
 
34
- def run_query!(request)
35
- with_sever_response request, 'query' do | it |
36
- {status: it['exit'].to_sym, result: it['out']}
37
- end
38
- end
39
-
40
- def with_sever_response(request, route, &action)
41
- response = post_to_server(request, route)
42
- action.call(response)
43
- rescue Exception => e
44
- {result: e.message, status: :errored}
45
- end
46
-
47
- def post_to_server(request, route)
48
- JSON.parse RestClient.post(
49
- "#{test_runner_url}/#{route}",
50
- request.to_json,
51
- content_type: :json)
52
- end
53
- end
9
+ module Mumukit
10
+ module Bridge
54
11
  end
55
- end
12
+ end
@@ -0,0 +1,24 @@
1
+ module Mumukit
2
+ module Bridge
3
+ class Bibliotheca
4
+ def initialize(url = 'http://bibliotheca.mumuki.io')
5
+ @url = url
6
+ end
7
+
8
+ def guides
9
+ get('guides')['guides']
10
+ end
11
+
12
+ def guide(slug)
13
+ get "guides/#{slug}"
14
+ end
15
+
16
+ def get(path)
17
+ JSON.parse RestClient.get("http://bibliotheca.mumuki.io/#{path}")
18
+ end
19
+
20
+ end
21
+
22
+
23
+ end
24
+ end
@@ -0,0 +1,51 @@
1
+ require_relative './runner/response_type'
2
+ require_relative './runner/array'
3
+ require_relative './runner/boolean'
4
+
5
+
6
+ module Mumukit
7
+ module Bridge
8
+ class Runner
9
+ attr_accessor :test_runner_url
10
+
11
+ def initialize(test_runner_url)
12
+ @test_runner_url = test_runner_url
13
+ end
14
+
15
+ # Expects a hash
16
+ # {test: string, extra: string, content: string, expectations: [{binding:string, inspection: string})]}
17
+ # Returns a hash
18
+ # {result: string,
19
+ # test_results: [{title:string, status:symbol, result:string}],
20
+ # status: :passed|:failed|:errored|:aborted|:passed_with_warnings,
21
+ # expectation_results: [{binding:string, inspection:string, result:symbol}],
22
+ # feedback: string}
23
+ def run_tests!(request)
24
+ with_sever_response request, 'test' do |response|
25
+ response_type = ResponseType.for_response response
26
+ response_type.parse response
27
+ end
28
+ end
29
+
30
+ def run_query!(request)
31
+ with_sever_response request, 'query' do | it |
32
+ {status: it['exit'].to_sym, result: it['out']}
33
+ end
34
+ end
35
+
36
+ def with_sever_response(request, route, &action)
37
+ response = post_to_server(request, route)
38
+ action.call(response)
39
+ rescue Exception => e
40
+ {result: e.message, status: :errored}
41
+ end
42
+
43
+ def post_to_server(request, route)
44
+ JSON.parse RestClient.post(
45
+ "#{test_runner_url}/#{route}",
46
+ request.to_json,
47
+ content_type: :json)
48
+ end
49
+ end
50
+ end
51
+ end
File without changes
@@ -1,5 +1,5 @@
1
1
  module Mumukit
2
2
  module Bridge
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumukit-bridge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-29 00:00:00.000000000 Z
11
+ date: 2015-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '2'
47
+ version: '2.99'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '2'
54
+ version: '2.99'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rest-client
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -88,9 +88,11 @@ extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
90
  - lib/mumukit/bridge.rb
91
- - lib/mumukit/bridge/array.rb
92
- - lib/mumukit/bridge/boolean.rb
93
- - lib/mumukit/bridge/response_type.rb
91
+ - lib/mumukit/bridge/bibliotheca.rb
92
+ - lib/mumukit/bridge/runner.rb
93
+ - lib/mumukit/bridge/runner/array.rb
94
+ - lib/mumukit/bridge/runner/boolean.rb
95
+ - lib/mumukit/bridge/runner/response_type.rb
94
96
  - lib/mumukit/bridge/version.rb
95
97
  homepage: http://github.com/uqbar-project/mumukit-bridge
96
98
  licenses: