ld-patch 0.3.0.beta1 → 0.3.0.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/ld/patch.rb +1 -0
- data/lib/ld/patch/format.rb +53 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6c281ea02fbf1be0d1cee4f7088433e6380d216
|
4
|
+
data.tar.gz: 66789aa3c79d0b51fa3dbd15fcf6cc93566927d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a4f42b629ce640513801117a23d6c900197b060e6c9ff880233e2675a3551a62ba24d2ef2e41d27e49efc873e52ccf4981a8b4c38b7fa99108297c66a125dd5
|
7
|
+
data.tar.gz: ea380458dc6fad431344b670b7fb78746db9869bff5bbae9fe79e7423c3caea1ad54ea5952a43067fb9a4e5c24e3a54272bda77444e60f2a8d727bdd0c0aad1c
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.0.
|
1
|
+
0.3.0.beta2
|
data/lib/ld/patch.rb
CHANGED
@@ -0,0 +1,53 @@
|
|
1
|
+
module LD::Patch
|
2
|
+
##
|
3
|
+
# LD::Patch format specification. Note that this format does not define any readers or writers.
|
4
|
+
#
|
5
|
+
# @example Obtaining an LD Patch format class
|
6
|
+
# RDF::Format.for(:ldp) #=> LD::Patch::Format
|
7
|
+
# RDF::Format.for("etc/foaf.ldp")
|
8
|
+
# RDF::Format.for(:file_name => "etc/foaf.ldp")
|
9
|
+
# RDF::Format.for(file_extension: "ldp")
|
10
|
+
# RDF::Format.for(:content_type => "text/ldpatch")
|
11
|
+
#
|
12
|
+
# @see http://www.w3.org/TR/ldpatch/
|
13
|
+
class Format < RDF::Format
|
14
|
+
content_type 'text/ldpatch', extension: :ldp
|
15
|
+
content_encoding 'utf-8'
|
16
|
+
|
17
|
+
##
|
18
|
+
# Hash of CLI commands appropriate for this format
|
19
|
+
# @return [Hash{Symbol => Lambda(Array, Hash)}]
|
20
|
+
def self.cli_commands
|
21
|
+
{
|
22
|
+
patch: {
|
23
|
+
description: "Patch the current graph using a URI Encoded patch file, or a referenced path file/URI",
|
24
|
+
help: "patch [--patch 'patch'] [--patch-file file]",
|
25
|
+
parse: true,
|
26
|
+
lambda: -> (argv, opts) do
|
27
|
+
opts[:patch] ||= RDF::Util::File.open_file(opts[:patch_file]) {|f| f.read}
|
28
|
+
raise ArgumentError, "Patching requires a URI encoded patch or reference to patch resource" unless opts[:patch]
|
29
|
+
$stdout.puts "Patch"
|
30
|
+
patch = LD::Patch.parse(opts[:patch], base_uri: opts.fetch(:patch_file, "http://rubygems.org/gems/ld-patch"))
|
31
|
+
RDF::CLI.repository.query(patch)
|
32
|
+
end,
|
33
|
+
options: [
|
34
|
+
RDF::CLI::Option.new(
|
35
|
+
symbol: :patch,
|
36
|
+
datatype: String,
|
37
|
+
on: ["--patch STRING"],
|
38
|
+
description: "Patch in URI encoded format"
|
39
|
+
) {|v| URI.decode(v)},
|
40
|
+
RDF::CLI::Option.new(
|
41
|
+
symbol: :patch_file,
|
42
|
+
datatype: String,
|
43
|
+
on: ["--patch-file URI"],
|
44
|
+
description: "URI of patch file"
|
45
|
+
) {|v| RDF::URI(v)},
|
46
|
+
]
|
47
|
+
}
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.to_sym; :ldpatch; end
|
52
|
+
end
|
53
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ld-patch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.0.
|
4
|
+
version: 0.3.0.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregg Kellogg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdf
|
@@ -267,6 +267,7 @@ files:
|
|
267
267
|
- lib/ld/patch/algebra/prefix.rb
|
268
268
|
- lib/ld/patch/algebra/reverse.rb
|
269
269
|
- lib/ld/patch/algebra/update_list.rb
|
270
|
+
- lib/ld/patch/format.rb
|
270
271
|
- lib/ld/patch/meta.rb
|
271
272
|
- lib/ld/patch/parser.rb
|
272
273
|
- lib/ld/patch/terminals.rb
|
@@ -291,7 +292,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
291
292
|
version: 1.3.1
|
292
293
|
requirements: []
|
293
294
|
rubyforge_project: ld-patch
|
294
|
-
rubygems_version: 2.
|
295
|
+
rubygems_version: 2.4.8
|
295
296
|
signing_key:
|
296
297
|
specification_version: 4
|
297
298
|
summary: W3C Linked Data Patch Format for RDF.rb.
|