xrd 0.1.0
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/CHANGELOG +3 -0
- data/LICENSE +202 -0
- data/README.md +36 -0
- data/Rakefile +59 -0
- data/lib/xrd.rb +30 -0
- data/lib/xrd/link.rb +46 -0
- data/lib/xrd/properties.rb +62 -0
- data/lib/xrd/resource_descriptor.rb +122 -0
- data/lib/xrd/title.rb +18 -0
- data/lib/xrd/version.rb +26 -0
- data/spec/spec.opts +2 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/xrd/link_spec.rb +111 -0
- data/spec/xrd/xrd_spec.rb +431 -0
- data/tasks/clobber.rake +2 -0
- data/tasks/gem.rake +70 -0
- data/tasks/git.rake +40 -0
- data/tasks/metrics.rake +22 -0
- data/tasks/rdoc.rake +26 -0
- data/tasks/rubyforge.rake +103 -0
- data/tasks/spec.rake +71 -0
- data/tasks/yard.rake +26 -0
- data/website/index.html +95 -0
- metadata +171 -0
data/tasks/clobber.rake
ADDED
data/tasks/gem.rake
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'rake/gempackagetask'
|
2
|
+
|
3
|
+
namespace :gem do
|
4
|
+
GEM_SPEC = Gem::Specification.new do |s|
|
5
|
+
unless s.respond_to?(:add_development_dependency)
|
6
|
+
puts 'The gem spec requires a newer version of RubyGems.'
|
7
|
+
exit(1)
|
8
|
+
end
|
9
|
+
|
10
|
+
s.name = PKG_NAME
|
11
|
+
s.version = PKG_VERSION
|
12
|
+
s.author = PKG_AUTHOR
|
13
|
+
s.email = PKG_AUTHOR_EMAIL
|
14
|
+
s.homepage = PKG_HOMEPAGE
|
15
|
+
s.summary = PKG_SUMMARY
|
16
|
+
s.description = PKG_DESCRIPTION
|
17
|
+
s.rubyforge_project = RUBY_FORGE_PROJECT
|
18
|
+
|
19
|
+
s.files = PKG_FILES.to_a
|
20
|
+
|
21
|
+
s.has_rdoc = true
|
22
|
+
s.extra_rdoc_files = %w( README.md )
|
23
|
+
s.rdoc_options.concat ['--main', 'README.md']
|
24
|
+
|
25
|
+
s.add_runtime_dependency('sporkmonger-sax-machine', '>= 0.1.1')
|
26
|
+
|
27
|
+
s.add_development_dependency('rake', '~> 0.8.3')
|
28
|
+
s.add_development_dependency('rspec', '~> 1.1.11')
|
29
|
+
s.add_development_dependency('launchy', '~> 0.3.2')
|
30
|
+
s.add_development_dependency('diff-lcs', '~> 1.1.2')
|
31
|
+
|
32
|
+
s.require_path = 'lib'
|
33
|
+
end
|
34
|
+
|
35
|
+
Rake::GemPackageTask.new(GEM_SPEC) do |p|
|
36
|
+
p.gem_spec = GEM_SPEC
|
37
|
+
p.need_tar = true
|
38
|
+
p.need_zip = true
|
39
|
+
end
|
40
|
+
|
41
|
+
desc 'Show information about the gem'
|
42
|
+
task :debug do
|
43
|
+
puts GEM_SPEC.to_ruby
|
44
|
+
end
|
45
|
+
|
46
|
+
desc 'Install the gem'
|
47
|
+
task :install => ['clobber', 'gem:package'] do
|
48
|
+
sh "#{SUDO} gem install --local pkg/#{GEM_SPEC.full_name}"
|
49
|
+
end
|
50
|
+
|
51
|
+
desc 'Uninstall the gem'
|
52
|
+
task :uninstall do
|
53
|
+
installed_list = Gem.source_index.find_name(PKG_NAME)
|
54
|
+
if installed_list &&
|
55
|
+
(installed_list.collect { |s| s.version.to_s}.include?(PKG_VERSION))
|
56
|
+
sh(
|
57
|
+
"#{SUDO} gem uninstall --version '#{PKG_VERSION}' " +
|
58
|
+
"--ignore-dependencies --executables #{PKG_NAME}"
|
59
|
+
)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
desc 'Reinstall the gem'
|
64
|
+
task :reinstall => [:uninstall, :install]
|
65
|
+
end
|
66
|
+
|
67
|
+
desc 'Alias to gem:package'
|
68
|
+
task 'gem' => 'gem:package'
|
69
|
+
|
70
|
+
task 'clobber' => ['gem:clobber_package']
|
data/tasks/git.rake
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
namespace :git do
|
2
|
+
namespace :tag do
|
3
|
+
desc 'List tags from the Git repository'
|
4
|
+
task :list do
|
5
|
+
tags = `git tag -l`
|
6
|
+
tags.gsub!("\r", '')
|
7
|
+
tags = tags.split("\n").sort {|a, b| b <=> a }
|
8
|
+
puts tags.join("\n")
|
9
|
+
end
|
10
|
+
|
11
|
+
desc 'Create a new tag in the Git repository'
|
12
|
+
task :create do
|
13
|
+
changelog = File.open('CHANGELOG', 'r') { |file| file.read }
|
14
|
+
puts '-' * 80
|
15
|
+
puts changelog
|
16
|
+
puts '-' * 80
|
17
|
+
puts
|
18
|
+
|
19
|
+
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
20
|
+
abort "Versions don't match #{v} vs #{PKG_VERSION}" if v != PKG_VERSION
|
21
|
+
|
22
|
+
tag = "#{PKG_NAME}-#{PKG_VERSION}"
|
23
|
+
msg = "Release #{PKG_NAME}-#{PKG_VERSION}"
|
24
|
+
|
25
|
+
existing_tags = `git tag -l #{PKG_NAME}-*`.split("\n")
|
26
|
+
if existing_tags.include?(tag)
|
27
|
+
warn('Tag already exists, deleting...')
|
28
|
+
unless system "git tag -d #{tag}"
|
29
|
+
abort 'Tag deletion failed.'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
puts "Creating git tag '#{tag}'..."
|
33
|
+
unless system "git tag -a -m \"#{msg}\" #{tag}"
|
34
|
+
abort 'Tag creation failed.'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
task 'gem:release' => 'git:tag:create'
|
data/tasks/metrics.rake
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
namespace :metrics do
|
2
|
+
task :lines do
|
3
|
+
lines, codelines, total_lines, total_codelines = 0, 0, 0, 0
|
4
|
+
for file_name in FileList['lib/**/*.rb']
|
5
|
+
f = File.open(file_name)
|
6
|
+
while line = f.gets
|
7
|
+
lines += 1
|
8
|
+
next if line =~ /^\s*$/
|
9
|
+
next if line =~ /^\s*#/
|
10
|
+
codelines += 1
|
11
|
+
end
|
12
|
+
puts "L: #{sprintf('%4d', lines)}, " +
|
13
|
+
"LOC #{sprintf('%4d', codelines)} | #{file_name}"
|
14
|
+
total_lines += lines
|
15
|
+
total_codelines += codelines
|
16
|
+
|
17
|
+
lines, codelines = 0, 0
|
18
|
+
end
|
19
|
+
|
20
|
+
puts "Total: Lines #{total_lines}, LOC #{total_codelines}"
|
21
|
+
end
|
22
|
+
end
|
data/tasks/rdoc.rake
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rake/rdoctask'
|
2
|
+
|
3
|
+
namespace :doc do
|
4
|
+
desc 'Generate RDoc documentation'
|
5
|
+
Rake::RDocTask.new do |rdoc|
|
6
|
+
rdoc.rdoc_dir = 'doc'
|
7
|
+
rdoc.title = "#{PKG_NAME}-#{PKG_VERSION} Documentation"
|
8
|
+
rdoc.options << '--line-numbers' << '--inline-source' <<
|
9
|
+
'--accessor' << 'cattr_accessor=object' << '--charset' << 'utf-8'
|
10
|
+
rdoc.template = "#{ENV['template']}.rb" if ENV['template']
|
11
|
+
rdoc.rdoc_files.include('README', 'CHANGELOG', 'LICENSE')
|
12
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Generate ri locally for testing'
|
16
|
+
task :ri do
|
17
|
+
sh 'rdoc --ri -o ri .'
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'Remove ri products'
|
21
|
+
task :clobber_ri do
|
22
|
+
rm_r 'ri' rescue nil
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
task 'clobber' => ['doc:clobber_rdoc', 'doc:clobber_ri']
|
@@ -0,0 +1,103 @@
|
|
1
|
+
namespace :gem do
|
2
|
+
desc 'Package and upload to RubyForge'
|
3
|
+
task :release => ['gem:package'] do |t|
|
4
|
+
require 'rubyforge'
|
5
|
+
|
6
|
+
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
7
|
+
abort "Versions don't match #{v} vs #{PROJ.version}" if v != PKG_VERSION
|
8
|
+
pkg = "pkg/#{GEM_SPEC.full_name}"
|
9
|
+
|
10
|
+
rf = RubyForge.new
|
11
|
+
rf.configure
|
12
|
+
puts 'Logging in...'
|
13
|
+
rf.login
|
14
|
+
|
15
|
+
c = rf.userconfig
|
16
|
+
changelog = File.open('CHANGELOG') { |file| file.read }
|
17
|
+
c['release_changes'] = changelog
|
18
|
+
c['preformatted'] = true
|
19
|
+
|
20
|
+
files = ["#{pkg}.tgz", "#{pkg}.zip", "#{pkg}.gem"]
|
21
|
+
|
22
|
+
puts "Releasing #{PKG_NAME} v. #{PKG_VERSION}"
|
23
|
+
rf.add_release RUBY_FORGE_PROJECT, PKG_NAME, PKG_VERSION, *files
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
namespace :doc do
|
28
|
+
desc 'Publish RDoc to RubyForge'
|
29
|
+
task :release => ['doc:rdoc'] do
|
30
|
+
require 'rake/contrib/sshpublisher'
|
31
|
+
require 'yaml'
|
32
|
+
|
33
|
+
config = YAML.load(
|
34
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
35
|
+
)
|
36
|
+
host = "#{config['username']}@rubyforge.org"
|
37
|
+
remote_dir = RUBY_FORGE_PATH + '/api'
|
38
|
+
local_dir = 'doc'
|
39
|
+
if !File.exist?('website/api')
|
40
|
+
system('mkdir website/api')
|
41
|
+
end
|
42
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
namespace :spec do
|
47
|
+
desc 'Publish specdoc to RubyForge'
|
48
|
+
task :release => ['spec:specdoc'] do
|
49
|
+
require 'rake/contrib/sshpublisher'
|
50
|
+
require 'yaml'
|
51
|
+
|
52
|
+
config = YAML.load(
|
53
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
54
|
+
)
|
55
|
+
host = "#{config['username']}@rubyforge.org"
|
56
|
+
remote_dir = RUBY_FORGE_PATH + '/specdoc'
|
57
|
+
local_dir = 'specdoc'
|
58
|
+
if !File.exist?('website/specdoc')
|
59
|
+
system('mkdir website/specdoc')
|
60
|
+
end
|
61
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
62
|
+
end
|
63
|
+
|
64
|
+
namespace :rcov do
|
65
|
+
desc 'Publish coverage report to RubyForge'
|
66
|
+
task :release => ['spec:rcov'] do
|
67
|
+
require 'rake/contrib/sshpublisher'
|
68
|
+
require 'yaml'
|
69
|
+
|
70
|
+
config = YAML.load(
|
71
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
72
|
+
)
|
73
|
+
host = "#{config['username']}@rubyforge.org"
|
74
|
+
remote_dir = RUBY_FORGE_PATH + '/coverage'
|
75
|
+
local_dir = 'coverage'
|
76
|
+
if !File.exist?('website/coverage')
|
77
|
+
system('mkdir website/coverage')
|
78
|
+
end
|
79
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
namespace :website do
|
85
|
+
desc 'Publish website to RubyForge'
|
86
|
+
task :init do
|
87
|
+
require 'rake/contrib/sshpublisher'
|
88
|
+
require 'yaml'
|
89
|
+
|
90
|
+
config = YAML.load(
|
91
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
92
|
+
)
|
93
|
+
host = "#{config['username']}@rubyforge.org"
|
94
|
+
remote_dir = RUBY_FORGE_PATH
|
95
|
+
local_dir = 'website'
|
96
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
97
|
+
end
|
98
|
+
|
99
|
+
desc 'Publish website to RubyForge'
|
100
|
+
task :release => [
|
101
|
+
'website:init', 'doc:release', 'spec:release', 'spec:rcov:release'
|
102
|
+
]
|
103
|
+
end
|
data/tasks/spec.rake
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'spec/rake/verify_rcov'
|
2
|
+
|
3
|
+
namespace :spec do
|
4
|
+
Spec::Rake::SpecTask.new(:rcov) do |t|
|
5
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
6
|
+
t.spec_opts = ['--color', '--format', 'specdoc']
|
7
|
+
if RCOV_ENABLED
|
8
|
+
if `which rcov`.strip == ''
|
9
|
+
STDERR.puts 'Please install rcov:'
|
10
|
+
STDERR.puts 'sudo gem install relevance-rcov'
|
11
|
+
exit(1)
|
12
|
+
end
|
13
|
+
t.rcov = true
|
14
|
+
else
|
15
|
+
t.rcov = false
|
16
|
+
end
|
17
|
+
t.rcov_opts = [
|
18
|
+
'--exclude', 'spec',
|
19
|
+
'--exclude', '\\.rvm\\/gems',
|
20
|
+
'--exclude', '1\\.8\\/gems',
|
21
|
+
'--exclude', '1\\.9\\/gems',
|
22
|
+
'--exclude', '\\.rvm',
|
23
|
+
'--exclude', '\\/Library\\/Ruby'
|
24
|
+
]
|
25
|
+
end
|
26
|
+
|
27
|
+
Spec::Rake::SpecTask.new(:normal) do |t|
|
28
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
29
|
+
t.spec_opts = ['--color', '--format', 'specdoc']
|
30
|
+
t.rcov = false
|
31
|
+
end
|
32
|
+
|
33
|
+
if RCOV_ENABLED
|
34
|
+
RCov::VerifyTask.new(:verify) do |t|
|
35
|
+
t.threshold = 100.0
|
36
|
+
t.index_html = 'coverage/index.html'
|
37
|
+
end
|
38
|
+
|
39
|
+
task :verify => :rcov
|
40
|
+
end
|
41
|
+
|
42
|
+
desc 'Generate HTML Specdocs for all specs'
|
43
|
+
Spec::Rake::SpecTask.new(:specdoc) do |t|
|
44
|
+
specdoc_path = File.expand_path(
|
45
|
+
File.join(File.dirname(__FILE__), '../specdoc/'))
|
46
|
+
Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path)
|
47
|
+
|
48
|
+
output_file = File.join(specdoc_path, 'index.html')
|
49
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
50
|
+
t.spec_opts = ['--format', "\"html:#{output_file}\"", '--diff']
|
51
|
+
t.fail_on_error = false
|
52
|
+
end
|
53
|
+
|
54
|
+
namespace :rcov do
|
55
|
+
desc 'Browse the code coverage report.'
|
56
|
+
task :browse => 'spec:rcov' do
|
57
|
+
require 'launchy'
|
58
|
+
Launchy::Browser.run('coverage/index.html')
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
if RCOV_ENABLED
|
64
|
+
desc 'Alias to spec:verify'
|
65
|
+
task 'spec' => 'spec:verify'
|
66
|
+
else
|
67
|
+
desc 'Alias to spec:normal'
|
68
|
+
task 'spec' => 'spec:normal'
|
69
|
+
end
|
70
|
+
|
71
|
+
task 'clobber' => ['spec:clobber_rcov']
|
data/tasks/yard.rake
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'yard'
|
5
|
+
require 'yard/rake/yardoc_task'
|
6
|
+
|
7
|
+
namespace :doc do
|
8
|
+
desc 'Generate Yardoc documentation'
|
9
|
+
YARD::Rake::YardocTask.new do |yardoc|
|
10
|
+
yardoc.name = 'yard'
|
11
|
+
yardoc.options = ['--verbose']
|
12
|
+
yardoc.files = [
|
13
|
+
'lib/**/*.rb', 'ext/**/*.c', 'README', 'CHANGELOG', 'LICENSE'
|
14
|
+
]
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
task 'clobber' => ['doc:clobber_yard']
|
19
|
+
|
20
|
+
desc 'Alias to doc:yard'
|
21
|
+
task 'doc' => 'doc:yard'
|
22
|
+
rescue LoadError
|
23
|
+
# If yard isn't available, it's not the end of the world
|
24
|
+
desc 'Alias to doc:rdoc'
|
25
|
+
task 'doc' => 'doc:rdoc'
|
26
|
+
end
|
data/website/index.html
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8"/>
|
5
|
+
<title>XRD</title>
|
6
|
+
<style type="text/css">
|
7
|
+
* {
|
8
|
+
font-size: 100%;
|
9
|
+
margin: 0;
|
10
|
+
padding: 0;
|
11
|
+
}
|
12
|
+
|
13
|
+
body {
|
14
|
+
font-family: "Lucida Grande", Verdana, sans-serif;
|
15
|
+
margin: 1em;
|
16
|
+
}
|
17
|
+
|
18
|
+
a {
|
19
|
+
color: #880000;
|
20
|
+
}
|
21
|
+
|
22
|
+
a:visited {
|
23
|
+
color: #333333;
|
24
|
+
}
|
25
|
+
|
26
|
+
h1 {
|
27
|
+
font-size: 2em;
|
28
|
+
margin: 0 0 0.8em 0;
|
29
|
+
text-align: center;
|
30
|
+
}
|
31
|
+
|
32
|
+
h2 {
|
33
|
+
font-size: 1em;
|
34
|
+
margin: 0.8em 0;
|
35
|
+
}
|
36
|
+
|
37
|
+
p {
|
38
|
+
margin: 0.8em 0;
|
39
|
+
}
|
40
|
+
|
41
|
+
ul {
|
42
|
+
font-size: 0.9em;
|
43
|
+
margin: 0 0 0 1.5em;
|
44
|
+
}
|
45
|
+
|
46
|
+
div {
|
47
|
+
width: 50%;
|
48
|
+
margin: 0 auto;
|
49
|
+
padding: 0.8em;
|
50
|
+
background-color: #AA5852;
|
51
|
+
border: 2px solid #C2645D;
|
52
|
+
}
|
53
|
+
|
54
|
+
@media print {
|
55
|
+
body {
|
56
|
+
font-size: 0.9em;
|
57
|
+
}
|
58
|
+
|
59
|
+
a {
|
60
|
+
text-decoration: none;
|
61
|
+
color: #000;
|
62
|
+
}
|
63
|
+
}
|
64
|
+
</style>
|
65
|
+
</head>
|
66
|
+
<body>
|
67
|
+
<h1>XRD</h1>
|
68
|
+
<div>
|
69
|
+
<p>
|
70
|
+
An XRD parser and generator for Ruby.
|
71
|
+
</p>
|
72
|
+
<ul>
|
73
|
+
<li>
|
74
|
+
<a href="http://rubyforge.org/projects/xrd/">
|
75
|
+
Project Page
|
76
|
+
</a>
|
77
|
+
</li>
|
78
|
+
<li>
|
79
|
+
<a href="http://github.com/sporkmonger/xrd/tree/">
|
80
|
+
GitHub Page
|
81
|
+
</a>
|
82
|
+
</li>
|
83
|
+
<li><a href="/api/">API</a></li>
|
84
|
+
<li><a href="/specdoc/">Specifications</a></li>
|
85
|
+
<li><a href="/coverage/">Code Coverage</a></li>
|
86
|
+
</ul>
|
87
|
+
<p>
|
88
|
+
You know what to do:
|
89
|
+
</p>
|
90
|
+
<p>
|
91
|
+
<code>sudo gem install xrd</code>
|
92
|
+
</p>
|
93
|
+
</div>
|
94
|
+
</body>
|
95
|
+
</html>
|