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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7e943e721047ea7b8eae3140aed5fd786a816ea9c2be1c4b6fcaf746a6270c6
4
- data.tar.gz: 739ba7b8e688951e1b92381b2b601be60691032a1933cd8bad999dfccad4a6c1
3
+ metadata.gz: 26c42da4079ed80836699be4a2b2ea0fcdc08c7f15723859bd17400d52bb09f8
4
+ data.tar.gz: 3ae3770cf9b7f0db664e019d394ea8cacec91ba4c92d7b7bfc5da5b9182ecab5
5
5
  SHA512:
6
- metadata.gz: e2872b0805e592ed64aa75747905f9fb8cf79ef95769665652a54ca30d4430e8742eb497b4062403893c24aba91a9327d69795016378b4bb58dbe077a60074c3
7
- data.tar.gz: f642ca1de76746c5402453dc1af69d2d4604ed5b8b87860d6b3f13cab469e680643168a8afb500e46a4259d9dd1747c499b38e135134f84dd75c544ed14f0760
6
+ metadata.gz: f1051fd3aa84d204dcf94e18d2ef17d1c24c5b1051f40b2a140f4a4f15e6186140692d135c79f43a3fb15fb6d0534076b8a4d53aa1adf171d5a620d98e09170c
7
+ data.tar.gz: 2b2d07e72efbb1824a8ab693c95c441839a3cdf57ba6f6dfee3d253f24c5a0c79ae3ec33236d3bac652f087cd296d150ba9cc0db844113ed4f0641bde898fa1a
@@ -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.3'
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'
@@ -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
- "bash #{filename}"
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
@@ -1,3 +1,3 @@
1
1
  module BashVersionHook
2
- VERSION = '1.1.7'
2
+ VERSION = '1.2.0'
3
3
  end
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.1.7
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: 2019-07-26 00:00:00.000000000 Z
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
- rubygems_version: 3.0.4
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