mysh 0.1.12 → 0.1.13

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
  SHA1:
3
- metadata.gz: 1658b8c71d6ab5674a8cd4576cc552c8b3fa6904
4
- data.tar.gz: 7f8ce8c574a5c959a59bf5b90d64c72fa91776b2
3
+ metadata.gz: cc384b16374733a18131ead73b90537a16f06b1a
4
+ data.tar.gz: aaa9a7f9e10bf52d685e9fdb6a2ec1de8c92eb60
5
5
  SHA512:
6
- metadata.gz: 1f4cb448b3a8f3b7e145efdaa4ce7de0550de04cef55009e03a3cd932f2c9dea29a2bf88fb177f0e1476d82790595aaf56affbb62d4c0bdfc4eb6adaa5a1941f
7
- data.tar.gz: 675d36eaead283f5d899e7da6949fd09d894496eec25170983db5df34a7b41e0e7cef7f6edfc79775682e88881e60e7211561a82454f0370776e7b0c97d11988
6
+ metadata.gz: 15b4e08c89be15e6ef264734cde9c2a0314dcd65ab00e5702dace3303d8c6cfd209ccb05597c8b7404c4cb94735370df7a53dc75251ff084d848cf718ff28bba
7
+ data.tar.gz: 6549e793c55788c7dc64dc147dee847140131881de18959159badaf9560cab01d2360a87973dc4adcd31c5c9dfafe0863e7f1c0301b3dc221bf95c8d129e6421
data/README.md CHANGED
@@ -5,11 +5,11 @@ I thought it would be fun to experiment with that concept and see if it could
5
5
  be taken further.
6
6
 
7
7
  Many years ago, a popular shell program was modeled after
8
- the 'C' programming language. It went by the csh for C-shell (by the C shore :-)
9
- Instead of 'C', my shell would be based on Ruby (were you shocked?)! The
10
- obvious name rsh for Ruby-shell was already in use by the Remote-shell. So,
8
+ the 'C' programming language. It went by the name csh for C-shell (by the C
9
+ shore :-) Instead of 'C', my shell would be based on Ruby (were you shocked?)!
10
+ The obvious name rsh for Ruby-shell was already in use by the Remote-shell. So,
11
11
  given the limited scope of this effort, and not wanting to do a lot of typing
12
- all the time, I chose the name mysh for My-shell.
12
+ all the time, I chose the name mysh for MY-SHell.
13
13
 
14
14
  Since that name was available, it would seem that no one had yet written a
15
15
  shell program at this level of narcissism.
@@ -41,201 +41,171 @@ Or install it yourself as:
41
41
  The mysh gem includes a simple executable called mysh. When run, the user is
42
42
  presented with a command prompt:
43
43
 
44
- Peter Camilleri@NCC1701G ~
45
44
  $ mysh
46
45
  mysh>
47
46
 
48
47
 
49
48
  This prompt can be used to execute four sorts of commands:
50
49
 
51
- * Internal commands that are processed directly by mysh
52
50
  * Ruby expressions, which are preceded by the equal (=) sign.
51
+ * Internal commands that are processed directly by mysh
53
52
  * External ruby source files that are passed on to the Ruby interpreter.
54
53
  * External commands that are passed on to the standard command shell.
55
54
 
