mumuki-bash-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/bash_runner.rb +13 -0
- data/lib/metadata_hook.rb +16 -0
- data/lib/try_hook.rb +76 -0
- data/lib/version_hook.rb +3 -0
- metadata +131 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 44fd52e58cce711a67fbebba7dcd3dd5bf87f065
|
4
|
+
data.tar.gz: 8e2c50dc975e3ec20f97bf287f8d45c22aff4a87
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: aeb613f9c2ab011477767572305a4f0d38c50e2053c2a1c7d62d2ffd91d7fef5ae5638d9c3f6f7927e1895f1cdc88a04c0bbe5a35185dd338db4a0798aeadddb
|
7
|
+
data.tar.gz: 2c5634b3fb09404652b0a0a74852bbef2a6ea2e87db54c6a5c068a4f6222831afb57fac95ec81fce957bd6dcfe5dcf5573df1bcc9e0ec97096d3966fbc74fce2
|
data/lib/bash_runner.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'mumukit'
|
2
|
+
|
3
|
+
I18n.load_translations_path File.join(__dir__, 'locales', '*.yml')
|
4
|
+
|
5
|
+
Mumukit.runner_name = 'bash'
|
6
|
+
Mumukit.configure do |config|
|
7
|
+
config.docker_image = 'mumuki/mumuki-bash-worker'
|
8
|
+
config.stateful = true
|
9
|
+
end
|
10
|
+
|
11
|
+
require_relative './version_hook'
|
12
|
+
require_relative './metadata_hook'
|
13
|
+
require_relative './try_hook'
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class BashMetadataHook < Mumukit::Hook
|
2
|
+
def metadata
|
3
|
+
{language: {
|
4
|
+
name: 'bash',
|
5
|
+
icon: {type: 'devicon', name: 'bash'},
|
6
|
+
version: '4.3.48(1)-release',
|
7
|
+
extension: 'sh',
|
8
|
+
ace_mode: 'bash',
|
9
|
+
prompt: '$'
|
10
|
+
},
|
11
|
+
test_framework: {
|
12
|
+
name: 'metatest',
|
13
|
+
test_extension: 'yml'
|
14
|
+
}}
|
15
|
+
end
|
16
|
+
end
|
data/lib/try_hook.rb
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
class BashTryHook < Mumukit::Templates::TryHook
|
2
|
+
isolated true
|
3
|
+
|
4
|
+
def tempfile_extension
|
5
|
+
'.sh'
|
6
|
+
end
|
7
|
+
|
8
|
+
def compile_file_content(r)
|
9
|
+
<<bash
|
10
|
+
echo #{extra_separator}
|
11
|
+
#{r.extra}
|
12
|
+
echo #{cookie_separator}
|
13
|
+
#{(r.cookie || []).join("\n")}
|
14
|
+
echo #{query_separator}
|
15
|
+
#{r.query}
|
16
|
+
echo $?
|
17
|
+
echo #{goal_separator}
|
18
|
+
#{r.goal.with_indifferent_access[:query]}
|
19
|
+
bash
|
20
|
+
end
|
21
|
+
|
22
|
+
def command_line(filename)
|
23
|
+
"bash #{filename}"
|
24
|
+
end
|
25
|
+
|
26
|
+
def extra_separator
|
27
|
+
'!!!MUMUKI-EXTRA-START!!!'
|
28
|
+
end
|
29
|
+
|
30
|
+
def cookie_separator
|
31
|
+
'!!!MUMUKI-COOKIE-START!!!'
|
32
|
+
end
|
33
|
+
|
34
|
+
def query_separator
|
35
|
+
'!!!MUMUKI-QUERY-START!!!'
|
36
|
+
end
|
37
|
+
|
38
|
+
def goal_separator
|
39
|
+
'!!!MUMUKI-GOAL-START!!!'
|
40
|
+
end
|
41
|
+
|
42
|
+
def post_process_file(_file, result, status)
|
43
|
+
/#{extra_separator}
|
44
|
+
?(.*)
|
45
|
+
#{cookie_separator}
|
46
|
+
?(.*)
|
47
|
+
#{query_separator}
|
48
|
+
?(.*)
|
49
|
+
#{goal_separator}
|
50
|
+
?(.*)
|
51
|
+
/m =~ result
|
52
|
+
|
53
|
+
results = {
|
54
|
+
query: to_query_result($3),
|
55
|
+
goal: $4,
|
56
|
+
status: status
|
57
|
+
}
|
58
|
+
|
59
|
+
check_results = check(results)
|
60
|
+
|
61
|
+
[check_results[2], check_results[1], results[:query]]
|
62
|
+
end
|
63
|
+
|
64
|
+
def to_query_result(query_output)
|
65
|
+
result, _, status = query_output.rpartition("\n")
|
66
|
+
status = status == '0' ? :passed : :failed
|
67
|
+
{result: result, status: status}
|
68
|
+
end
|
69
|
+
|
70
|
+
def create_tempfile
|
71
|
+
file = super
|
72
|
+
%x{chmod o+r #{file.path}}
|
73
|
+
file
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
data/lib/version_hook.rb
ADDED
metadata
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mumuki-bash-runner
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- mumuki
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-10-20 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.16'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.16'
|
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: '3.1'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.1'
|
97
|
+
description:
|
98
|
+
email:
|
99
|
+
executables: []
|
100
|
+
extensions: []
|
101
|
+
extra_rdoc_files: []
|
102
|
+
files:
|
103
|
+
- lib/bash_runner.rb
|
104
|
+
- lib/metadata_hook.rb
|
105
|
+
- lib/try_hook.rb
|
106
|
+
- lib/version_hook.rb
|
107
|
+
homepage: http://github.com/mumuki/mumuki-bash-server
|
108
|
+
licenses:
|
109
|
+
- MIT
|
110
|
+
metadata: {}
|
111
|
+
post_install_message:
|
112
|
+
rdoc_options: []
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
requirements: []
|
126
|
+
rubyforge_project:
|
127
|
+
rubygems_version: 2.5.1
|
128
|
+
signing_key:
|
129
|
+
specification_version: 4
|
130
|
+
summary: bash Runner for Mumuki
|
131
|
+
test_files: []
|