textpow 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -4,7 +4,6 @@ gemspec
4
4
 
5
5
  gem 'oniguruma', :platform => :ruby_18
6
6
 
7
- group :dev do
8
- gem 'rake', '0.8.7'
9
- gem 'rspec'
10
- end
7
+ gem 'rake'
8
+ gem 'rspec'
9
+ gem 'bump'
@@ -1,30 +1,32 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- textpow (1.3.0)
4
+ textpow (1.3.1)
5
5
  plist (>= 3.0.1)
6
6
 
7
7
  GEM
8
8
  remote: http://rubygems.org/
9
9
  specs:
10
+ bump (0.3.9)
10
11
  diff-lcs (1.1.3)
11
12
  oniguruma (1.1.0)
12
13
  plist (3.1.0)
13
- rake (0.8.7)
14
- rspec (2.6.0)
15
- rspec-core (~> 2.6.0)
16
- rspec-expectations (~> 2.6.0)
17
- rspec-mocks (~> 2.6.0)
18
- rspec-core (2.6.4)
19
- rspec-expectations (2.6.0)
20
- diff-lcs (~> 1.1.2)
21
- rspec-mocks (2.6.0)
14
+ rake (10.0.3)
15
+ rspec (2.12.0)
16
+ rspec-core (~> 2.12.0)
17
+ rspec-expectations (~> 2.12.0)
18
+ rspec-mocks (~> 2.12.0)
19
+ rspec-core (2.12.2)
20
+ rspec-expectations (2.12.1)
21
+ diff-lcs (~> 1.1.3)
22
+ rspec-mocks (2.12.2)
22
23
 
23
24
  PLATFORMS
24
25
  ruby
25
26
 
26
27
  DEPENDENCIES
28
+ bump
27
29
  oniguruma
28
- rake (= 0.8.7)
30
+ rake
29
31
  rspec
30
32
  textpow!
@@ -17,6 +17,10 @@ Install oniguruma
17
17
  # Then
18
18
  gem install oniguruma
19
19
 
