All Projects → chrislee35 → configparser

chrislee35 / configparser

Licence: MIT License
parses configuration files compatible with Python's ConfigParser

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to configparser

configmanager
Forget about configparser, YAML, or JSON parsers. Focus on configuration. NOT RECOMMENDED FOR USE (2019-01-26)
Stars: ✭ 15 (+15.38%)
Mutual labels:  configparser
marshmallow-objects
Marshmallow Objects and Models
Stars: ✭ 37 (+184.62%)
Mutual labels:  configparser
usersettings
Portable Local Settings Storage for Python
Stars: ✭ 28 (+115.38%)
Mutual labels:  configparser

Configparser

Configparser parses configuration files compatible with Python's ConfigParser

Installation

Add this line to your application's Gemfile:

gem 'configparser'

And then execute:

$ bundle

Or install it yourself as:

$ gem install configparser

Usage

$ cat test/simple.cfg
	test1=hi
	test2 = hello

	[first_section]
	mytest=55
	yourtest     =     99
	#nothere=notthere
	myboolean

	[second section]
	myway=or the
	  highway

require 'configparser'
cp = ConfigParser.new('test/simple.cfg')
puts cp.to_s

	test1: hi
	test2: hello
	[first_section]
	myboolean
	mytest: 55
	yourtest: 99
	[second section]
	myway: or the highway
	
$ cat test/complex.cfg
	global1=default-$(global3)
	global2=strange-$(global1)
	global3=whatever

	[section1]
	local1=$(global2)-$(local2)-local
	local2=yodel

	[section2]
	local1=hotel
	local2=recent $(local1)
	local3=un$(resolvable)

cp = ConfigParser.new('test/complex.cfg')
puts cp['global2']
puts cp['section1']['local1']
puts cp['section2']['local2']
puts cp['section2']['local3']

	strange-default-whatever
	strange-default-whatever-yodel-local
	recent hotel
	un$(resolvable)

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].