56
- From the mysh help:
57
-
58
- mysh> ?
59
- mysh (MY ruby SHell) version: 0.1.11
60
-
61
- 1) Internal mysh commands:
62
- - executed by mysh directly.
63
- - supports the following set of commands.
64
-
65
- Internal Commands
66
- ===================
67
-
68
- ! Display the mysh command history.
69
- ? Display help information for mysh.
70
- cd <dir> Change directory to the optional <dir> parameter.
71
- Then display the current working directory.
72
- exit Exit mysh.
73
- help Display help information for mysh.
74
- history Display the mysh command history.
75
- pwd Display the current working directory.
76
- quit Exit mysh.
77
-
78
- 2) Ruby Expression support:
79
- - any line beginning with an equals "=" sign will be evaluated as a Ruby
80
- expression. This allows the mysh command line to serve as a programming,
81
- debugging and super-calculator environment.
82
- - for more info use the 'help ruby' command.
83
-
84
- 3) Math support:
85
- - the execution environment includes the Math module.
86
- - for more info use the 'help math' command.
87
-
88
- 4) External commands:
89
- - executed by the system using the standard shell.
90
- - to force the use of the external shell, add a leading space to the command.
91
-
92
- Note: If the command has a '.rb' extension it is executed by Ruby.
93
- So the command "myfile.rb" is executed as "ruby myfile.rb"
94
-
95
- and
96
-
97
- mysh> ? ruby
98
- mysh (MY ruby SHell) version: 0.1.11
99
-
100
- mysh Ruby expression support summary
101
-
102
- - All command lines that begin with an equals "=" sign are evaluated as Ruby
103
- expressions.
104
- - Expressions ending with a backslash character "\" are continued on the next
105
- line. The prompt changes to "mysh\" to indicate that this is going on.
106
- - The results are displayed using the pretty-print facility.
107
- - Auto-complete always places any file names in quotes so they can be used
108
- as string parameters.
109
-
110
- A few noteworthy methods exist that facilitate use of Ruby expressions:
111
-
112
- reset Reset the execution environment to the default state.
113
- result Returns the result of the previous expression.
114
- vls <mask> List modules with version info. The optional mask string value
115
- is used to filter for modules containing that string.
116
-
117
- and
118
-
119
- mysh> ? math
120
- mysh (MY ruby SHell) version: 0.1.11
121
-
122
- mysh Math support summary
123
-
124
- The Ruby expression execution environment has direct access to many advanced
125
- Math functions. For example, to compute the cosine of 3.141592653589793 use:
126
-
127
- mysh> =cos(PI)
128
- -1.0
129
-
130
- Method Returns Description
131
- ======= ======= ================================================
132
- acos(x) Float Computes the arc cosine of x. Returns 0..PI.
133
- acosh(x) Float Computes the inverse hyperbolic cosine of x.
134
- asin(x) Float Computes the arc sine of x. Returns -PI/2..PI/2.
135
- asinh(x) Float Computes the inverse hyperbolic sine of x.
136
- atan(x) Float Computes the arc tangent of x. Returns -PI/2..PI/2.
137
- atan2(y,x) Float Computes the arc tangent given y and x.
138
- Returns a Float in the range -PI..PI.
139
- atanh(x) Float Computes the inverse hyperbolic tangent of x.
140
- cbrt(x) Float Returns the cube root of x.
141
- cos(x) Float Computes the cosine of x (expressed in radians).
142
- Returns a Float in the range -1.0..1.0.
143
- cosh(x) Float Computes the hyperbolic cosine of x (expressed in radians).
144
- erf(x) Float Calculates the error function of x.
145
- erfc(x) Float Calculates the complementary error function of x.
146
- exp(x) Float Returns e**x.
147
- frexp(x) Array Returns a two-element array containing the normalized
148
- fraction (a Float) and exponent (a Fixnum) of x.
149
- gamma(x) Float Calculates the gamma function of x.
150
- hypot(x,y) Float Returns sqrt(x**2 + y**2), the hypotenuse of a right-angled
151
- triangle with sides x and y.
152
- ldexp(f,e) Float Returns the value of f*(2**e).
153
- lgamma(x) Array Returns a two-element array containing the log of the
154
- gamma of x and the sign of gamma of x.
155
- log(x) Float Computes the natural log of x.
156
- log(x,B) Float Computes the base B log of x.
157
- log10(x) Float Returns the base 10 logarithm of x.
158
- log2(x) Float Returns the base 2 logarithm of x.
159
- sin(x) Float Computes the sine of x (expressed in radians).
160
- Returns a Float in the range -1.0..1.0.
161
- sinh(x) Float Computes the hyperbolic sine of x (expressed in radians).
162
- sqrt(x) Float Returns the non-negative square root of x.
163
- tan(x) Float Computes the tangent of x (expressed in radians).
164
- tanh(x) Float Computes the hyperbolic tangent of x (expressed in radians).
165
-
166
- PI Float The value 3.141592653589793
167
- E Float The value 2.718281828459045
55
+ #### Ruby expressions:
56
+
57
+ * Any line beginning with an equals "=" sign will be evaluated as a Ruby
58
+ expression. This allows the mysh command line to serve as a programming,
59
+ debugging and super-calculator environment.
60
+ * Expressions ending with a backslash character "\" are continued on the next
61
+ line. The prompt changes to "mysh\" to indicate that this is going on.
62
+ * The results are displayed using the pretty-print facility.
63
+ * Auto-complete always places any file names in quotes so they can be used
64
+ as string parameters.
65
+
66
+ A few noteworthy methods exist that facilitate use of Ruby expressions:
67
+ ```
68
+ reset Reset the execution environment to the default state.
69
+ result Returns the result of the previous expression.
70
+ vls "mask" List modules with version info. The optional mask string value is
71
+ used to filter for modules containing that string.
72
+ ```
73
+
74
+ The Ruby expression execution environment has direct access to many advanced
75
+ Math functions. For example, to compute the cosine of 3.141592653589793 use:
76
+ ```
77
+ mysh> =cos(PI)
78
+ -1.0
79
+ ```
80
+
81
+ The following table describes the available math functions.
82
+
83
+ Function |Returns |Description
84
+ -----------|--------|-----------------------------------------------------
85
+ acos(x) |Float |Computes the arc cosine of x. Returns 0..PI.
86
+ acosh(x) |Float |Computes the inverse hyperbolic cosine of x.
87
+ asin(x) |Float |Computes the arc sine of x. Returns -PI/2..PI/2.
88
+ asinh(x) |Float |Computes the inverse hyperbolic sine of x.
89
+ atan(x) |Float |Computes the arc tangent of x. Returns -PI/2..PI/2.
90
+ atan2(y,x) |Float |Computes the arc tangent given y and x.
91
+ | |Returns a Float in the range -PI..PI.
92
+ atanh(x) |Float |Computes the inverse hyperbolic tangent of x.
93
+ cbrt(x) |Float |Returns the cube root of x.
94
+ cos(x) |Float |Computes the cosine of x (expressed in radians).
95
+ | |Returns a Float in the range -1.0..1.0.
96
+ cosh(x) |Float |Computes the hyperbolic cosine of x (expressed in radians).
97
+ erf(x) |Float |Calculates the error function of x.
98
+ erfc(x) |Float |Calculates the complementary error function of x.
99
+ exp(x) |Float |Returns e**x.
100
+ frexp(x) |Array |Returns a two-element array containing the normalized
101
+ | |fraction (a Float) and exponent (a Fixnum) of x.
102
+ gamma(x) |Float |Calculates the gamma function of x.
103
+ hypot(x,y) |Float |Returns sqrt(x\*\*2 + y\*\*2), the hypotenuse of a right-angled
104
+ | |triangle with sides x and y.
105
+ ldexp(m,e) |Float |Returns the value of m\*(2\*\*e) where m is the mantissa and
106
+ | |e is the power of 2 exponent.
107
+ lgamma(x) |Array |Returns a two-element array containing the log of the
108
+ | |gamma of x and the sign of gamma of x.
109
+ log(x) |Float |Computes the natural log of x.
110
+ log(x,B) |Float |Computes the base B log of x.
111
+ log10(x) |Float |Returns the base 10 logarithm of x.
112
+ log2(x) |Float |Returns the base 2 logarithm of x.
113
+ sin(x) |Float |Computes the sine of x (expressed in radians).
114
+ | |Returns a Float in the range -1.0..1.0.
115
+ sinh(x) |Float |Computes the hyperbolic sine of x (expressed in radians).
116
+ sqrt(x) |Float |Returns the non-negative square root of x.
117
+ tan(x) |Float |Computes the tangent of x (expressed in radians).
118
+ tanh(x) |Float |Computes the hyperbolic tangent of x (expressed in radians).
119
+ | |
120
+ PI |Float |The value 3.141592653589793
121
+ E |Float |The value 2.718281828459045
122
+
123
+ #### Internal mysh commands:
124
+
125
+ Internal commands are recognized by name and are executed by mysh directly.
126
+
127
+ The following set of commands are supported:
128
+
129
+ ```
130
+ ! Display the mysh command history.
131
+ ? Display help information for mysh.
132
+ cd <dir> Change directory to the optional <dir> parameter.
133
+ Then display the current working directory.
134
+ exit Exit mysh.
135
+ help Display help information for mysh.
136
+ history Display the mysh command history.
137
+ pwd Display the current working directory.
138
+ quit Exit mysh.
139
+ ```
140
+
141
+ #### External commands:
142
+
143
+ All other commands are executed by the system using the standard shell or
144
+ the appropriate ruby interpreter.
145
+
146
+ Notes:
147
+ * If an internal command has the same name as an external command, adding a
148
+ leading space will force the use of the external command.
149
+ * If the command has a '.rb' extension, it is executed by the appropriate ruby
150
+ interpreter. The interpreter used is the one specified by RbConfig.ruby
151
+
152
+ ## Embedding mysh in an application.
168
153
 
