md_inc 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +15 -3
- data/lib/md_inc/md_inc_commands.rb +5 -5
- data/lib/md_inc/version.rb +1 -1
- data/spec/md_inc_spec.rb +9 -0
- metadata +1 -1
data/README.md
CHANGED
@@ -16,10 +16,22 @@ Or install it yourself as:
|
|
16
16
|
|
17
17
|
$ gem install md_inc
|
18
18
|
|
19
|
-
|
20
|
-
|
19
|
+
## API Changes
|
20
|
+
|
21
|
+
The MdInc API has changed somewhat with the
|
22
|
+
0.3.x releases:
|
23
|
+
* With version 0.3.0 the API for adding
|
24
|
+
new commands has changed. You command methods
|
21
25
|
should be ordinary methods, not module methods
|
22
|
-
as before
|
26
|
+
as before.
|
27
|
+
* Version 0.3.1 fixes and at the same time changes
|
28
|
+
the way that the base directory for the included files
|
29
|
+
works. In pre-0.3 versions you would use the `root`
|
30
|
+
method to set the base directory. In newer versions
|
31
|
+
you can set the base directory by passing an options
|
32
|
+
tag to the constructor:
|
33
|
+
|
34
|
+
processor = MdInc::TextProcessor.new(:base_dir => '/etc')
|
23
35
|
|
24
36
|
## Usage
|
25
37
|
|
data/lib/md_inc/version.rb
CHANGED
data/spec/md_inc_spec.rb
CHANGED
@@ -132,6 +132,15 @@ describe MdInc::TextProcessor do
|
|
132
132
|
output.should == "first\naaa\nbbb\nlast"
|
133
133
|
end
|
134
134
|
|
135
|
+
it 'can pull in a file from a different direc using the :base_dir option' do
|
136
|
+
processor = MdInc::TextProcessor.new(:base_dir => '/etc')
|
137
|
+
text = "first\n.inc 'passwd'\nlast"
|
138
|
+
output = processor.process(text)
|
139
|
+
output.should match(/root/)
|
140
|
+
output.should match(/bin/)
|
141
|
+
|
142
|
+
end
|
143
|
+
|
135
144
|
it 'can do include just the lines between two matching lines' do
|
136
145
|
text = "first\n.between(/line 4/, /line 7/, inc('temp2') )\nlast"
|
137
146
|
output = mdi.process(text)
|