xing-backend-specdoc 0.0.1 → 0.0.2

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: a4fb54b420e096821934f1179eb5c9f274f70deb
4
- data.tar.gz: b0624e2586339eb47c2b6e18fc1165cb422dec75
3
+ metadata.gz: 87322205a046b3423fdb285bf706517ce52474e1
4
+ data.tar.gz: 5b0531c181a0b7fb5744517418fa2c00e68389d3
5
5
  SHA512:
6
- metadata.gz: c70d8ad1026fa80d5d8545dfc76054ba26b530687e6455ee9f098d001c92d5148df66c7fd2f9755585362002a26167349dc7a73d85612e9c4af862e19e87bd0d
7
- data.tar.gz: 98efef1c24410242f382363ec918a5b583db04a50aa17aa6584d978cf867848b7272e47938d0d16f3ab066757055c50154da7bee95b3f041f407556e05bce69f
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 ||= JSON.parse(contents)
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 ||= JSON.pretty_generate(parsed_body)+"\n"
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)
@@ -21,7 +21,7 @@ module Xing
21
21
  end
22
22
 
23
23
  def store(doc)
24
- doc_hash[doc.base_filename].add(doc)
24
+ doc_hash[doc.base_filename].add(doc.document)
25
25
  end
26
26
 
27
27
  def record_docs
@@ -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 list.any?{|kept| not kept.different_from?(doc.parsed_body)}
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|
@@ -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.1
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-17 00:00:00.000000000 Z
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.1 Documentation
56
+ - xing-backend-specdoc-0.0.2 Documentation
57
57
  require_paths:
58
58
  - lib/
59
59
  required_ruby_version: !ruby/object:Gem::Requirement