multimarkdown-cli 0.0.1 → 0.0.2

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: 09aae7f2a12d2b2bde33ddc689d422e69a672e70
4
- data.tar.gz: 8ab81ce10a0e9c99860f1cf5a00244a45319b842
3
+ metadata.gz: 6c1f95e85980744337201d4d206b483819bc3f99
4
+ data.tar.gz: aa8014cd7c02b996dae1b141a393ba3a0d87c996
5
5
  SHA512:
6
- metadata.gz: ef7c2c5d3542e91d2c47fe5c0cb487e453ca2d864703a9507001ab7e35c091154054c8655d1d5319bb23d1a0325293ad927eea0cf1179e144ecd5955df6c6268
7
- data.tar.gz: e52683072e60768366714142bbca08da14eed4c3a6eb755ad62d70c9b45c37f4964fdef5934b62dbae3288cb82915ae859113bea028b843a02523db0a09bea91
6
+ metadata.gz: c802db048bbb13a05f6d527a684d0172b7f8151e2520238bcfbb3b22327a44ff11e68c19661c3d714fb92650f62a0b9e8b2e5a2dd50bd124cd722f4dc573ce5b
7
+ data.tar.gz: 06138fd60fc9ff1e8a40cbaf370e412c152441b25fea33a276d3b2004b1ada651f90de7b77329e926986466013d276b09b3ddaa09d2101f7d53e4c5c52fe936c
@@ -7,6 +7,7 @@ GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  rake (10.1.1)
10
+ tilt (1.4.1)
10
11
 
11
12
  PLATFORMS
12
13
  ruby
@@ -15,3 +16,4 @@ DEPENDENCIES
15
16
  bundler (~> 1.3)
16
17
  multimarkdown-cli!
17
18
  rake
19
+ tilt
@@ -1,21 +1,29 @@
1
1
  require "multimarkdown-cli/version"
2
+ require "multimarkdown-cli/tilt_plugin"
2
3
 
3
- # check that the command line tool is installed when requiring
4
- # from http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
5
- exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
6
- mmd_cmd_found = false
7
- ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
8
- exts.each do |ext|
9
- exe = File.join(path, "multimarkdown#{ext}")
10
- if File.executable? exe
11
- mmd_cmd_found = true
12
- break
4
+ module MultiMarkdownCLI
5
+ def self._cli_installed?
6
+ # from http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
7
+ exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
8
+ mmd_cmd_found = false
9
+ ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
10
+ exts.each do |ext|
11
+ exe = File.join(path, "multimarkdown#{ext}")
12
+ if File.executable? exe
13
+ mmd_cmd_found = true
14
+ break
15
+ end
16
+ end
13
17
  end
18
+ mmd_cmd_found
14
19
  end
15
- end
16
- raise "Can't find the multimarkdown command in your path. Please install it" if !mmd_cmd_found
17
20
 
18
- module MultiMarkdownCLI
21
+ # check that the command line tool is installed when requiring
22
+ unless _cli_installed?
23
+ raise LoadError.new("Can't find the multimarkdown command in your path. Please install it")
24
+ end
25
+
26
+
19
27
  class Parser
20
28
  attr_reader :source
21
29
 
@@ -0,0 +1,33 @@
1
+
2
+ require 'tilt' unless defined? Tilt
3
+
4
+ require 'multimarkdown-cli'
5
+
6
+ module MultiMarkdownCLI
7
+ class Template < Tilt::Template
8
+
9
+ def self.engine_initialized?
10
+ require 'multimarkdown-cli'
11
+ end
12
+
13
+ def initialize_engine
14
+ end
15
+
16
+ def prepare
17
+ @source = data
18
+ end
19
+
20
+ def evaluate(scope, locals, &block)
21
+ parser = MultiMarkdownCLI::Parser.new(@source, :snippet)
22
+ parser.to_html
23
+ end
24
+
25
+ def allows_script?
26
+ false
27
+ end
28
+ end
29
+
30
+ Tilt.register Template, 'multimarkdown'
31
+ end
32
+
33
+
@@ -1,3 +1,3 @@
1
1
  module MultimarkdownCLI
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -23,4 +23,5 @@ Gem::Specification.new do |spec|
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.3"
25
25
  spec.add_development_dependency "rake"
26
+ spec.add_development_dependency "tilt"
26
27
  end
@@ -7,3 +7,6 @@ require_relative 'test_markdown'
7
7
  require_relative 'test_memoir'
8
8
  require_relative 'test_mmd'
9
9
 
10
+ require_relative 'test_module'
11
+ require_relative 'test_tilt_integration'
12
+
@@ -3,7 +3,7 @@ $: << File.join(File.dirname(__FILE__), "../lib")
3
3
 
4
4
  require 'test/unit'
5
5
  require 'multimarkdown-cli'
