iniparse 0.2.1 → 1.0.0
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/LICENSE +1 -1
- data/README.rdoc +2 -0
- data/Rakefile +49 -76
- data/VERSION +1 -0
- data/lib/iniparse.rb +4 -2
- data/lib/iniparse/document.rb +2 -0
- data/lib/iniparse/generator.rb +1 -1
- data/lib/iniparse/line_collection.rb +1 -1
- data/lib/iniparse/lines.rb +1 -1
- data/lib/iniparse/parser.rb +2 -2
- data/spec/document_spec.rb +20 -4
- data/spec/generator/method_missing_spec.rb +1 -1
- data/spec/generator/with_section_blocks_spec.rb +1 -1
- data/spec/generator/without_section_blocks_spec.rb +1 -1
- data/spec/parser/document_parsing_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/spec_helper_spec.rb +1 -1
- metadata +38 -17
- data/lib/iniparse/version.rb +0 -3
data/LICENSE
CHANGED
data/README.rdoc
CHANGED
@@ -10,6 +10,8 @@ or you feed it an INI file which doesn't work as you'd expected, please mail
|
|
10
10
|
me at +anthony at ninecraft dot com+, ideally with a copy of the INI file in
|
11
11
|
question.
|
12
12
|
|
13
|
+
IniParse tests pass on Ruby 1.8.6p383, 1.8.7p174, and 1.9.1p243.
|
14
|
+
|
13
15
|
=== Main features
|
14
16
|
|
15
17
|
* <b>Support for duplicate options.</b> While not common, some INI files
|
data/Rakefile
CHANGED
@@ -1,102 +1,75 @@
|
|
1
|
-
require 'rubygems'
|
2
1
|
require 'rake/clean'
|
3
|
-
require 'rake/
|
4
|
-
require 'rubygems/specification'
|
5
|
-
require 'date'
|
2
|
+
require 'rake/rdoctask'
|
6
3
|
require 'spec/rake/spectask'
|
7
4
|
|
8
|
-
begin
|
9
|
-
require 'hanna/rdoctask'
|
10
|
-
rescue LoadError
|
11
|
-
require 'rake/rdoctask'
|
12
|
-
end
|
13
|
-
|
14
|
-
require 'lib/iniparse/version'
|
15
|
-
|
16
|
-
GEM = 'iniparse'
|
17
|
-
GEM_VERSION = IniParse::VERSION
|
18
|
-
|
19
5
|
##############################################################################
|
20
|
-
# Packaging & Installation
|
6
|
+
# Packaging & Installation.
|
21
7
|
##############################################################################
|
22
8
|
|
23
9
|
CLEAN.include ['pkg', '*.gem', 'doc', 'coverage']
|
24
10
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
Rake::GemPackageTask.new(spec) do |pkg|
|
50
|
-
pkg.gem_spec = spec
|
51
|
-
end
|
52
|
-
|
53
|
-
desc "Run :package and install the resulting .gem"
|
54
|
-
task :install => :package do
|
55
|
-
sh %(gem install --local pkg/#{GEM}-#{GEM_VERSION}.gem)
|
56
|
-
end
|
57
|
-
|
58
|
-
desc "Run :clean and uninstall the .gem"
|
59
|
-
task :uninstall => :clean do
|
60
|
-
sh %(gem uninstall #{GEM})
|
61
|
-
end
|
62
|
-
|
63
|
-
desc "Create a gemspec file"
|
64
|
-
task :make_spec do
|
65
|
-
File.open("#{GEM}.gemspec", "w") do |file|
|
66
|
-
file.puts spec.to_ruby
|
11
|
+
begin
|
12
|
+
require 'jeweler'
|
13
|
+
|
14
|
+
Jeweler::Tasks.new do |gem|
|
15
|
+
gem.name = 'iniparse'
|
16
|
+
gem.platform = Gem::Platform::RUBY
|
17
|
+
gem.summary = 'A pure Ruby library for parsing INI documents.'
|
18
|
+
gem.description = gem.summary
|
19
|
+
gem.author = 'Anthony Williams'
|
20
|
+
gem.email = 'anthony@ninecraft.com'
|
21
|
+
gem.homepage = 'http://github.com/antw/iniparse'
|
22
|
+
|
23
|
+
gem.files = %w(LICENSE README.rdoc Rakefile VERSION) +
|
24
|
+
Dir.glob("{lib,spec}/**/*")
|
25
|
+
|
26
|
+
# rdoc
|
27
|
+
gem.has_rdoc = true
|
28
|
+
gem.extra_rdoc_files = %w(README.rdoc LICENSE VERSION)
|
29
|
+
|
30
|
+
# Dependencies
|
31
|
+
gem.add_dependency 'extlib', '>= 0.9.9'
|
32
|
+
gem.add_development_dependency 'rspec', '>= 1.2.0'
|
67
33
|
end
|
34
|
+
|
35
|
+
Jeweler::GemcutterTasks.new
|
36
|
+
Jeweler::RubyforgeTasks.new
|
37
|
+
rescue LoadError
|
38
|
+
puts 'Jeweler (or a dependency) not available. Install it with: gem ' \
|
39
|
+
'install jeweler'
|
68
40
|
end
|
69
41
|
|
70
42
|
##############################################################################
|
71
43
|
# Documentation
|
72
44
|
##############################################################################
|
73
|
-
task :doc => ['doc:rdoc']
|
74
|
-
namespace :doc do
|
75
45
|
|
76
|
-
|
77
|
-
|
78
|
-
rdoc.main = "README.rdoc"
|
79
|
-
rdoc.title = "IniParse API Documentation"
|
80
|
-
rdoc.options << "--line-numbers" << "--inline-source"
|
81
|
-
rdoc.rdoc_dir = 'doc'
|
82
|
-
end
|
46
|
+
Rake::RDocTask.new do |rdoc|
|
47
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
83
48
|
|
49
|
+
rdoc.rdoc_dir = 'rdoc'
|
50
|
+
rdoc.title = "iniparse #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
84
53
|
end
|
85
54
|
|
86
55
|
##############################################################################
|
87
|
-
#
|
56
|
+
# Tests & Metrics.
|
88
57
|
##############################################################################
|
89
58
|
|
90
59
|
desc "Run all examples"
|
91
|
-
Spec::Rake::SpecTask.new(
|
92
|
-
|
93
|
-
|
60
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
61
|
+
spec.libs << 'lib' << 'spec'
|
62
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
63
|
+
spec.spec_opts = ['-c -f s']
|
94
64
|
end
|
95
65
|
|
96
66
|
desc "Run all examples with RCov"
|
97
|
-
Spec::Rake::SpecTask.new(
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
67
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
68
|
+
spec.libs << 'lib' << 'spec'
|
69
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
70
|
+
spec.spec_opts = ['-c -f s']
|
71
|
+
spec.rcov = true
|
72
|
+
spec.rcov_opts = ['--exclude', 'spec']
|
102
73
|
end
|
74
|
+
|
75
|
+
task :spec => :check_dependencies
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
data/lib/iniparse.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'rubygems'
|
2
1
|
require 'extlib'
|
3
2
|
|
4
3
|
dir = Pathname(__FILE__).dirname.expand_path / 'iniparse'
|
@@ -8,9 +7,12 @@ require dir / 'generator'
|
|
8
7
|
require dir / 'line_collection'
|
9
8
|
require dir / 'lines'
|
10
9
|
require dir / 'parser'
|
11
|
-
require dir / 'version'
|
12
10
|
|
13
11
|
module IniParse
|
12
|
+
VERSION = File.read(
|
13
|
+
Pathname(__FILE__).dirname.expand_path / '..' / 'VERSION'
|
14
|
+
).strip
|
15
|
+
|
14
16
|
# A base class for IniParse errors.
|
15
17
|
class IniParseError < StandardError; end
|
16
18
|
|
data/lib/iniparse/document.rb
CHANGED
data/lib/iniparse/generator.rb
CHANGED
data/lib/iniparse/lines.rb
CHANGED
data/lib/iniparse/parser.rb
CHANGED
data/spec/document_spec.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper'
|
2
2
|
|
3
3
|
describe "IniParse::Document" do
|
4
|
-
it 'should have a +
|
5
|
-
IniParse::Document.instance_methods.
|
4
|
+
it 'should have a +lines+ reader' do
|
5
|
+
methods = IniParse::Document.instance_methods.map { |m| m.to_sym }
|
6
|
+
methods.should include(:lines)
|
6
7
|
end
|
7
8
|
|
8
|
-
it 'should not have a +
|
9
|
-
IniParse::Document.instance_methods.
|
9
|
+
it 'should not have a +lines+ writer' do
|
10
|
+
methods = IniParse::Document.instance_methods.map { |m| m.to_sym }
|
11
|
+
methods.should_not include(:lines=)
|
10
12
|
end
|
11
13
|
|
12
14
|
it 'should delegate #[] to +lines+' do
|
@@ -21,6 +23,20 @@ describe "IniParse::Document" do
|
|
21
23
|
doc.each { |l| }
|
22
24
|
end
|
23
25
|
|
26
|
+
it 'should be enumerable' do
|
27
|
+
IniParse::Document.included_modules.should include(Enumerable)
|
28
|
+
|
29
|
+
sections = [
|
30
|
+
IniParse::Lines::Section.new('first section'),
|
31
|
+
IniParse::Lines::Section.new('second section')
|
32
|
+
]
|
33
|
+
|
34
|
+
doc = IniParse::Document.new
|
35
|
+
doc.lines << sections[0] << sections[1]
|
36
|
+
|
37
|
+
doc.map { |line| line }.should == sections
|
38
|
+
end
|
39
|
+
|
24
40
|
describe '#has_section?' do
|
25
41
|
before(:all) do
|
26
42
|
@doc = IniParse::Document.new
|
data/spec/spec_helper.rb
CHANGED
data/spec/spec_helper_spec.rb
CHANGED
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: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony Williams
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-05 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,6 +22,16 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: 0.9.9
|
24
24
|
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rspec
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.2.0
|
34
|
+
version:
|
25
35
|
description: A pure Ruby library for parsing INI documents.
|
26
36
|
email: anthony@ninecraft.com
|
27
37
|
executables: []
|
@@ -29,44 +39,43 @@ executables: []
|
|
29
39
|
extensions: []
|
30
40
|
|
31
41
|
extra_rdoc_files:
|
32
|
-
- README.rdoc
|
33
42
|
- LICENSE
|
43
|
+
- README.rdoc
|
44
|
+
- VERSION
|
34
45
|
files:
|
35
46
|
- LICENSE
|
36
47
|
- README.rdoc
|
37
48
|
- Rakefile
|
38
|
-
-
|
49
|
+
- VERSION
|
50
|
+
- lib/iniparse.rb
|
39
51
|
- lib/iniparse/document.rb
|
40
52
|
- lib/iniparse/generator.rb
|
41
53
|
- lib/iniparse/line_collection.rb
|
42
54
|
- lib/iniparse/lines.rb
|
43
55
|
- lib/iniparse/parser.rb
|
44
|
-
- lib/iniparse/version.rb
|
45
|
-
- lib/iniparse.rb
|
46
56
|
- spec/document_spec.rb
|
47
57
|
- spec/fixture_spec.rb
|
48
|
-
- spec/fixtures
|
49
58
|
- spec/fixtures/openttd.ini
|
50
59
|
- spec/fixtures/race07.ini
|
51
60
|
- spec/fixtures/smb.ini
|
52
|
-
- spec/generator
|
53
61
|
- spec/generator/method_missing_spec.rb
|
54
62
|
- spec/generator/with_section_blocks_spec.rb
|
55
63
|
- spec/generator/without_section_blocks_spec.rb
|
56
64
|
- spec/iniparse_spec.rb
|
57
65
|
- spec/line_collection_spec.rb
|
58
66
|
- spec/lines_spec.rb
|
59
|
-
- spec/parser
|
60
67
|
- spec/parser/document_parsing_spec.rb
|
61
68
|
- spec/parser/line_parsing_spec.rb
|
62
69
|
- spec/spec_fixtures.rb
|
63
70
|
- spec/spec_helper.rb
|
64
71
|
- spec/spec_helper_spec.rb
|
65
72
|
has_rdoc: true
|
66
|
-
homepage: http://github.com/
|
67
|
-
|
68
|
-
rdoc_options: []
|
73
|
+
homepage: http://github.com/antw/iniparse
|
74
|
+
licenses: []
|
69
75
|
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options:
|
78
|
+
- --charset=UTF-8
|
70
79
|
require_paths:
|
71
80
|
- lib
|
72
81
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -83,10 +92,22 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
92
|
version:
|
84
93
|
requirements: []
|
85
94
|
|
86
|
-
rubyforge_project:
|
87
|
-
rubygems_version: 1.3.
|
95
|
+
rubyforge_project:
|
96
|
+
rubygems_version: 1.3.5
|
88
97
|
signing_key:
|
89
|
-
specification_version:
|
98
|
+
specification_version: 3
|
90
99
|
summary: A pure Ruby library for parsing INI documents.
|
91
|
-
test_files:
|
92
|
-
|
100
|
+
test_files:
|
101
|
+
- spec/document_spec.rb
|
102
|
+
- spec/fixture_spec.rb
|
103
|
+
- spec/generator/method_missing_spec.rb
|
104
|
+
- spec/generator/with_section_blocks_spec.rb
|
105
|
+
- spec/generator/without_section_blocks_spec.rb
|
106
|
+
- spec/iniparse_spec.rb
|
107
|
+
- spec/line_collection_spec.rb
|
108
|
+
- spec/lines_spec.rb
|
109
|
+
- spec/parser/document_parsing_spec.rb
|
110
|
+
- spec/parser/line_parsing_spec.rb
|
111
|
+
- spec/spec_fixtures.rb
|
112
|
+
- spec/spec_helper.rb
|
113
|
+
- spec/spec_helper_spec.rb
|
data/lib/iniparse/version.rb
DELETED