ultraviolet1x 0.13.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -1
- data/Gemfile.lock +2 -2
- data/Rakefile +14 -0
- data/lib/uv.rb +22 -25
- data/lib/uv/version.rb +1 -1
- metadata +4 -4
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -13,7 +13,7 @@ GEM
|
|
13
13
|
rspec-expectations (2.6.0)
|
14
14
|
diff-lcs (~> 1.1.2)
|
15
15
|
rspec-mocks (2.6.0)
|
16
|
-
textpow1x (1.
|
16
|
+
textpow1x (1.2.0)
|
17
17
|
plist (>= 3.0.1)
|
18
18
|
|
19
19
|
PLATFORMS
|
@@ -23,4 +23,4 @@ DEPENDENCIES
|
|
23
23
|
oniguruma
|
24
24
|
rake (= 0.8.7)
|
25
25
|
rspec
|
26
|
-
textpow1x (>= 1)
|
26
|
+
textpow1x (>= 1.2)
|
data/Rakefile
CHANGED
@@ -4,3 +4,17 @@ Bundler::GemHelper.install_tasks
|
|
4
4
|
task :default do
|
5
5
|
sh "rspec spec/"
|
6
6
|
end
|
7
|
+
|
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
|
+
new_version = version_parts * '.'
|
17
|
+
File.open(file,'w'){|f| f.write(version_file.sub(old_version, new_version)) }
|
18
|
+
|
19
|
+
sh "bundle && git add #{file} Gemfile.lock && git commit -m 'bump version to #{new_version}'"
|
20
|
+
end
|
data/lib/uv.rb
CHANGED
@@ -16,80 +16,77 @@ module Uv
|
|
16
16
|
self.default_style = 'mac_classic'
|
17
17
|
self.syntaxes = {}
|
18
18
|
|
19
|
-
def
|
19
|
+
def self.path
|
20
20
|
result = []
|
21
21
|
result << File.join(File.dirname(__FILE__), ".." )
|
22
22
|
end
|
23
23
|
|
24
24
|
def self.syntax_node_for(syntax)
|
25
|
-
if
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
else
|
30
|
-
false
|
31
|
-
end
|
32
|
-
end
|
33
|
-
if !@syntaxes[syntax]
|
34
|
-
raise ArgumentError, "No #{syntax}.syntax file in #{@syntax_path}"
|
25
|
+
if @syntaxes.key?(syntax)
|
26
|
+
@syntaxes[syntax]
|
27
|
+
else
|
28
|
+
@syntaxes[syntax] = Textpow.syntax(syntax) || raise(ArgumentError, "No syntax found for #{syntax}")
|
35
29
|
end
|
36
|
-
@syntaxes[syntax]
|
37
30
|
end
|
38
31
|
|
39
|
-
def
|
32
|
+
def self.copy_files(output, output_dir)
|
40
33
|
Uv.path.each do |dir|
|
41
34
|
dir_name = File.join( dir, "render", output, "files" )
|
42
35
|
FileUtils.cp_r( Dir.glob(File.join( dir_name, "." )), output_dir ) if File.exists?( dir_name )
|
43
36
|
end
|
44
37
|
end
|
45
38
|
|
46
|
-
def
|
39
|
+
def self.syntaxes
|
47
40
|
Dir.glob( File.join(@syntax_path, '*.syntax') ).collect do |f|
|
48
41
|
File.basename(f, '.syntax')
|
49
42
|
end
|
50
43
|
end
|
51
44
|
|
52
|
-
def
|
45
|
+
def self.themes
|
53
46
|
Dir.glob( File.join(@theme_path, '*.css') ).collect do |f|
|
54
47
|
File.basename(f, '.css')
|
55
48
|
end
|
56
49
|
end
|
57
50
|
|
58
|
-
def
|
51
|
+
def self.syntax_for_file(file_name)
|
59
52
|
init_syntaxes unless @syntaxes
|
53
|
+
|
54
|
+
# get first non-empty line
|
60
55
|
first_line = ""
|
61
56
|
File.open( file_name, 'r' ) { |f|
|
62
57
|
while (first_line = f.readline).strip.size == 0; end
|
63
58
|
}
|
59
|
+
|
60
|
+
|
61
|
+
# find syntax by file-extension
|
64
62
|
result = []
|
65
|
-
@syntaxes.each do |key,
|
63
|
+
@syntaxes.each do |key, syntax|
|
66
64
|
assigned = false
|
67
|
-
if
|
68
|
-
|
65
|
+
if syntax.fileTypes
|
66
|
+
syntax.fileTypes.each do |t|
|
69
67
|
if t == File.basename( file_name ) || t == File.extname( file_name )[1..-1]
|
70
|
-
result << [key,
|
68
|
+
result << [key, syntax]
|
71
69
|
assigned = true
|
72
70
|
break
|
73
71
|
end
|
74
72
|
end
|
75
73
|
end
|
76
74
|
unless assigned
|
77
|
-
if
|
78
|
-
result << [key,
|
75
|
+
if syntax.firstLineMatch && syntax.firstLineMatch =~ first_line
|
76
|
+
result << [key, syntax]
|
79
77
|
end
|
80
78
|
end
|
81
79
|
end
|
82
80
|
result
|
83
81
|
end
|
84
82
|
|
85
|
-
def
|
83
|
+
def self.parse(text, output = "xhtml", syntax_name = nil, line_numbers = false, render_style = nil, headers = false)
|
86
84
|
RenderProcessor.load(output, render_style, line_numbers, headers) do |processor|
|
87
85
|
syntax_node_for(syntax_name).parse(text, processor)
|
88
86
|
end.string
|
89
87
|
end
|
90
88
|
|
91
|
-
def
|
89
|
+
def self.debug(text, syntax_name)
|
92
90
|
syntax_node_for(syntax_name).parse(text, Textpow::DebugProcessor.new)
|
93
91
|
end
|
94
|
-
|
95
92
|
end
|
data/lib/uv/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ultraviolet1x
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 39
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 14
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.14.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dizan Vasquez
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2011-10-
|
21
|
+
date: 2011-10-08 00:00:00 +02:00
|
22
22
|
default_executable:
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|