bjeanes-ultraviolet-tools 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +6 -0
- data/LICENSE +20 -0
- data/README.rdoc +7 -0
- data/Rakefile +58 -0
- data/VERSION +1 -0
- data/bin/uv-create-syntax +42 -0
- data/bin/uv-create-theme +156 -0
- data/ultraviolet-tools.gemspec +51 -0
- metadata +92 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Bodaniel Jeanes
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "ultraviolet-tools"
|
8
|
+
gem.summary = %Q{Some command line utilities for turning textmate bundles into themes and syntaxes for UltraViolet, and placing them in a custom directory}
|
9
|
+
gem.email = "me@bjeanes.com"
|
10
|
+
gem.homepage = "http://github.com/bjeanes/ultraviolet-tools"
|
11
|
+
gem.authors = ["Bodaniel Jeanes"]
|
12
|
+
gem.add_dependency('plist', '>= 3.0.0')
|
13
|
+
gem.add_dependency('textpow', '>= 0.10.1')
|
14
|
+
gem.add_dependency('bjeanes-ultraviolet', '>= 0.10.3')
|
15
|
+
end
|
16
|
+
|
17
|
+
rescue LoadError
|
18
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'rake/testtask'
|
22
|
+
Rake::TestTask.new(:test) do |test|
|
23
|
+
test.libs << 'lib' << 'test'
|
24
|
+
test.pattern = 'test/**/*_test.rb'
|
25
|
+
test.verbose = true
|
26
|
+
end
|
27
|
+
|
28
|
+
begin
|
29
|
+
require 'rcov/rcovtask'
|
30
|
+
Rcov::RcovTask.new do |test|
|
31
|
+
test.libs << 'test'
|
32
|
+
test.pattern = 'test/**/*_test.rb'
|
33
|
+
test.verbose = true
|
34
|
+
end
|
35
|
+
rescue LoadError
|
36
|
+
task :rcov do
|
37
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
task :default => :test
|
43
|
+
|
44
|
+
require 'rake/rdoctask'
|
45
|
+
Rake::RDocTask.new do |rdoc|
|
46
|
+
if File.exist?('VERSION.yml')
|
47
|
+
config = YAML.load(File.read('VERSION.yml'))
|
48
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
49
|
+
else
|
50
|
+
version = ""
|
51
|
+
end
|
52
|
+
|
53
|
+
rdoc.rdoc_dir = 'rdoc'
|
54
|
+
rdoc.title = "ultraviolet-tools #{version}"
|
55
|
+
rdoc.rdoc_files.include('README*')
|
56
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
57
|
+
end
|
58
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.1
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'plist'
|
5
|
+
rescue LoadError
|
6
|
+
require 'rubygems'
|
7
|
+
require 'plist'
|
8
|
+
end
|
9
|
+
|
10
|
+
def create_syntax(syntax_file, output_dir)
|
11
|
+
file = File.basename(syntax_file)
|
12
|
+
|
13
|
+
begin
|
14
|
+
syntax = Plist.parse_xml(syntax_file)
|
15
|
+
name = File.basename(syntax_file).downcase.gsub(/.(tmlanguage|plist)$/, '').gsub(/[^a-z]/, '_').gsub(/_+/, '_')
|
16
|
+
FileUtils.mkdir_p(File.join(output_dir, "render"))
|
17
|
+
File.open( File.join( output_dir, "render", "#{name}.render" ), "w" ) {|f| YAML.dump( syntax, f ) }
|
18
|
+
|
19
|
+
puts %Q[Creating syntax from "#{file}"]
|
20
|
+
rescue
|
21
|
+
$stderr.puts %Q[Could not create syntax from "#{file}"]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
tm_syntax = File.expand_path(ARGV[0])
|
26
|
+
output_dir = File.expand_path(ARGV[1] || ".")
|
27
|
+
|
28
|
+
if File.directory? tm_syntax
|
29
|
+
# assume it's a tmBundle and iterate over each tmLanguage file
|
30
|
+
|
31
|
+
syntaxes = File.join(tm_syntax, "Syntaxes")
|
32
|
+
|
33
|
+
abort "No syntaxes found in #{syntaxes}" unless File.exists?(syntaxes)
|
34
|
+
|
35
|
+
Dir.chdir(syntaxes) do
|
36
|
+
Dir["*"].each do |syntax|
|
37
|
+
create_syntax(File.join(Dir.pwd, syntax), output_dir)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
else
|
41
|
+
create_syntax(tm_syntax, output_dir)
|
42
|
+
end
|
data/bin/uv-create-theme
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
# This is pretty much just theme2xhtmlrender from Ultraviolet, except outputs to a custom directory
|
4
|
+
begin
|
5
|
+
require 'plist'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'plist'
|
9
|
+
end
|
10
|
+
require 'uv/utility'
|
11
|
+
|
12
|
+
base_dir = ARGV[1] || "."
|
13
|
+
|
14
|
+
def settings
|
15
|
+
@settings ||= @theme["settings"].find { |s| ! s["name"] }["settings"]
|
16
|
+
end
|
17
|
+
|
18
|
+
puts "Processing #{ARGV[0]}"
|
19
|
+
|
20
|
+
@theme = Plist::parse_xml( ARGV[0] )
|
21
|
+
render = {"name" => @theme["name"]}
|
22
|
+
css = {}
|
23
|
+
|
24
|
+
standard_name = File.basename( ARGV[0] ).downcase.gsub(/\s+/, '_').gsub('.tmtheme', '').gsub(/\W/, '').gsub(/_+/, '_')
|
25
|
+
code_name = "pre.#{standard_name}"
|
26
|
+
|
27
|
+
render["tags"] = []
|
28
|
+
count_names = {}
|
29
|
+
@theme["settings"].each do |t|
|
30
|
+
if t["scope"]
|
31
|
+
class_name = t["name"].downcase.gsub(/\W/, ' ').gsub('.tmtheme', '').split(' ').collect{|s| s.capitalize}.join
|
32
|
+
if class_name == ""
|
33
|
+
class_name = "x" * t["name"].size
|
34
|
+
end
|
35
|
+
|
36
|
+
if count_names[class_name]
|
37
|
+
tname = class_name
|
38
|
+
class_name = "#{class_name}#{count_names[class_name]}"
|
39
|
+
count_names[tname] += count_names[tname] + 1
|
40
|
+
else
|
41
|
+
count_names[class_name] = 1
|
42
|
+
end
|
43
|
+
|
44
|
+
tag = {}
|
45
|
+
tag["selector"] = t["scope"]
|
46
|
+
tag["begin"] = "<span class=\"#{class_name}\">"
|
47
|
+
tag["end"] = "</span>"
|
48
|
+
render["tags"] << tag
|
49
|
+
|
50
|
+
if s = t["settings"]
|
51
|
+
style = {}
|
52
|
+
style["color"] = Uv.normalize_color(settings, s["foreground"], true)
|
53
|
+
style["background-color"] = Uv.normalize_color(settings, s["background"])
|
54
|
+
case s["fontStyle"]
|
55
|
+
when /bold/ then style["font-weight"] = "bold"
|
56
|
+
when /italic/ then style["font-style"] = "italic"
|
57
|
+
when /underline/ then style["text-decoration"] = "underline"
|
58
|
+
end
|
59
|
+
css[".#{class_name}"] = style
|
60
|
+
end
|
61
|
+
elsif ! t["name"]
|
62
|
+
if s = t["settings"]
|
63
|
+
style = {}
|
64
|
+
style["color"] = Uv.normalize_color(settings, s["foreground"], true)
|
65
|
+
style["background-color"] = Uv.alpha_blend(s["background"], s["background"])
|
66
|
+
css[code_name] = style
|
67
|
+
@style = style
|
68
|
+
style = {}
|
69
|
+
style["background-color"] = Uv.alpha_blend(s["selection"], s["selection"])
|
70
|
+
style["color"] = Uv.foreground( style["background-color"] )
|
71
|
+
css[".line-numbers"] = style
|
72
|
+
|
73
|
+
tag = {}
|
74
|
+
tag["begin"] = "<span class=\"line-numbers\">"
|
75
|
+
tag["end"] = "</span>"
|
76
|
+
render["line-numbers"] = tag
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
render["filter"] = "CGI.escapeHTML( @escaped )"
|
82
|
+
|
83
|
+
tag = {}
|
84
|
+
tag["begin"] = ""
|
85
|
+
tag["end"] = ""
|
86
|
+
render["line"] = tag
|
87
|
+
|
88
|
+
|
89
|
+
tag = {}
|
90
|
+
tag["begin"] = "<pre class=\"#{standard_name}\">"
|
91
|
+
tag["end"] = "</pre>"
|
92
|
+
render["listing"] = tag
|
93
|
+
|
94
|
+
tag = {}
|
95
|
+
tag["begin"] = <<END
|
96
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
97
|
+
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
|
98
|
+
|
99
|
+
<head>
|
100
|
+
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
|
101
|
+
<meta http-equiv="cache-control" content="no-cache" />
|
102
|
+
<meta http-equiv="expires" content="3600" />
|
103
|
+
<meta name="revisit-after" content="2 days" />
|
104
|
+
<meta name="robots" content="index,follow" />
|
105
|
+
<meta name="publisher" content="Dichodaemon" />
|
106
|
+
<meta name="copyright" content="Dichodaemon" />
|
107
|
+
|
108
|
+
<meta name="author" content="Dichodaemon" />
|
109
|
+
<meta name="distribution" content="global" />
|
110
|
+
<meta name="description" content="Ocatarinetabellachithchix" />
|
111
|
+
<meta name="keywords" content="arzaversperia flexilimosos toves" />
|
112
|
+
<link rel="stylesheet" type="text/css" media="screen,projection,print" href="css/#{standard_name}.css" />
|
113
|
+
<title>#{standard_name}</title>
|
114
|
+
|
115
|
+
</head>
|
116
|
+
|
117
|
+
<body>
|
118
|
+
END
|
119
|
+
|
120
|
+
tag["end"] = <<END
|
121
|
+
<p>
|
122
|
+
<a href="http://validator.w3.org/check?uri=referer">
|
123
|
+
<img style="border:0"
|
124
|
+
src="http://www.w3.org/Icons/valid-xhtml10"
|
125
|
+
alt="Valid XHTML 1.0 Strict" height="31" width="88" />
|
126
|
+
</a>
|
127
|
+
<a href="http://jigsaw.w3.org/css-validator/check?uri=referer">
|
128
|
+
<img style="border:0;width:88px;height:31px"
|
129
|
+
src="http://jigsaw.w3.org/css-validator/images/vcss"
|
130
|
+
alt="Valid CSS!" />
|
131
|
+
</a>
|
132
|
+
</p>
|
133
|
+
</body>
|
134
|
+
</html>
|
135
|
+
END
|
136
|
+
|
137
|
+
render["document"] = tag
|
138
|
+
|
139
|
+
FileUtils.mkdir_p(File.join(base_dir, "xhtml", "files", "css"))
|
140
|
+
|
141
|
+
File.open( File.join( base_dir, "xhtml", "#{standard_name}.render" ), "w" ) {|f| YAML.dump( render, f ) }
|
142
|
+
|
143
|
+
File.open( File.join( base_dir, "xhtml", "files", "css", "#{standard_name}.css" ), "w" ) do |f|
|
144
|
+
css.each do |key, values|
|
145
|
+
if key == code_name
|
146
|
+
f.puts "#{code_name} {"
|
147
|
+
#puts @style
|
148
|
+
else
|
149
|
+
f.puts "#{code_name} #{key} {"
|
150
|
+
end
|
151
|
+
values.each do |style, value|
|
152
|
+
f.puts " #{style}: #{value};" if value
|
153
|
+
end
|
154
|
+
f.puts "}"
|
155
|
+
end
|
156
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{ultraviolet-tools}
|
5
|
+
s.version = "1.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Bodaniel Jeanes"]
|
9
|
+
s.date = %q{2009-07-13}
|
10
|
+
s.email = %q{me@bjeanes.com}
|
11
|
+
s.executables = ["uv-create-syntax", "uv-create-theme"]
|
12
|
+
s.extra_rdoc_files = [
|
13
|
+
"LICENSE",
|
14
|
+
"README.rdoc"
|
15
|
+
]
|
16
|
+
s.files = [
|
17
|
+
".document",
|
18
|
+
".gitignore",
|
19
|
+
"LICENSE",
|
20
|
+
"README.rdoc",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"bin/uv-create-syntax",
|
24
|
+
"bin/uv-create-theme",
|
25
|
+
"ultraviolet-tools.gemspec"
|
26
|
+
]
|
27
|
+
s.homepage = %q{http://github.com/bjeanes/ultraviolet-tools}
|
28
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
29
|
+
s.require_paths = ["lib"]
|
30
|
+
s.rubygems_version = %q{1.3.4}
|
31
|
+
s.summary = %q{Some command line utilities for turning textmate bundles into themes and syntaxes for UltraViolet, and placing them in a custom directory}
|
32
|
+
|
33
|
+
if s.respond_to? :specification_version then
|
34
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
35
|
+
s.specification_version = 3
|
36
|
+
|
37
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
38
|
+
s.add_runtime_dependency(%q<plist>, [">= 3.0.0"])
|
39
|
+
s.add_runtime_dependency(%q<textpow>, [">= 0.10.1"])
|
40
|
+
s.add_runtime_dependency(%q<bjeanes-ultraviolet>, [">= 0.10.3"])
|
41
|
+
else
|
42
|
+
s.add_dependency(%q<plist>, [">= 3.0.0"])
|
43
|
+
s.add_dependency(%q<textpow>, [">= 0.10.1"])
|
44
|
+
s.add_dependency(%q<bjeanes-ultraviolet>, [">= 0.10.3"])
|
45
|
+
end
|
46
|
+
else
|
47
|
+
s.add_dependency(%q<plist>, [">= 3.0.0"])
|
48
|
+
s.add_dependency(%q<textpow>, [">= 0.10.1"])
|
49
|
+
s.add_dependency(%q<bjeanes-ultraviolet>, [">= 0.10.3"])
|
50
|
+
end
|
51
|
+
end
|
metadata
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bjeanes-ultraviolet-tools
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Bodaniel Jeanes
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-07-13 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: plist
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 3.0.0
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: textpow
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.10.1
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: bjeanes-ultraviolet
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.10.3
|
44
|
+
version:
|
45
|
+
description:
|
46
|
+
email: me@bjeanes.com
|
47
|
+
executables:
|
48
|
+
- uv-create-syntax
|
49
|
+
- uv-create-theme
|
50
|
+
extensions: []
|
51
|
+
|
52
|
+
extra_rdoc_files:
|
53
|
+
- LICENSE
|
54
|
+
- README.rdoc
|
55
|
+
files:
|
56
|
+
- .document
|
57
|
+
- .gitignore
|
58
|
+
- LICENSE
|
59
|
+
- README.rdoc
|
60
|
+
- Rakefile
|
61
|
+
- VERSION
|
62
|
+
- bin/uv-create-syntax
|
63
|
+
- bin/uv-create-theme
|
64
|
+
- ultraviolet-tools.gemspec
|
65
|
+
has_rdoc: false
|
66
|
+
homepage: http://github.com/bjeanes/ultraviolet-tools
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options:
|
69
|
+
- --charset=UTF-8
|
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: "0"
|
83
|
+
version:
|
84
|
+
requirements: []
|
85
|
+
|
86
|
+
rubyforge_project:
|
87
|
+
rubygems_version: 1.2.0
|
88
|
+
signing_key:
|
89
|
+
specification_version: 3
|
90
|
+
summary: Some command line utilities for turning textmate bundles into themes and syntaxes for UltraViolet, and placing them in a custom directory
|
91
|
+
test_files: []
|
92
|
+
|