mumuki-haskell-runner 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/expectations_hook.rb +9 -0
- data/lib/haskell_file_hook.rb +12 -0
- data/lib/haskell_runner.rb +14 -0
- data/lib/metadata_hook.rb +16 -0
- data/lib/query_hook.rb +11 -0
- data/lib/test_hook.rb +41 -0
- data/lib/validation_hook.rb +14 -0
- metadata +135 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 652153fe22608c8b7f34bc0c2663dd5491645a16
|
4
|
+
data.tar.gz: 3eb2a880bcc0eb398faffdf844b76ca1cc4a3955
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 99d83b59149373fe94a5a8730acb528e7fd1f394d982e308c07fb42908134a504c363c6adbd291f28f80f3d1d3d4c4b4b96ac278a9589d4968e754f149aa6341
|
7
|
+
data.tar.gz: 2766799db070d55c5c1332de60e820e709b1fef473a84456959ccedf08439675bcf869dc08a1166b1684897db40ccdb3c8acb0d5e979ece29a36596481978d97
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'mumukit'
|
2
|
+
|
3
|
+
Mumukit.runner_name = 'haskell'
|
4
|
+
Mumukit.configure do |config|
|
5
|
+
config.docker_image = 'mumuki/mumuki-hspec-worker'
|
6
|
+
config.comment_type = Mumukit::Directives::CommentType::Haskell
|
7
|
+
end
|
8
|
+
|
9
|
+
require_relative './haskell_file_hook'
|
10
|
+
require_relative './expectations_hook'
|
11
|
+
require_relative './validation_hook'
|
12
|
+
require_relative './metadata_hook'
|
13
|
+
require_relative './test_hook'
|
14
|
+
require_relative './query_hook'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class HaskellMetadataHook < Mumukit::Hook
|
2
|
+
def metadata
|
3
|
+
{language: {
|
4
|
+
name: 'haskell',
|
5
|
+
icon: {type: 'devicon', name: 'haskell'},
|
6
|
+
version: 'ghc-7.10.1',
|
7
|
+
extension: 'hs',
|
8
|
+
ace_mode: 'haskell'
|
9
|
+
},
|
10
|
+
test_framework: {
|
11
|
+
name: 'hspec',
|
12
|
+
version: '2',
|
13
|
+
test_extension: 'hs'
|
14
|
+
}}
|
15
|
+
end
|
16
|
+
end
|
data/lib/query_hook.rb
ADDED
data/lib/test_hook.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
class HaskellTestHook < HaskellFileHook
|
2
|
+
structured true
|
3
|
+
|
4
|
+
def to_structured_result(result)
|
5
|
+
result = result.split('@@@RESULTS-START@@@').last
|
6
|
+
super(result).compact
|
7
|
+
end
|
8
|
+
|
9
|
+
def compile_file_content(req)
|
10
|
+
<<-EOF
|
11
|
+
{-# OPTIONS_GHC -fdefer-type-errors #-}
|
12
|
+
import Test.Hspec
|
13
|
+
import Test.Hspec.Runner (hspecWith, defaultConfig, Config (configFormatter))
|
14
|
+
import Test.QuickCheck
|
15
|
+
import Test.Hspec.Formatters
|
16
|
+
|
17
|
+
import qualified Control.Exception as Exception
|
18
|
+
|
19
|
+
import Data.List
|
20
|
+
|
21
|
+
structured :: Formatter
|
22
|
+
structured = silent {
|
23
|
+
exampleSucceeded = \\p ->
|
24
|
+
writeTerm [formatPath p, "passed", ""],
|
25
|
+
exampleFailed = \\p result -> case result of
|
26
|
+
(Right e) -> writeTerm [formatPath p, "failed", e]
|
27
|
+
(Left e) -> writeTerm [formatPath p, "failed", show e],
|
28
|
+
headerFormatter = write $ "@@@RESULTS-START@@@[",
|
29
|
+
footerFormatter = write $ "null]"
|
30
|
+
}
|
31
|
+
where formatPath (ps, p) = intercalate " " $ (ps ++ [p])
|
32
|
+
writeTerm = write.(++",").show
|
33
|
+
|
34
|
+
#{req.content}
|
35
|
+
#{req.extra}
|
36
|
+
main :: IO ()
|
37
|
+
main = hspecWith defaultConfig {configFormatter = Just structured} $ do
|
38
|
+
#{req.test.lines.map {|it| ' ' + it}.join}
|
39
|
+
EOF
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class HaskellValidationHook < Mumukit::Hook
|
2
|
+
def validate!(request)
|
3
|
+
raise Mumukit::RequestValidationError, 'you can not use unsafe io' if unsafe?(request)
|
4
|
+
end
|
5
|
+
|
6
|
+
def unsafe?(request)
|
7
|
+
[
|
8
|
+
request.content,
|
9
|
+
request.test,
|
10
|
+
request.extra,
|
11
|
+
request.query
|
12
|
+
].compact.any? { |it| it.include? 'System.IO.Unsafe' }
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,135 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mumuki-haskell-runner
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Franco Leonardo Bulgarelli
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-09-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mumukit
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.4'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.4'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: codeclimate-test-reporter
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: mumukit-bridge
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.3'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.3'
|
97
|
+
description:
|
98
|
+
email:
|
99
|
+
- franco@mumuki.org
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- lib/expectations_hook.rb
|
105
|
+
- lib/haskell_file_hook.rb
|
106
|
+
- lib/haskell_runner.rb
|
107
|
+
- lib/metadata_hook.rb
|
108
|
+
- lib/query_hook.rb
|
109
|
+
- lib/test_hook.rb
|
110
|
+
- lib/validation_hook.rb
|
111
|
+
homepage: http://github.com/mumuki/mumuki-haskell-server
|
112
|
+
licenses:
|
113
|
+
- MIT
|
114
|
+
metadata: {}
|
115
|
+
post_install_message:
|
116
|
+
rdoc_options: []
|
117
|
+
require_paths:
|
118
|
+
- lib
|
119
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - ">="
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
requirements: []
|
130
|
+
rubyforge_project:
|
131
|
+
rubygems_version: 2.4.8
|
132
|
+
signing_key:
|
133
|
+
specification_version: 4
|
134
|
+
summary: Haskell Runner for Mumuki
|
135
|
+
test_files: []
|