conpar 0.1.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +9 -1
- data/lib/conpar/directive/base.rb +2 -1
- data/lib/conpar/document.rb +1 -1
- data/lib/conpar/version.rb +1 -1
- data/spec/lib/document_spec.rb +13 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
# Conpar
|
1
|
+
# Conpar
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/conpar.svg)](http://badge.fury.io/rb/conpar)
|
3
3
|
[![Build Status](https://travis-ci.org/CITguy/conpar.png?branch=master)](https://travis-ci.org/CITguy/conpar)
|
4
4
|
[![Coverage Status](https://coveralls.io/repos/CITguy/conpar/badge.png?branch=master)](https://coveralls.io/r/CITguy/conpar?branch=master)
|
5
|
+
[![Dependency Status](https://gemnasium.com/CITguy/conpar.svg)](https://gemnasium.com/CITguy/conpar)
|
5
6
|
|
6
7
|
Conpar (short for Configuration Parser) is designed to be a flexible and extendable library for parsing through a Firewall configuration file by tokenizing the configuration directives into ruby objects for evaluation.
|
7
8
|
|
@@ -37,6 +38,12 @@ The returned array will have parsed every line in the configuration string into
|
|
37
38
|
## Configuration
|
38
39
|
**NOTE:** While configuration _is_ functional, it is **not** advised to do any configuration for the current version of this gem.
|
39
40
|
|
41
|
+
## CHANGELOG
|
42
|
+
### 0.2.0
|
43
|
+
* Minor version bumped due to potentially breaking change in functionality.
|
44
|
+
* Changes
|
45
|
+
* Directive line_number now returns a string that is in the same encoding as the line it refers.
|
46
|
+
|
40
47
|
## Contributing
|
41
48
|
|
42
49
|
1. Fork it
|
@@ -44,3 +51,4 @@ The returned array will have parsed every line in the configuration string into
|
|
44
51
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
45
52
|
4. Push to the branch (`git push origin my-new-feature`)
|
46
53
|
5. Create new Pull Request
|
54
|
+
|
@@ -5,8 +5,9 @@ module Conpar
|
|
5
5
|
SIGNATURE = /^(.*)$/ # Matches any non-empty string
|
6
6
|
|
7
7
|
# @!attribute [rw] line_number
|
8
|
-
# @return [
|
8
|
+
# @return [String]
|
9
9
|
# 1-based line number within the configuration
|
10
|
+
# String returned is in same encoding as the line it refers
|
10
11
|
attr_accessor :line_number
|
11
12
|
|
12
13
|
# @!attribute [rw] line_span
|
data/lib/conpar/document.rb
CHANGED
data/lib/conpar/version.rb
CHANGED
data/spec/lib/document_spec.rb
CHANGED
@@ -46,11 +46,23 @@ describe Conpar::Document do
|
|
46
46
|
end
|
47
47
|
it { expect(acls).to have(1).item }
|
48
48
|
it "first acl should be on line #3" do
|
49
|
-
expect(acls.first.line_number).to eq(3)
|
49
|
+
expect(acls.first.line_number).to eq("3")
|
50
50
|
end
|
51
51
|
end
|
52
52
|
# f
|
53
53
|
end
|
54
|
+
|
55
|
+
context "as UTF-8 encoding" do
|
56
|
+
let(:content) { config.encode("UTF-8") }
|
57
|
+
context "result" do
|
58
|
+
let(:result) { subject.parse(content) }
|
59
|
+
it "line_number encodings should all be same as content encoding" do
|
60
|
+
encodings = result.collect{|r| r.line_number.to_s.encoding }
|
61
|
+
encodings &= encodings
|
62
|
+
expect(encodings).to eq([content.encoding])
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
54
66
|
end
|
55
67
|
|
56
68
|
# 2 comments and 2 different ACLs
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conpar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-05-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -227,7 +227,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
227
227
|
version: '0'
|
228
228
|
segments:
|
229
229
|
- 0
|
230
|
-
hash: -
|
230
|
+
hash: -220778513351759836
|
231
231
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
232
232
|
none: false
|
233
233
|
requirements:
|
@@ -236,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
236
236
|
version: '0'
|
237
237
|
segments:
|
238
238
|
- 0
|
239
|
-
hash: -
|
239
|
+
hash: -220778513351759836
|
240
240
|
requirements: []
|
241
241
|
rubyforge_project:
|
242
242
|
rubygems_version: 1.8.23
|