ultraviolet 1.0.0 → 1.0.1
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/.gitmodules +1 -1
- data/.travis.yml +6 -0
- data/Gemfile +7 -8
- data/Gemfile.lock +11 -3
- data/Rakefile +2 -17
- data/Readme.md +1 -0
- data/lib/uv.rb +12 -11
- data/lib/uv/version.rb +1 -1
- data/spec/ultraviolet_spec.rb +8 -3
- metadata +8 -4
data/.gitmodules
CHANGED
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
source
|
1
|
+
source "https://rubygems.org"
|
2
2
|
|
3
|
-
|
4
|
-
gem 'textpow', '>=1.3'
|
3
|
+
gemspec
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
gem 'oniguruma', :platform => :ruby_18
|
6
|
+
gem 'bump'
|
7
|
+
gem 'rake'
|
8
|
+
gem 'rspec'
|
9
|
+
gem 'rack'
|
data/Gemfile.lock
CHANGED
@@ -1,6 +1,13 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ultraviolet (1.0.1)
|
5
|
+
textpow (>= 1.3.0)
|
6
|
+
|
1
7
|
GEM
|
2
|
-
remote:
|
8
|
+
remote: https://rubygems.org/
|
3
9
|
specs:
|
10
|
+
bump (0.4.1)
|
4
11
|
diff-lcs (1.1.3)
|
5
12
|
oniguruma (1.1.0)
|
6
13
|
plist (3.1.0)
|
@@ -14,15 +21,16 @@ GEM
|
|
14
21
|
rspec-expectations (2.11.2)
|
15
22
|
diff-lcs (~> 1.1.3)
|
16
23
|
rspec-mocks (2.11.2)
|
17
|
-
textpow (1.3.
|
24
|
+
textpow (1.3.1)
|
18
25
|
plist (>= 3.0.1)
|
19
26
|
|
20
27
|
PLATFORMS
|
21
28
|
ruby
|
22
29
|
|
23
30
|
DEPENDENCIES
|
31
|
+
bump
|
24
32
|
oniguruma
|
25
33
|
rack
|
26
34
|
rake
|
27
35
|
rspec
|
28
|
-
|
36
|
+
ultraviolet!
|
data/Rakefile
CHANGED
@@ -1,22 +1,7 @@
|
|
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/"
|
5
7
|
end
|
6
|
-
|
7
|
-
# extracted from https://github.com/grosser/project_template
|
8
|
-
rule /^version:bump:.*/ do |t|
|
9
|
-
sh "git status | grep 'nothing to commit'" # ensure we are not dirty
|
10
|
-
index = ['major', 'minor','patch'].index(t.name.split(':').last)
|
11
|
-
file = 'lib/uv/version.rb'
|
12
|
-
|
13
|
-
version_file = File.read(file)
|
14
|
-
old_version, *version_parts = version_file.match(/(\d+)\.(\d+)\.(\d+)/).to_a
|
15
|
-
version_parts[index] = version_parts[index].to_i + 1
|
16
|
-
version_parts[2] = 0 if index < 2 # remove patch for minor
|
17
|
-
version_parts[1] = 0 if index < 1 # remove minor for major
|
18
|
-
new_version = version_parts * '.'
|
19
|
-
File.open(file,'w'){|f| f.write(version_file.sub(old_version, new_version)) }
|
20
|
-
|
21
|
-
sh "bundle && git add #{file} Gemfile.lock && git commit -m 'bump version to #{new_version}'"
|
22
|
-
end
|
data/Readme.md
CHANGED
@@ -87,3 +87,4 @@ Original author [Dizan Vasquez](https://github.com/dichodaemon).
|
|
87
87
|
[Michael Grosser](http://grosser.it)<br/>
|
88
88
|
michael@grosser.it<br/>
|
89
89
|
License: MIT<br/>
|
90
|
+
[](http://travis-ci.org/grosser/ultraviolet)
|
data/lib/uv.rb
CHANGED
@@ -7,25 +7,24 @@ require "uv/version"
|
|
7
7
|
|
8
8
|
module Uv
|
9
9
|
class << self
|
10
|
-
attr_accessor :render_path, :theme_path, :syntax_path, :default_style
|
10
|
+
attr_accessor :render_path, :theme_path, :syntax_path, :default_style
|
11
11
|
end
|
12
12
|
|
13
13
|
self.syntax_path = Textpow.syntax_path
|
14
14
|
self.render_path = File.join(File.dirname(__FILE__), '..', 'render')
|
15
15
|
self.theme_path = File.join(render_path, 'xhtml', 'files', 'css')
|
16
16
|
self.default_style = 'mac_classic'
|
17
|
-
|
18
|
-
|
17
|
+
|
19
18
|
def self.path
|
20
19
|
result = []
|
21
20
|
result << File.join(File.dirname(__FILE__), ".." )
|
22
21
|
end
|
23
22
|
|
24
23
|
def self.syntax_node_for(syntax)
|
25
|
-
if
|
26
|
-
|
24
|
+
if syntax_nodes.key?(syntax)
|
25
|
+
syntax_nodes[syntax]
|
27
26
|
else
|
28
|
-
|
27
|
+
syntax_nodes[syntax] = Textpow.syntax(syntax) || raise(ArgumentError, "No syntax found for #{syntax}")
|
29
28
|
end
|
30
29
|
end
|
31
30
|
|
@@ -37,11 +36,16 @@ module Uv
|
|
37
36
|
end
|
38
37
|
|
39
38
|
def self.syntaxes
|
40
|
-
Dir.glob( File.join(@syntax_path, '*.syntax') ).collect do |f|
|
39
|
+
Dir.glob( File.join(@syntax_path, '*.syntax') ).collect do |f|
|
41
40
|
File.basename(f, '.syntax')
|
42
41
|
end
|
43
42
|
end
|
44
43
|
|
44
|
+
def self.syntax_nodes
|
45
|
+
@syntax_nodes ||= Hash[syntaxes.map { |name| [name, Textpow.syntax(name)] }]
|
46
|
+
end
|
47
|
+
private_class_method :syntax_nodes
|
48
|
+
|
45
49
|
def self.themes
|
46
50
|
Dir.glob( File.join(@theme_path, '*.css') ).collect do |f|
|
47
51
|
File.basename(f, '.css')
|
@@ -49,18 +53,15 @@ module Uv
|
|
49
53
|
end
|
50
54
|
|
51
55
|
def self.syntax_for_file(file_name)
|
52
|
-
init_syntaxes unless @syntaxes
|
53
|
-
|
54
56
|
# get first non-empty line
|
55
57
|
first_line = ""
|
56
58
|
File.open( file_name, 'r' ) { |f|
|
57
59
|
while (first_line = f.readline).strip.size == 0; end
|
58
60
|
}
|
59
61
|
|
60
|
-
|
61
62
|
# find syntax by file-extension
|
62
63
|
result = []
|
63
|
-
|
64
|
+
syntax_nodes.each do |key, syntax|
|
64
65
|
assigned = false
|
65
66
|
if syntax.fileTypes
|
66
67
|
syntax.fileTypes.each do |t|
|
data/lib/uv/version.rb
CHANGED
data/spec/ultraviolet_spec.rb
CHANGED
@@ -1,13 +1,18 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
|
+
require "stringio"
|
2
3
|
|
3
4
|
describe Uv do
|
4
|
-
# all 2 legacy tests ...
|
5
5
|
it "parses blank" do
|
6
6
|
Uv.parse('', 'xhtml', 'css').should == %(<pre class="mac_classic"></pre>)
|
7
7
|
end
|
8
8
|
|
9
9
|
it "debugs" do
|
10
|
-
STDERR.stub!(:puts) # silence
|
11
10
|
Uv.debug('', 'css').is_a?(Textpow::DebugProcessor).should == true
|
12
11
|
end
|
12
|
+
|
13
|
+
describe ".syntax_for_file" do
|
14
|
+
it "finds a syntax" do
|
15
|
+
Uv.syntax_for_file("lib/uv.rb").map(&:first).should == ["source.ruby"]
|
16
|
+
end
|
17
|
+
end
|
13
18
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ultraviolet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.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:
|
15
|
+
date: 2013-05-02 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: textpow
|
@@ -41,6 +41,7 @@ extensions: []
|
|
41
41
|
extra_rdoc_files: []
|
42
42
|
files:
|
43
43
|
- .gitmodules
|
44
|
+
- .travis.yml
|
44
45
|
- Gemfile
|
45
46
|
- Gemfile.lock
|
46
47
|
- Rakefile
|
@@ -134,16 +135,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
134
135
|
version: '0'
|
135
136
|
segments:
|
136
137
|
- 0
|
137
|
-
hash:
|
138
|
+
hash: 2810095283243012001
|
138
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
140
|
none: false
|
140
141
|
requirements:
|
141
142
|
- - ! '>='
|
142
143
|
- !ruby/object:Gem::Version
|
143
144
|
version: '0'
|
145
|
+
segments:
|
146
|
+
- 0
|
147
|
+
hash: 2810095283243012001
|
144
148
|
requirements: []
|
145
149
|
rubyforge_project:
|
146
|
-
rubygems_version: 1.8.
|
150
|
+
rubygems_version: 1.8.25
|
147
151
|
signing_key:
|
148
152
|
specification_version: 3
|
149
153
|
summary: Ultraviolet syntax highlighting gem for Ruby18 and Ruby19
|