xing-backend-specdoc 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/lib/xing/specdoc/document.rb +12 -2
- data/lib/xing/specdoc/module.rb +1 -1
- data/lib/xing/specdoc/winnower.rb +8 -2
- data/spec/document_spec.rb +8 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87322205a046b3423fdb285bf706517ce52474e1
|
4
|
+
data.tar.gz: 5b0531c181a0b7fb5744517418fa2c00e68389d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33482bf1989583b7badb4a50d4574e225f04a3e05e8b1432957885e0b4b86111fc791aae485cbac93e557df05e7807b7b8ae3d645ca18d6650aed9bbdf72ba63
|
7
|
+
data.tar.gz: adb9f1743612c50c2c071ad843d033b169c4dfec21278f41a2dc5f5ae33880137982bbf502bb0724d001f565e183730b9c2359548f17667ea8c864d893faafa4
|
@@ -10,11 +10,21 @@ module Xing
|
|
10
10
|
attr_reader :path, :contents
|
11
11
|
|
12
12
|
def parsed_body
|
13
|
-
@parsed_body ||=
|
13
|
+
@parsed_body ||=
|
14
|
+
if contents.empty?
|
15
|
+
{}
|
16
|
+
else
|
17
|
+
JSON.parse(contents)
|
18
|
+
end
|
14
19
|
end
|
15
20
|
|
16
21
|
def pretty_body
|
17
|
-
@pretty_body ||=
|
22
|
+
@pretty_body ||=
|
23
|
+
if contents.empty?
|
24
|
+
""
|
25
|
+
else
|
26
|
+
JSON.pretty_generate(parsed_body)+"\n"
|
27
|
+
end
|
18
28
|
end
|
19
29
|
|
20
30
|
def difference_from(other)
|
data/lib/xing/specdoc/module.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
module Xing
|
3
2
|
module SpecDoc
|
4
3
|
class Winnower
|
@@ -40,7 +39,9 @@ module Xing
|
|
40
39
|
|
41
40
|
def significant_docs
|
42
41
|
@incoming_docs.reduce([]) do |list, doc|
|
43
|
-
if
|
42
|
+
if doc.contents.empty?
|
43
|
+
list
|
44
|
+
elsif list.any?{|kept| not kept.different_from?(doc.parsed_body)}
|
44
45
|
list
|
45
46
|
else
|
46
47
|
list + [doc]
|
@@ -49,6 +50,11 @@ module Xing
|
|
49
50
|
end
|
50
51
|
|
51
52
|
def resolve_against_existing(doc, list)
|
53
|
+
if doc.contents.empty?
|
54
|
+
@obsolete_paths << doc.path
|
55
|
+
return list
|
56
|
+
end
|
57
|
+
|
52
58
|
old_doc = JSON.parse(doc.contents)
|
53
59
|
|
54
60
|
keep, trash = list.partition do |doc|
|
data/spec/document_spec.rb
CHANGED
@@ -40,6 +40,14 @@ describe Xing::SpecDoc::Document do
|
|
40
40
|
our_hash.to_json
|
41
41
|
end
|
42
42
|
|
43
|
+
context "with an empty content" do
|
44
|
+
it "should work okay" do
|
45
|
+
doc = Xing::SpecDoc::Document.new("somewhere", "")
|
46
|
+
expect(doc.parsed_body).to eq({})
|
47
|
+
expect(doc.pretty_body).to eq("")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
43
51
|
context "should not register difference" do
|
44
52
|
let :is_diff do
|
45
53
|
false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xing-backend-specdoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Judson Lester
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hashdiff
|
@@ -53,7 +53,7 @@ rdoc_options:
|
|
53
53
|
- "--main"
|
54
54
|
- doc/README
|
55
55
|
- "--title"
|
56
|
-
- xing-backend-specdoc-0.0.
|
56
|
+
- xing-backend-specdoc-0.0.2 Documentation
|
57
57
|
require_paths:
|
58
58
|
- lib/
|
59
59
|
required_ruby_version: !ruby/object:Gem::Requirement
|