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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 088033f899d0f090b97f68fa01ee1062c7fd721a
|
4
|
+
data.tar.gz: 7ca8d38827b1738728b76b141c0a7bf669a4e0e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
16
|
-
|
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
|
-
|
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
|
@@ -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
|
-
|
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
|