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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8f49cec807395e10261501e6d5913c25fa11967
4
- data.tar.gz: f4effd1ab9acb46a5b798535f40e9c8605a0930b
3
+ metadata.gz: c6c281ea02fbf1be0d1cee4f7088433e6380d216
4
+ data.tar.gz: 66789aa3c79d0b51fa3dbd15fcf6cc93566927d1
5
5
  SHA512:
6
- metadata.gz: 0e6386aee4c2736708975fdea80b1117b9a005cb69a90557dd9c28c0697ed51632a7b69f356458003741cd55e183edb5447f8300974e46f79249952ee862da57
7
- data.tar.gz: 4cfbe0f022d1e0def50ea11f249abff7bbc0b0a9e03a05d8281dac312a155a100acf19a774398a14c75ba75ddcd70fe7505a61e083810bb7a97af0c2a7649868
6
+ metadata.gz: 4a4f42b629ce640513801117a23d6c900197b060e6c9ff880233e2675a3551a62ba24d2ef2e41d27e49efc873e52ccf4981a8b4c38b7fa99108297c66a125dd5
7
+ data.tar.gz: ea380458dc6fad431344b670b7fb78746db9869bff5bbae9fe79e7423c3caea1ad54ea5952a43067fb9a4e5c24e3a54272bda77444e60f2a8d727bdd0c0aad1c
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0.beta1
1
+ 0.3.0.beta2
@@ -9,6 +9,7 @@ module LD
9
9
  #
10
10
  # @author [Gregg Kellogg](http://greggkellogg.net/)
11
11
  module Patch
12
+ require 'ld/patch/format'
12
13
  autoload :Algebra, 'ld/patch/algebra'
13
14
  autoload :Meta, 'ld/patch/meta'
14
15
  autoload :Parser, 'ld/patch/parser'
@@ -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.beta1
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-02-22 00:00:00.000000000 Z
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.5.1
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.