169
154
  The mysh can also be used from within a Ruby application:
170
155
 
171
156
  ```ruby
157
+ require "mysh"
158
+
159
+ #Some stuff omitted.
160
+
172
161
  Mysh.run
173
162
  ```
174
163
 
175
- ## Adding New Commands
164
+ #### Adding New Commands
176
165
 
177
- It is possible to add new internal commands to the mysh CLI. This is done by
178
- depositing the appropriate ruby file in the commands folder located at:
166
+ It is possible to add new internal commands to the mysh CLI. This may done
167
+ manually by depositing the appropriate ruby file in the commands folder located
168
+ at:
179
169
 
180
- /mysh/lib/mysh/commands
170
+ <gem_root>/mysh/lib/mysh/commands
181
171
 
182
- As an example, the file cd.rb is shown to illustrate the responsibilities of
183
- a typical command plug-in:
172
+ A survey of the contents of that folder will reveal the nature of these
173
+ command files.
184
174
 
185
- ```ruby
186
- # coding: utf-8
175
+ New internal commands may also be added in code via the the add method of the
176
+ InternalCommand class of the Mysh module. The code to do this would look
177
+ something like this:
187
178
 
188
- #* commands/cd.rb -- The mysh internal cd command.
179
+ ```ruby
189
180
  module Mysh
