github-markup 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.md +4 -0
- data/lib/github/markup.rb +3 -0
- data/lib/github/markup/version.rb +1 -1
- data/lib/github/markups.rb +3 -2
- data/test/markup_test.rb +8 -0
- metadata +2 -2
data/HISTORY.md
CHANGED
data/lib/github/markup.rb
CHANGED
@@ -26,6 +26,7 @@ module GitHub
|
|
26
26
|
|
27
27
|
def command(command, regexp, &block)
|
28
28
|
command = command.to_s
|
29
|
+
|
29
30
|
if !File.exists?(command) && !command.include?('/')
|
30
31
|
command = File.dirname(__FILE__) + '/commands/' + command.to_s
|
31
32
|
end
|
@@ -54,6 +55,8 @@ module GitHub
|
|
54
55
|
end
|
55
56
|
|
56
57
|
def execute(command, target)
|
58
|
+
return target if !system("which #{command} > /dev/null")
|
59
|
+
|
57
60
|
out = ''
|
58
61
|
Open3.popen3(command) do |stdin, stdout, _|
|
59
62
|
stdin.puts target
|
data/lib/github/markups.rb
CHANGED
@@ -20,9 +20,10 @@ command(:asciidoc2html, /asciidoc/)
|
|
20
20
|
# Any block passed to `command` will be handed the command's STDOUT for
|
21
21
|
# post processing.
|
22
22
|
command("/usr/bin/env pod2html", /pod/) do |rendered|
|
23
|
+
require 'fileutils'
|
23
24
|
if rendered =~ /<body.+?>\s*(.+)\s*<\/body>/mi
|
24
|
-
|
25
|
-
|
25
|
+
FileUtils.rm("pod2htmd.tmp") if File.exists?('pod2htmd.tmp') rescue nil
|
26
|
+
FileUtils.rm("pod2htmi.tmp") if File.exists?('pod2htmi.tmp') rescue nil
|
26
27
|
$1.sub('<!-- INDEX BEGIN -->', '').sub('<!-- INDEX END -->', '')
|
27
28
|
end
|
28
29
|
end
|
data/test/markup_test.rb
CHANGED
@@ -26,4 +26,12 @@ message
|
|
26
26
|
assert_equal true, GitHub::Markup.can_render?('README.markdown')
|
27
27
|
assert_equal false, GitHub::Markup.can_render?('README.cmd')
|
28
28
|
end
|
29
|
+
|
30
|
+
def test_fails_gracefully_on_missing_commands
|
31
|
+
GitHub::Markup.command(:i_made_it_up, /mde/)
|
32
|
+
text = 'hi there'
|
33
|
+
assert_equal true, GitHub::Markup.can_render?('README.mde')
|
34
|
+
actual = GitHub::Markup.render('README.mde', text)
|
35
|
+
assert_equal text, actual
|
36
|
+
end
|
29
37
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-markup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Wanstrath
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-17 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|