Skip to content

Commit b4cb770

Browse files
committed
Finish 2.0.0.beta2
2 parents b525150 + 31ea4e1 commit b4cb770

30 files changed

Lines changed: 601 additions & 376 deletions

CONTRIBUTING.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# How to contribute
2+
3+
Community contributions are essential for keeping Ruby RDF great. We want to keep it as easy as possible to contribute changes that get things working in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.
4+
5+
## Development
6+
7+
This repository uses [Git Flow](https://github.com/nvie/gitflow) to manage development and release activity. All submissions _must_ be on a feature branch based on the _develop_ branch to ease staging and integration.
8+
9+
* create or respond to an issue on the [Github Repository](http://github.com/ruby-rdf/rdf/issues)
10+
* Fork and clone the repo:
11+
`git clone git@github.com:your-username/rdf.git`
12+
* Install bundle:
13+
`bundle install`
14+
* Create tests in RSpec and make sure you achieve at least 90% code coverage for the feature your adding or behavior being modified.
15+
* Push to your fork and [submit a pull request][pr].
16+
17+
## Do's and Dont's
18+
* Do your best to adhere to the existing coding conventions and idioms.
19+
* Don't use hard tabs, and don't leave trailing whitespace on any line.
20+
Before committing, run `git diff --check` to make sure of this.
21+
* Do document every method you add using [YARD][] annotations. Read the
22+
[tutorial][YARD-GS] or just look at the existing code for examples.
23+
* Don't touch the `.gemspec` or `VERSION` files. If you need to change them,
24+
do so on your private branch only.
25+
* Do feel free to add yourself to the `CREDITS` file and the
26+
corresponding list in the the `README`. Alphabetical order applies.
27+
* Don't touch the `AUTHORS` file. If your contributions are significant
28+
enough, be assured we will eventually add you in there.
29+
* Do note that in order for us to merge any non-trivial changes (as a rule
30+
of thumb, additions larger than about 15 lines of code), we need an
31+
explicit [public domain dedication][PDD] on record from you.
32+
33+
[YARD]: http://yardoc.org/
34+
[YARD-GS]: http://rubydoc.info/docs/yard/file/docs/GettingStarted.md
35+
[PDD]: http://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
36+
[pr]: https://github.com/ruby-rdf/rdf/compare/

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,13 @@ Notably, {RDF::Queryable#query} and {RDF::Query#execute} are now completely symm
7979
When installed, RDF.rb includes a `rdf` shell script which acts as a wrapper to perform a number of different
8080
operations on RDF files using available readers and writers.
8181

82-
* `serialize`: Parse an RDF input and re-serializing to [N-Triples][] or another available format using `--output-format` option.
8382
* `count`: Parse and RDF input and count the number of statements.
84-
* `subjects`: Returns unique subjects from parsed input.
85-
* `objects`: Returns unique objects from parsed input.
8683
* `predicates`: Returns unique objects from parsed input.
84+
* `objects`: Returns unique objects from parsed input.
85+
* `serialize`: Parse an RDF input and re-serializing to [N-Triples][] or another available format using `--output-format` option.
86+
* `subjects`: Returns unique subjects from parsed input.
8787

88+
The `serialize` command can also be used to serialize as a vocabulary
8889
## Examples
8990

9091
require 'rdf'

Rakefile

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ task :doap do
3535
sh "bin/rdf serialize etc/doap.ttl --output etc/doap.nt"
3636
end
3737

38-
require 'linkeddata'
39-
require 'rdf/cli/vocab-loader'
38+
require 'rdf/vocab/writer'
4039

4140
desc "Generate Vocabularies"
4241
vocab_sources = {
@@ -72,18 +71,16 @@ task gen_vocabs: vocab_sources.keys.map {|v| "lib/rdf/vocab/#{v}.rb"}
7271
vocab_sources.each do |id, v|
7372
file "lib/rdf/vocab/#{id}.rb" => :do_build do
7473
puts "Generate lib/rdf/vocab/#{id}.rb"
74+
cmd = "bin/rdf serialize --uri '#{v[:uri]}' --output-format vocabulary"
75+
cmd += " --class-name #{id.to_s.upcase}"
76+
cmd += " -o lib/rdf/vocab/#{id}.rb_t"
77+
cmd += " --strict" if v.fetch(:strict, true)
78+
cmd += " '" + v.fetch(:source, v[:uri]) + "'"
79+
puts " #{cmd}"
7580
begin
76-
out = StringIO.new
77-
loader = RDF::VocabularyLoader.new(id.to_s.upcase)
78-
loader.uri = v[:uri]
79-
loader.source = v[:source] if v[:source]
80-
loader.extra = v[:extra] if v[:extra]
81-
loader.strict = v.fetch(:strict, true)
82-
loader.output = out
83-
loader.run
84-
out.rewind
85-
File.open("lib/rdf/vocab/#{id}.rb", "w") {|f| f.write out.read}
81+
%x{#{cmd} && mv lib/rdf/vocab/#{id}.rb_t lib/rdf/vocab/#{id}.rb}
8682
rescue
83+
%x{rm -f lib/rdf/vocab/#{id}.rb_t}
8784
puts "Failed to load #{id}: #{$!.message}"
8885
end
8986
end

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.0.0.beta1
1+
2.0.0.beta2

bin/rdf

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,19 @@ options = RDF::CLI.options do
1111
self.on('-V', '--version', 'Display the RDF.rb version and exit.') do
1212
puts RDF::VERSION; exit
1313
end
14+
15+
ARGV.select {|a| RDF::CLI.commands.include?(a)}.each do |cmd|
16+
# Load command-specific options
17+
Array(RDF::CLI::COMMANDS[cmd.to_sym][:options]).each do |cli_opt|
18+
on_args = cli_opt.on || []
19+
on_args << cli_opt.description if cli_opt.description
20+
self.on(*on_args) do |arg|
21+
self.options[cli_opt.symbol] = cli_opt.call(arg)
22+
end
23+
end
24+
end
1425
end
1526

1627
abort options.banner if ARGV.empty? && !options.options[:evaluate]
1728

18-
RDF::CLI.exec_command(command = ARGV.shift, ARGV, options.options)
29+
RDF::CLI.exec(ARGV, options.options)

0 commit comments

Comments
 (0)