curies 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,48 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+ require File.dirname(__FILE__) + '/../lib/curies.rb'
3
+
4
+ describe "The Curie library" do
5
+ it "should be able to parse a safe curie into a fully qualified URI" do
6
+ Curie.parse("[foaf:person]").should eql("http://xmlns.com/foaf/0.1/person")
7
+ end
8
+
9
+ it "should be able to parse a safe curie into its components, a fully qualified prefix and a reference" do
10
+ Curie.parse("[foaf:person]", :in_parts => true).should eql(["http://xmlns.com/foaf/0.1/", "person"])
11
+ end
12
+
13
+ it "should be able to parse a standard curie into a fully qualified URI" do
14
+ Curie.parse("foaf:person").should eql("http://xmlns.com/foaf/0.1/person")
15
+ end
16
+
17
+ it "should be able to parse a standard curie into its components, a fully qualified prefix and a reference" do
18
+ Curie.parse("foaf:person", :in_parts => true).should eql(["http://xmlns.com/foaf/0.1/", "person"])
19
+ end
20
+
21
+ it "should raise an error when parsing a curie whose prefix has not been registed" do
22
+ lambda { Curie.parse("foo:bar") }.should raise_error("Sorry, no namespace or prefix registered for curies with the prefix foo")
23
+ end
24
+
25
+ it "should allow users to add new prefixes when the prefix is a symbol" do
26
+ Curie.add_prefixes! :foo => "http://foobaz.com"
27
+ Curie.parse("foo:bar", :in_parts => true).should eql(["http://foobaz.com", "bar"])
28
+ end
29
+
30
+ it "should allow users to add new prefixes when the prefix is a string" do
31
+ Curie.add_prefixes! "foo" => "http://foobaz.com"
32
+ Curie.parse("foo:bar", :in_parts => true).should eql(["http://foobaz.com", "bar"])
33
+ end
34
+
35
+ it "should allow users to remove prefixes when the prefix is a string" do
36
+ Curie.add_prefixes! "foo" => "http://foobaz.com"
37
+ Curie.parse("foo:bar", :in_parts => true).should eql(["http://foobaz.com", "bar"])
38
+ Curie.remove_prefixes! "foo"
39
+ lambda { Curie.parse("foo:bar") }.should raise_error("Sorry, no namespace or prefix registered for curies with the prefix foo")
40
+ end
41
+
42
+ it "should allow users to remove prefixes when the prefix is a string" do
43
+ Curie.add_prefixes! "foo" => "http://foobaz.com"
44
+ Curie.parse("foo:bar", :in_parts => true).should eql(["http://foobaz.com", "bar"])
45
+ Curie.remove_prefixes! :foo
46
+ lambda { Curie.parse("foo:bar") }.should raise_error("Sorry, no namespace or prefix registered for curies with the prefix foo")
47
+ end
48
+ end
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,7 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ gem 'rspec'
6
+ require 'spec'
7
+ end
@@ -0,0 +1,34 @@
1
+ desc 'Release the website and new gem version'
2
+ task :deploy => [:check_version, :website, :release] do
3
+ puts "Remember to create SVN tag:"
4
+ puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
5
+ "svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
6
+ puts "Suggested comment:"
7
+ puts "Tagging release #{CHANGES}"
8
+ end
9
+
10
+ desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
11
+ task :local_deploy => [:website_generate, :install_gem]
12
+
13
+ task :check_version do
14
+ unless ENV['VERSION']
15
+ puts 'Must pass a VERSION=x.y.z release version'
16
+ exit
17
+ end
18
+ unless ENV['VERSION'] == VERS
19
+ puts "Please update your version.rb to match the release version, currently #{VERS}"
20
+ exit
21
+ end
22
+ end
23
+
24
+ desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
25
+ task :install_gem_no_doc => [:clean, :package] do
26
+ sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
27
+ end
28
+
29
+ namespace :manifest do
30
+ desc 'Recreate Manifest.txt to include ALL files'
31
+ task :refresh do
32
+ `rake check_manifest | patch -p0 > Manifest.txt`
33
+ end
34
+ end
@@ -0,0 +1,7 @@
1
+ task :ruby_env do
2
+ RUBY_APP = if RUBY_PLATFORM =~ /java/
3
+ "jruby"
4
+ else
5
+ "ruby"
6
+ end unless defined? RUBY_APP
7
+ end
@@ -0,0 +1,17 @@
1
+ desc 'Generate website files'
2
+ task :website_generate => :ruby_env do
3
+ (Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
4
+ sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
5
+ end
6
+ end
7
+
8
+ desc 'Upload website files to rubyforge'
9
+ task :website_upload do
10
+ host = "#{rubyforge_username}@rubyforge.org"
11
+ remote_dir = "/var/www/gforge-projects/#{PATH}/"
12
+ local_dir = 'website'
13
+ sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
14
+ end
15
+
16
+ desc 'Generate and upload website files'
17
+ task :website => [:website_generate, :website_upload, :publish_docs]
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: curies
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Pius Uzamere
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-11-10 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: hoe
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.3.2
24
+ version:
25
+ description: Curies implements the CURIE syntax for expressing Compact URIs. See http://www.w3.org/TR/curie/ for more information.
26
+ email:
27
+ - pius+curie@uyiosa.com
28
+ executables: []
29
+
30
+ extensions: []
31
+
32
+ extra_rdoc_files:
33
+ - History.txt
34
+ - License.txt
35
+ - Manifest.txt
36
+ - README.txt
37
+ files:
38
+ - History.txt
39
+ - License.txt
40
+ - Manifest.txt
41
+ - README.txt
42
+ - Rakefile
43
+ - config/hoe.rb
44
+ - config/requirements.rb
45
+ - lib/curies.rb
46
+ - lib/curies/curie.rb
47
+ - lib/curies/version.rb
48
+ - log/debug.log
49
+ - script/destroy
50
+ - script/generate
51
+ - script/txt2html
52
+ - setup.rb
53
+ - spec/curies_spec.rb
54
+ - spec/spec.opts
55
+ - spec/spec_helper.rb
56
+ - tasks/deployment.rake
57
+ - tasks/environment.rake
58
+ - tasks/website.rake
59
+ has_rdoc: true
60
+ homepage: http://curies.rubyforge.org
61
+ licenses: []
62
+
63
+ post_install_message:
64
+ rdoc_options:
65
+ - --main
66
+ - README.txt
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: "0"
74
+ version:
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: "0"
80
+ version:
81
+ requirements: []
82
+
83
+ rubyforge_project: curies
84
+ rubygems_version: 1.3.5
85
+ signing_key:
86
+ specification_version: 3
87
+ summary: Curies implements the CURIE syntax for expressing Compact URIs. See http://www.w3.org/TR/curie/ for more information.
88
+ test_files: []
89
+