java-checkstyle 1.0.0 → 1.0.3
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/README.md +8 -18
- data/java-checkstyle.gemspec +1 -1
- data/lib/plugins/{pre_commit → pre-commit}/checks/checkstyle.rb +0 -0
- data/lib/{pre-commit → plugins/pre-commit}/checkstyle/version.rb +5 -2
- data/lib/plugins/pre-commit/domain/bad_file.rb +18 -0
- data/lib/plugins/pre-commit/domain/checkstyle.rb +25 -0
- data/lib/plugins/pre-commit/message/extractor.rb +48 -0
- data/lib/plugins/{pre_commit → pre-commit}/message/formatter.rb +13 -18
- data/lib/plugins/{pre_commit → pre-commit}/support/path.rb +1 -1
- data/lib/{pre-commit/support → resources}/checkstyle/checkstyle-6.11-all.jar +0 -0
- data/lib/{pre-commit/support → resources}/checkstyle/google_checks.xml +0 -0
- data/readmedemo.png +0 -0
- data/spec/plugins/pre_commit/checks/checkstyle_spec.rb +1 -1
- data/spec/plugins/pre_commit/message/extractor_spec.rb +31 -16
- data/spec/plugins/pre_commit/message/formatter_spec.rb +31 -44
- metadata +13 -10
- data/lib/plugins/pre_commit/message/extractor.rb +0 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e339fa95b5ee175c07cf559479c5895eacc8ddf
|
4
|
+
data.tar.gz: a8e505970de9afb9051819568191d160bb57fb54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 544ed8c52e58bf1950ee606da1df6623d68a08e1fc0bafea8cffa2620a7a5a488e89baa8e82889a6c4b54723b22affcfd956345d27cf55ade03eeb2c2d20d010
|
7
|
+
data.tar.gz: 2b0befcd3dffc6f711299134aa1bd00bd3373f0307e81dcefa405f08f06c9e2783417100911e8d7bc22be4e7764eb8737b0df763ef90d3cc62428edd75b40153
|
data/README.md
CHANGED
@@ -4,13 +4,15 @@
|
|
4
4
|
[](https://codeclimate.com/github/CristianOliveiraDaRosa/java-checkstyle)
|
5
5
|
[](https://codeclimate.com/github/CristianOliveiraDaRosa/java-checkstyle/coverage)
|
6
6
|
|
7
|
-
Useful pre-commit hook for linting Java code.
|
7
|
+
Useful git pre-commit hook for linting Java code.
|
8
8
|
|
9
|
-
It uses
|
9
|
+
It uses as default [The Google Style Guide](https://google.github.io/styleguide/javaguide.html)
|
10
|
+
and the famous [Checkstyle](http://checkstyle.sourceforge.net/) linter as a plugin for [pre-commit](https://github.com/jish/pre-commit).
|
10
11
|
|
11
12
|
## Demo
|
12
13
|
|
13
14
|

|
15
|
+
[Don't you know who is Leeroy Jenkins?](https://www.youtube.com/watch?v=mLyOj_QD4a4)
|
14
16
|
|
15
17
|
## Installation
|
16
18
|
|
@@ -23,6 +25,9 @@ First install the gems.
|
|
23
25
|
|
24
26
|
gem install java-checkstyle
|
25
27
|
|
28
|
+
##### (optional) If you use RVM
|
29
|
+
Take a look here [Install with RVM](https://github.com/jish/pre-commit#rvm)
|
30
|
+
|
26
31
|
### Configuring
|
27
32
|
Use the pre-commit command to generate a stub pre-commit hook.
|
28
33
|
Inside folder of your git repo:
|
@@ -47,7 +52,7 @@ pre-commit enable yaml checks checkstyle
|
|
47
52
|
|
48
53
|
### Result
|
49
54
|
Every time you try to commit some java code with style errors it will validate
|
50
|
-
|
55
|
+
for you ensuring that your code will be always awesome.
|
51
56
|
|
52
57
|
---
|
53
58
|
#### Detailed version to install.
|
@@ -55,21 +60,6 @@ Still don't work? Try the detailed version [here](https://github.com/CristianOli
|
|
55
60
|
|
56
61
|
---
|
57
62
|
|
58
|
-
## Installing with RVM
|
59
|
-
|
60
|
-
If you are using rvm you need to install pre-commit into the ```default``` gemset, because it does not use the ```current``` environment
|
61
|
-
|
62
|
-
$ rvm default do gem install pre-commit
|
63
|
-
|
64
|
-
Alternatively you can configure pre-commit to use the ```current``` rvm gemset
|
65
|
-
|
66
|
-
$ git config pre-commit.ruby "rvm `rvm current` do ruby"
|
67
|
-
|
68
|
-
More details about this part see on:
|
69
|
-
[pre-commit](https://github.com/jish/pre-commit)
|
70
|
-
|
71
|
-
And your pre-commit hook has been configured.
|
72
|
-
|
73
63
|
## Checkstyle Guide
|
74
64
|
|
75
65
|
It uses as default [The Google Style Guide](https://google.github.io/styleguide/javaguide.html).
|
data/java-checkstyle.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'pre-commit/checkstyle/version'
|
4
|
+
require './lib/plugins/pre-commit/checkstyle/version.rb'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "java-checkstyle"
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
##
|
2
|
-
# This a fork version of the original
|
2
|
+
# This is a fork version of the original
|
3
3
|
# checkstyle:
|
4
4
|
# https://github.com/secondrotation/pre-commit-checkstyle
|
5
5
|
#
|
@@ -10,7 +10,10 @@ module PreCommit
|
|
10
10
|
# Allen Madsen (Original Version 0.0.1)
|
11
11
|
# Cristian Oliveira
|
12
12
|
# Alex Rocha
|
13
|
+
#
|
14
|
+
# Main file: checks/checkstyle.rb
|
15
|
+
|
13
16
|
module Checkstyle
|
14
|
-
VERSION = '1.0.
|
17
|
+
VERSION = '1.0.3'
|
15
18
|
end
|
16
19
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Domain
|
2
|
+
##
|
3
|
+
# Represents a file with style errors.
|
4
|
+
#
|
5
|
+
class BadFile
|
6
|
+
attr_reader :name, :errors
|
7
|
+
|
8
|
+
##
|
9
|
+
# Instanciate a default bad file.
|
10
|
+
#
|
11
|
+
# @param [String] The File name
|
12
|
+
# @param [Array] The errors
|
13
|
+
def initialize(name, errors)
|
14
|
+
@name = name
|
15
|
+
@errors = errors
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Domain
|
2
|
+
##
|
3
|
+
# Represents the Checkstyle
|
4
|
+
# @param [Array] of bad files
|
5
|
+
class Checkstyle
|
6
|
+
attr_reader :bad_files
|
7
|
+
|
8
|
+
def initialize(bad_files)
|
9
|
+
@bad_files = bad_files
|
10
|
+
end
|
11
|
+
|
12
|
+
##
|
13
|
+
# A good checkstyle means no errors.
|
14
|
+
#
|
15
|
+
def good?
|
16
|
+
@bad_files.nil? || @bad_files.empty?
|
17
|
+
end
|
18
|
+
|
19
|
+
##
|
20
|
+
# Factory for Checkstyle without errors
|
21
|
+
def self.good
|
22
|
+
Domain::Checkstyle.new(nil)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'crack'
|
2
|
+
require_relative '../domain/checkstyle'
|
3
|
+
require_relative '../domain/bad_file'
|
4
|
+
|
5
|
+
module PreCommit
|
6
|
+
module Message
|
7
|
+
##
|
8
|
+
# Responsible for extract error messages from terminal output
|
9
|
+
class Extractor
|
10
|
+
##
|
11
|
+
# Extract data from a XML formatted +output+
|
12
|
+
#
|
13
|
+
# @param output [String] Xml formatted ouput
|
14
|
+
# @return [Hash]
|
15
|
+
def extract(output)
|
16
|
+
return Domain::Checkstyle.good if output.nil? || output.empty?
|
17
|
+
xml_data = Crack::XML.parse(xml_content(output))
|
18
|
+
|
19
|
+
files = xml_data['checkstyle']['file']
|
20
|
+
|
21
|
+
Domain::Checkstyle.new(extract_bad_file(files))
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def xml_content(raw_output)
|
27
|
+
raw_output[/<(.*)>/m]
|
28
|
+
end
|
29
|
+
|
30
|
+
def extract_bad_file(xml_files)
|
31
|
+
return [create_bad_file(xml_files)] unless xml_files.is_a? Array
|
32
|
+
|
33
|
+
xml_files.reduce([]) { |a, e| a.push(create_bad_file(e)) }
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_bad_file(file)
|
37
|
+
Domain::BadFile.new(file['name'], extract_errors(file['error']))
|
38
|
+
end
|
39
|
+
|
40
|
+
def extract_errors(xml_errors)
|
41
|
+
return [] if xml_errors.nil? || xml_errors.empty?
|
42
|
+
return [xml_errors] unless xml_errors.is_a? Array
|
43
|
+
|
44
|
+
xml_errors
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -10,37 +10,32 @@ module PreCommit
|
|
10
10
|
# @return [String] formatted output (may return nil)
|
11
11
|
# @raise ArgumentError when input is empty
|
12
12
|
#
|
13
|
-
def format(
|
14
|
-
throw ArgumentError.new if
|
13
|
+
def format(checkstyle)
|
14
|
+
throw ArgumentError.new if checkstyle.nil?
|
15
|
+
return nil if checkstyle.good?
|
15
16
|
|
16
|
-
|
17
|
-
|
18
|
-
return nil if files.empty?
|
19
|
-
return format_single(files) unless files.is_a? Array
|
20
|
-
|
21
|
-
format_multiple(files)
|
17
|
+
format_multiple(checkstyle.bad_files)
|
22
18
|
end
|
23
19
|
|
24
20
|
private
|
25
21
|
|
26
|
-
def
|
27
|
-
|
28
|
-
|
22
|
+
def format_multiple(files)
|
23
|
+
files.reduce('') { |a, e| a + format_single(e) }
|
24
|
+
end
|
25
|
+
|
26
|
+
def format_single(bad_file)
|
27
|
+
"File errors: #{bad_file.name} \n" + format_errors(bad_file.errors)
|
29
28
|
end
|
30
29
|
|
31
30
|
def format_errors(errors)
|
32
|
-
return line(errors) unless errors.is_a? Array
|
33
31
|
errors.reduce('') do |out, error|
|
34
32
|
out + line(error)
|
35
33
|
end
|
36
34
|
end
|
37
35
|
|
38
|
-
def
|
39
|
-
"
|
40
|
-
|
41
|
-
|
42
|
-
def format_multiple(files)
|
43
|
-
files.reduce('') { |a, e| a + format_single(e) }
|
36
|
+
def line(error)
|
37
|
+
" line: #{error['line']}:#{error['column']}"\
|
38
|
+
" error: #{error['message']}\n"
|
44
39
|
end
|
45
40
|
end
|
46
41
|
end
|
File without changes
|
File without changes
|
data/readmedemo.png
CHANGED
Binary file
|
@@ -1,34 +1,44 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'plugins/
|
2
|
+
require 'plugins/pre-commit/message/extractor'
|
3
|
+
require 'plugins/pre-commit/domain/checkstyle'
|
4
|
+
require 'plugins/pre-commit/domain/bad_file'
|
5
|
+
|
3
6
|
##
|
4
7
|
# Tests for PreCommit::Message::Extractor
|
5
8
|
describe PreCommit::Message::Extractor do
|
6
9
|
let(:extractor) { PreCommit::Message::Extractor.new }
|
7
10
|
|
8
|
-
context "
|
9
|
-
it "should
|
11
|
+
context "When nil output" do
|
12
|
+
it "should be good" do
|
10
13
|
result = extractor.extract nil
|
11
|
-
expect(result
|
14
|
+
expect(result).to be_good
|
12
15
|
end
|
16
|
+
end
|
13
17
|
|
14
|
-
|
18
|
+
context "When empty output" do
|
19
|
+
it "should be good" do
|
15
20
|
result = extractor.extract ''
|
16
|
-
expect(result
|
21
|
+
expect(result).to be_good
|
17
22
|
end
|
18
23
|
end
|
19
24
|
|
20
|
-
context "has one bad file" do
|
25
|
+
context "When has one bad file" do
|
21
26
|
# given
|
22
27
|
let(:output) { IO.read(fixture_file("output_one_bad_file.log")) }
|
23
28
|
|
29
|
+
it "should not be good" do
|
30
|
+
result = extractor.extract output
|
31
|
+
expect(result).to_not be_good
|
32
|
+
end
|
33
|
+
|
24
34
|
it "should contain one single file" do
|
25
35
|
result = extractor.extract output
|
26
|
-
expect(result
|
36
|
+
expect(result.bad_files).to be_a Array
|
27
37
|
end
|
28
38
|
|
29
39
|
it "should contain its errors" do
|
30
40
|
result = extractor.extract output
|
31
|
-
expect(result[
|
41
|
+
expect(result.bad_files[0].errors.size).to eq 2
|
32
42
|
end
|
33
43
|
|
34
44
|
it "should extract error details" do
|
@@ -49,23 +59,28 @@ describe PreCommit::Message::Extractor do
|
|
49
59
|
]
|
50
60
|
|
51
61
|
result = extractor.extract output
|
52
|
-
errors = result[
|
62
|
+
errors = result.bad_files[0].errors
|
53
63
|
expect(errors).to eq expected
|
54
64
|
end
|
55
65
|
end
|
56
66
|
|
57
|
-
context "has multiple bad files" do
|
67
|
+
context "When has multiple bad files" do
|
58
68
|
let(:output) { IO.read(fixture_file("output_two_bad_files.log")) }
|
59
69
|
|
70
|
+
it "should not be good" do
|
71
|
+
result = extractor.extract output
|
72
|
+
expect(result).to_not be_good
|
73
|
+
end
|
74
|
+
|
60
75
|
it "should extract multiple files" do
|
61
76
|
result = extractor.extract output
|
62
|
-
expect(result
|
77
|
+
expect(result.bad_files).to be_a Array
|
63
78
|
end
|
64
79
|
|
65
80
|
it "should extract their errors" do
|
66
81
|
result = extractor.extract output
|
67
|
-
expect(result[
|
68
|
-
expect(result[
|
82
|
+
expect(result.bad_files[0].errors.size).to eq 2
|
83
|
+
expect(result.bad_files[1].errors.size).to eq 2
|
69
84
|
end
|
70
85
|
|
71
86
|
it "should extract error details" do
|
@@ -86,8 +101,8 @@ describe PreCommit::Message::Extractor do
|
|
86
101
|
]
|
87
102
|
|
88
103
|
result = extractor.extract output
|
89
|
-
|
90
|
-
expect(errors).to eq expected
|
104
|
+
|
105
|
+
expect(result.bad_files[0].errors).to eq expected
|
91
106
|
end
|
92
107
|
end
|
93
108
|
end
|
@@ -1,67 +1,54 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'plugins/
|
2
|
+
require 'plugins/pre-commit/message/formatter'
|
3
|
+
require 'plugins/pre-commit/domain/checkstyle'
|
4
|
+
require 'plugins/pre-commit/domain/bad_file'
|
5
|
+
|
3
6
|
##
|
4
7
|
# Tests for PreCommit::Message::Formatter
|
5
8
|
describe PreCommit::Message::Formatter do
|
6
9
|
let(:formatter) { PreCommit::Message::Formatter.new }
|
7
10
|
|
11
|
+
let(:file_error) {
|
12
|
+
Domain::BadFile.new('/some/path/file_name.java',
|
13
|
+
[{
|
14
|
+
"line"=>"1",
|
15
|
+
"severity"=>"error",
|
16
|
+
"message"=>"some error message",
|
17
|
+
"source"=>"com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTypeCheck"
|
18
|
+
}])
|
19
|
+
}
|
20
|
+
|
21
|
+
let(:file_error_2) {
|
22
|
+
Domain::BadFile.new('/some/path/file_name2.java',
|
23
|
+
[{
|
24
|
+
"line"=>"11",
|
25
|
+
"column"=>"40",
|
26
|
+
"severity"=>"error",
|
27
|
+
"message"=>"some error message",
|
28
|
+
"source"=>"com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTypeCheck"
|
29
|
+
}])
|
30
|
+
|
31
|
+
}
|
32
|
+
|
8
33
|
context "When has empty input" do
|
9
34
|
it {expect{ formatter.format(nil) }.to raise_error(ArgumentError)}
|
10
|
-
it {expect{ formatter.format('') }.to raise_error(ArgumentError)}
|
11
35
|
end
|
12
36
|
|
13
37
|
context "When has no errors" do
|
14
|
-
let(:
|
15
|
-
it { expect(formatter.format(
|
38
|
+
let(:good) { Domain::Checkstyle.good }
|
39
|
+
it { expect(formatter.format(good)).to be_nil }
|
16
40
|
end
|
17
41
|
|
18
42
|
context "When has one file" do
|
19
|
-
let(:errors)
|
20
|
-
{ 'checkstyle' => {
|
21
|
-
'file' => {
|
22
|
-
'name' => '/some/path/file_name.java',
|
23
|
-
'error' => [{
|
24
|
-
"line"=>"1",
|
25
|
-
"column"=>"40",
|
26
|
-
"severity"=>"error",
|
27
|
-
"message"=>"some error message",
|
28
|
-
"source"=>"com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTypeCheck"
|
29
|
-
}]
|
30
|
-
}
|
31
|
-
}
|
32
|
-
}
|
33
|
-
end
|
43
|
+
let(:errors) { Domain::Checkstyle.new( [ file_error ] ) }
|
34
44
|
|
35
45
|
it{ expect(formatter.format(errors)).to include "File errors: /some/path/file_name.java"}
|
36
|
-
it{ expect(formatter.format(errors)).to include " line: 1:
|
46
|
+
it{ expect(formatter.format(errors)).to include " line: 1: error: some error message"}
|
37
47
|
end
|
38
48
|
|
39
49
|
context "When has more than one file" do
|
40
50
|
let(:errors) do
|
41
|
-
|
42
|
-
'file' => [
|
43
|
-
{
|
44
|
-
'name' => '/some/path/file_name.java',
|
45
|
-
'error' => [{
|
46
|
-
"line"=>"1",
|
47
|
-
"severity"=>"error",
|
48
|
-
"message"=>"some error message",
|
49
|
-
"source"=>"com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTypeCheck"
|
50
|
-
}]
|
51
|
-
},
|
52
|
-
{
|
53
|
-
'name' => '/some/path/file_name2.java',
|
54
|
-
'error' => [{
|
55
|
-
"line"=>"11",
|
56
|
-
"column"=>"40",
|
57
|
-
"severity"=>"error",
|
58
|
-
"message"=>"some error message",
|
59
|
-
"source"=>"com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTypeCheck"
|
60
|
-
}]
|
61
|
-
}
|
62
|
-
]
|
63
|
-
}
|
64
|
-
}
|
51
|
+
Domain::Checkstyle.new( [ file_error, file_error_2 ] )
|
65
52
|
end
|
66
53
|
|
67
54
|
it{ expect(formatter.format(errors)).to include "File errors: /some/path/file_name.java"}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: java-checkstyle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Allen Madsen
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-10-
|
13
|
+
date: 2015-10-13 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: pre-commit
|
@@ -107,13 +107,15 @@ files:
|
|
107
107
|
- Rakefile
|
108
108
|
- demo.png
|
109
109
|
- java-checkstyle.gemspec
|
110
|
-
- lib/plugins/
|
111
|
-
- lib/plugins/
|
112
|
-
- lib/plugins/
|
113
|
-
- lib/plugins/
|
114
|
-
- lib/pre-commit/
|
115
|
-
- lib/pre-commit/
|
116
|
-
- lib/pre-commit/support/
|
110
|
+
- lib/plugins/pre-commit/checks/checkstyle.rb
|
111
|
+
- lib/plugins/pre-commit/checkstyle/version.rb
|
112
|
+
- lib/plugins/pre-commit/domain/bad_file.rb
|
113
|
+
- lib/plugins/pre-commit/domain/checkstyle.rb
|
114
|
+
- lib/plugins/pre-commit/message/extractor.rb
|
115
|
+
- lib/plugins/pre-commit/message/formatter.rb
|
116
|
+
- lib/plugins/pre-commit/support/path.rb
|
117
|
+
- lib/resources/checkstyle/checkstyle-6.11-all.jar
|
118
|
+
- lib/resources/checkstyle/google_checks.xml
|
117
119
|
- readmedemo.png
|
118
120
|
- spec/fixtures/bad.java
|
119
121
|
- spec/fixtures/bad2.java
|
@@ -145,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
147
|
version: '0'
|
146
148
|
requirements: []
|
147
149
|
rubyforge_project:
|
148
|
-
rubygems_version: 2.4.
|
150
|
+
rubygems_version: 2.4.8
|
149
151
|
signing_key:
|
150
152
|
specification_version: 4
|
151
153
|
summary: Checkstyle linter plugin for pre-commit
|
@@ -160,3 +162,4 @@ test_files:
|
|
160
162
|
- spec/plugins/pre_commit/message/extractor_spec.rb
|
161
163
|
- spec/plugins/pre_commit/message/formatter_spec.rb
|
162
164
|
- spec/spec_helper.rb
|
165
|
+
has_rdoc:
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'crack'
|
2
|
-
|
3
|
-
module PreCommit
|
4
|
-
module Message
|
5
|
-
##
|
6
|
-
# Responsible for extract error messages from terminal output
|
7
|
-
class Extractor
|
8
|
-
EMPTY = { 'checkstyle' => { 'file' => [] } }
|
9
|
-
|
10
|
-
##
|
11
|
-
# Extract data from a XML formatted +output+
|
12
|
-
#
|
13
|
-
# @param output [String] Xml formatted ouput
|
14
|
-
# @return [Hash]
|
15
|
-
def extract(output)
|
16
|
-
return EMPTY if output.nil? || output.empty?
|
17
|
-
Crack::XML.parse(xml_content(output))
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def xml_content(raw_output)
|
23
|
-
raw_output[/<(.*)>/m]
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|