190
-
191
- #* cd.rb -- The mysh internal cd command.
192
181
  class InternalCommand
193
- #Add the cd command to the library.
194
- desc = ['Change directory to the optional <dir> parameter.',
195
- 'Then display the current working directory.']
196
-
197
- add('cd <dir>', desc) do |args|
198
- begin
199
- Dir.chdir(args[0]) unless args.empty?
200
- puts decorate(Dir.pwd)
201
- rescue => err
202
- puts "Error: #{err}"
203
- end
204
- end
205
182
 
206
- #Add the pwd command to the library.
207
- add('pwd', 'Display the current working directory.') do |args|
208
- begin
209
- puts decorate(Dir.pwd)
210
- rescue => err
211
- puts "Error: #{err}"
212
- end
183
+ add(command_name, command_description) do |args|
184
+ # Action block goes here
213
185
  end
214
186
 
215
187
  end
216
188
  end
217
189
  ```
218
190
 
219
- Note that the plug in code is contained within the InternalCommand class under
220
- the Mysh module umbrella. The principle method used to create internal commands
221
- is the add method:
222
-
223
- ```ruby
224
- add(command_name, command_description) do |args|
225
- # Action block goes here
226
- end
227
- ```
228
191
  Where:
229
192
  * command_name is the name of the command with optional argument descriptions
230
- seperated with spaces. The command is the first word of this string.
193
+ separated with spaces. The command is the first word of this string.
231
194
  * command_description is a string or an array of strings that describe the
232
195
  command.
233
196
  * args is an array of zero or more arguments that were entered with the command.
234
197
 
235
- Commands sometimes have more than one possible name. This is supported with:
198
+ Commands sometimes have more than one possible name. This is supported with
199
+ the add_alias method:
236
200
 
237
201
  ```ruby
