gcc-to-clang-analyzer 0.0.6 → 0.0.7

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: fcf5a94d9492a0ec261dd310b2e0a581525e361d
4
- data.tar.gz: 1788dbf79927d9ea5c3ed09bc58783c9c3119a31
3
+ metadata.gz: 088033f899d0f090b97f68fa01ee1062c7fd721a
4
+ data.tar.gz: 7ca8d38827b1738728b76b141c0a7bf669a4e0e4
5
5
  SHA512:
6
- metadata.gz: d0e970f305a3470ccea8f1de3455c27461d2ac121435011d362f80472bc4ecb2ff7d7612ef96037f256a2ebd4efe99000d535b982b9250764339425a32659888
7
- data.tar.gz: b1f70d051f762abc079bce0cb64498a70a1c174545d9dc6adef12bfb23cd85e372b690292a1702596bd130b0c849e9f2153a9448cd26c82ea8a825cf47c54d89
6
+ metadata.gz: 4bc73355082a846ad78dfaa608b8a192d74125483fc37c05c10627a8a08e8eaaeb1cb919f6d38f1c8226b8a58b7fb16859cc5bf1b9ca7e46273389e729dc2145
7
+ data.tar.gz: ebd14a2d34aab91804a11ba12b2d6fd707cbda8fe8d9e7fd1e5ac19e8e65673ad7d2741787be6f6649571ee7c53953d3efc6e53850ba58fea56f9fdc4f61573c
@@ -12,13 +12,16 @@ class RewritePlistFile
12
12
  def self.with_prefix(prefix, original)
13
13
  doc = REXML::Document.new(original)
14
14
  array_element = REXML::XPath.first(doc, "//key[text()='files']/following-sibling::array")
15
- array_element.elements.each do |s|
16
- s.text = File.join(prefix, s.text)
15
+ if array_element
16
+ array_element.elements.each do |s|
17
+ s.text = File.join(prefix, s.text)
18
+ end
19
+ res = StringIO.new
20
+ formatter = REXML::Formatters::Pretty.new(2)
21
+ formatter.compact = true
22
+ formatter.write(doc, res)
23
+ return res.string
17
24
  end
18
- res = StringIO.new
19
- formatter = REXML::Formatters::Pretty.new(2)
20
- formatter.compact = true
21
- formatter.write(doc, res)
22
- return res.string
25
+ return original
23
26
  end
24
27
  end
@@ -1,3 +1,3 @@
1
1
  module GccToClangAnalyzer
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -2,7 +2,7 @@ require 'gcc_to_clang_analyzer/rewrite_plist_file'
2
2
 
3
3
  describe RewritePlistFile do
4
4
  it 'should replace the files array with a prefixed version' do
5
- original_plist = <<-eos
5
+ original = <<-eos
6
6
  <?xml version="1.0" encoding="UTF-8"?>
7
7
  <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
8
8
  <plist version="1.0">
@@ -34,8 +34,24 @@ eos
34
34
  </plist>
35
35
  eos
36
36
  should_be_plist.strip!
37
-
38
- new_plist = RewritePlistFile.with_prefix('test', original_plist)
37
+ new_plist = RewritePlistFile.with_prefix('test', original)
39
38
  new_plist.should eq(should_be_plist)
40
39
  end
40
+
41
+ it 'should do nothing for empty file arrays' do
42
+ original = <<-eos
43
+ <?xml version='1.0' encoding='UTF-8'?>
44
+ <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
45
+ <plist version='1.0'>
46
+ <dict>
47
+ <key>clang_version</key>
48
+ <string>clang version 3.4 (trunk 182989)</string>
49
+ <key>files</key>
50
+ <array> </array>
51
+ </dict>
52
+ </plist>
53
+ eos
54
+ new_file = RewritePlistFile.with_prefix('test', original)
55
+ new_file.should eq(original.strip)
56
+ end
41
57
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gcc-to-clang-analyzer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Köstlin