iniparse 1.1.5 → 1.1.6

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.
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source :rubygems
2
+ gemspec
data/README.rdoc CHANGED
@@ -1,4 +1,4 @@
1
- = IniParse
1
+ = IniParse {<img src="https://secure.travis-ci.org/antw/iniparse.png" alt="Build Status" />}[http://travis-ci.org/antw/iniparse]
2
2
 
3
3
  IniParse is a pure Ruby library for parsing
4
4
  INI[http://en.wikipedia.org/wiki/INI_file] configuration and data
@@ -34,7 +34,7 @@ IniFile gem does all you need.
34
34
 
35
35
  Parsing an INI file is fairly simple:
36
36
 
37
- IniParse.parse( File.open('path/to/my/file.ini') ) # => IniParse::Document
37
+ IniParse.parse( File.read('path/to/my/file.ini') ) # => IniParse::Document
38
38
 
39
39
  IniParse.parse returns an IniParse::Document instance which represents the
40
40
  passed "INI string". Assuming you know the structure of the document, you can
data/iniparse.gemspec CHANGED
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
12
12
  ## If your rubyforge_project name is different, then edit it and comment out
13
13
  ## the sub! line in the Rakefile
14
14
  s.name = 'iniparse'
15
- s.version = '1.1.5'
16
- s.date = '2011-12-21'
15
+ s.version = '1.1.6'
16
+ s.date = '2012-11-07'
17
17
  s.rubyforge_project = 'iniparse'
18
18
 
19
19
  s.summary = 'A pure Ruby library for parsing INI documents.'
@@ -27,10 +27,11 @@ Gem::Specification.new do |s|
27
27
  s.extra_rdoc_files = %w(History LICENSE README.rdoc)
28
28
 
29
29
  # Dependencies.
30
- s.add_development_dependency('rspec', '>= 2.0.0.beta.20')
30
+ s.add_development_dependency('rspec', '>= 2.11.0')
31
31
 
32
32
  # = MANIFEST =
33
33
  s.files = %w[
34
+ Gemfile
34
35
  History
35
36
  LICENSE
36
37
  README.rdoc
data/lib/iniparse.rb CHANGED
@@ -7,7 +7,7 @@ require File.join(dir, 'lines')
7
7
  require File.join(dir, 'parser')
8
8
 
9
9
  module IniParse
10
- VERSION = '1.1.5'
10
+ VERSION = '1.1.6'
11
11
 
12
12
  # A base class for IniParse errors.
13
13
  class IniParseError < StandardError; end
@@ -77,8 +77,8 @@ module IniParse
77
77
  # Strips in inline comment from a line (or value), removes trailing
78
78
  # whitespace and sets the comment options as applicable.
79
79
  def strip_comment(line, opts)
80
- if m = /^(.*?)(?:\s+(;|\#)\s*(.*))$/.match(line) ||
81
- m = /(^)(?:(;|\#)\s*(.*))$/.match(line) # Comment lines.
80
+ if m = /^(^)(?:(;|\#)\s*(.*))$$/.match(line) ||
81
+ m = /^(.*?)(?:\s+(;|\#)\s*(.*))$/.match(line) # Comment lines.
82
82
  opts[:comment] = m[3].rstrip
83
83
  opts[:comment_sep] = m[2]
84
84
  # Remove the line content (since an option value may contain a
@@ -37,6 +37,15 @@ describe 'Parsing a document' do
37
37
  @doc['first_section'].lines.to_a.first.should be_kind_of(IniParse::Lines::Blank)
38
38
  end
39
39
 
40
+ it 'should permit comments on their own line' do
41
+ lambda {
42
+ @doc = IniParse::Parser.new(fixture(:comment_line)).parse
43
+ }.should_not raise_error
44
+
45
+ line = @doc['first_section'].lines.to_a.first
46
+ line.comment.should eql('; block comment ;')
47
+ end
48
+
40
49
  it 'should raise an error if an option preceeds the first section' do
41
50
  lambda {
42
51
  IniParse::Parser.new(fixture(:option_before_section)).parse
@@ -53,3 +53,10 @@ IniParse::Test::Fixtures[:section_with_equals] = <<-FIX.gsub(/^ /, '')
53
53
  [another_section = a name]
54
54
  another = thing
55
55
  FIX
56
+
57
+ IniParse::Test::Fixtures[:comment_line] = <<-FIX.gsub(/^ /, '')
58
+ [first_section]
59
+ ; block comment ;
60
+ ; with more lines ;
61
+ key = value
62
+ FIX
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iniparse
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,19 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-21 00:00:00.000000000 Z
12
+ date: 2012-11-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70270665077040 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 2.0.0.beta.20
21
+ version: 2.11.0
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70270665077040
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 2.11.0
25
30
  description:
26
31
  email: hi@antw.me
27
32
  executables: []
@@ -31,6 +36,7 @@ extra_rdoc_files:
31
36
  - LICENSE
32
37
  - README.rdoc
33
38
  files:
39
+ - Gemfile
34
40
  - History
35
41
  - LICENSE
36
42
  - README.rdoc
@@ -80,7 +86,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
80
86
  version: '0'
81
87
  requirements: []
82
88
  rubyforge_project: iniparse
83
- rubygems_version: 1.8.10
89
+ rubygems_version: 1.8.23
84
90
  signing_key:
85
91
  specification_version: 2
86
92
  summary: A pure Ruby library for parsing INI documents.
@@ -98,3 +104,4 @@ test_files:
98
104
  - spec/spec_fixtures.rb
99
105
  - spec/spec_helper.rb
100
106
  - spec/spec_helper_spec.rb
107
+ has_rdoc: