mumuki-ruby-runner 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/query_hook.rb +44 -2
- data/lib/ruby_runner.rb +1 -0
- data/lib/version.rb +3 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 988622db185a5d78fca2eb93bf165f24d0c28d07
|
4
|
+
data.tar.gz: bd1674bc036ef76421250c1a153996aa28bad849
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2ba24fc9d404aa567559948e526476e352109bde95389683f4ab45d2928b184dc8f964165b5e33a6172c2ace6ce49b999737e20beae9679a34b98ba6db34453
|
7
|
+
data.tar.gz: e47517509c27f46931bac0b49b006d67a49899dc997fb5b36704c1f7a9c6cab88bf8139745a28efbf4166ac2c63e5ebbc187e56c33f79d6eaa972ce22d9e6c75
|
data/lib/query_hook.rb
CHANGED
@@ -6,10 +6,52 @@ class RubyQueryHook < Mumukit::Templates::FileHook
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def compile_file_content(r)
|
9
|
-
|
9
|
+
<<ruby
|
10
|
+
class MumukiConsole
|
11
|
+
def self.write(string)
|
12
|
+
end
|
13
|
+
def self.enter_cookie!
|
14
|
+
@@old_stdout = $stdout
|
15
|
+
$stdout = MumukiConsole
|
16
|
+
end
|
17
|
+
def self.exit_cookie!
|
18
|
+
$stdout = @@old_stdout
|
19
|
+
end
|
20
|
+
end
|
21
|
+
#{r.extra}
|
22
|
+
#{r.content}
|
23
|
+
MumukiConsole.enter_cookie!
|
24
|
+
#{compile_cookie(r.cookie)}
|
25
|
+
MumukiConsole.exit_cookie!
|
26
|
+
#{compile_query(r.query)}
|
27
|
+
ruby
|
10
28
|
end
|
11
29
|
|
12
30
|
def command_line(filename)
|
13
31
|
"ruby #{filename}"
|
14
32
|
end
|
15
|
-
|
33
|
+
|
34
|
+
def compile_query(query)
|
35
|
+
if query.start_with? 'def '
|
36
|
+
"#{query}\nputs \"=> nil\""
|
37
|
+
else
|
38
|
+
"print('=> ' + (#{query}).inspect)"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def build_state(cookie)
|
43
|
+
(cookie||[]).map do |statement|
|
44
|
+
<<ruby
|
45
|
+
begin
|
46
|
+
#{statement}
|
47
|
+
rescue
|
48
|
+
end
|
49
|
+
ruby
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def compile_cookie(cookie)
|
54
|
+
build_state(cookie).join("\n")
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
data/lib/ruby_runner.rb
CHANGED
data/lib/version.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumuki-ruby-runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.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: 2016-
|
11
|
+
date: 2016-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mumukit
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.6'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.6'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- lib/query_hook.rb
|
106
106
|
- lib/ruby_runner.rb
|
107
107
|
- lib/test_hook.rb
|
108
|
+
- lib/version.rb
|
108
109
|
homepage: http://github.com/mumuki/mumuki-ruby-server
|
109
110
|
licenses:
|
110
111
|
- MIT
|