mysh 0.6.9 → 0.6.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +25 -5
- data/lib/mysh.rb +19 -9
- data/lib/mysh/{internal/action.rb → action.rb} +8 -8
- data/lib/mysh/{internal/action_pool.rb → action_pool.rb} +8 -8
- data/lib/mysh/{internal/actions/command_line.rb → command_line.rb} +10 -10
- data/lib/mysh/{internal/actions/command_line → command_line}/debug.rb +9 -11
- data/lib/mysh/command_line/history.rb +61 -0
- data/lib/mysh/{internal/actions/command_line → command_line}/init.rb +8 -8
- data/lib/mysh/{internal/actions/command_line → command_line}/load.rb +5 -5
- data/lib/mysh/{internal/actions/command_line → command_line}/pause.rb +6 -8
- data/lib/mysh/{internal/actions/command_line → command_line}/post_prompt.rb +10 -12
- data/lib/mysh/{internal/actions/command_line → command_line}/pre_prompt.rb +10 -12
- data/lib/mysh/{internal/actions/command_line → command_line}/prompt.rb +9 -10
- data/lib/mysh/command_line/quit.rb +19 -0
- data/lib/mysh/{internal/actions/command_line → command_line}/usage.rb +4 -4
- data/lib/mysh/expression.rb +11 -31
- data/lib/mysh/external.rb +4 -5
- data/lib/mysh/globalize.rb +14 -10
- data/lib/mysh/handlebars.rb +10 -13
- data/lib/mysh/handlebars/eval_handlebars.rb +38 -0
- data/lib/mysh/{internal/actions/help → help}/env.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/expr.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/gem.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/gls.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/h_o_h.txt +1 -1
- data/lib/mysh/{internal/actions/help → help}/hbar.txt +11 -0
- data/lib/mysh/{internal/actions/help → help}/help.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/history.txt +7 -0
- data/lib/mysh/{internal/actions/help → help}/init.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/kbd.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/math.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/mls.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/quick.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/ruby.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/show.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/term.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/timed.txt +0 -0
- data/lib/mysh/help/type.txt +28 -0
- data/lib/mysh/{internal/actions/help → help}/types.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/usage.txt +0 -0
- data/lib/mysh/{internal/actions/help → help}/vars.txt +4 -4
- data/lib/mysh/input_wrapper.rb +13 -13
- data/lib/mysh/internal.rb +20 -8
- data/lib/mysh/internal/{actions/cancel.rb → cancel.rb} +0 -0
- data/lib/mysh/internal/{actions/cd.rb → cd.rb} +2 -2
- data/lib/mysh/internal/{actions/comment.rb → comment.rb} +2 -2
- data/lib/mysh/internal/{actions/elapsed.rb → elapsed.rb} +2 -2
- data/lib/mysh/internal/{actions/exit.rb → exit.rb} +0 -0
- data/lib/mysh/internal/{actions/gls.rb → gls.rb} +6 -7
- data/lib/mysh/internal/{actions/help.rb → help.rb} +7 -9
- data/lib/mysh/internal/{actions/history.rb → history.rb} +10 -9
- data/lib/mysh/internal/load.rb +45 -0
- data/lib/mysh/internal/{actions/mls.rb → mls.rb} +2 -2
- data/lib/mysh/internal/{actions/pwd.rb → pwd.rb} +1 -1
- data/lib/mysh/internal/{actions/say.rb → say.rb} +1 -1
- data/lib/mysh/internal/{actions/show.rb → show.rb} +7 -6
- data/lib/mysh/internal/{actions/help → support}/sub_help.rb +9 -7
- data/lib/mysh/internal/type.rb +38 -0
- data/lib/mysh/internal/{actions/vars.rb → vars.rb} +8 -8
- data/lib/mysh/{init.rb → load_init_file.rb} +3 -3
- data/lib/mysh/process.rb +7 -7
- data/lib/mysh/quick.rb +10 -4
- data/lib/mysh/shell_variables.rb +9 -4
- data/lib/mysh/shell_variables/evaluate.rb +2 -11
- data/lib/mysh/shell_variables/shell_variable_keeper.rb +6 -7
- data/lib/mysh/shell_variables/shell_variable_store.rb +13 -14
- data/lib/mysh/{internal/actions/show → show}/env.rb +3 -5
- data/lib/mysh/{internal/actions/show → show}/gem.rb +3 -16
- data/lib/mysh/{internal/actions/show → show}/ruby.rb +0 -0
- data/lib/mysh/{internal/actions/show → show}/term.rb +5 -7
- data/lib/mysh/sources/console.rb +11 -7
- data/lib/mysh/sources/parse.rb +7 -10
- data/lib/mysh/sources/smart_auto_complete.rb +5 -5
- data/lib/mysh/sources/string.rb +6 -6
- data/lib/mysh/string_helpers.rb +37 -0
- data/lib/mysh/system.rb +2 -2
- data/lib/mysh/user_input.rb +5 -9
- data/lib/mysh/version.rb +4 -4
- data/mysh.gemspec +4 -3
- data/samples/show.txt +2 -0
- data/tests/my_shell_tests.rb +18 -6
- metadata +77 -65
- data/lib/mysh/binding_wrapper.rb +0 -21
- data/lib/mysh/handlebars/string.rb +0 -22
- data/lib/mysh/internal/actions/actions_path.rb +0 -15
- data/lib/mysh/internal/actions/command_line/quit.rb +0 -19
- data/lib/mysh/internal/actions/load.rb +0 -36
- data/lib/mysh/internal/actions/type.rb +0 -22
- data/lib/mysh/internal/manage.rb +0 -20
- data/lib/mysh/internal/to_file_spec.rb +0 -26
- data/lib/mysh/pre_processor.rb +0 -11
@@ -1,24 +1,24 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
# The mysh load command.
|
4
4
|
module Mysh
|
5
5
|
|
6
|
-
|
6
|
+
# The mysh load command.
|
7
7
|
class LoadOption < CommandOption
|
8
8
|
|
9
|
-
#Skip over the argument for pre_boot.
|
9
|
+
# Skip over the argument for pre_boot.
|
10
10
|
def pre_boot(read_point)
|
11
11
|
get_arg(read_point)
|
12
12
|
end
|
13
13
|
|
14
|
-
#Execute the load command line option.
|
14
|
+
# Execute the load command line option.
|
15
15
|
def post_boot(read_point)
|
16
16
|
mysh "load #{get_arg(read_point).to_host_spec}"
|
17
17
|
end
|
18
18
|
|
19
19
|
end
|
20
20
|
|
21
|
-
#Add the load command line option to the library.
|
21
|
+
# Add the load command line option to the library.
|
22
22
|
desc = 'Load the specified file into the mysh.'
|
23
23
|
COMMAND_LINE.add_action(LoadOption.new('--load filename', desc))
|
24
24
|
COMMAND_LINE.add_action(LoadOption.new('-l filename', desc))
|
@@ -5,9 +5,8 @@ module Mysh
|
|
5
5
|
# The page pause option.
|
6
6
|
class PauseOption < CommandOption
|
7
7
|
|
8
|
-
#Execute the help command line option.
|
9
|
-
|
10
|
-
#* :reek:UtilityFunction
|
8
|
+
# Execute the help command line option.
|
9
|
+
# Endemic Code Smells :reek:UtilityFunction
|
11
10
|
def post_boot(_args)
|
12
11
|
MNV[:page_pause] = "on"
|
13
12
|
end
|
@@ -18,16 +17,15 @@ module Mysh
|
|
18
17
|
|
19
18
|
end
|
20
19
|
|
21
|
-
#Add the pause command line option to the library.
|
20
|
+
# Add the pause command line option to the library.
|
22
21
|
desc = 'Turn on page pauses.'
|
23
22
|
COMMAND_LINE.add_action(PauseOption.new('--pause', desc))
|
24
23
|
|
25
24
|
# The no page pause option.
|
26
25
|
class NoPauseOption < CommandOption
|
27
26
|
|
28
|
-
#Execute the help command line option.
|
29
|
-
|
30
|
-
#* :reek:UtilityFunction
|
27
|
+
# Execute the help command line option.
|
28
|
+
# Endemic Code Smells :reek:UtilityFunction
|
31
29
|
def post_boot(_args)
|
32
30
|
MNV[:page_pause] = "off"
|
33
31
|
end
|
@@ -38,7 +36,7 @@ module Mysh
|
|
38
36
|
|
39
37
|
end
|
40
38
|
|
41
|
-
#Add the no pause command line option to the library.
|
39
|
+
# Add the no pause command line option to the library.
|
42
40
|
desc = 'Turn off page pauses.'
|
43
41
|
COMMAND_LINE.add_action(NoPauseOption.new('--no-pause', desc))
|
44
42
|
end
|
@@ -1,43 +1,41 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
# The mysh post prompt command.
|
4
4
|
module Mysh
|
5
5
|
|
6
|
-
|
6
|
+
# The mysh post prompt command.
|
7
7
|
class PostpromptOption < CommandOption
|
8
8
|
|
9
|
-
#Skip over the argument for pre_boot.
|
9
|
+
# Skip over the argument for pre_boot.
|
10
10
|
def pre_boot(read_point)
|
11
11
|
get_arg(read_point)
|
12
12
|
end
|
13
13
|
|
14
|
-
#Execute the prompt command line option.
|
15
|
-
|
16
|
-
#* :reek:UtilityFunction
|
14
|
+
# Execute the prompt command line option.
|
15
|
+
# Endemic Code Smells :reek:UtilityFunction
|
17
16
|
def post_boot(read_point)
|
18
17
|
MNV[:post_prompt] = get_arg(read_point)
|
19
18
|
end
|
20
19
|
|
21
20
|
end
|
22
21
|
|
23
|
-
#Add the post prompt command line option to the library.
|
22
|
+
# Add the post prompt command line option to the library.
|
24
23
|
desc = 'Set the mysh line continuation prompt to "str".'
|
25
24
|
COMMAND_LINE.add_action(PostpromptOption.new('--post-prompt "str"', desc))
|
26
25
|
COMMAND_LINE.add_action(PostpromptOption.new('-pp "str"', desc))
|
27
26
|
|
28
|
-
|
27
|
+
# The mysh command no post prompt.
|
29
28
|
class NoPostpromptOption < CommandOption
|
30
29
|
|
31
|
-
#Execute the no post prompt command line option.
|
32
|
-
|
33
|
-
#* :reek:UtilityFunction
|
30
|
+
# Execute the no post prompt command line option.
|
31
|
+
# Endemic Code Smells :reek:UtilityFunction
|
34
32
|
def post_boot(_args)
|
35
33
|
MNV[:post_prompt] = ""
|
36
34
|
end
|
37
35
|
|
38
36
|
end
|
39
37
|
|
40
|
-
#Add the prompt command line option to the library.
|
38
|
+
# Add the prompt command line option to the library.
|
41
39
|
desc = 'Turn off mysh post prompting.'
|
42
40
|
COMMAND_LINE.add_action(NoPostpromptOption.new('--no-post-prompt', desc))
|
43
41
|
COMMAND_LINE.add_action(NoPostpromptOption.new('-npp', desc))
|
@@ -1,43 +1,41 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
# The mysh pre_prompt command.
|
4
4
|
module Mysh
|
5
5
|
|
6
|
-
|
6
|
+
# The mysh pre_prompt command.
|
7
7
|
class PrepromptOption < CommandOption
|
8
8
|
|
9
|
-
#Skip over the argument for pre_boot.
|
9
|
+
# Skip over the argument for pre_boot.
|
10
10
|
def pre_boot(read_point)
|
11
11
|
get_arg(read_point)
|
12
12
|
end
|
13
13
|
|
14
|
-
#Execute the prompt command line option.
|
15
|
-
|
16
|
-
#* :reek:UtilityFunction
|
14
|
+
# Execute the prompt command line option.
|
15
|
+
# Endemic Code Smells :reek:UtilityFunction
|
17
16
|
def post_boot(read_point)
|
18
17
|
MNV[:pre_prompt] = get_arg(read_point)
|
19
18
|
end
|
20
19
|
|
21
20
|
end
|
22
21
|
|
23
|
-
#Add the pre prompt command line option to the library.
|
22
|
+
# Add the pre prompt command line option to the library.
|
24
23
|
desc = 'Set the mysh pre prompt to "str".'
|
25
24
|
COMMAND_LINE.add_action(PrepromptOption.new('--pre-prompt "str"', desc))
|
26
25
|
COMMAND_LINE.add_action(PrepromptOption.new('-pr "str"', desc))
|
27
26
|
|
28
|
-
|
27
|
+
# The mysh command no pre_prompt.
|
29
28
|
class NoPrepromptOption < CommandOption
|
30
29
|
|
31
|
-
#Execute the no pre_prompt command line option.
|
32
|
-
|
33
|
-
#* :reek:UtilityFunction
|
30
|
+
# Execute the no pre_prompt command line option.
|
31
|
+
# Endemic Code Smells :reek:UtilityFunction
|
34
32
|
def post_boot(_args)
|
35
33
|
MNV[:pre_prompt] = ""
|
36
34
|
end
|
37
35
|
|
38
36
|
end
|
39
37
|
|
40
|
-
#Add the prompt command line option to the library.
|
38
|
+
# Add the prompt command line option to the library.
|
41
39
|
desc = 'Turn off mysh pre prompting.'
|
42
40
|
COMMAND_LINE.add_action(NoPrepromptOption.new('--no-pre-prompt', desc))
|
43
41
|
COMMAND_LINE.add_action(NoPrepromptOption.new('-npr', desc))
|
@@ -1,41 +1,40 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
# The mysh prompt command.
|
4
4
|
module Mysh
|
5
5
|
|
6
|
-
|
6
|
+
# The mysh prompt command.
|
7
7
|
class PromptOption < CommandOption
|
8
8
|
|
9
|
-
#Skip over the argument for pre_boot.
|
9
|
+
# Skip over the argument for pre_boot.
|
10
10
|
def pre_boot(read_point)
|
11
11
|
get_arg(read_point)
|
12
12
|
end
|
13
13
|
|
14
|
-
#Execute the prompt command line option.
|
14
|
+
# Execute the prompt command line option.
|
15
15
|
def post_boot(read_point)
|
16
16
|
MNV[:prompt] = get_arg(read_point)
|
17
17
|
end
|
18
18
|
|
19
19
|
end
|
20
20
|
|
21
|
-
#Add the prompt command line option to the library.
|
21
|
+
# Add the prompt command line option to the library.
|
22
22
|
desc = 'Set the mysh prompt to "str".'
|
23
23
|
COMMAND_LINE.add_action(PromptOption.new('--prompt "str"', desc))
|
24
24
|
COMMAND_LINE.add_action(PromptOption.new('-p "str"', desc))
|
25
25
|
|
26
|
-
|
26
|
+
# The mysh prompt command no prompt.
|
27
27
|
class NoPromptOption < CommandOption
|
28
28
|
|
29
|
-
#Execute the no prompt command line option.
|
30
|
-
|
31
|
-
#* :reek:UtilityFunction
|
29
|
+
# Execute the no prompt command line option.
|
30
|
+
# Endemic Code Smells :reek:UtilityFunction
|
32
31
|
def post_boot(_args)
|
33
32
|
MNV[:prompt] = ""
|
34
33
|
end
|
35
34
|
|
36
35
|
end
|
37
36
|
|
38
|
-
#Add the prompt command line option to the library.
|
37
|
+
# Add the prompt command line option to the library.
|
39
38
|
desc = 'Turn off mysh prompting.'
|
40
39
|
COMMAND_LINE.add_action(NoPromptOption.new('--no-prompt', desc))
|
41
40
|
COMMAND_LINE.add_action(NoPromptOption.new('-np', desc))
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
# The mysh quit command.
|
4
|
+
module Mysh
|
5
|
+
|
6
|
+
# The mysh quit command.
|
7
|
+
class QuitOption < CommandOption
|
8
|
+
|
9
|
+
# Execute the quit command line option.
|
10
|
+
def post_boot(_args)
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
# Add the quit command line option to the library.
|
17
|
+
desc = "Exit a nested mysh file or command."
|
18
|
+
COMMAND_LINE.add_action(QuitOption.new('--quit', desc))
|
19
|
+
end
|
@@ -1,19 +1,19 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
# The mysh help command usage.
|
4
4
|
module Mysh
|
5
5
|
|
6
|
-
|
6
|
+
# The mysh help command usage.
|
7
7
|
class UsageOption < CommandOption
|
8
8
|
|
9
|
-
#Execute the help command line option. (Punt to error handler with no msg)
|
9
|
+
# Execute the help command line option. (Punt to error handler with no msg)
|
10
10
|
def pre_boot(_args)
|
11
11
|
raise MyshUsage
|
12
12
|
end
|
13
13
|
|
14
14
|
end
|
15
15
|
|
16
|
-
#Add the usage command line option to the library.
|
16
|
+
# Add the usage command line option to the library.
|
17
17
|
desc = 'Display mysh usage info and exit.'
|
18
18
|
|
19
19
|
USAGE = UsageOption.new('--help', desc)
|
data/lib/mysh/expression.rb
CHANGED
@@ -1,66 +1,46 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
require 'pp'
|
4
3
|
require_relative 'expression/lineage'
|
5
4
|
|
6
|
-
|
7
|
-
#<br>Endemic Code Smells
|
8
|
-
#* :reek:ModuleInitialize -- False positive
|
5
|
+
# Endemic Code Smells :reek:ModuleInitialize -- False positive
|
9
6
|
module Mysh
|
10
7
|
|
11
|
-
#Set up some popular constants
|
8
|
+
# Set up some popular constants
|
12
9
|
E = Math::E
|
13
10
|
PI = Math::PI
|
14
11
|
|
15
|
-
|
16
|
-
|
17
|
-
#
|
12
|
+
$mysh_exec_result = nil
|
13
|
+
|
14
|
+
# Reset the state of the execution hosting environment.
|
15
|
+
# Endemic Code Smells :reek:TooManyStatements -- False positive
|
18
16
|
def self.reset_host
|
19
17
|
exec_class = Class.new do
|
20
18
|
|
21
19
|
include Math
|
22
20
|
|
23
|
-
#Set up a new execution environment
|
21
|
+
# Set up a new execution environment
|
24
22
|
def initialize
|
25
|
-
$
|
26
|
-
$mysh_exec_binding = mysh_binding
|
27
|
-
end
|
28
|
-
|
29
|
-
#Do the actual work of executing an expression.
|
30
|
-
#<br>Note:
|
31
|
-
#* The expression string always begins with an '=' character.
|
32
|
-
def execute(expression)
|
33
|
-
pp $mysh_exec_binding.eval("$mysh_exec_result" + expression)
|
34
|
-
:expression
|
23
|
+
$mysh_exec_binding = binding
|
35
24
|
end
|
36
25
|
|
37
|
-
#Return a simple message for less convoluted error messages.
|
26
|
+
# Return a simple message for less convoluted error messages.
|
38
27
|
def inspect
|
39
28
|
"exec_host"
|
40
29
|
end
|
41
30
|
|
42
|
-
#Evaluate the string in the my shell context.
|
43
|
-
def mysh_eval(str)
|
44
|
-
$mysh_exec_binding.eval(str)
|
45
|
-
end
|
46
|
-
|
47
31
|
private
|
48
32
|
|
49
|
-
#Get the previous result
|
33
|
+
# Get the previous result
|
50
34
|
def result
|
51
35
|
$mysh_exec_result
|
52
36
|
end
|
53
37
|
|
54
|
-
#Reset the state of the execution host.
|
38
|
+
# Reset the state of the execution host.
|
55
39
|
def reset
|
56
40
|
Mysh.reset_host
|
57
41
|
nil
|
58
42
|
end
|
59
43
|
|
60
|
-
#Create a binding for mysh to execute expressions in.
|
61
|
-
def mysh_binding
|
62
|
-
binding
|
63
|
-
end
|
64
44
|
end
|
65
45
|
|
66
46
|
$mysh_exec_host = exec_class.new
|
data/lib/mysh/external.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
|
3
|
+
# Support for executing external files.
|
4
4
|
module Mysh
|
5
5
|
|
6
|
-
#Try to execute an external file.
|
7
|
-
|
8
|
-
#* :reek:TooManyStatements
|
6
|
+
# Try to execute an external file.
|
7
|
+
# Endemic Code Smells :reek:TooManyStatements
|
9
8
|
def self.try_execute_external(input)
|
10
9
|
args = input.parsed
|
11
10
|
file_name = args.shift
|
@@ -22,7 +21,7 @@ module Mysh
|
|
22
21
|
Mysh.process_file(file_name)
|
23
22
|
:mysh_script
|
24
23
|
elsif ext == '.txt'
|
25
|
-
show_handlebar_file(file_name,
|
24
|
+
show_handlebar_file(file_name, binding)
|
26
25
|
:internal
|
27
26
|
end
|
28
27
|
end
|
data/lib/mysh/globalize.rb
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
#Monkey patches for mysh global entities.
|
3
|
+
# Monkey patches for mysh global entities.
|
4
4
|
class Object
|
5
5
|
|
6
|
-
#Make the environment variable store accessible everywhere.
|
6
|
+
# Make the environment variable store accessible everywhere.
|
7
7
|
MNV = Mysh::MNV
|
8
8
|
|
9
9
|
private
|
10
10
|
|
11
|
-
#The mysh equivalent of the system method.
|
12
|
-
|
13
|
-
#* :reek:UtilityFunction
|
11
|
+
# The mysh equivalent of the system method.
|
12
|
+
# Endemic Code Smells :reek:UtilityFunction
|
14
13
|
def mysh(str)
|
15
14
|
Mysh.try_execute_command(str)
|
16
15
|
end
|
@@ -20,11 +19,16 @@ class Object
|
|
20
19
|
raise MyshExit
|
21
20
|
end
|
22
21
|
|
23
|
-
#
|
24
|
-
def
|
25
|
-
|
26
|
-
|
27
|
-
|
22
|
+
# Get the latest version for the named gem. Patched code.
|
23
|
+
def latest_version_for(name, fetcher=nil)
|
24
|
+
dependency = Gem::Dependency.new(name)
|
25
|
+
fetcher ||= Gem::SpecFetcher.new
|
26
|
+
|
27
|
+
if specs = fetcher.spec_for_dependency(dependency)[0][-1]
|
28
|
+
specs[0].version
|
29
|
+
else
|
30
|
+
"<Not found in repository>"
|
31
|
+
end
|
28
32
|
end
|
29
33
|
|
30
34
|
end
|
data/lib/mysh/handlebars.rb
CHANGED
@@ -1,26 +1,23 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
|
-
require_relative 'handlebars/
|
3
|
+
require_relative 'handlebars/eval_handlebars'
|
4
4
|
|
5
|
-
|
5
|
+
# Handlebar embedded ruby support.
|
6
6
|
class Object
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
#
|
11
|
-
|
8
|
+
private
|
9
|
+
|
10
|
+
# Show a file with embedded ruby handlebars.
|
11
|
+
# Note: The message receiver is the evaluation host for the handlebar code.
|
12
|
+
def show_handlebar_file(name, evaluator = $mysh_exec_binding)
|
12
13
|
puts eval_handlebar_file(name, evaluator)
|
13
14
|
end
|
14
15
|
|
15
|
-
#Expand a file with embedded ruby handlebars.
|
16
|
-
|
17
|
-
#
|
18
|
-
#<br>Endemic Code Smells
|
19
|
-
#* :reek:UtilityFunction
|
16
|
+
# Expand a file with embedded ruby handlebars.
|
17
|
+
# Note: The message receiver is the evaluation host for the handlebar code.
|
18
|
+
# Endemic Code Smells :reek:UtilityFunction
|
20
19
|
def eval_handlebar_file(name, evaluator)
|
21
20
|
IO.read(name).preprocess(evaluator)
|
22
21
|
end
|
23
22
|
|
24
23
|
end
|
25
|
-
|
26
|
-
|