selfml 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc CHANGED
@@ -1,52 +1 @@
1
- #!/usr/bin/env bash
2
-
3
- # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
- # development environment upon cd'ing into the directory
5
-
6
- # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional,
7
- # Only full ruby name is supported here, for short names use:
8
- # echo "rvm use 1.9.3" > .rvmrc
9
- environment_id="ruby-1.9.3-p125"
10
-
11
- # Uncomment the following lines if you want to verify rvm version per project
12
- # rvmrc_rvm_version="1.13.4 (master)" # 1.10.1 seams as a safe start
13
- # eval "$(echo ${rvm_version}.${rvmrc_rvm_version} | awk -F. '{print "[[ "$1*65536+$2*256+$3" -ge "$4*65536+$5*256+$6" ]]"}' )" || {
14
- # echo "This .rvmrc file requires at least RVM ${rvmrc_rvm_version}, aborting loading."
15
- # return 1
16
- # }
17
-
18
- # First we attempt to load the desired environment directly from the environment
19
- # file. This is very fast and efficient compared to running through the entire
20
- # CLI and selector. If you want feedback on which environment was used then
21
- # insert the word 'use' after --create as this triggers verbose mode.
22
- if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
23
- && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
24
- then
25
- \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
26
- [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
27
- \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
28
- if [[ $- == *i* ]] # check for interactive shells
29
- then echo "Using: $(tput setaf 2)$GEM_HOME$(tput sgr0)" # show the user the ruby and gemset they are using in green
30
- else echo "Using: $GEM_HOME" # don't use colors in non-interactive shells
31
- fi
32
- else
33
- # If the environment file has not yet been created, use the RVM CLI to select.
34
- rvm --create use "$environment_id" || {
35
- echo "Failed to create RVM environment '${environment_id}'."
36
- return 1
37
- }
38
- fi
39
-
40
- # If you use bundler, this might be useful to you:
41
- # if [[ -s Gemfile ]] && {
42
- # ! builtin command -v bundle >/dev/null ||
43
- # builtin command -v bundle | GREP_OPTIONS= \grep $rvm_path/bin/bundle >/dev/null
44
- # }
45
- # then
46
- # printf "%b" "The rubygem 'bundler' is not installed. Installing it now.\n"
47
- # gem install bundler
48
- # fi
49
- # if [[ -s Gemfile ]] && builtin command -v bundle >/dev/null
50
- # then
51
- # bundle install | GREP_OPTIONS= \grep -vE '^Using|Your bundle is complete'
52
- # fi
1
+ rvm use default@selfml --create
data/.travis.yml CHANGED
@@ -1,5 +1,11 @@
1
1
  rvm:
2
+ - ree
3
+ - 1.8.7
2
4
  - 1.9.2
3
5
  - 1.9.3
6
+ - ruby-head
7
+ - jruby-18mode
4
8
  - jruby-19mode
9
+ - jruby-head
10
+ - rbx-18mode
5
11
  - rbx-19mode
data/Gemfile CHANGED
@@ -1,9 +1,12 @@
1
- source "http://rubygems.org"
1
+ source :rubygems
2
2
 
3
3
  # Specify your gem's dependencies in self-ml.gemspec
4
4
  gemspec
5
5
 
6
+ gem "require_relative"
7
+
6
8
  group :test do
9
+ gem "minitest", :require => "minitest/autorun"
7
10
  gem "rake"
8
11
  gem "pry"
9
12
  end
data/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ Copyright (c) 2012 Ricardo Mendes
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7
+ the Software, and to permit persons to whom the Software is furnished to do so,
8
+ subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ 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, FITNESS
15
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.markdown CHANGED
@@ -1,4 +1,7 @@
1
1
  # Self-ML
2
+ [![endorse](http://api.coderwall.com/locks/endorsecount.png)](http://coderwall.com/locks)
3
+ [![Build Status](https://secure.travis-ci.org/locks/self-ml.png)](http://travis-ci.org/locks/self-ml)
4
+ [![Gemnasium Build Status](https://gemnasium.com/locks/self-ml.png)](https://gemnasium.com/locks/self-ml)
2
5
 
3
6
  This is a ruby library for reading [self-ml](http://chocolatapp.com/blog/self-ml) files.
4
7
  It is mostly finished, just needs a good polish.
@@ -7,9 +10,9 @@ It will only parse correctly formed files, returning an error otherwise.
7
10
 
8
11
  ## Install
9
12
 
10
- Comming really soon:
11
-
13
+ ```ruby
12
14
  gem install self-ml
15
+ ```
13
16
 
14
17
  ## Usage
15
18
 
@@ -45,7 +48,4 @@ See issue tracker.
45
48
 
46
49
  * locks - ruby implementation
47
50
  * devyn - helpful support
48
- * alexgordon - clearing up self-ml grammar
49
-
50
- [![endorse](http://api.coderwall.com/locks/endorsecount.png)](http://coderwall.com/locks)
51
- [![Build Status](https://secure.travis-ci.org/locks/self-ml.png)](http://travis-ci.org/locks/self-ml)
51
+ * alexgordon - clearing up self-ml grammar
data/bin/selfml ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'optparse'
4
+
5
+ require 'selfml'
6
+ require 'json'
7
+
8
+ engine = nil
9
+
10
+ options = {}
11
+ opts = OptionParser.new do |opts|
12
+ executable_name = File.split($0)[1]
13
+ opts.banner = <<-EOS
14
+ Banner banner
15
+
16
+ Usage: #{executable_name} [options] args...
17
+ EOS
18
+
19
+ opts.on("--json", "Generate JSON") do
20
+ engine = SelfML::Engines::JSON
21
+ end
22
+ end
23
+ opts.parse!
24
+
25
+ input = ARGF.read
26
+ $stdout << SelfML.parse(input, engine)
@@ -0,0 +1,9 @@
1
+ module SelfML::AST
2
+
3
+ class Comment < String
4
+ def serialize; nil; end
5
+
6
+ alias :to_s :serialize
7
+ end
8
+
9
+ end
@@ -0,0 +1,12 @@
1
+ module SelfML::AST
2
+
3
+ class Document < Array
4
+
5
+ def to_s
6
+ a = self.map(&:serialize).reject {|n| n.nil? }
7
+ a.join("\n\n") + "\n"
8
+ end
9
+
10
+ end
11
+
12
+ end
@@ -0,0 +1,38 @@
1
+ module SelfML::AST
2
+
3
+ class Node
4
+ attr_accessor :head , :tail
5
+
6
+ def initialize( head , tail = [] )
7
+ @head , @tail = head , tail
8
+ end
9
+
10
+ def serialize( level = 1 )
11
+ tail = @tail.sort.map do |t|
12
+ case t
13
+ when Node
14
+ "\n" + " "*level*4 + (t.serialize level+1)
15
+ when StringNode
16
+ " "+t.serialize
17
+ else
18
+ nil
19
+ end
20
+ end
21
+
22
+ # puts "head", head, @head.serialize
23
+ # puts "tail", tail
24
+
25
+ "(" + head.serialize + tail.join("") + ")"
26
+ end
27
+
28
+ alias :to_s :serialize
29
+
30
+ def <=> rhs
31
+ case rhs when Node then 0
32
+ when StringNode then 1
33
+ else -1 end
34
+ end
35
+
36
+ end
37
+
38
+ end
@@ -0,0 +1,22 @@
1
+ module SelfML::AST
2
+
3
+ class StringNode < String
4
+
5
+ def serialize
6
+ return "`#{self.gsub("`","``")}`" if self.count("[") != self.count("]")
7
+ return "[#{self}]" if self.match(/[#`()\[\]{} ]/)
8
+
9
+ self
10
+ end
11
+
12
+ alias :to_s :serialize
13
+
14
+ def <=> rhs
15
+ case rhs when StringNode then 0
16
+ when Node then -1
17
+ else 1 end
18
+ end
19
+
20
+ end
21
+
22
+ end
data/lib/selfml/ast.rb CHANGED
@@ -1,72 +1,6 @@
1
- module SelfML::AST
1
+ module SelfML::AST; end
2
2
 
3
- class Document < Array
4
-
5
- def to_s
6
- a = self.map(&:serialize).reject {|n| n.nil? }
7
- a.join("\n\n") + "\n"
8
- end
9
-
10
- end
11
-
12
- class Node
13
- attr_accessor :head , :tail
14
-
15
- def initialize( head , tail = [] )
16
- @head , @tail = head , tail
17
- end
18
-
19
- def serialize( level = 1 )
20
- tail = @tail.sort.map do |t|
21
- case t
22
- when Node
23
- "\n" + " "*level*4 + (t.serialize level+1)
24
- when StringNode
25
- " "+t.serialize
26
- else
27
- nil
28
- end
29
- end
30
-
31
- # puts "head", head, @head.serialize
32
- # puts "tail", tail
33
-
34
- "(" + head.serialize + tail.join("") + ")"
35
- end
36
-
37
- alias :to_s :serialize
38
-
39
- def <=> rhs
40
- case rhs when Node then 0
41
- when StringNode then 1
42
- else -1 end
43
- end
44
-
45
- end
46
-
47
- class StringNode < String
48
-
49
- def serialize
50
- return "`#{self.gsub("`","``")}`" if self.count("[") != self.count("]")
51
- return "[#{self}]" if self.match(/[#`()\[\]{} ]/)
52
-
53
- self
54
- end
55
-
56
- alias :to_s :serialize
57
-
58
- def <=> rhs
59
- case rhs when StringNode then 0
60
- when Node then -1
61
- else 1 end
62
- end
63
-
64
- end
65
-
66
- class Comment < String
67
- def serialize; nil; end
68
-
69
- alias :to_s :serialize
70
- end
71
-
72
- end
3
+ require_relative 'ast/document'
4
+ require_relative 'ast/node'
5
+ require_relative 'ast/string_node'
6
+ require_relative 'ast/comment'
@@ -0,0 +1,19 @@
1
+ module SelfML::Engines
2
+
3
+ class Array < Parslet::Transform
4
+ rule(:verbatim => simple(:s)) { String(s).to_sym }
5
+ rule(:string => simple(:s)) { s.to_sym }
6
+
7
+ rule(:list => subtree(:l)) do
8
+ # (tail = Array(l[:tail]).empty? ? [ String(l[:head]).to_sym , Array(l[:tail]) ]
9
+ [String(l[:head].to_sym)].tap do |ary|
10
+ tail = Array(l[:tail])
11
+
12
+ ary.concat tail unless tail.empty?
13
+ end
14
+ end
15
+
16
+ rule(:document => subtree(:d)) { Array(d) }
17
+ end
18
+
19
+ end
@@ -1,31 +1,17 @@
1
- require 'parslet'
1
+ require_relative '../ast'
2
2
 
3
- module SelfML
3
+ module SelfML::Engines
4
4
 
5
- class HashTransformer < Parslet::Transform
6
- rule(:document => sequence(:d)) { Array(d) }
7
- rule(:list => subtree(:l)) do
8
- head = String(l[:head]).to_sym
9
- tail = Array(l[:tail])
10
-
11
- { head => tail }
12
- end
13
-
14
- rule(:string => simple(:s)) { String(s) }
15
- rule(:verbatim => simple(:s)) { String(s) }
16
- end
5
+ class Document < Parslet::Transform
6
+ include SelfML::AST
17
7
 
18
-
19
- class Transformer < Parslet::Transform
20
- include AST
21
-
22
- rule(:document => sequence(:doc)) { Document.new(doc) }
8
+ rule(:document => sequence(:doc)) { SelfML::AST::Document.new(doc) }
23
9
  rule(:list => subtree(:l)) do
24
10
  Node.new(
25
11
  StringNode.new(l[:head]) , Array(l[:tail])
26
12
  )
27
13
  end
28
-
14
+
29
15
  # Comments
30
16
  rule(:comment => simple(:s)) { Comment.new(s) }
31
17
  rule(:block => simple(:blk)) { Comment.new(blk) }
@@ -0,0 +1,20 @@
1
+ module SelfML::Engines
2
+
3
+ class Hash < Parslet::Transform
4
+ rule(:document => sequence(:d)) { Array(d) }
5
+ rule(:list => subtree(:l)) do
6
+ head = String(l[:head]).to_sym
7
+ tail = Array(l[:tail])
8
+
9
+ { head => tail }
10
+ end
11
+
12
+ rule(:string => simple(:s)) { String(s) }
13
+ rule(:verbatim => simple(:s)) { String(s) }
14
+
15
+ rule(:brackets => sequence(:b)) { "[#{b.reduce(:+)}]" }
16
+
17
+ rule(:text => simple(:t)) { String(t) }
18
+ end
19
+
20
+ end
@@ -0,0 +1,9 @@
1
+ require_relative 'hash'
2
+
3
+ module SelfML::Engines
4
+
5
+ class JSON < SelfML::Engines::Hash
6
+ rule(:document => sequence(:d)) { Array(d).to_json }
7
+ end
8
+
9
+ end
@@ -0,0 +1,8 @@
1
+ require 'parslet'
2
+
3
+ module SelfML::Engines; end
4
+
5
+ require_relative "engines/document"
6
+ require_relative "engines/array"
7
+ require_relative "engines/hash"
8
+ require_relative "engines/json"
data/lib/selfml/parser.rb CHANGED
@@ -1,54 +1,60 @@
1
+ require 'bundler/setup'
1
2
  require 'parslet'
2
3
 
3
- class Parslet::Parser
4
- rule(:space) { match('\s').repeat(1) }
5
- rule(:space?) { space.maybe }
6
-
7
- rule(:word) { match('\w').repeat }
8
- rule(:word?) { word.maybe }
9
- end # monkey patching in a couple of helpers
10
-
11
- class SelfML::Parser < Parslet::Parser
12
- root(:top)
13
- rule(:top) do
14
- (space? >> node >> space?).repeat.as(:document)
15
- end
4
+ module SelfML
5
+ class Parslet::Parser
6
+
7
+ rule(:space) { match('\s').repeat(1) }
8
+ rule(:space?) { space.maybe }
16
9
 
17
- rule(:node) { comment.as(:comment) | list.as(:list) | string.as(:string) }
10
+ rule(:word) { match('\w').repeat }
11
+ rule(:word?) { word.maybe }
12
+ end # monkey patching in a couple of helpers
18
13
 
19
- # String
20
- rule(:string) { backtick.as(:backticks) | bracketed.as(:brackets) | verbatim.as(:verbatim) }
21
- rule(:backtick) do
22
- str('`') >> (
23
- str('``').as(:ticks) | match('``|[^`]').as(:text)
24
- ).repeat >> str('`')
25
- end
26
- rule(:bracketed) do
27
- str('[') >> (
28
- bracketed.as(:nested) | match('[^\]]').as(:text)
29
- ).repeat >> str(']')
30
- end
31
- rule(:verbatim) { str("#").absnt? >> match['^\[\](){}\s'].repeat(1) }
32
-
33
- # List
34
- rule(:tail) do
35
- (node >> space?).repeat
36
- end
37
- rule(:list) do
38
- str('(') >> space? >>
39
- comment.as(:comment).maybe >> space? >>
40
- string.as(:head) >> space? >>
41
- tail.as(:tail) >> space? >>
42
- space? >> str(')')
43
- end
14
+ class Parser < Parslet::Parser
15
+ root(:top)
16
+ rule(:top) do
17
+ (space? >> node >> space?).repeat.as(:document)
18
+ end
19
+
20
+ rule(:node) { comment.as(:comment) | list.as(:list) | string.as(:string) }
21
+
22
+ # String
23
+ rule(:string) { backtick.as(:backticks) | bracketed.as(:brackets) | verbatim.as(:verbatim) }
24
+ rule(:backtick) do
25
+ str('`') >> (
26
+ # str('``').as(:ticks) | match('``|[^`]').as(:text)
27
+ str('``').as(:ticks) | (str("`").absent? >> any).as(:text)
28
+ ).repeat >> str('`')
29
+ end
30
+ rule(:bracketed) do
31
+ str('[') >> (
32
+ # bracketed.as(:nested) | match('[^\]]').as(:text)
33
+ bracketed.as(:nested) | (str("]").absent? >> any).as(:text)
34
+ ).repeat >> str(']')
35
+ end
36
+ rule(:verbatim) { str("#").absnt? >> match['^\[\](){}\s'].repeat(1) }
37
+
38
+ # List
39
+ rule(:tail) do
40
+ (node >> space?).repeat
41
+ end
42
+ rule(:list) do
43
+ str('(') >> space? >>
44
+ comment.as(:comment).maybe >> space? >>
45
+ string.as(:head) >> space? >>
46
+ tail.as(:tail) >> space? >>
47
+ space? >> str(')')
48
+ end
49
+
50
+ # Comment
51
+ rule(:comment) { line.as(:line) | block.as(:block) }
52
+ rule(:line) { str('#') >> match['^\\n'].repeat.as(:text) >> (str("\n") | any.absnt?) }
53
+ rule(:block) do
54
+ str('{#') >> (
55
+ block.as(:block) | match['^#}'].as(:text)
56
+ ).repeat >> str('#}')
57
+ end
44
58
 
45
- # Comment
46
- rule(:comment) { line.as(:line) | block.as(:block) }
47
- rule(:line) { str('#') >> match['^\\n'].repeat.as(:text) >> (str("\n") | any.absnt?) }
48
- rule(:block) do
49
- str('{#') >> (
50
- block.as(:block) | match['^#}'].as(:text)
51
- ).repeat >> str('#}')
52
59
  end
53
-
54
60
  end
@@ -1,3 +1,3 @@
1
1
  module SelfML
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/selfml.rb CHANGED
@@ -1,6 +1,9 @@
1
- ['version', 'parser','ast','transformer'].each do |file|
2
- require_relative "selfml/#{file}"
3
- end
1
+ require 'bundler'
2
+ Bundler.require(:default)
3
+
4
+ require_relative 'selfml/engines'
5
+ require_relative 'selfml/parser'
6
+ require_relative 'selfml/ast'
4
7
 
5
8
  module SelfML
6
9
 
@@ -8,10 +11,10 @@ module SelfML
8
11
  transformer = engine.new if engine.instance_of? Class
9
12
 
10
13
  parser = Parser.new
11
- transformer ||= Transformer.new
14
+ transformer ||= Engines::Document.new
12
15
 
13
16
  tree = parser.parse(s)
14
17
  out = transformer.apply(tree)
15
18
  end
16
19
 
17
- end
20
+ end
data/man/selfml.1.ronn ADDED
@@ -0,0 +1,123 @@
1
+ self-ml(1) -- read self-ml files
2
+ =============================================
3
+
4
+ ## SYNOPSIS
5
+
6
+ `ronn` [<format>...] <file>...<br>
7
+ `ronn` `-m`|`--man` <file>...<br>
8
+ `ronn` `-S`|`--server` <file>...<br>
9
+ `ronn` `--pipe` <file><br>
10
+ `ronn` &lt; <file>
11
+
12
+ `self-ml` filename
13
+
14
+ ## DESCRIPTION
15
+
16
+ **Self-ML** parses files written in the self-ml format.
17
+
18
+ Something something
19
+
20
+ ## FILES
21
+
22
+ The `self-ml` command expects input to be valid self-ml(7) text. Source files
23
+ are typically named <name>.selfml (e.g., `example.1.ronn`). The <name>
24
+ and <section> should match the name and section defined in the <file>'s heading.
25
+
26
+ When building roff or HTML output files, destination filenames are determined by
27
+ taking the basename of the input <file> and adding the appropriate file
28
+ extension (or removing the file extension in the case of roff output). For
29
+ example, executing `ronn example.1.ronn` generates `example.1` with roff output
30
+ and `example.1.html` with HTML output.
31
+
32
+ ## OPTIONS
33
+
34
+ These options control whether output is written to file(s), standard output, or
35
+ directly to a man pager.
36
+
37
+ * `-o`=<output>:
38
+ Generate file <output>.
39
+
40
+ * `--pipe`:
41
+ Don't generate files, write generated output to standard output. This is the
42
+ default behavior when ronn source text is piped in on standard input and no
43
+ <file> arguments are provided.
44
+
45
+ Format options control the files `ronn` generates, or the output format when the
46
+ `--pipe` argument is specified. When no format options are given, both `--roff`
47
+ and `--html` are assumed.
48
+
49
+ * `-r`, `--roff`:
50
+ Generate roff output. This is the default behavior when no <file>s are given
51
+ and ronn source text is read from standard input.
52
+
53
+ * `-5`, `--html`:
54
+ Generate output in HTML format.
55
+
56
+ * `-f`, `--fragment`:
57
+ Generate output in HTML format but only the document fragment, not the
58
+ header, title, or footer.
59
+
60
+ Document attributes displayed in the header and footer areas of generated
61
+ content are specified with these options. (These values may also be set via
62
+ the [ENVIRONMENT][].)
63
+
64
+ * `--manual`=<manual>:
65
+ The name of the manual this man page belongs to; <manual> is prominently
66
+ displayed top-center in the header area.
67
+
68
+ * `--organization`=<name>:
69
+ The name of the group, organization, or individual responsible for
70
+ publishing the document; <name> is displayed in the bottom-left footer area.
71
+
72
+ * `--date`=<date>:
73
+ The document's published date; <date> must be formatted `YYYY-MM-DD` and is
74
+ displayed in the bottom-center footer area. The <file> mtime is used when no
75
+ <date> is given, or the current time when no <file> is available.
76
+
77
+ Miscellaneous options:
78
+
79
+ * `-v`, `--version`:
80
+ Show ronn version and exit.
81
+
82
+ * `-h`, `--help`:
83
+ Show selfml help and exit.
84
+
85
+ ## EXAMPLES
86
+
87
+
88
+ ## ENVIRONMENT
89
+
90
+ * `RONN_MANUAL`:
91
+ A default manual name to be displayed in the top-center header area.
92
+ The `--manual` option takes precedence over this value.
93
+
94
+ * `RONN_ORGANIZATION`:
95
+ The default manual publishing group, organization, or individual to be
96
+ displayed in the bottom-left footer area. The `--organization` option takes
97
+ precedence over this value.
98
+
99
+ * `RONN_DATE`:
100
+ The default manual date in `YYYY-MM-DD` format. Displayed in the
101
+ bottom-center footer area. The `--date` option takes precedence over this
102
+ value.
103
+
104
+ * `RONN_STYLE`:
105
+ A `PATH`-style list of directories to check for stylesheets given to the
106
+ `--style` option. Directories are separated by a _:_; blank entries are
107
+ ignored. Use _._ to include the current working directory.
108
+
109
+ * `MANPAGER`:
110
+ The paging program used for man pages. This is typically set to
111
+ something like 'less -is'.
112
+
113
+
114
+ ## BUGS
115
+
116
+
117
+ ## COPYRIGHT
118
+
119
+ Self-ML is Copyright (C) 2012 Ricardo Mendes <http://ricardomend.es>
120
+
121
+ ## SEE ALSO
122
+
123
+ selfml(7)
data/man/selfml.5.ronn ADDED
File without changes
data/self-ml.gemspec CHANGED
@@ -15,11 +15,15 @@ Gem::Specification.new do |s|
15
15
 
16
16
  s.files = `git ls-files`.split("\n")
17
17
  s.test_files = `git ls-files -- spec/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ # s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.executables << 'selfml'
19
20
  s.require_paths = ["lib"]
20
21
 
21
22
  s.add_development_dependency "parslet"
22
23
  s.add_development_dependency "minitest"
24
+ s.add_development_dependency "ronn"
25
+ s.add_development_dependency "aruba"
23
26
 
24
27
  s.add_runtime_dependency "parslet"
28
+ s.add_runtime_dependency "gem-man"
25
29
  end
data/spec/basic_spec.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require 'bundler'
2
+ Bundler.require(:default, :test)
3
+
1
4
  require_relative 'spec_helper'
2
5
 
3
6
  describe SelfML do
@@ -0,0 +1,30 @@
1
+ require 'bundler'
2
+ Bundler.require(:default, :test)
3
+
4
+ require_relative 'spec_helper'
5
+
6
+ require 'selfml/engines/hash'
7
+
8
+ describe SelfML do
9
+
10
+ let(:document) { SelfML::Parser.new.parse("(grandparent (parent child1 child2))") }
11
+
12
+ describe "Engines" do
13
+
14
+ describe "Hash" do
15
+ subject { SelfML::Engines::Hash.new }
16
+ # let(:engine) { SelfML::Engines::Hash }
17
+
18
+ it "parses correctly" do
19
+ subject.apply(document)
20
+ end
21
+
22
+ it "outputs correctly" do
23
+ output = {:document=>[{:grandparent=>[{:parent=>["child1", "child2"]}]}]}
24
+ subject.apply(document).must_equal output
25
+ end
26
+ end
27
+
28
+ end
29
+
30
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,10 +1,3 @@
1
- require 'bundler'
2
- Bundler.setup
3
-
4
- require 'minitest/autorun'
5
-
6
- require 'selfml'
7
-
8
1
  def load_fixture name
9
2
  {
10
3
  :input => File.read("spec/fixtures/#{name}.selfml"),
data/spec/string_spec.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require 'bundler'
2
+ Bundler.require(:default, :test)
3
+
1
4
  require_relative 'spec_helper'
2
5
 
3
6
  describe SelfML do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selfml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-08 00:00:00.000000000 Z
12
+ date: 2012-07-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: parslet
@@ -43,6 +43,38 @@ dependencies:
43
43
  - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: ronn
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: aruba
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
46
78
  - !ruby/object:Gem::Dependency
47
79
  name: parslet
48
80
  requirement: !ruby/object:Gem::Requirement
@@ -59,11 +91,28 @@ dependencies:
59
91
  - - ! '>='
60
92
  - !ruby/object:Gem::Version
61
93
  version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: gem-man
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
62
110
  description: Self-ML is, as the name implies, a self-ml parser. It also has some utilities
63
111
  to aid in building self-ml files.
64
112
  email:
65
113
  - rokusu@gmail.com
66
- executables: []
114
+ executables:
115
+ - selfml
67
116
  extensions: []
68
117
  extra_rdoc_files: []
69
118
  files:
@@ -71,15 +120,28 @@ files:
71
120
  - .rvmrc
72
121
  - .travis.yml
73
122
  - Gemfile
123
+ - LICENSE
74
124
  - README.markdown
75
125
  - Rakefile
126
+ - bin/selfml
76
127
  - lib/selfml.rb
77
128
  - lib/selfml/ast.rb
129
+ - lib/selfml/ast/comment.rb
130
+ - lib/selfml/ast/document.rb
131
+ - lib/selfml/ast/node.rb
132
+ - lib/selfml/ast/string_node.rb
133
+ - lib/selfml/engines.rb
134
+ - lib/selfml/engines/array.rb
135
+ - lib/selfml/engines/document.rb
136
+ - lib/selfml/engines/hash.rb
137
+ - lib/selfml/engines/json.rb
78
138
  - lib/selfml/parser.rb
79
- - lib/selfml/transformer.rb
80
139
  - lib/selfml/version.rb
140
+ - man/selfml.1.ronn
141
+ - man/selfml.5.ronn
81
142
  - self-ml.gemspec
82
143
  - spec/basic_spec.rb
144
+ - spec/engines_spec.rb
83
145
  - spec/fixtures/basic.selfml
84
146
  - spec/fixtures/comments.selfml
85
147
  - spec/fixtures/output.basic.selfml
@@ -114,6 +176,7 @@ specification_version: 3
114
176
  summary: self-ml parser
115
177
  test_files:
116
178
  - spec/basic_spec.rb
179
+ - spec/engines_spec.rb
117
180
  - spec/fixtures/basic.selfml
118
181
  - spec/fixtures/comments.selfml
119
182
  - spec/fixtures/output.basic.selfml
@@ -122,4 +185,3 @@ test_files:
122
185
  - spec/fixtures/strings.selfml
123
186
  - spec/spec_helper.rb
124
187
  - spec/string_spec.rb
125
- has_rdoc: