visionmedia-lightr 0.0.3

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.
data/History.rdoc ADDED
@@ -0,0 +1,16 @@
1
+
2
+ === 0.0.3 / 2009-03-07
3
+
4
+ * Added C example
5
+ * Fixed C / JS grammar numbers; cannot include _ like Ruby
6
+
7
+ === 0.0.2 / 2009-03-07
8
+
9
+ * Added JavaScript grammar
10
+ * Added C grammar
11
+ * Added JS example
12
+ * Moved grammar into mixins
13
+
14
+ === 0.0.1 / 2009-03-07
15
+
16
+ * Initial release
data/Manifest ADDED
@@ -0,0 +1,24 @@
1
+ examples/c.rb
2
+ examples/javascript.rb
3
+ examples/ruby.rb
4
+ History.rdoc
5
+ lib/lightr/grammars/c.rb
6
+ lib/lightr/grammars/javascript.rb
7
+ lib/lightr/grammars/ruby.rb
8
+ lib/lightr/grammars.rb
9
+ lib/lightr/mixins/grammar.rb
10
+ lib/lightr/mixins.rb
11
+ lib/lightr/version.rb
12
+ lib/lightr.rb
13
+ lightr.gemspec
14
+ Manifest
15
+ Rakefile
16
+ README.rdoc
17
+ spec/grammars/c_spec.rb
18
+ spec/grammars/javascript_spec.rb
19
+ spec/grammars/ruby_spec.rb
20
+ spec/spec_helper.rb
21
+ tasks/docs.rake
22
+ tasks/gemspec.rake
23
+ tasks/spec.rake
24
+ Todo.rdoc
data/README.rdoc ADDED
@@ -0,0 +1,57 @@
1
+
2
+ = Lightr
3
+
4
+ Extremely light-weight syntax highlighting DSL.
5
+ This library is not meant to be the be-all, end-all
6
+ syntax highlighting library, however it is very small,
7
+ fast, and provides a simple DSL for creation of grammars.
8
+
9
+ == Usage
10
+
11
+ Lightr::Ruby.parse(string_of_ruby).to_s
12
+ # => html with span's wrapping for highlighting
13
+
14
+ == Grammars
15
+
16
+ Core Lightr grammars are auto-loaded, so no need to require
17
+ them explicitly. The following are included with Lightr:
18
+
19
+ * Ruby
20
+
21
+ == Styling
22
+
23
+ Currently Lightr does not offer any pre-defined styles,
24
+ however this can be done using CSS very easily. Generally
25
+ grammars should use classes like 'keyword', 'variable', 'constant',
26
+ etc, in order to keep styles portable.
27
+
28
+ For simplicity of styling some naming conventions are not correct. A good
29
+ example of this would be that while 'a' is not a string in C, when it comes
30
+ to styling it is easier to retain commonalities between languages as much
31
+ as possible.
32
+
33
+ == License
34
+
35
+ (The MIT License)
36
+
37
+ Copyright (c) 2009 TJ Holowaychuk <tj@vision-media.ca>
38
+
39
+ Permission is hereby granted, free of charge, to any person obtaining
40
+ a copy of this software and associated documentation files (the
41
+ 'Software'), to deal in the Software without restriction, including
42
+ without limitation the rights to use, copy, modify, merge, publish,
43
+ distribute, sublicense, an d/or sell copies of the Software, and to
44
+ permit persons to whom the Software is furnished to do so, subject to
45
+ the following conditions:
46
+
47
+ The above copyright notice and this permission notice shall be
48
+ included in all copies or substantial portions of the Software.
49
+
50
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
51
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
52
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
53
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
54
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
55
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
56
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
57
+
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+
2
+ require 'rubygems'
3
+ require 'rake'
4
+ require 'echoe'
5
+ require './lib/lightr.rb'
6
+
7
+ Echoe.new("lightr", Lightr::VERSION) do |p|
8
+ p.author = "TJ Holowaychuk"
9
+ p.email = "tj@vision-media.ca"
10
+ p.summary = "Extremely light-weight syntax highlighting DSL."
11
+ p.url = "http://github.com/visionmedia/lightr"
12
+ p.runtime_dependencies = []
13
+ end
14
+
15
+ Dir['tasks/**/*.rake'].sort.each { |f| load f }
data/Todo.rdoc ADDED
@@ -0,0 +1,17 @@
1
+
2
+ == Major:
3
+
4
+ * JavaScript
5
+ * add common mixins (strings, numbers, etc)
6
+ * allow regexp to be string, etc for matching
7
+ * allow lambda to set @in_cdata = true etc ... and for checking condtions, make dsl for this
8
+ * CSS style templates
9
+ * mini site
10
+
11
+ == Minor:
12
+
13
+ * Nothing
14
+
15
+ == Brainstorming:
16
+
17
+ * Nothing
data/examples/c.rb ADDED
@@ -0,0 +1,47 @@
1
+
2
+ require File.dirname(__FILE__) + '/../lib/lightr'
3
+
4
+ c = %|
5
+ /*
6
+ * compile.c
7
+ * ast to bytecode
8
+ *
9
+ * (c) 2008 why the lucky stiff, the freelance professor
10
+ */
11
+
12
+ #include <stdio.h>
13
+ #include <stdlib.h>
14
+ #include <string.h>
15
+ #include <math.h>
16
+ #include "potion.h"
17
+ #include "internal.h"
18
+ #include "pn-ast.h"
19
+ #include "opcodes.h"
20
+
21
+ #define PN_ASM1(ins, _a) ({ \
22
+ (*pos)->code = (u8)ins; \
23
+ (*pos)->a = (int)_a; \
24
+ (*pos)++; \
25
+ })
26
+
27
+ const struct {
28
+ const char *name;
29
+ const u8 args;
30
+ } potion_ops[] = {
31
+ { "noop", 0 }, { "move", 2 }, { "loadk", 2 }, { "loadpn", 2 }, { "self", 1 },
32
+ { "newtuple", 2 }, { "settuple", 2 }, { "getlocal", 2 }, { "setlocal", 2 },
33
+ { "getupval", 2 }, { "setupval", 2 }, { "gettable", 2 }, { "settable", 2 },
34
+ { "getpath", 2 }, { "setpath", 2 }, { "add", 2 }, { "sub", 2 }, { "mult", 2 },
35
+ { "div", 2 }, { "mod", 2 }, { "pow", 2 }, { "not", 1 }, { "cmp", 2 },
36
+ { "eq", 2 }, { "neq", 2 }, { "lt", 2 }, { "lte", 2 }, { "gt", 2 }, { "gte", 2 },
37
+ { "bitl", 2 }, { "bitr", 2 }, { "bind", 2 }, { "jump", 1 }, { "test", 2 },
38
+ { "testjmp", 2 }, { "notjmp", 2 }, { "call", 2 }, { "tailcall", 2 },
39
+ { "return", 1 }, { "proto", 2 },
40
+ };
41
+
42
+ PN potion_proto_call(Potion *P, PN cl, PN self, PN args) {
43
+ return potion_vm(P, self, args, 0, NULL);
44
+ }
45
+ |
46
+
47
+ puts Lightr::C.parse(c)
@@ -0,0 +1,19 @@
1
+
2
+ require File.dirname(__FILE__) + '/../lib/lightr'
3
+
4
+ javascript = %|
5
+ function Client(name, callback) {
6
+ this.name = name
7
+ this.regexp = /some_pattern/
8
+
9
+ // Blah blah just a 'comment' "test"
10
+ if (typeof callback == 'function')
11
+ return callback.call()
12
+ else if (callback.constructor == Fuction)
13
+ return 'rawr'
14
+ else
15
+ return this
16
+ }
17
+ |
18
+
19
+ puts Lightr::JavaScript.parse(javascript)
data/examples/ruby.rb ADDED
@@ -0,0 +1,19 @@
1
+
2
+ require File.dirname(__FILE__) + '/../lib/lightr'
3
+
4
+ ruby = %{
5
+ module Foo
6
+ class Bar
7
+ include Something
8
+
9
+ attr_reader :n
10
+
11
+ def initialize n = 100_000
12
+ @n = n
13
+ end
14
+
15
+ end
16
+ end
17
+ }
18
+
19
+ puts Lightr::Ruby.parse(ruby)
data/lib/lightr.rb ADDED
@@ -0,0 +1,28 @@
1
+ #--
2
+ # Copyright (c) 2009 TJ Holowaychuk <tj@vision-media.ca>
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+
24
+ $:.unshift File.dirname(__FILE__)
25
+
26
+ require 'lightr/version'
27
+ require 'lightr/mixins'
28
+ require 'lightr/grammars'
@@ -0,0 +1,6 @@
1
+
2
+ module Lightr
3
+ autoload :Ruby, 'lightr/grammars/ruby'
4
+ autoload :JavaScript, 'lightr/grammars/javascript'
5
+ autoload :C, 'lightr/grammars/c'
6
+ end
@@ -0,0 +1,15 @@
1
+
2
+ # TODO: multi-line comments
3
+ # TODO: pre-processor directives / macros
4
+
5
+ module Lightr
6
+ class C
7
+ include Grammar
8
+ int = /\d+/
9
+ match :keyword, /(NULL|if|else|asm|auto|break|case|char|const|continue|default|do|double|enum|extern|float|for|goto|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)(?:\n|\z| )/
10
+ match :string, /'.*?'|".*?"/
11
+ match :comment, %r{//.*?(\n|\z)}
12
+ match :number, /-?#{int}(?:\.#{int})?/
13
+ match nil, /\n|\s|.+?/
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+
2
+ module Lightr
3
+ class JavaScript
4
+ include Grammar
5
+ id = /[\w\d]*/
6
+ int = /\d+/
7
+ match :keyword, /(if|else|throw|break|case|catch|continue|default|delete|do|double|true|false|final|finally|float|for|function|int|instanceof|in|long|new|null|return|short|switch|throw|try|typeof|var|void|while|with)(?:\n|\z| )/
8
+ match :string, /'.*?'|".*?"/
9
+ match :comment, %r{//.*?(\n|\z)}
10
+ match :regexp, %r{/.*?/[\w]*}
11
+ match :self, /this/
12
+ match :capitalized, /[A-Z]#{id}/
13
+ match :number, /-?#{int}(?:\.#{int})?/
14
+ match nil, /\n|\s|.+?/
15
+ end
16
+ end
@@ -0,0 +1,25 @@
1
+
2
+ # TODO: inst / class vars
3
+ # TODO: method definitions
4
+ # TODO: issue with # in regexp
5
+ # TODO: multi-line comments
6
+ # TODO: alternative symbols (using strings)
7
+ # TODO: alternative literals %x{} etc
8
+ # TODO: substitutions #{}
9
+
10
+ module Lightr
11
+ class Ruby
12
+ include Grammar
13
+ id = /[\w\d]*/
14
+ int = /\d[\d_]*/
15
+ match :keyword, /(if|else|elsif|unless|retry|super|then|true|while|until|class|module|defined|end|in|alias|BEGIN|END|begin|break|def|do|nil|not|or|and|redo|rescue|return|yield)(?:\n|\z| )/
16
+ match :string, /'.*?'|".*?"/
17
+ match :regexp, %r{/.*?/[\w]*}
18
+ match :self, /self/
19
+ match :comment, /#.*?(\n|\z)/
20
+ match :constant, /[A-Z]#{id}/
21
+ match :symbol, /:#{id}/
22
+ match :number, /-?#{int}(?:\.#{int})?/
23
+ match nil, /\n|\s|.+?/
24
+ end
25
+ end
@@ -0,0 +1,5 @@
1
+
2
+ module Lightr
3
+ autoload :Common, 'lightr/mixins/common'
4
+ autoload :Grammar, 'lightr/mixins/grammar'
5
+ end
@@ -0,0 +1,75 @@
1
+
2
+ module Lightr
3
+
4
+ ##
5
+ # = Grammar
6
+ #
7
+ # Primary Lightr syntax highlighting mixin, providing
8
+ # the #match method to create your own Lightr DSL.
9
+ #
10
+ # === Examples
11
+ #
12
+ # module Lightr
13
+ # class Ruby
14
+ # include Grammar
15
+ # id = /[\w\d]*/
16
+ # int = /\d[\d_]*/
17
+ # match :comment, /#.*?(\n|\z)/
18
+ # match :constant, /[A-Z]#{id}/
19
+ # match :symbol, /:#{id}/
20
+ # match :number, /-?#{int}(?:\.#{int})?/
21
+ # match nil, /\n|\s|.+?/
22
+ # ...
23
+ #
24
+
25
+ module Grammar
26
+ def self.included base
27
+ base.extend ClassMethods
28
+ base.send :include, InstanceMethods
29
+ end
30
+
31
+ module ClassMethods
32
+ def match name, regexp
33
+ (@matchers ||= []) << [name, regexp]
34
+ end
35
+
36
+ def parse input
37
+ new(input).parse!
38
+ end
39
+ end
40
+
41
+ module InstanceMethods
42
+ attr_reader :input, :output
43
+ alias :to_s :output
44
+
45
+ def initialize input
46
+ @input, @output = input, ''
47
+ @matchers = self.class.instance_variable_get :"@matchers"
48
+ @regexp = Regexp.union *@matchers.transpose[1]
49
+ end
50
+
51
+ def escape string
52
+ string.
53
+ gsub(/&/, '&amp;').
54
+ gsub(/</, '&lt;').
55
+ gsub(/>/, '&gt;').
56
+ gsub(/"/, '&quot;')
57
+ end
58
+
59
+ def wrap string
60
+ @matchers.each do |name, regexp|
61
+ return escape(string) if name.nil? and string =~ regexp
62
+ return %(<span class="#{name}">#{escape(string)}</span>) if string =~ regexp
63
+ end
64
+ end
65
+
66
+ def parse!
67
+ @input.dup.gsub @regexp do |match|
68
+ @output << wrap(match)
69
+ end
70
+ self
71
+ end
72
+ end
73
+
74
+ end
75
+ end
@@ -0,0 +1,4 @@
1
+
2
+ module Lightr
3
+ VERSION = '0.0.3'
4
+ end
data/lightr.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{lightr}
5
+ s.version = "0.0.3"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["TJ Holowaychuk"]
9
+ s.date = %q{2009-03-07}
10
+ s.description = %q{Extremely light-weight syntax highlighting DSL.}
11
+ s.email = %q{tj@vision-media.ca}
12
+ s.extra_rdoc_files = ["lib/lightr/grammars/c.rb", "lib/lightr/grammars/javascript.rb", "lib/lightr/grammars/ruby.rb", "lib/lightr/grammars.rb", "lib/lightr/mixins/grammar.rb", "lib/lightr/mixins.rb", "lib/lightr/version.rb", "lib/lightr.rb", "README.rdoc", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake"]
13
+ s.files = ["examples/c.rb", "examples/javascript.rb", "examples/ruby.rb", "History.rdoc", "lib/lightr/grammars/c.rb", "lib/lightr/grammars/javascript.rb", "lib/lightr/grammars/ruby.rb", "lib/lightr/grammars.rb", "lib/lightr/mixins/grammar.rb", "lib/lightr/mixins.rb", "lib/lightr/version.rb", "lib/lightr.rb", "lightr.gemspec", "Manifest", "Rakefile", "README.rdoc", "spec/grammars/c_spec.rb", "spec/grammars/javascript_spec.rb", "spec/grammars/ruby_spec.rb", "spec/spec_helper.rb", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake", "Todo.rdoc"]
14
+ s.has_rdoc = true
15
+ s.homepage = %q{http://github.com/visionmedia/lightr}
16
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Lightr", "--main", "README.rdoc"]
17
+ s.require_paths = ["lib"]
18
+ s.rubyforge_project = %q{lightr}
19
+ s.rubygems_version = %q{1.3.1}
20
+ s.summary = %q{Extremely light-weight syntax highlighting DSL.}
21
+
22
+ if s.respond_to? :specification_version then
23
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
+ s.specification_version = 2
25
+
26
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
27
+ else
28
+ end
29
+ else
30
+ end
31
+ end
@@ -0,0 +1,39 @@
1
+
2
+ describe Lightr::C do
3
+
4
+ def parse string
5
+ Lightr::C.parse(string).to_s
6
+ end
7
+
8
+ describe "should highlight" do
9
+
10
+ it 'strings' do
11
+ parse('"test"').should include('class="string">&quot;test&quot;')
12
+ parse("'test'").should include(%(class="string">'test'))
13
+ end
14
+
15
+ it 'comments' do
16
+ parse('test // comment').should include('class="comment">// comment')
17
+ end
18
+
19
+ # it "pre-processor directives/ macros" do
20
+ # parse('#define VERSION = "0.0.1"').should include('class="pre_processor">#define')
21
+ # end
22
+
23
+ %w( NULL if else asm auto break case char const continue default do double enum extern
24
+ float for goto int long register return short signed sizeof static struct
25
+ switch typedef union unsigned void volatile while ).
26
+ each do |keyword|
27
+ it "#{keyword.strip} as a keyword" do
28
+ parse("#{keyword.strip} foo").should include(%(class="keyword">#{keyword.strip} <))
29
+ end
30
+ end
31
+
32
+ end
33
+
34
+ it 'should not highlight // within strings as comment' do
35
+ parse('"//test"').should include(%(class="string">&quot;//test&quot;))
36
+ parse("'//test'").should include(%(class="string">'//test'))
37
+ end
38
+
39
+ end
@@ -0,0 +1,37 @@
1
+
2
+ describe Lightr::JavaScript do
3
+
4
+ def parse string
5
+ Lightr::JavaScript.parse(string).to_s
6
+ end
7
+
8
+ describe "should highlight" do
9
+
10
+ it 'strings' do
11
+ parse('"test"').should include('class="string">&quot;test&quot;')
12
+ parse("'test'").should include(%(class="string">'test'))
13
+ end
14
+
15
+ it 'comments' do
16
+ parse('test // comment').should include('class="comment">// comment')
17
+ # TODO: fixme
18
+ # parse('test // comment "Test"').should include('class="comment">// comment')
19
+ end
20
+
21
+ %w( if else throw break case catch continue default delete do double true
22
+ false final finally float for function int instanceof in long new null return short
23
+ switch throw try typeof var void while with ).
24
+ each do |keyword|
25
+ it "#{keyword.strip} as a keyword" do
26
+ parse("#{keyword.strip} foo").should include(%(class="keyword">#{keyword.strip} <))
27
+ end
28
+ end
29
+
30
+ end
31
+
32
+ it 'should not highlight // within strings as comment' do
33
+ parse('"//test"').should include(%(class="string">&quot;//test&quot;))
34
+ parse("'//test'").should include(%(class="string">'//test'))
35
+ end
36
+
37
+ end
@@ -0,0 +1,63 @@
1
+
2
+ describe Lightr::Ruby do
3
+
4
+ def parse string
5
+ Lightr::Ruby.parse(string).to_s
6
+ end
7
+
8
+ describe "should highlight" do
9
+
10
+ it 'symbols' do
11
+ parse('a :symbol').should include('class="symbol">:symbol')
12
+ end
13
+
14
+ it 'strings' do
15
+ parse('"test"').should include('class="string">&quot;test&quot;')
16
+ parse("'test'").should include(%(class="string">'test'))
17
+ end
18
+
19
+ it 'self' do
20
+ parse('self.test').should include('class="self">self<')
21
+ end
22
+
23
+ it 'comments' do
24
+ parse('test # comment').should include('class="comment"># comment')
25
+ end
26
+
27
+ it "regular expressions" do
28
+ parse('/test/').should include('class="regexp">/test/')
29
+ end
30
+
31
+ it "regular expressions with mode flags" do
32
+ parse('/test/sex').should include('class="regexp">/test/sex')
33
+ parse('/test/sex test').should include('class="regexp">/test/sex<')
34
+ end
35
+
36
+ %w( 11 1_000 1.1 1.100_00 ).each do |number|
37
+ it "#{number} as number" do
38
+ parse(number).should include('class="number"')
39
+ end
40
+ end
41
+
42
+ it "constants" do
43
+ parse('FooBar').should include('class="constant"')
44
+ parse('FOOBAR').should include('class="constant"')
45
+ end
46
+
47
+ %w( if else elsif unless retry super then true while until class module def end in alias
48
+ BEGIN END begin break defined do nil not or and redo rescue return yield ).
49
+ each do |keyword|
50
+ it "#{keyword.strip} as a keyword" do
51
+ parse("#{keyword.strip} foo").should include(%(class="keyword">#{keyword.strip} <))
52
+ end
53
+ end
54
+
55
+ end
56
+
57
+ it 'should not highlight # within regexp or strings as comment' do
58
+ parse('/#test/').should include('class="regexp">/#test/')
59
+ parse('"#test"').should include(%(class="string">&quot;#test&quot;))
60
+ parse("'#test'").should include(%(class="string">'#test'))
61
+ end
62
+
63
+ end
@@ -0,0 +1,2 @@
1
+
2
+ require 'lightr'
data/tasks/docs.rake ADDED
@@ -0,0 +1,13 @@
1
+
2
+ namespace :docs do
3
+
4
+ desc 'Remove rdoc products'
5
+ task :remove => [:clobber_docs]
6
+
7
+ desc 'Build docs, and open in browser for viewing (specify BROWSER)'
8
+ task :open do
9
+ browser = ENV["BROWSER"] || "safari"
10
+ sh "open -a #{browser} doc/index.html"
11
+ end
12
+
13
+ end
@@ -0,0 +1,3 @@
1
+
2
+ desc 'Build gemspec file'
3
+ task :gemspec => [:build_gemspec]
data/tasks/spec.rake ADDED
@@ -0,0 +1,25 @@
1
+
2
+ require 'spec/rake/spectask'
3
+
4
+ desc "Run all specifications"
5
+ Spec::Rake::SpecTask.new(:spec) do |t|
6
+ t.libs << "lib"
7
+ t.spec_opts = ["--color", "--require", "spec/spec_helper.rb"]
8
+ end
9
+
10
+ namespace :spec do
11
+
12
+ desc "Run all specifications verbosely"
13
+ Spec::Rake::SpecTask.new(:verbose) do |t|
14
+ t.libs << "lib"
15
+ t.spec_opts = ["--color", "--format", "specdoc", "--require", "spec/spec_helper.rb"]
16
+ end
17
+
18
+ desc "Run specific specification verbosely (specify SPEC)"
19
+ Spec::Rake::SpecTask.new(:select) do |t|
20
+ t.libs << "lib"
21
+ t.spec_files = [ENV["SPEC"]]
22
+ t.spec_opts = ["--color", "--format", "specdoc", "--require", "spec/spec_helper.rb"]
23
+ end
24
+
25
+ end
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: visionmedia-lightr
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ platform: ruby
6
+ authors:
7
+ - TJ Holowaychuk
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-03-07 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Extremely light-weight syntax highlighting DSL.
17
+ email: tj@vision-media.ca
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - lib/lightr/grammars/c.rb
24
+ - lib/lightr/grammars/javascript.rb
25
+ - lib/lightr/grammars/ruby.rb
26
+ - lib/lightr/grammars.rb
27
+ - lib/lightr/mixins/grammar.rb
28
+ - lib/lightr/mixins.rb
29
+ - lib/lightr/version.rb
30
+ - lib/lightr.rb
31
+ - README.rdoc
32
+ - tasks/docs.rake
33
+ - tasks/gemspec.rake
34
+ - tasks/spec.rake
35
+ files:
36
+ - examples/c.rb
37
+ - examples/javascript.rb
38
+ - examples/ruby.rb
39
+ - History.rdoc
40
+ - lib/lightr/grammars/c.rb
41
+ - lib/lightr/grammars/javascript.rb
42
+ - lib/lightr/grammars/ruby.rb
43
+ - lib/lightr/grammars.rb
44
+ - lib/lightr/mixins/grammar.rb
45
+ - lib/lightr/mixins.rb
46
+ - lib/lightr/version.rb
47
+ - lib/lightr.rb
48
+ - lightr.gemspec
49
+ - Manifest
50
+ - Rakefile
51
+ - README.rdoc
52
+ - spec/grammars/c_spec.rb
53
+ - spec/grammars/javascript_spec.rb
54
+ - spec/grammars/ruby_spec.rb
55
+ - spec/spec_helper.rb
56
+ - tasks/docs.rake
57
+ - tasks/gemspec.rake
58
+ - tasks/spec.rake
59
+ - Todo.rdoc
60
+ has_rdoc: true
61
+ homepage: http://github.com/visionmedia/lightr
62
+ post_install_message:
63
+ rdoc_options:
64
+ - --line-numbers
65
+ - --inline-source
66
+ - --title
67
+ - Lightr
68
+ - --main
69
+ - README.rdoc
70
+ require_paths:
71
+ - lib
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: "0"
77
+ version:
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: "1.2"
83
+ version:
84
+ requirements: []
85
+
86
+ rubyforge_project: lightr
87
+ rubygems_version: 1.2.0
88
+ signing_key:
89
+ specification_version: 2
90
+ summary: Extremely light-weight syntax highlighting DSL.
91
+ test_files: []
92
+