mumuki-bash-runner 1.1.7 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bash_runner.rb +7 -1
- data/lib/try_hook.rb +13 -1
- data/lib/version_hook.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26c42da4079ed80836699be4a2b2ea0fcdc08c7f15723859bd17400d52bb09f8
|
4
|
+
data.tar.gz: 3ae3770cf9b7f0db664e019d394ea8cacec91ba4c92d7b7bfc5da5b9182ecab5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1051fd3aa84d204dcf94e18d2ef17d1c24c5b1051f40b2a140f4a4f15e6186140692d135c79f43a3fb15fb6d0534076b8a4d53aa1adf171d5a620d98e09170c
|
7
|
+
data.tar.gz: 2b2d07e72efbb1824a8ab693c95c441839a3cdf57ba6f6dfee3d253f24c5a0c79ae3ec33236d3bac652f087cd296d150ba9cc0db844113ed4f0641bde898fa1a
|
data/lib/bash_runner.rb
CHANGED
@@ -4,10 +4,16 @@ I18n.load_translations_path File.join(__dir__, 'locales', '*.yml')
|
|
4
4
|
|
5
5
|
Mumukit.runner_name = 'bash'
|
6
6
|
Mumukit.configure do |config|
|
7
|
-
config.docker_image = 'mumuki/mumuki-bash-worker:1.
|
7
|
+
config.docker_image = 'mumuki/mumuki-bash-worker:1.4'
|
8
8
|
config.stateful = true
|
9
9
|
end
|
10
10
|
|
11
|
+
module BashRunner
|
12
|
+
REQUIRED_COMMANDS = %w(bash sh).freeze
|
13
|
+
DEFAULT_ENABLED_COMMANDS = %w(cat cp git head ls mkdir mv sed tail touch).freeze
|
14
|
+
ALLOWED_COMMANDS = %w(awk cat cp git grep head ln ls mkdir mv rm rmdir sed tac tail touch wc whoami).freeze
|
15
|
+
end
|
16
|
+
|
11
17
|
require_relative './version_hook'
|
12
18
|
require_relative './metadata_hook'
|
13
19
|
require_relative './try_hook'
|
data/lib/try_hook.rb
CHANGED
@@ -6,6 +6,7 @@ class BashTryHook < Mumukit::Templates::TryHook
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def compile_file_content(r)
|
9
|
+
set_custom_allowed_commands! r
|
9
10
|
<<~bash
|
10
11
|
(echo #{extra_separator}
|
11
12
|
#{r.extra}
|
@@ -20,7 +21,7 @@ class BashTryHook < Mumukit::Templates::TryHook
|
|
20
21
|
end
|
21
22
|
|
22
23
|
def command_line(filename)
|
23
|
-
|
24
|
+
['runbash', available_commands.join(' '), filename]
|
24
25
|
end
|
25
26
|
|
26
27
|
def extra_separator
|
@@ -70,4 +71,15 @@ class BashTryHook < Mumukit::Templates::TryHook
|
|
70
71
|
file
|
71
72
|
end
|
72
73
|
|
74
|
+
def enabled_commands
|
75
|
+
(@custom_enabled_commands.presence || BashRunner::DEFAULT_ENABLED_COMMANDS) & BashRunner::ALLOWED_COMMANDS
|
76
|
+
end
|
77
|
+
|
78
|
+
def available_commands
|
79
|
+
[enabled_commands, BashRunner::REQUIRED_COMMANDS].flatten
|
80
|
+
end
|
81
|
+
|
82
|
+
def set_custom_allowed_commands!(r)
|
83
|
+
@custom_enabled_commands = r.settings.try { |settings| settings['enabled_commands'] }
|
84
|
+
end
|
73
85
|
end
|
data/lib/version_hook.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumuki-bash-runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mumuki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mumukit
|
@@ -123,7 +123,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
|
-
|
126
|
+
rubyforge_project:
|
127
|
+
rubygems_version: 2.7.7
|
127
128
|
signing_key:
|
128
129
|
specification_version: 4
|
129
130
|
summary: bash Runner for Mumuki
|