md-ruby-eval 0.2.0 → 0.3.0
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 +5 -5
- data/README.md +2 -2
- data/VERSION +1 -1
- data/bin/md-ruby-eval +23 -16
- data/lib/md_ruby_eval.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dec15b3f48af5f743b96c4a8c8afceee6f6f6819cc16fad51a91dfd06e531462
|
4
|
+
data.tar.gz: ab6707c2f223488c986bac361c597e496123b5af8f935af8567971af0cb83e35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf6f4607c2f0dafcc31cce0e44753fafaa511cf6101ff93e3cc4b2cbadc136bd0765805efc65437bfc14cd2512a14cc24981669a68961b0aedd509cb457a3848
|
7
|
+
data.tar.gz: 01d08f8118ec12274801803b2be8591e472af988849a4b13c6966131e229f2089b721cd8db760eb918fe3d1567718cf83aeaa01a2e7fde3b8706782295c4b789
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Usage: md-ruby-eval [options] --auto
|
4
4
|
md-ruby-eval [options] INPUT_FILE OUTPUT_FILE
|
5
|
-
md-ruby-eval --help
|
5
|
+
md-ruby-eval --help
|
6
6
|
|
7
7
|
Evaluates Ruby examples in MD files.
|
8
8
|
|
@@ -60,7 +60,7 @@ added to the output as a comment, which is useful for method and class definitio
|
|
60
60
|
c.md
|
61
61
|
|
62
62
|
- `md-ruby-eval --auto` call the tool
|
63
|
-
|
63
|
+
|
64
64
|
Creates files `a.out.md` and `b.out.md` evaluating each in isolated environments, before
|
65
65
|
`a.out.md` is evaluated `a.init.md` is required to setup its environment. `c.md` is ignored
|
66
66
|
since it does not have `in` marker.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/bin/md-ruby-eval
CHANGED
@@ -7,10 +7,15 @@ to_require = []
|
|
7
7
|
indentation = 40
|
8
8
|
line_length = 79
|
9
9
|
auto = false
|
10
|
+
dir = Dir.pwd
|
10
11
|
|
11
12
|
OptionParser.new do |opts|
|
12
13
|
opts.banner = File.read(__dir__ + '/../README.md') + "\n## Options:\n\n"
|
13
14
|
|
15
|
+
opts.on('-d', '--directory DIR', 'Working directory') do |v|
|
16
|
+
dir = File.expand_path v
|
17
|
+
end
|
18
|
+
|
14
19
|
opts.on('-r', '--require FILE', 'Require given files before processing the MD files') do |v|
|
15
20
|
to_require << v
|
16
21
|
end
|
@@ -33,25 +38,27 @@ OptionParser.new do |opts|
|
|
33
38
|
end
|
34
39
|
end.parse!
|
35
40
|
|
36
|
-
|
37
|
-
|
38
|
-
|
41
|
+
Dir.chdir dir do
|
42
|
+
if auto
|
43
|
+
input_paths = Dir.glob('*.in.md')
|
44
|
+
input_paths.each do |input_path|
|
39
45
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
+
pid = fork do
|
47
|
+
to_require.each { |p| require p }
|
48
|
+
init_path = File.basename(input_path, '.in.md') + '.init.rb'
|
49
|
+
if File.exist? init_path
|
50
|
+
puts "using: #{init_path}"
|
51
|
+
load init_path
|
52
|
+
end
|
53
|
+
MDRubyEval.new input_path, input_path.gsub(/(\.in)?\.md$/, '.out.md'), binding, indentation, line_length
|
46
54
|
end
|
47
|
-
MDRubyEval.new input_path, input_path.gsub(/(\.in)?\.md$/, '.out.md'), binding, indentation, line_length
|
48
|
-
end
|
49
55
|
|
50
|
-
|
56
|
+
Process.wait pid
|
57
|
+
end
|
58
|
+
else
|
59
|
+
input_path, output_path = ARGV.map { |p| File.expand_path p }
|
60
|
+
raise 'no input path' unless input_path && File.exist?(input_path)
|
61
|
+
MDRubyEval.new input_path, output_path, binding, indentation, line_length
|
51
62
|
end
|
52
|
-
else
|
53
|
-
input_path, output_path = ARGV.map { |p| File.expand_path p }
|
54
|
-
raise 'no input path' unless input_path && File.exist?(input_path)
|
55
|
-
MDRubyEval.new input_path, output_path, binding, indentation, line_length
|
56
63
|
end
|
57
64
|
|
data/lib/md_ruby_eval.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: md-ruby-eval
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Petr Chalupa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -59,7 +59,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
59
|
version: '0'
|
60
60
|
requirements: []
|
61
61
|
rubyforge_project:
|
62
|
-
rubygems_version: 2.6
|
62
|
+
rubygems_version: 2.7.6
|
63
63
|
signing_key:
|
64
64
|
specification_version: 4
|
65
65
|
summary: Evaluator of Ruby examples in Markdown files.
|