github-markup 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/HISTORY.md +5 -0
- data/github-markup.gemspec +1 -3
- data/lib/github-markup.rb +1 -1
- data/lib/github/markup/command_implementation.rb +8 -5
- data/lib/github/markups.rb +0 -4
- data/test/markup_test.rb +10 -14
- metadata +3 -4
- data/test/markups/README.lhs +0 -10
- data/test/markups/README.lhs.html +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c8a09a747ae3f717bd9e710c3725217419f7bd1
|
4
|
+
data.tar.gz: b741c9f19985f3bcc8384dbde99ee3c74bb0fbc6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 924b42c03f352f31e81e5abdd3d2905f420b4010417ac59186553b2aa6354e779c3c1c6cd105b86a3a8119fb2853c74e8f24a69dfad7c7461c325b5079699264
|
7
|
+
data.tar.gz: 94ec8a1a48a890b4fdd2472d433c1f3a7cf30d15bc2b158015e975776ef096dbacbd021555a6fa2bda8001bd2e3286a672ff391f40b302575bf28ee954f1e79f
|
data/Gemfile
CHANGED
data/HISTORY.md
CHANGED
data/github-markup.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
## the sub! line in the Rakefile
|
17
17
|
s.name = 'github-markup'
|
18
18
|
s.version = GitHub::Markup::VERSION
|
19
|
-
s.date = '2014-
|
19
|
+
s.date = '2014-03-10'
|
20
20
|
s.executables = ['github-markup']
|
21
21
|
|
22
22
|
## Make sure your summary is short. The description may be as long
|
@@ -79,8 +79,6 @@ desc
|
|
79
79
|
test/markups/README.asciidoc.html
|
80
80
|
test/markups/README.creole
|
81
81
|
test/markups/README.creole.html
|
82
|
-
test/markups/README.lhs
|
83
|
-
test/markups/README.lhs.html
|
84
82
|
test/markups/README.litcoffee
|
85
83
|
test/markups/README.litcoffee.html
|
86
84
|
test/markups/README.markdown
|
data/lib/github-markup.rb
CHANGED
@@ -3,6 +3,9 @@ require "github/markup/implementation"
|
|
3
3
|
|
4
4
|
module GitHub
|
5
5
|
module Markup
|
6
|
+
class CommandError < RuntimeError
|
7
|
+
end
|
8
|
+
|
6
9
|
class CommandImplementation < Implementation
|
7
10
|
attr_reader :command, :block
|
8
11
|
|
@@ -31,11 +34,11 @@ module GitHub
|
|
31
34
|
|
32
35
|
def execute(command, target)
|
33
36
|
spawn = POSIX::Spawn::Child.new(*command, :input => target)
|
34
|
-
spawn.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
37
|
+
if spawn.status.success?
|
38
|
+
spawn.out.gsub("\r", '')
|
39
|
+
else
|
40
|
+
raise CommandError.new(spawn.err.strip)
|
41
|
+
end
|
39
42
|
end
|
40
43
|
end
|
41
44
|
end
|
data/lib/github/markups.rb
CHANGED
@@ -22,10 +22,6 @@ markup(:wikicloth, /mediawiki|wiki/) do |content|
|
|
22
22
|
WikiCloth::WikiCloth.new(:data => content).to_html(:noedit => true)
|
23
23
|
end
|
24
24
|
|
25
|
-
markup(:literati, /lhs/) do |content|
|
26
|
-
Literati.render(content)
|
27
|
-
end
|
28
|
-
|
29
25
|
markup(:asciidoctor, /adoc|asc(iidoc)?/) do |content|
|
30
26
|
Asciidoctor.render(content, :safe => :secure, :attributes => %w(showtitle idprefix idseparator=- env=github env-github source-highlighter=html-pipeline))
|
31
27
|
end
|
data/test/markup_test.rb
CHANGED
@@ -39,19 +39,15 @@ message
|
|
39
39
|
assert_equal true, GitHub::Markup.can_render?('README.litcoffee')
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
43
|
-
GitHub::Markup.command(
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
text = 'hey mang'
|
53
|
-
assert GitHub::Markup.can_render?('README.tf')
|
54
|
-
actual = GitHub::Markup.render('README.tf', text)
|
55
|
-
assert_equal text, actual
|
42
|
+
def test_raises_error_if_command_exits_non_zero
|
43
|
+
GitHub::Markup.command('echo "failure message">&2 && false', /fail/)
|
44
|
+
assert GitHub::Markup.can_render?('README.fail')
|
45
|
+
begin
|
46
|
+
GitHub::Markup.render('README.fail', "stop swallowing errors")
|
47
|
+
rescue GitHub::Markup::CommandError => e
|
48
|
+
assert_equal "failure message", e.message
|
49
|
+
else
|
50
|
+
fail "an exception was expected but was not raised"
|
51
|
+
end
|
56
52
|
end
|
57
53
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-markup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Wanstrath
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
This gem is used by GitHub to render any fancy markup such as
|
@@ -44,8 +44,6 @@ files:
|
|
44
44
|
- test/markups/README.asciidoc.html
|
45
45
|
- test/markups/README.creole
|
46
46
|
- test/markups/README.creole.html
|
47
|
-
- test/markups/README.lhs
|
48
|
-
- test/markups/README.lhs.html
|
49
47
|
- test/markups/README.litcoffee
|
50
48
|
- test/markups/README.litcoffee.html
|
51
49
|
- test/markups/README.markdown
|
@@ -93,3 +91,4 @@ signing_key:
|
|
93
91
|
specification_version: 2
|
94
92
|
summary: The code GitHub uses to render README.markup
|
95
93
|
test_files: []
|
94
|
+
has_rdoc:
|
data/test/markups/README.lhs
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
<h1>Markdown</h1>
|
2
|
-
|
3
|
-
<p>Except with more magic added.</p>
|
4
|
-
|
5
|
-
<pre><code class="haskell">isPrefixOf :: (Eq a) => [a] -> [a] -> Bool
|
6
|
-
isPrefixOf [] _ = True
|
7
|
-
isPrefixOf _ [] = False
|
8
|
-
isPrefixOf (x:xs) (y:ys)= x == y && isPrefixOf xs ys
|
9
|
-
</code></pre>
|
10
|
-
|
11
|
-
<p>And Haskell. A lot of Haskell.</p>
|