-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First commit: RConfig - The complete solution for Ruby Configuration …
…Management.
- Loading branch information
0 parents
commit 92e0f59
Showing
25 changed files
with
1,743 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
0.1 | ||
===== | ||
* First public release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Copyright (C) 2009 Rahmal H. Conda | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
ChangeLog | ||
demo/ | ||
demo/demo.conf | ||
demo/demo.rb | ||
demo/demo.xml | ||
demo/demo.yml | ||
demo/global.yml | ||
lib/ | ||
lib/rconfig/ | ||
lib/rconfig/config_hash.rb | ||
lib/rconfig/config_parser.rb | ||
lib/rconfig/core_ext/ | ||
lib/rconfig/core_ext/hash.rb | ||
rconfig.rb | ||
LICENSE | ||
Manifest | ||
Rakefile | ||
rconfig.gemspec | ||
README | ||
tasks/ | ||
tasks/docs.rake | ||
tasks/gemspec.rake | ||
test/ | ||
test/rconfig_test.rb | ||
test/test_files/ | ||
test/test_files/global.yml | ||
test/test_files/test_development.yml | ||
test/test_files/test_local.yml | ||
test/test_files/test_production.yml | ||
test/test_files/test.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
RConfig | ||
============= | ||
by Rahmal Conda - http://www.rahmalconda.com | ||
|
||
* RConfig provides a dottable, hash, array, and argument access to YAML | ||
configuration files | ||
* Implements multilevel caching to reduce disk accesses | ||
* Overlays multiple configuration files in an intelligent manner | ||
|
||
|
||
Requirements | ||
============ | ||
|
||
Currently you need all of those things to get Gullery to run: | ||
|
||
* Ruby -v of 1.8.2 (25-05-2004) or greater. | ||
* A database that is supported by Rails migrations. | ||
* Ruby drivers for your database. | ||
* For best performance, you should have a web server running either | ||
Apache or Lighttpd along with FastCGI, although these aren't | ||
strictly required--you can use Ruby's built-in web server for | ||
low-volume testing. | ||
|
||
|
||
Installation | ||
============ | ||
|
||
Usage | ||
============ | ||
|
||
Running tests | ||
============= | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env rake | ||
|
||
# Add your own tasks in files placed in lib/tasks ending in .rake, | ||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | ||
|
||
require 'rubygems' | ||
require 'echoe' | ||
require 'hoe' | ||
require 'rake' | ||
require 'rake/testtask' | ||
require 'rake/rdoctask' | ||
require 'lib/rconfig' | ||
|
||
Hoe.new('rconfig', RConfig::VERSION) do |p| | ||
p.developer( 'Rahmal Conda', 'rahmal@gmail.com' ) | ||
|
||
end | ||
|
||
|
||
=begin | ||
spec = Gem::Specification.new do |s| | ||
s.name = "ActiveControl" | ||
s.version = "0.0.1" | ||
s.author = "Rahmal Conda" | ||
s.email = "rahmal@gmail.com" | ||
s.homepage = "http://www.rahmalconda.com" | ||
s.platform = Gem::Platform::RUBY | ||
s.summary = "" | ||
s.files = FileList["{bin,lib}/**/*"].to_a | ||
s.require_path = "lib" | ||
s.autorequire = "name" | ||
s.test_files = FileList["{test}/**/*test.rb"].to_a | ||
s.has_rdoc = true | ||
s.extra_rdoc_files = ["README"] | ||
s.add_dependency("dependency", ">= 0.x.x") | ||
end | ||
Rake::GemPackageTask.new(spec) do |pkg| | ||
pkg.need_tar = true | ||
end | ||
=end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
admin_email = root@localhost | ||
listen_ip = 127.0.0.1 | ||
listen_port = 87345 | ||
|
||
[group1] | ||
user_name = johnny | ||
group_name = daemons | ||
|
||
[group2] | ||
user_name = rita | ||
group_name = daemons |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require('rubygems') | ||
require('rconfig') | ||
#require('./lib/parseconfig.rb') | ||
|
||
begin | ||
c = ParseConfig.new('demo.conf') | ||
rescue Errno::ENOENT | ||
puts "The config file you specified was not found" | ||
exit | ||
rescue Errno::EACCES | ||
puts "The config file you specified is not readable" | ||
exit | ||
end | ||
|
||
puts | ||
puts 'Reading main config section and groups...' | ||
puts '-' * 77 | ||
puts | ||
c.write() | ||
puts | ||
puts 'Available params are...' | ||
puts '-' * 77 | ||
puts | ||
puts c.get_params() | ||
puts | ||
puts | ||
|
||
puts 'Available sub-groups are...' | ||
puts '-' * 77 | ||
puts | ||
puts c.get_groups() | ||
puts | ||
puts | ||
|
||
puts 'Accessing sub-group params...' | ||
puts '-' * 77 | ||
puts | ||
puts "group1 user name value is: #{c.params['group1']['user_name']}" | ||
puts | ||
puts | ||
|
||
puts "Using params hash..." | ||
puts '-' * 77 | ||
puts | ||
puts "The admin email address is #{c.params['admin_email']}" | ||
puts | ||
puts | ||
|
||
puts "Using get_value (kind of deprecated)..." | ||
puts '-' * 77 | ||
puts | ||
puts "The listen address is #{c.get_value('listen_ip')} and the user name " + | ||
"is #{c.get_value('group1')['user_name']}" | ||
puts | ||
puts | ||
|
||
puts "Writing the config out to a file" | ||
puts '-' * 77 | ||
puts | ||
f = open('/tmp/parseconfig_sample_config', 'w') | ||
c.write(f) | ||
f.close() | ||
puts "Config written to /tmp/parseconfig_sample_config" | ||
puts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<demo> | ||
<admin_email>root@localhost</admin_email> | ||
<listen_ip>127.0.0.1</listen_ip> | ||
<listen_port>87345</listen_port> | ||
<group1> | ||
<user_name>johnny</user_name> | ||
<group_name>daemons</group_name> | ||
</group1> | ||
<group2> | ||
<user_name>rita</user_name> | ||
<group_name>daemons</group_name> | ||
</group2> | ||
</demo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
admin_email: root@localhost | ||
listen_ip: 127.0.0.1 | ||
listen_port: 87345 | ||
|
||
group1: | ||
user_name: johnny | ||
group_name: daemons | ||
|
||
group2: | ||
user_name: rita | ||
group_name: daemons |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test=true |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA04CCP+C9jQEtghGIW8JRHJdnR1UsQqYkz6+k9SWBuUaZ5ti/o5htroxx+O/DXRf5L+2nOBXKIlmX7eRpOSQpuWHIRcpHx4j2pmyl/H2 |
Oops, something went wrong.