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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f2bf28c5515feafd037786383c67ce40e482f3f3
4
- data.tar.gz: 99c65eb34485a76969611064d7202612c89535e6
3
+ metadata.gz: 9c8a09a747ae3f717bd9e710c3725217419f7bd1
4
+ data.tar.gz: b741c9f19985f3bcc8384dbde99ee3c74bb0fbc6
5
5
  SHA512:
6
- metadata.gz: 82cc2f19d92b7301d6593fb67056ef5a450cc64cacd11572671fa7acb25dce036c1f4765d8202f0fffa7717a714a2cc349c91c23a56dd638574a9c9cc85b3d39
7
- data.tar.gz: a40f9887214699a9fc58b9596763c4788bbf72431711c66cad40ab2a7d566b91c5969bb71d31058c090befac3fafffc93ed6acf5c5a62aea1e4b66ac9c7cbb4e
6
+ metadata.gz: 924b42c03f352f31e81e5abdd3d2905f420b4010417ac59186553b2aa6354e779c3c1c6cd105b86a3a8119fb2853c74e8f24a69dfad7c7461c325b5079699264
7
+ data.tar.gz: 94ec8a1a48a890b4fdd2472d433c1f3a7cf30d15bc2b158015e975776ef096dbacbd021555a6fa2bda8001bd2e3286a672ff391f40b302575bf28ee954f1e79f
data/Gemfile CHANGED
@@ -5,7 +5,6 @@ gem "rdoc", "~>3.6"
5
5
  gem "org-ruby", ">= 0.8.1"
6
6
  gem "creole", "~>0.3.6"
7
7
  gem "wikicloth", "=0.6.0"
8
- gem "literati", "= 0.0.3"
9
8
  gem "asciidoctor", "= 0.1.4"
10
9
  gem "rake"
11
10
  gem "posix-spawn"
data/HISTORY.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 1.1.0 (2014-03-10)
2
+
3
+ * Raise GitHub::Markup::CommandError if external command exits with a non-zero status.
4
+ * Remove support for literate Haskell (see #266)
5
+
1
6
  ## 0.5.1 (2010-09-30)
2
7
 
3
8
  * Support relative path links in rdoc
@@ -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-02-25'
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
@@ -1,6 +1,6 @@
1
1
  module GitHub
2
2
  module Markup
3
- VERSION = '1.0.3'
3
+ VERSION = '1.1.0'
4
4
  Version = VERSION
5
5
  end
6
6
  end
@@ -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.out.gsub("\r", '')
35
- rescue Errno::EPIPE
36
- ""
37
- rescue Errno::ENOENT
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
@@ -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 test_fails_gracefully_on_missing_commands
43
- GitHub::Markup.command(:i_made_it_up, /mde/)
44
- text = 'hi there'
45
- assert GitHub::Markup.can_render?('README.mde')
46
- actual = GitHub::Markup.render('README.mde', text)
47
- assert_equal text, actual
48
- end
49
-
50
- def test_fails_gracefully_on_missing_env_commands
51
- GitHub::Markup.command('/usr/bin/env totally_fake', /tf/)
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.3
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-02-25 00:00:00.000000000 Z
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:
@@ -1,10 +0,0 @@
1
- # Markdown
2
-
3
- Except with more magic added.
4
-
5
- > isPrefixOf :: (Eq a) => [a] -> [a] -> Bool
6
- > isPrefixOf [] _ = True
7
- > isPrefixOf _ [] = False
8
- > isPrefixOf (x:xs) (y:ys)= x == y && isPrefixOf xs ys
9
-
10
- And Haskell. A lot of Haskell.
@@ -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) =&gt; [a] -&gt; [a] -&gt; Bool
6
- isPrefixOf [] _ = True
7
- isPrefixOf _ [] = False
8
- isPrefixOf (x:xs) (y:ys)= x == y &amp;&amp; isPrefixOf xs ys
9
- </code></pre>
10
-
11
- <p>And Haskell. A lot of Haskell.</p>