6
- require_relative 'test_writer'
6
+ require_relative 'mmd_test_suite_builder'
7
7
 
8
8
  class BeamerSuiteTest < Test::Unit::TestCase
9
9
 
@@ -3,7 +3,7 @@ $: << File.join(File.dirname(__FILE__), "../lib")
3
3
 
4
4
  require 'test/unit'
5
5
  require 'multimarkdown-cli'
6
- require_relative 'test_writer'
6
+ require_relative 'mmd_test_suite_builder'
7
7
 
8
8
  class CompatSuiteTest < Test::Unit::TestCase
9
9
 
@@ -3,7 +3,7 @@ $: << File.join(File.dirname(__FILE__), "../lib")
3
3
 
4
4
  require 'test/unit'
5
5
  require 'multimarkdown-cli'
6
- require_relative 'test_writer'
6
+ require_relative 'mmd_test_suite_builder'
7
7
 
8
8
  class MarkdownSuiteTest < Test::Unit::TestCase
9
9
 
@@ -3,7 +3,7 @@ $: << File.join(File.dirname(__FILE__), "../lib")
3
3
 
4
4
  require 'test/unit'
5
5
  require 'multimarkdown-cli'
6
- require_relative 'test_writer'
6
+ require_relative 'mmd_test_suite_builder'
7
7
 
8
8
  class MemoirSuiteTest < Test::Unit::TestCase
9
9
 
@@ -3,7 +3,7 @@ $: << File.join(File.dirname(__FILE__), "../lib")
3
3
 
4
4
  require 'test/unit'
5
5
  require 'multimarkdown-cli'
6
- require_relative 'test_writer'
6
+ require_relative 'mmd_test_suite_builder'
7
7
 
8
8
  class MultiMarkdownSuiteTest < Test::Unit::TestCase
9
9
 
@@ -0,0 +1,23 @@
1
+
2
+ $: << File.join(File.dirname(__FILE__), "../lib")
3
+
4
+ require 'test/unit'
5
+
6
+ class ModuleSuiteTest < Test::Unit::TestCase
7
+
8
+ # make sure the module throws an exception on import if
9
+ # the multimarkdown command can't be found
10
+ def test_import_exception
11
+ # blow out the path so that the command won't be found
12
+ old_path = ENV['PATH']
13
+ begin
14
+ ENV['PATH'] = ''
15
+ assert_raise LoadError do
16
+ require 'multimarkdown-cli'
17
+ end
18
+ ensure
19
+ ENV['PATH'] = old_path
20
+ end
21
+ end
22
+ end
23
+
@@ -0,0 +1,14 @@
1
+
2
+ $: << File.join(File.dirname(__FILE__), "../lib")
3
+
4
+ require 'test/unit'
5
+
6
+ require 'multimarkdown-cli'
7
+
8
+ class TiltIntegrationSuiteTest < Test::Unit::TestCase
9
+
10
+ def test_registered_extension
11
+ assert_equal MultiMarkdownCLI::Template, Tilt['test.multimarkdown']
12
+ end
13
+ end
14
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multimarkdown-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Torsney-Weir
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-01 00:00:00.000000000 Z
11
+ date: 2014-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: tilt
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: |2
42
56
  A Ruby extension that can process MultiMarkdown-formatted
43
57
  text using the multimarkdown command line tool.
@@ -55,15 +69,18 @@ files:
55
69
  - README.md
56
70
  - Rakefile
57
71
  - lib/multimarkdown-cli.rb
72
+ - lib/multimarkdown-cli/tilt_plugin.rb
58
73
  - lib/multimarkdown-cli/version.rb
59
74
  - multimarkdown-cli.gemspec
60
75
  - test/all_tests.rb
76
+ - test/mmd_test_suite_builder.rb
61
77
  - test/test_beamer.rb
62
78
  - test/test_compat.rb
63
79
  - test/test_markdown.rb
64
80
  - test/test_memoir.rb
65
81
  - test/test_mmd.rb
66
- - test/test_writer.rb
82
+ - test/test_module.rb
83
+ - test/test_tilt_integration.rb
67
84
  homepage: https://github.com/gabysbrain/rb-MultiMarkdown-4
68
85
  licenses:
69
86
  - MIT
@@ -90,9 +107,11 @@ specification_version: 4
90
107
  summary: An interface to the multimarkdown command line tool
91
108
  test_files:
92
109
  - test/all_tests.rb
110
+ - test/mmd_test_suite_builder.rb
93
111
  - test/test_beamer.rb
94
112
  - test/test_compat.rb
95
113
  - test/test_markdown.rb
96
114
  - test/test_memoir.rb
97
115
  - test/test_mmd.rb
98
- - test/test_writer.rb
116
+ - test/test_module.rb
117
+ - test/test_tilt_integration.rb