mucgly 0.1.0 → 0.1.1
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/CHANGELOG.rdoc +4 -0
- data/README.rdoc +32 -20
- data/doc/Mucgly.html +2 -2
- data/doc/_index.html +1 -1
- data/doc/file.CHANGELOG.html +6 -2
- data/doc/file.README.html +32 -20
- data/doc/index.html +32 -20
- data/doc/top-level-namespace.html +1 -1
- data/ext/mucgly/mucgly.c +98 -96
- data/lib/version.rb +1 -1
- data/test/golden/test_basic.txt +11 -2
- data/test/golden/test_file_ctrl.txt +9 -0
- data/test/golden/test_redirect.txt +2 -0
- data/test/result/test_basic.txt +11 -2
- data/test/result/test_file_ctrl.txt +9 -0
- data/test/result/test_redirect.txt +2 -0
- data/test/test_basic.rx.txt +11 -2
- data/test/test_file_ctrl.rx.txt +10 -0
- data/test/test_mucgly.rb +22 -5
- data/test/test_skip.txt +4 -0
- metadata +19 -5
data/lib/version.rb
CHANGED
data/test/golden/test_basic.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Line 1 from file "test_basic.rx.txt".
|
1
|
+
Line 1 from file "test_basic.rx.txt:1".
|
2
2
|
Test escapes (backslash, empty): "\" "" ... and the rest of the line.
|
3
3
|
Next the test file "test_include.txt" is included.
|
4
4
|
Line 1 in test file test_included.txt.
|
@@ -15,4 +15,13 @@ The last line in "test_basic.rx.txt"
|
|
15
15
|
The name of this file is: "test_basic.rx.txt".
|
16
16
|
We are outputting to file result/test_basic.txt and 16
|
17
17
|
Multipass macros are output with one "#" removed each round.
|
18
|
-
-<puts "This will be a macro execution in the next round.">-
|
18
|
+
-<puts "This will be a macro execution in the next round.">-
|
19
|
+
This comment will be consumed "".
|
20
|
+
|
21
|
+
Some Mucgly module tests...
|
22
|
+
Mucgly.puts
|
23
|
+
Mucgly.write
|
24
|
+
hookbeg is "-<"
|
25
|
+
hookend is ">-"
|
26
|
+
hookend is "\"
|
27
|
+
End of test file...***
|
data/test/result/test_basic.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Line 1 from file "test_basic.rx.txt".
|
1
|
+
Line 1 from file "test_basic.rx.txt:1".
|
2
2
|
Test escapes (backslash, empty): "\" "" ... and the rest of the line.
|
3
3
|
Next the test file "test_include.txt" is included.
|
4
4
|
Line 1 in test file test_included.txt.
|
@@ -15,4 +15,13 @@ The last line in "test_basic.rx.txt"
|
|
15
15
|
The name of this file is: "test_basic.rx.txt".
|
16
16
|
We are outputting to file result/test_basic.txt and 16
|
17
17
|
Multipass macros are output with one "#" removed each round.
|
18
|
-
-<puts "This will be a macro execution in the next round.">-
|
18
|
+
-<puts "This will be a macro execution in the next round.">-
|
19
|
+
This comment will be consumed "".
|
20
|
+
|
21
|
+
Some Mucgly module tests...
|
22
|
+
Mucgly.puts
|
23
|
+
Mucgly.write
|
24
|
+
hookbeg is "-<"
|
25
|
+
hookend is ">-"
|
26
|
+
hookend is "\"
|
27
|
+
End of test file...***
|
data/test/test_basic.rx.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Line 1 from file "-<write ifilename>-".
|
1
|
+
Line 1 from file "-<write ifilename; write ":"; write ilinenumber>-".
|
2
2
|
-<:hook \\>-\
|
3
3
|
Test escapes (backslash, empty): "\\" "\ \ " \
|
4
4
|
... and the rest of the line.
|
@@ -19,5 +19,14 @@ The name of this file is: "\write ifilename\ ".
|
|
19
19
|
We are outputting to file \write ofilename\ and \write olinenumber.to_s\
|
20
20
|
Multipass macros are output with one "#" removed each round.
|
21
21
|
\:hook -< >-\ \
|
22
|
-
-<#puts "This will be a macro execution in the next round."
|
22
|
+
-<#puts "This will be a macro execution in the next round.">-
|
23
23
|
This comment will be consumed "-</A comment>-".
|
24
|
+
|
25
|
+
Some Mucgly module tests...
|
26
|
+
-<Mucgly.puts "Mucgly.puts">--<Mucgly.write "Mucgly.write">-
|
27
|
+
-<if hookbeg == "\-<"; write "hookbeg is \\"\-<\\""; end>-
|
28
|
+
-<if hookend == "\>-"; write "hookend is \\"\>-\\""; end>-
|
29
|
+
-<if hookesc == "\\\\"; write "hookend is \\"\\\\\\""; end>-
|
30
|
+
-<sethookbeg "-{"; sethookend "}-"; sethookesc "|">-|
|
31
|
+
-{write "End of test file..."}-|
|
32
|
+
***
|
data/test/test_mucgly.rb
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
require 'test/unit'
|
2
2
|
|
3
3
|
|
4
|
+
|
4
5
|
# Test execution routine.
|
5
6
|
def runTest( cmdopts, test, sep = "" )
|
6
|
-
Dir.chdir( 'test' )
|
7
|
-
FileUtils.mkdir_p "result"
|
8
7
|
rf = "result/#{test}#{sep}.txt"
|
9
8
|
gf = "golden/#{test}#{sep}.txt"
|
10
9
|
|
11
|
-
system( "export RUBYLIB
|
10
|
+
system( "export RUBYLIB=../lib; ../bin/mucgly -i -m #{cmdopts} -f #{test}.rx.txt -o #{rf}" )
|
12
11
|
|
13
12
|
if false
|
14
13
|
# Populate golden files after inspection.
|
@@ -16,15 +15,33 @@ def runTest( cmdopts, test, sep = "" )
|
|
16
15
|
end
|
17
16
|
|
18
17
|
assert( system( "diff #{rf} #{gf}" ), "FAILED: diff #{rf} #{gf}" )
|
19
|
-
|
20
|
-
Dir.chdir( '..' )
|
21
18
|
end
|
22
19
|
|
23
20
|
|
24
21
|
class MucglyTest < Test::Unit::TestCase
|
25
22
|
|
23
|
+
def setup
|
24
|
+
Dir.chdir( 'test' )
|
25
|
+
FileUtils.mkdir_p "result"
|
26
|
+
end
|
27
|
+
|
28
|
+
def teardown
|
29
|
+
Dir.chdir( '..' )
|
30
|
+
end
|
31
|
+
|
32
|
+
|
26
33
|
def test_basic() runTest( "", "test_basic" ); end
|
27
34
|
def test_specials_cli() runTest( "-b @ -e @ -s /", "test_specials_cli" ); end
|
28
35
|
def test_specials_cmd() runTest( "", "test_specials_cmd" ); end
|
29
36
|
|
37
|
+
def test_file_ctrl()
|
38
|
+
rf1 = "result/test_file_ctrl.txt"
|
39
|
+
rf2 = "result/test_redirect.txt"
|
40
|
+
gf1 = "golden/test_file_ctrl.txt"
|
41
|
+
gf2 = "golden/test_redirect.txt"
|
42
|
+
system( "export MUCGLY=./test_include.rb; export RUBYLIB=../lib; ../bin/mucgly -m -f test_file_ctrl.rx.txt -o #{rf1}" )
|
43
|
+
assert( system( "diff #{rf1} #{gf1}" ), "FAILED: diff #{rf1} #{gf1}" )
|
44
|
+
assert( system( "diff #{rf2} #{gf2}" ), "FAILED: diff #{rf2} #{gf2}" )
|
45
|
+
end
|
46
|
+
|
30
47
|
end
|
data/test/test_skip.txt
ADDED
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mucgly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tero Isannainen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description:
|
14
|
-
|
15
|
-
|
13
|
+
description: |-
|
14
|
+
Mucgly is a macro expander for inline macros that exist in the middle
|
15
|
+
of body text. Mucgly is useful for code generation and all kinds of
|
16
|
+
templating systems. The macros are expected to be mostly regular Ruby
|
17
|
+
code, but a few special commands are also available.
|
16
18
|
email: tero.isannainen@gmail.com
|
17
19
|
executables:
|
18
20
|
- mucgly
|
@@ -45,16 +47,22 @@ files:
|
|
45
47
|
- ext/mucgly/mucgly.c
|
46
48
|
- lib/version.rb
|
47
49
|
- test/golden/test_basic.txt
|
50
|
+
- test/golden/test_file_ctrl.txt
|
51
|
+
- test/golden/test_redirect.txt
|
48
52
|
- test/golden/test_specials_cli.txt
|
49
53
|
- test/golden/test_specials_cmd.txt
|
50
54
|
- test/result/test_basic.txt
|
55
|
+
- test/result/test_file_ctrl.txt
|
56
|
+
- test/result/test_redirect.txt
|
51
57
|
- test/result/test_specials_cli.txt
|
52
58
|
- test/result/test_specials_cmd.txt
|
53
59
|
- test/result/test_specials_cmd2.txt
|
54
60
|
- test/test_basic.rx.txt
|
61
|
+
- test/test_file_ctrl.rx.txt
|
55
62
|
- test/test_include.rb
|
56
63
|
- test/test_include.txt
|
57
64
|
- test/test_mucgly.rb
|
65
|
+
- test/test_skip.txt
|
58
66
|
- test/test_specials_cli.rx.txt
|
59
67
|
- test/test_specials_cmd.rx.txt
|
60
68
|
homepage:
|
@@ -82,8 +90,11 @@ signing_key:
|
|
82
90
|
specification_version: 4
|
83
91
|
summary: Mucgly processes inline macros.
|
84
92
|
test_files:
|
93
|
+
- test/test_skip.txt
|
85
94
|
- test/golden/test_basic.txt
|
86
95
|
- test/golden/test_specials_cli.txt
|
96
|
+
- test/golden/test_file_ctrl.txt
|
97
|
+
- test/golden/test_redirect.txt
|
87
98
|
- test/golden/test_specials_cmd.txt
|
88
99
|
- test/test_specials_cmd.rx.txt
|
89
100
|
- test/test_include.rb
|
@@ -91,8 +102,11 @@ test_files:
|
|
91
102
|
- test/test_basic.rx.txt
|
92
103
|
- test/test_specials_cli.rx.txt
|
93
104
|
- test/test_mucgly.rb
|
105
|
+
- test/test_file_ctrl.rx.txt
|
94
106
|
- test/result/test_basic.txt
|
95
107
|
- test/result/test_specials_cli.txt
|
108
|
+
- test/result/test_file_ctrl.txt
|
96
109
|
- test/result/test_specials_cmd2.txt
|
110
|
+
- test/result/test_redirect.txt
|
97
111
|
- test/result/test_specials_cmd.txt
|
98
112
|
has_rdoc:
|