20
+ == Demo
21
+ * {Ultraviolet}[http://grosser.github.com/ultraviolet/] uses testpow to generate html syntax highlighting
22
+ * {Ruco (Ruby commandline editor)}[https://github.com/grosser/ruco] uses textpow to colorize the console
23
+
20
24
  == USAGE:
21
25
 
22
26
  1. Load a Syntax File {list of included syntax}[https://github.com/grosser/textpow/tree/master/lib/textpow/syntax]
@@ -80,3 +84,5 @@ having <tt>name="text.string", position=10</tt> and the second having
80
84
  * Copyright (c) 2010 {Chris Hoffman}[http://github.com/cehoffman]
81
85
  * Copyright (c) 2009 {Spox}[http://github.com/spox]
82
86
  * Copyright (c) 2007-2008 Dizan Vasquez
87
+
88
+ {<img src="https://secure.travis-ci.org/grosser/textpow.png" />}[http://travis-ci.org/grosser/textpow]
data/Rakefile CHANGED
@@ -1,4 +1,6 @@
1
+ require "bundler/setup"
1
2
  require "bundler/gem_tasks"
3
+ require "bump/tasks"
2
4
 
3
5
  task :default do
4
6
  sh "rspec spec/"
@@ -9,23 +11,6 @@ task :convert, :in, :out do |t,args|
9
11
  convert(args[:in], args[:out] || 'out.syntax')
10
12
  end
11
13
 
12
- # extracted from https://github.com/grosser/project_template
13
- rule /^version:bump:.*/ do |t|
14
- sh "git status | grep 'nothing to commit'" # ensure we are not dirty
15
- index = ['major', 'minor','patch'].index(t.name.split(':').last)
16
- file = 'lib/textpow/version.rb'
17
-
18
- version_file = File.read(file)
19
- old_version, *version_parts = version_file.match(/(\d+)\.(\d+)\.(\d+)/).to_a
20
- version_parts[index] = version_parts[index].to_i + 1
21
- version_parts[2] = 0 if index < 2 # remove patch for minor
22
- version_parts[1] = 0 if index < 1 # remove minor for major
23
- new_version = version_parts * '.'
24
- File.open(file,'w'){|f| f.write(version_file.sub(old_version, new_version)) }
25
-
26
- sh "bundle && git add #{file} Gemfile.lock && git commit -m 'bump version to #{new_version}'"
27
- end
28
-
29
14
  desc "update syntaxes from their original source"
30
15
  task :update_syntax do
31
16
  {
@@ -14,11 +14,11 @@ module Textpow
14
14
 
15
15
  @@syntax = {}
16
16
  def self.syntax(syntax_name)
17
- syntax_name = syntax_name.downcase
18
- if @@syntax.has_key?(syntax_name)
19
- @@syntax[syntax_name]
17
+ key = syntax_name.downcase
18
+ if @@syntax.has_key?(key)
19
+ @@syntax[key]
20
20
  else
21
- @@syntax[syntax_name] = uncached_syntax(syntax_name)
21
+ @@syntax[key] = uncached_syntax(syntax_name)
22
22
  end
23
23
  end
24
24
 
@@ -27,8 +27,8 @@ private
27
27
  def self.uncached_syntax(name)
28
28
  path = (
29
29
  find_syntax_by_path(name) ||
30
- find_syntax_by_scope_name(name) ||
31
- find_syntax_by_fuzzy_name(name)
30
+ find_syntax_by_scope_name(name.downcase) ||
31
+ find_syntax_by_fuzzy_name(name.downcase)
32
32
  )
33
33
  SyntaxNode.load(path) if path
34
34
  end
@@ -135,13 +135,15 @@ module Textpow
135
135
 
136
136
  def self.convert_file_to_table(file)
137
137
  raise "File not found: #{file}" unless File.exist?(file)
138
- case file
138
+ table = case file
139
139
  when /(\.tmSyntax|\.plist)$/
140
140
  require 'plist'
141
141
  Plist::parse_xml(file)
142
142
  else
143
143
  YAML.load_file(file)
144
144
  end
145
+ raise "Could not parse file #{file} to a table" if table.is_a?(String)
146
+ table
145
147
  end
146
148
 
147
149
  def parse_repository(repository)
@@ -1,3 +1,3 @@
1
1
  module Textpow
2
- VERSION = Version = "1.3.0"
2
+ VERSION = Version = "1.3.1"
3
3
  end
@@ -0,0 +1,107 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>BBEditDocumentType</key>
6
+ <string>CodelessLanguageModule</string>
7
+ <key>BBLMColorsSyntax</key>
8
+ <true/>
9
+ <key>BBLMIsCaseSensitive</key>
10
+ <true/>
11
+ <key>BBLMKeywordList</key>
12
+ <array>
13
+ <string>and</string>
14
+ <string>or</string>
15
+ <string>xor</string>
16
+ <string>virtual</string>
17
+ <string>if</string>
18
+ <string>else</string>
19
+ <string>do</string>
20
+ <string>while</string>
21
+ <string>use</string>
22
+ <string>bundle</string>
23
+ <string>native</string>
24
+ <string>static</string>
25
+ <string>public</string>
26
+ <string>private</string>
27
+ <string>class</string>
28
+ <string>interface</string>
29
+ <string>select</string>
30
+ <string>other</string>
31
+ <string>enum</string>
32
+ <string>for</string>
33
+ <string>each</string>
34
+ <string>label</string>
35
+ <string>return</string>
36
+ <string>Byte</string>
37
+ <string>Int</string>
38
+ <string>Parent</string>
39
+ <string>from</string>
40
+ <string>Float</string>
41
+ <string>Char</string>
42
+ <string>Bool</string>
43
+ <string>String</string>
44
+ <string>Nil</string>
45
+ <string>true</string>
46
+ <string>false</string>
47
+ <string>function</string>
48
+ <string>method</string>
49
+ </array>
50
+ <key>BBLMLanguageCode</key>
51
+ <string>LSL</string>
52
+ <key>BBLMLanguageDisplayName</key>
53
+ <string>Objeck</string>
54
+ <key>BBLMScansFunctions</key>
55
+ <true/>
56
+ <key>BBLMSuffixMap</key>
57
+ <array>
58
+ <dict>
59
+ <key>BBLMLanguageSuffix</key>
60
+ <string>.obs</string>
61
+ </dict>
62
+ </array>
63
+ <key>Language Features</key>
64
+ <dict>
65
+ <key>Close Block Comments</key>
66
+ <string>~#</string>
67
+ <key>Close Parameter Lists</key>
68
+ <string>)</string>
69
+ <key>Close Statement Blocks</key>
70
+ <string>}</string>
71
+ <key>Close Strings 1</key>
72
+ <string>&quot;</string>
73
+ <key>Close Strings 2</key>
74
+ <string>&apos;</string>
75
+ <key>End-of-line Ends Strings 1</key>
76
+ <false/>
77
+ <key>End-of-line Ends Strings 2</key>
78
+ <false/>
79
+ <key>Escape Char in Strings 1</key>
80
+ <string>\</string>
81
+ <key>Escape Char in Strings 2</key>
82
+ <string>\</string>
83
+ <key>Identifier and Keyword Characters</key>
84
+ <string>@0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz</string>
85
+ <key>Open Block Comments</key>
86
+ <string>#~</string>
87
+ <key>Open Line Comments</key>
88
+ <string>#</string>
89
+ <key>Open Parameter Lists</key>
90
+ <string>(</string>
91
+ <key>Open Statement Blocks</key>
92
+ <string>{</string>
93
+ <key>Open Strings 1</key>
94
+ <string>&quot;</string>
95
+ <key>Open Strings 2</key>
96
+ <string>&apos;</string>
97
+ <key>Prefix for Functions</key>
98
+ <string></string>
99
+ <key>Prefix for Procedures</key>
100
+ <string></string>
101
+ <key>Terminator for Prototypes 1</key>
102
+ <string></string>
103
+ <key>Terminator for Prototypes 2</key>
104
+ <string></string>
105
+ </dict>
106
+ </dict>
107
+ </plist>
@@ -21,6 +21,16 @@ describe Textpow do
21
21
  Textpow.syntax('lib/textpow/syntax/source.ruby.syntax').name.should == 'Ruby'
22
22
  end
23
23
 
24
+ it "finds syntax by path with capital letters" do
25
+ Textpow.syntax('spec/fixtures/objeck.tmSyntax').class.should == Textpow::SyntaxNode
26
+ end
27
+
28
+ it "complains about unreadable files" do
29
+ expect{
30
+ Textpow.syntax('Rakefile')
31
+ }.to raise_error(/Could not parse file Rakefile/)
32
+ end
33
+
24
34
  it "finds a syntax by scopeName" do
25
35
  Textpow.syntax('source.ruby').name.should == 'Ruby'
26
36
  end
@@ -1,12 +1,11 @@
1
1
  $LOAD_PATH.push File.expand_path("../lib", __FILE__)
2
- require "textpow/version"
2
+ name = "textpow"
3
+ require "#{name}/version"
3
4
 
4
- Gem::Specification.new do |s|
5
- s.name = "textpow"
6
- s.version = Textpow::Version
5
+ Gem::Specification.new name, Textpow::Version do |s|
7
6
  s.authors = ["Dizan Vasquez", "Spox", "Chris Hoffman", "Michael Grosser"]
8
7
  s.email = ["michael@grosser.it"]
9
- s.homepage = "http://github.com/grosser/textpow"
8
+ s.homepage = "https://github.com/grosser/#{name}"
10
9
  s.summary = "A library for parsing TextMate bundles"
11
10
  s.description = s.summary
12
11
  s.license = "MIT"
@@ -15,5 +14,5 @@ Gem::Specification.new do |s|
15
14
  s.executables = ["plist2yaml", "plist2syntax"]
16
15
  s.rdoc_options = ["--main", "README.rdoc"]
17
16
 
18
- s.add_dependency "plist", '>=3.0.1'
17
+ s.add_runtime_dependency "plist", '>=3.0.1'
19
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: textpow
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2012-08-19 00:00:00.000000000 Z
15
+ date: 2013-02-17 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: plist
@@ -221,6 +221,7 @@ files:
221
221
  - lib/textpow/syntax/text.xml.xsl.syntax
222
222
  - lib/textpow/version.rb
223
223
  - spec/fixtures/objeck.plist
224
+ - spec/fixtures/objeck.tmSyntax
224
225
  - spec/fixtures/utf8.txt
225
226
  - spec/spec_helper.rb
226
227
  - spec/textpow/score_manager_spec.rb
@@ -228,7 +229,7 @@ files:
228
229
  - spec/textpow/syntax_spec.rb
229
230
  - spec/textpow_spec.rb
230
231
  - textpow.gemspec
231
- homepage: http://github.com/grosser/textpow
232
+ homepage: https://github.com/grosser/textpow
232
233
  licenses:
233
234
  - MIT
234
235
  post_install_message:
@@ -245,7 +246,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
245
246
  version: '0'
246
247
  segments:
247
248
  - 0
248
- hash: 1600551724538838794
249
+ hash: -2419766218424752244
249
250
  required_rubygems_version: !ruby/object:Gem::Requirement
250
251
  none: false
251
252
  requirements:
@@ -254,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
254
255
  version: '0'
255
256
  segments:
256
257
  - 0
257
- hash: 1600551724538838794
258
+ hash: -2419766218424752244
258
259
  requirements: []
259
260
  rubyforge_project:
260
261
  rubygems_version: 1.8.24