trenni-markdown 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 80c7291285ffcd0dd7eee1a52a381007aa36c6bb
4
- data.tar.gz: 271bb81c07044631c1ffd593e25e03975925e5fe
3
+ metadata.gz: 5ab15103a8d530d275194e7c0767fc37c4bef965
4
+ data.tar.gz: 1e8a9b672609cfed81abe421a8248e5101ba0543
5
5
  SHA512:
6
- metadata.gz: d5ca7845a950149279de439986742b331aecbcf4499bd2ff87dada9045d388bb07b2d7c1ba32df9ad432843d9bd310d9a899513ae3f9bce503042482ddebeb71
7
- data.tar.gz: f08e25da04fb56720131cd9f1851a2365a32e3e18b44ab2e9639cfbcf329b40e4bb6e9037b39eb0a93a307549ca59320cb0bea9380cf08fc86d20dac870030ce
6
+ metadata.gz: 9934ffa244b38f2dde2ac84f0e7eba80707f200a2dd6400bd796bf352d4ae45085fde642df4b140da4641507af68ad64cff3f4262fe35cdfad4602bcb2802e56
7
+ data.tar.gz: a9d3a1afd1aad523be5b6be5975640d490558da0256ac6da0428307c1ed28c4d72e2e4732190d84e64ec4ccf959bbd286da40271bd903ee45cd966876db14ea0
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Trenni::Markdown
2
2
 
3
- Trenni::Markdown is a light-weight (deliberately) simple Markdown parser. It doesn't cover the entire spec but only a small subset required for implementing [literate](https://en.wikipedia.org/wiki/Literate_programming) unit tests, which are markdown documents which include unit tests.
3
+ Trenni::Markdown is a deliberately light-weight and simple Markdown parser. It doesn't cover the entire spec but only a small subset required for implementing [literate](https://en.wikipedia.org/wiki/Literate_programming) unit tests, which are markdown documents which include unit tests.
4
4
 
5
5
  [![Build Status](https://secure.travis-ci.org/ioquatix/trenni-markdown.svg)](http://travis-ci.org/ioquatix/trenni-markdown)
6
6
  [![Code Climate](https://codeclimate.com/github/ioquatix/trenni-markdown.svg)](https://codeclimate.com/github/ioquatix/trenni-markdown)
@@ -38,7 +38,7 @@ Or install it yourself as:
38
38
 
39
39
  A command line binary is included for basic transforms (using [examples/test.md](examples/test.md) in this example):
40
40
 
41
- $ trenni-markdown -g RSpec examples/test.md
41
+ $ trenni-markdown generate -g RSpec examples/test.md
42
42
  RSpec.describe String.new("Test") do
43
43
 
44
44
  # This test checks that strings report the inclusion of letters correctly.
@@ -1,21 +1,27 @@
1
- #!/usr/bin/env Ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
- require 'trenni/markdown'
4
- require 'trenni/markdown/generators'
3
+ # Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
5
22
 
6
- require 'trollop'
23
+ require 'trenni/markdown/command'
7
24
 
8
- OPTIONS = Trollop::options do
9
- opt :generator, "Which generator to use for converting markdown.", :type => :string, :default => 'Ruby'
10
- end
25
+ top = Trenni::Markdown::Command::Top.parse(ARGV)
11
26
 
12
- generator_class = Trenni::Markdown::Generators.const_get(OPTIONS[:generator])
13
-
14
- ARGV.each do |path|
15
- buffer = Trenni::FileBuffer.new(path)
16
- generator = generator_class.new
17
-
18
- Trenni::Markdown::Parser.new(buffer, generator).parse!
19
-
20
- puts generator.output
21
- end
27
+ top.invoke
@@ -0,0 +1,69 @@
1
+ # Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require_relative '../markdown'
22
+ require_relative 'generators'
23
+
24
+ require 'samovar'
25
+
26
+ module Trenni
27
+ module Markdown
28
+ module Command
29
+ class Generate < Samovar::Command
30
+ options do
31
+ option "-g/--generator <name>", "The class to use for the conversion process.", default: 'Ruby'
32
+ end
33
+
34
+ many :paths, "The paths to convert."
35
+
36
+ def generator_class
37
+ Trenni::Markdown::Generators.const_get(@options[:generator])
38
+ end
39
+
40
+ def invoke
41
+ @paths.each do |path|
42
+ buffer = Trenni::FileBuffer.new(path)
43
+ generator = generator_class.new
44
+
45
+ Trenni::Markdown::Parser.new(buffer, generator).parse!
46
+
47
+ puts generator.output
48
+ end
49
+
50
+ end
51
+ end
52
+
53
+ class Top < Samovar::Command
54
+ self.description = "Convert markdown into other formats."
55
+
56
+ nested '<command>',
57
+ 'generate' => Generate
58
+
59
+ def invoke(program_name: File.basename($0))
60
+ if @command
61
+ @command.invoke
62
+ else
63
+ print_usage(program_name)
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Trenni
22
22
  module Markdown
23
- VERSION = "0.2.0"
23
+ VERSION = "0.3.0"
24
24
  end
25
25
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
 
20
20
  spec.add_dependency "trenni", "~> 1.6.0"
21
- spec.add_dependency "trollop", "~> 2.0.0"
21
+ spec.add_dependency "samovar", "~> 1.2.0"
22
22
 
23
23
  spec.add_development_dependency "bundler", "~> 1.11"
24
24
  spec.add_development_dependency "rake", "~> 10.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trenni-markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-31 00:00:00.000000000 Z
11
+ date: 2016-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trenni
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 1.6.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: trollop
28
+ name: samovar
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.0.0
33
+ version: 1.2.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.0.0
40
+ version: 1.2.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -100,6 +100,7 @@ files:
100
100
  - examples/test.md
101
101
  - examples/unit_test.md
102
102
  - lib/trenni/markdown.rb
103
+ - lib/trenni/markdown/command.rb
103
104
  - lib/trenni/markdown/generator.rb
104
105
  - lib/trenni/markdown/generators.rb
105
106
  - lib/trenni/markdown/generators/rspec.rb