238
- add_alias(new_name, old_name)
202
+ module Mysh
203
+ class InternalCommand
204
+
205
+ add_alias(new_name, old_name)
206
+
207
+ end
208
+ end
239
209
  ```
240
210
 
241
211
 
@@ -0,0 +1,15 @@
1
+ # coding: utf-8
2
+
3
+ #* commands/command_path.rb -- A convenient hook to the command folder.
4
+ module Mysh
5
+
6
+ #* commands/command_path.rb -- A convenient hook to the command folder.
7
+ class InternalCommand
8
+
9
+ #Capture this folder's name.
10
+ COMMAND_PATH = File.dirname(__FILE__) + "/"
11
+
12
+ end
13
+
14
+ end
15
+
@@ -1,25 +1,16 @@
1
1
  # coding: utf-8
2
2
 
3
- #* commands/exit.rb -- The mysh internal exit command.
3
+ #* commands/help.rb -- The mysh internal help command.
4
4
  module Mysh
5
5
 
6
- #* exit.rb -- The mysh internal exit command.
6
+ #* help.rb -- The mysh internal help command.
7
7
  class InternalCommand
8
- #Show a help file
9
- def show_help(name)
10
- full_name = File.dirname(__FILE__) + name
11
- str = IO.read(full_name)
12
- puts process_erb_string(str)
13
- rescue StandardError, ScriptError => err
14
- puts "Error processing file #{full_name}"
15
- puts "#{err.class.to_s}: #{err}"
16
- end
17
8
 
18
9
  HELP = Hash.new(lambda {|args| puts "No help found for #{args[0]}." })
19
10
 
20
- HELP[nil] = lambda {|_args| show_help('/help.txt') }
21
- HELP['math'] = lambda {|_args| show_help('/help_math.txt') }
22
- HELP['ruby'] = lambda {|_args| show_help('/help_ruby.txt') }
11
+ HELP[nil] = lambda {|_args| show_file('help.txt') }
12
+ HELP['math'] = lambda {|_args| show_file('help_math.txt') }
13
+ HELP['ruby'] = lambda {|_args| show_file('help_ruby.txt') }
23
14
 
24
15
  #Add the exit command to the library.
25
16
  add('help', 'Display help information for mysh.') do |args|
@@ -4,32 +4,35 @@ In mysh, commands fall into one of three broad categories. There are:
4
4
 
5
5
  1) Ruby expressions:
6
6
 
7
- - Any line beginning with an equals "=" sign will be evaluated as a Ruby
8
- expression. This allows the mysh command line to serve as a programming,
9
- debugging and super-calculator environment.
10
- - For more information on ruby expressions use the 'help ruby' command.
7
+ Any line beginning with an equals "=" sign will be evaluated as a Ruby
8
+ expression. This allows the mysh command line to serve as a programming,
9
+ debugging and super-calculator environment.
11
10
 
12
- - This environment includes support for advanced mathematical operations.
13
- - For more information on this feature, use the 'help math' command.
11
+ For more information on ruby expressions use the 'help ruby' command.
12
+
13
+ Note: This environment includes support for advanced mathematical operations.
14
+ For more information on this feature, use the 'help math' command.
14
15
 
15
16
  2) Internal mysh commands:
16
17
 
17
- - Internal commands are recognized by name and are executed by mysh directly.
18
- - These commands are found in the ".../mysh/lib/mysh/commands" folder.
19
- - The following set of commands are supported:
18
+ Internal commands are processed within mysh itself. Any command that matches
19
+ the name of an internal command is processed internally by mysh.
20
+
21
+ The following set of commands are supported:
20
22
 
21
23
  {{ format_items(InternalCommand.command_info).join("\n") }}
22
24
 
23
25
  3) External commands:
24
26
 
25
- - All other commands are executed by the system using the standard shell or
26
- the appropriate ruby interpreter.
27
- - If an internal command has the same name as an external command, adding a
28
- leading space will force the use of the external command.
29
- - If the command has a '.rb' extension, it is executed by the appropriate ruby
30
- interpreter. So the command "myfile.rb" is executed as
27
+ All other commands are executed by the system using the standard shell or the
28
+ appropriate ruby interpreter.
29
+
30
+ If the command has a '.rb' extension, it is executed by the appropriate ruby
31
+ interpreter. So the command "myfile.rb" is executed as
31
32
 
32
33
  {{ RbConfig.ruby }} myfile.rb"
33
34
 
34
- for this particular system.
35
+ Note: If an internal command has the same name as an external command, adding a
36
+ leading space will force the use of the external command.
37
+
35
38
 
@@ -1,7 +1,9 @@
1
1
  mysh Math support summary
2
2
 
3
3
  The Ruby expression execution environment has direct access to many advanced
4
- Math functions. For example, to compute the cosine of 3.141592653589793 use:
4
+ mathematical functions and values.
5
+
6
+ For example, to compute the cosine of 3.141592653589793 use:
5
7
 
6
8
  mysh> =cos(PI)
7
9
  -1.0
@@ -28,7 +30,8 @@ frexp(x) Array Returns a two-element array containing the normalized
28
30
  gamma(x) Float Calculates the gamma function of x.
29
31
  hypot(x,y) Float Returns sqrt(x**2 + y**2), the hypotenuse of a right-angled
30
32
  triangle with sides x and y.
31
- ldexp(f,e) Float Returns the value of f*(2**e).
33
+ ldexp(m,e) Float Returns the value of m*(2**e). Where m is the mantissa and
34
+ e is the base two exponent.
32
35
  lgamma(x) Array Returns a two-element array containing the log of the
33
36
  gamma of x and the sign of gamma of x.
34
37
  log(x) Float Computes the natural log of x.
@@ -1,17 +1,20 @@
1
1
  mysh Ruby expression support summary
2
2
 
3
- - All command lines that begin with an equals "=" sign are evaluated as Ruby
4
- expressions.
5
- - Expressions ending with a backslash character "\" are continued on the next
6
- line. The prompt changes to "mysh\" to indicate that this is going on.
7
- - The results are displayed using the pretty-print facility.
8
- - Auto-complete always places any file names in quotes so they can be used
9
- as string parameters.
3
+ All command lines that begin with an equals ("=") sign are evaluated as Ruby
4
+ expressions. Lines ending with a backslash character ("\") are continued on the
5
+ next line. The prompt changes to "mysh\" to indicate that this is going on. The
6
+ command is NOT actually processed until a line with NO trailing backslash is
7
+ entered.
10
8
 
11
- A few noteworthy methods exist that facilitate use of Ruby expressions:
9
+ The results of the expression are displayed using the pretty-print facility.
12
10
 
13
- reset Reset the execution environment to the default state.
14
- result Returns the result of the previous expression.
15
- vls "mask" List modules with version info. The optional mask string value is
16
- used to filter for modules containing that string.
11
+ Note: Auto-complete always places any file names in quotes so they can be used
12
+ as string parameters.
13
+
14
+ A few noteworthy special methods exist:
15
+
16
+ =reset Reset the execution environment to the default state.
17
+ =result Returns the result of the previous expression.
18
+ =vls "mask" List modules with version info. The optional mask string value is
19
+ used to filter for modules containing that string.
17
20
 
@@ -1,9 +1,9 @@
1
1
  # coding: utf-8
2
2
 
3
- #* commands/exit.rb -- The mysh internal exit command.
3
+ #* commands/history.rb -- The mysh internal history command.
4
4
  module Mysh
5
5
 
6
- #* exit.rb -- The mysh internal history command.
6
+ #* history.rb -- The mysh internal history command.
7
7
  class InternalCommand
8
8
  #Add the exit command to the library.
9
9
  add('history', 'Display the mysh command history.') do |args|
@@ -5,7 +5,8 @@ require_relative 'support/parse'
5
5
  require_relative 'support/format'
6
6
  require_relative 'support/frame'
7
7
  require_relative 'support/decorate'
8
- require_relative 'support/text_erb'
8
+ require_relative 'commands/command_path'
9
+ require_relative 'support/handlebars'
9
10
 
10
11
  #Load up the internal commands!
11
- Dir[File.dirname(__FILE__) + '/commands/*.rb'].each {|file| require file }
12
+ Dir[Mysh::InternalCommand::COMMAND_PATH + '*.rb'].each {|file| require file }
@@ -0,0 +1,30 @@
1
+ # coding: utf-8
2
+
3
+ #* support/handlebars.rb -- Allow text files to embed ruby code.
4
+ module Mysh
5
+
6
+ #The mysh embedded ruby text formatting.
7
+ class InternalCommand
8
+
9
+ #Process a string with embedded Ruby code.
10
+ def expand_handlebars(str)
11
+ loop do
12
+ pre_match, match, post_match = str.partition(/{{.*?}}/m)
13
+
14
+ return pre_match if match.empty?
15
+
16
+ str = pre_match + eval(match[2...-2]) + post_match
17
+ end
18
+ end
19
+
20
+ #Show a file with embedded ruby handlebars.
21
+ def show_file(name)
22
+ puts expand_handlebars(IO.read(full_name = COMMAND_PATH + name))
23
+ rescue StandardError, ScriptError => err
24
+ puts "Error in file: #{full_name}\n#{err.class}: #{err}"
25
+ end
26
+
27
+ end
28
+
29
+ end
30
+
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Mysh
4
4
  #The version string of MY SHell.
5
- VERSION = "0.1.12"
5
+ VERSION = "0.1.13"
6
6
 
7
7
  #A brief summary of this gem.
8
- SUMMARY = "mysh -- a Ruby inspired command shell"
8
+ SUMMARY = "mysh -- a Ruby inspired command shell."
9
9
  end
@@ -37,7 +37,7 @@ class MyShellTester < Minitest::Test
37
37
  cmd = Mysh::InternalCommand.commands['help']
38
38
 
39
39
  assert_equal("ABC 123 DEF",
40
- cmd.process_erb_string("ABC {{ (1..3).to_a.join }} DEF"))
40
+ cmd.expand_handlebars("ABC {{ (1..3).to_a.join }} DEF"))
41
41
 
42
42
  end
43
43
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Camilleri
@@ -152,6 +152,7 @@ files:
152
152
  - bin/mysh
153
153
  - lib/mysh.rb
154
154
  - lib/mysh/commands/cd.rb
155
+ - lib/mysh/commands/command_path.rb
155
156
  - lib/mysh/commands/exit.rb
156
157
  - lib/mysh/commands/help.rb
157
158
  - lib/mysh/commands/help.txt
@@ -165,9 +166,9 @@ files:
165
166
  - lib/mysh/support/decorate.rb
166
167
  - lib/mysh/support/format.rb
167
168
  - lib/mysh/support/frame.rb
169
+ - lib/mysh/support/handlebars.rb
168
170
  - lib/mysh/support/manage.rb
169
171
  - lib/mysh/support/parse.rb
170
- - lib/mysh/support/text_erb.rb
171
172
  - lib/mysh/version.rb
172
173
  - mysh.gemspec
173
174
  - rakefile.rb
@@ -197,6 +198,6 @@ rubyforge_project:
197
198
  rubygems_version: 2.2.2
198
199
  signing_key:
199
200
  specification_version: 4
200
- summary: mysh -- a Ruby inspired command shell
201
+ summary: mysh -- a Ruby inspired command shell.
201
202
  test_files: []
202
203
  has_rdoc:
@@ -1,24 +0,0 @@
1
- # coding: utf-8
2
-
3
- #* support/text_erb.rb -- Allow text files to embed ruby code.
4
- module Mysh
5
-
6
- #The mysh embedded ruby report formatting.
7
- class InternalCommand
8
-
9
- #Process a string with embedded Ruby code.
10
- def process_erb_string(str)
11
- loop do
12
- pre_match, match, post_match = str.partition(/{{.*?}}/m)
13
-
14
- return pre_match if match.empty?
15
-
16
- str = pre_match + eval(match[2...-2]) + post_match
17
- end
18
-
19
- end
20
-
21
- end
22
-
23
- end
24
-