configliere 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.textile +9 -0
- data/README.textile +4 -7
- data/VERSION +1 -1
- data/configliere.gemspec +3 -3
- data/lib/configliere.rb +4 -8
- data/lib/configliere/config_block.rb +1 -1
- data/lib/configliere/config_file.rb +7 -2
- data/spec/configliere/config_file_spec.rb +4 -0
- metadata +26 -13
data/CHANGELOG.textile
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
Note that while the version # is still in the 0.0.x range, the interface may change arbitrarily while we figure out the best simplest convenientest powerfullest way to arrange things
|
2
2
|
|
3
|
+
h2. Version 0.0.6 2010-04-05
|
4
|
+
|
5
|
+
* configliere/define and configliere/config_file are included by default.
|
6
|
+
* fixed a bug when ENV['HOME'] is missing (running as root)
|
7
|
+
|
8
|
+
h2. Version 0.0.5 2010-01-27
|
9
|
+
|
10
|
+
Configliere.use will load all gems by default
|
11
|
+
|
3
12
|
h2. Version 0.0.4 2010-01-16
|
4
13
|
|
5
14
|
* Cured a variety of issues noted by "@monad":http://github.com/monad -- thanks for the feedback!
|
data/README.textile
CHANGED
@@ -96,7 +96,7 @@ You can define static defaults in your module
|
|
96
96
|
Settings['delorean.power_source'] #=> 'plutonium'
|
97
97
|
Settings['delorean.missing'] #=> nil
|
98
98
|
Settings['delorean.missing.fail'] #=> nil
|
99
|
-
# method-like (no deep keys tho, and you have to
|
99
|
+
# method-like (no deep keys tho, and you have to #define the param; see below)
|
100
100
|
Settings.dest_time #=> '1955-11-05'
|
101
101
|
</pre>
|
102
102
|
|
@@ -224,8 +224,7 @@ Here are some things you don't get:
|
|
224
224
|
|
225
225
|
If you want more, you might like the Trollop gem. If you enjoy wordy nightmares, use "getoptlog":http://linuxdevcenter.com/pub/a/linux/2003/09/18/ruby_csv.html?page=2 from the ruby standard library.
|
226
226
|
|
227
|
-
Commandline parameters are demonstrated in "examples/simple_script.rb":http://github.com/mrflip/configliere/tree/master/examples/simple_script.rb and
|
228
|
-
"examples/env_var_script.rb":http://github.com/mrflip/configliere/tree/master/examples/env_var_script.rb
|
227
|
+
Commandline parameters are demonstrated in "examples/simple_script.rb":http://github.com/mrflip/configliere/tree/master/examples/simple_script.rb and examples/env_var_script.rb":http://github.com/mrflip/configliere/tree/master/examples/env_var_script.rb
|
229
228
|
|
230
229
|
h2. Fancy Parameters
|
231
230
|
|
@@ -332,10 +331,8 @@ h3. Note on Patches/Pull Requests
|
|
332
331
|
|
333
332
|
* Fork the project.
|
334
333
|
* Make your feature addition or bug fix.
|
335
|
-
* Add tests for it. This is important so I don't break it in a
|
336
|
-
|
337
|
-
* Commit, do not mess with rakefile, version, or history.
|
338
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
334
|
+
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
335
|
+
* Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
339
336
|
* Send a pull request to github.com/mrflip
|
340
337
|
* Drop a line to the mailing list for infochimps open-source projects, infochimps-code@googlegroups.com
|
341
338
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
data/configliere.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{configliere}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["mrflip"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-04-06}
|
13
13
|
s.default_executable = %q{configliere}
|
14
14
|
s.description = %q{ You've got a script. It's got some settings. Some settings are for this module, some are for that module. Most of them don't change. Except on your laptop, where the paths are different. Or when you're in production mode. Or when you're testing from the command line.
|
15
15
|
|
@@ -68,7 +68,7 @@ Configliere manage settings from many sources: static constants, simple config f
|
|
68
68
|
s.homepage = %q{http://github.com/mrflip/configliere}
|
69
69
|
s.rdoc_options = ["--charset=UTF-8"]
|
70
70
|
s.require_paths = ["lib"]
|
71
|
-
s.rubygems_version = %q{1.3.
|
71
|
+
s.rubygems_version = %q{1.3.6}
|
72
72
|
s.summary = %q{Wise, discreet configuration management}
|
73
73
|
s.test_files = [
|
74
74
|
"spec/configliere/commandline_spec.rb",
|
data/lib/configliere.rb
CHANGED
@@ -1,22 +1,18 @@
|
|
1
1
|
require 'configliere/core_ext'
|
2
2
|
require 'configliere/param'
|
3
|
+
require 'configliere/define'
|
4
|
+
require 'configliere/config_file'
|
3
5
|
|
4
6
|
module Configliere
|
5
|
-
# Where to load params given only a symbol
|
6
|
-
DEFAULT_CONFIG_FILE = ENV['HOME']+'/.configliere.yaml' unless defined?(DEFAULT_CONFIG_FILE)
|
7
|
-
# Where to load params given a bare filename
|
8
|
-
DEFAULT_CONFIG_DIR = ENV['HOME']+'/.configliere' unless defined?(DEFAULT_CONFIG_DIR)
|
9
7
|
|
10
|
-
#
|
11
|
-
#
|
12
8
|
# delegates to Configliere::Param
|
13
9
|
def self.new *args, &block
|
14
10
|
Configliere::Param.new *args, &block
|
15
11
|
end
|
16
12
|
|
17
|
-
ALL_MIXINS = [:define, :
|
13
|
+
ALL_MIXINS = [:define, :config_file, :commandline, :encrypted, :env_var, :config_block]
|
18
14
|
def self.use *mixins
|
19
|
-
mixins = ALL_MIXINS if mixins.include?(:all)
|
15
|
+
mixins = ALL_MIXINS if mixins.include?(:all) || mixins.empty?
|
20
16
|
mixins.each do |mixin|
|
21
17
|
require "configliere/#{mixin}"
|
22
18
|
end
|
@@ -1,6 +1,11 @@
|
|
1
1
|
require 'yaml'
|
2
2
|
require 'fileutils'
|
3
3
|
module Configliere
|
4
|
+
# Where to load params given only a symbol
|
5
|
+
DEFAULT_CONFIG_FILE = ENV['HOME'].to_s+'/.configliere.yaml' unless defined?(DEFAULT_CONFIG_FILE)
|
6
|
+
# Where to load params given a bare filename
|
7
|
+
DEFAULT_CONFIG_DIR = ENV['HOME'].to_s+'/.configliere' unless defined?(DEFAULT_CONFIG_DIR)
|
8
|
+
|
4
9
|
#
|
5
10
|
# ConfigFile -- load configuration from a simple YAML file
|
6
11
|
#
|
@@ -57,8 +62,8 @@ module Configliere
|
|
57
62
|
|
58
63
|
def filename_for_handle handle
|
59
64
|
case
|
60
|
-
when handle.is_a?(Symbol)
|
61
|
-
when handle.include?('/') then handle
|
65
|
+
when handle.is_a?(Symbol) then Configliere::DEFAULT_CONFIG_FILE
|
66
|
+
when handle.to_s.include?('/') then handle
|
62
67
|
else File.join(Configliere::DEFAULT_CONFIG_DIR, handle)
|
63
68
|
end
|
64
69
|
end
|
@@ -25,6 +25,10 @@ describe "Configliere::ConfigFile" do
|
|
25
25
|
File.should_receive(:open).with(Configliere::DEFAULT_CONFIG_DIR + '/file.yaml').and_return(@fake_file)
|
26
26
|
@config.read 'file.yaml'
|
27
27
|
end
|
28
|
+
it 'loads an absolute pathname from the given file' do
|
29
|
+
File.should_receive(:open).with('/fake/path.yaml').and_return(@fake_file)
|
30
|
+
@config.read '/fake/path.yaml'
|
31
|
+
end
|
28
32
|
after do
|
29
33
|
@config[:my_param].should == 'val'
|
30
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configliere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 6
|
9
|
+
version: 0.0.6
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- mrflip
|
@@ -9,29 +14,35 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date: 2010-
|
17
|
+
date: 2010-04-06 00:00:00 -05:00
|
13
18
|
default_executable: configliere
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: rspec
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ">="
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 2
|
30
|
+
- 9
|
23
31
|
version: 1.2.9
|
24
|
-
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
25
34
|
- !ruby/object:Gem::Dependency
|
26
35
|
name: yard
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
38
|
requirements:
|
31
39
|
- - ">="
|
32
40
|
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
33
43
|
version: "0"
|
34
|
-
|
44
|
+
type: :development
|
45
|
+
version_requirements: *id002
|
35
46
|
description: " You've got a script. It's got some settings. Some settings are for this module, some are for that module. Most of them don't change. Except on your laptop, where the paths are different. Or when you're in production mode. Or when you're testing from the command line.\n\n \"\" So, Consigliere of mine, I think you should tell your Don what everyone knows. \"\" -- Don Corleone\n\n\
|
36
47
|
Configliere manage settings from many sources: static constants, simple config files, environment variables, commandline options, straight ruby. You don't have to predefine anything, but you can ask configliere to type-convert, require, document or password-obscure any of its fields. Modules can define config settings independently of each other and the main program.\n"
|
37
48
|
email: flip@infochimps.org
|
@@ -96,18 +107,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
107
|
requirements:
|
97
108
|
- - ">="
|
98
109
|
- !ruby/object:Gem::Version
|
110
|
+
segments:
|
111
|
+
- 0
|
99
112
|
version: "0"
|
100
|
-
version:
|
101
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
114
|
requirements:
|
103
115
|
- - ">="
|
104
116
|
- !ruby/object:Gem::Version
|
117
|
+
segments:
|
118
|
+
- 0
|
105
119
|
version: "0"
|
106
|
-
version:
|
107
120
|
requirements: []
|
108
121
|
|
109
122
|
rubyforge_project:
|
110
|
-
rubygems_version: 1.3.
|
123
|
+
rubygems_version: 1.3.6
|
111
124
|
signing_key:
|
112
125
|
specification_version: 3
|
113
126
|
summary: Wise, discreet configuration management
|