configliere 0.0.2 → 0.0.3

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.
@@ -15,9 +15,10 @@ describe "Configliere::Environment" do
15
15
  it 'loads a hash into the individual params' do
16
16
  ENV.should_receive(:[]).with('HOME').and_return('/fake/path')
17
17
  ENV.should_receive(:[]).with('POWER_SUPPLY').and_return('1.21 jigawatts')
18
- @config.environment_variables 'HOME' => :home, 'POWER_SUPPLY' => 'delorean.power_supply'
18
+ @config.environment_variables :home => 'HOME', 'delorean.power_supply' => 'POWER_SUPPLY'
19
19
  @config[:home].should == '/fake/path'
20
20
  @config[:delorean][:power_supply].should == '1.21 jigawatts'
21
21
  end
22
22
  end
23
23
  end
24
+
@@ -2,34 +2,40 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
3
  describe "Configliere::Param" do
4
4
  before do
5
- @config = Configliere::Param.new
5
+ @config = Configliere::Param.new :hat => :cat, :basket => :lotion, :moon => { :man => :smiling }
6
6
  end
7
7
 
8
8
  describe '#defaults' do
9
- it 'merges new params' do
10
- @config.defaults :hat => :cat, :basket => :lotion, :moon => { :man => :smiling }
9
+ it 'deep_merges new params' do
11
10
  @config.defaults :basket => :tasket, :moon => { :cow => :jumping }
12
11
  @config.should == { :hat => :cat, :basket => :tasket, :moon => { :man => :smiling, :cow => :jumping } }
13
12
  end
14
13
  end
15
14
 
16
- describe 'setting vals' do
15
+ describe '#[]=' do
17
16
  it 'symbolizes keys' do
18
- @config.defaults :hat => :cat, :basket => :lotion
19
17
  @config['hat'] = :fedora
20
18
  @config['new'] = :unseen
21
- @config.should == { :hat => :fedora, :basket => :lotion, :new => :unseen }
19
+ # @config.should == { :hat => :fedora, :basket => :lotion, :new => :unseen, :moon => { :man => :smiling } }
22
20
  end
23
- it 'deep-sets dotted vals' do
24
- @config.defaults :hat => :cat, :basket => :lotion, :moon => { :man => :smiling }
21
+ it 'deep-sets dotted vals, replacing values' do
25
22
  @config['moon.man'] = :cheesy
26
23
  @config[:moon][:man].should == :cheesy
24
+ end
25
+ it 'deep-sets dotted vals, creating new values' do
27
26
  @config['moon.cheese.type'] = :tilsit
28
27
  @config[:moon][:cheese][:type].should == :tilsit
29
28
  end
29
+ it 'deep-sets dotted vals, auto-vivifying intermediate hashes' do
30
+ @config['this.that.the_other'] = :fuhgeddaboudit
31
+ @config[:this][:that][:the_other].should == :fuhgeddaboudit
32
+ end
33
+ end
34
+
35
+ describe '#[]' do
30
36
  it 'deep-gets dotted vals' do
31
37
  hsh = { :hat => :cat, :basket => :lotion, :moon => { :man => :smiling, :cheese => {:type => :tilsit} } }
32
- @config.defaults hsh
38
+ @config = Configliere::Param.new hsh.dup
33
39
  @config['moon.man'].should == :smiling
34
40
  @config['moon.cheese.type'].should == :tilsit
35
41
  @config['moon.cheese.smell'].should be_nil
@@ -37,7 +43,7 @@ describe "Configliere::Param" do
37
43
  @config['moon.non'].should be_nil
38
44
  if (RUBY_VERSION >= '1.9') then lambda{ @config['hat.cat'] }.should raise_error(TypeError)
39
45
  else lambda{ @config['hat.cat'] }.should raise_error(NoMethodError, 'undefined method `[]\' for :cat:Symbol') end
40
- @config.should == hsh # shouldn't change from reading
46
+ @config.should == hsh # shouldn't change from reading (specifically, shouldn't autovivify)
41
47
  end
42
48
  end
43
49
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: configliere
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - mrflip
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-08 00:00:00 -06:00
12
+ date: 2010-01-15 00:00:00 -06:00
13
13
  default_executable: configliere
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -45,6 +45,7 @@ extra_rdoc_files:
45
45
  files:
46
46
  - .document
47
47
  - .gitignore
48
+ - CHANGELOG.textile
48
49
  - LICENSE
49
50
  - README.textile
50
51
  - Rakefile
@@ -53,18 +54,19 @@ files:
53
54
  - configliere.gemspec
54
55
  - examples/commandline_script.rb
55
56
  - examples/commandline_script.yaml
57
+ - examples/config_block.rb
58
+ - examples/encrypted_script.rb
56
59
  - examples/foo.yaml
57
60
  - examples/simple_script.rb
58
61
  - examples/simple_script.yaml
59
62
  - lib/configliere.rb
60
63
  - lib/configliere/commandline.rb
61
- - lib/configliere/commandline/commands.rb
62
- - lib/configliere/commandline/options.rb
63
64
  - lib/configliere/config_block.rb
64
65
  - lib/configliere/config_file.rb
65
66
  - lib/configliere/core_ext.rb
66
67
  - lib/configliere/core_ext/blank.rb
67
68
  - lib/configliere/core_ext/hash.rb
69
+ - lib/configliere/core_ext/sash.rb
68
70
  - lib/configliere/crypter.rb
69
71
  - lib/configliere/define.rb
70
72
  - lib/configliere/encrypted.rb
@@ -73,6 +75,8 @@ files:
73
75
  - spec/configliere/commandline_spec.rb
74
76
  - spec/configliere/config_block_spec.rb
75
77
  - spec/configliere/config_file_spec.rb
78
+ - spec/configliere/core_ext/hash_spec.rb
79
+ - spec/configliere/core_ext/sash_spec.rb
76
80
  - spec/configliere/crypter_spec.rb
77
81
  - spec/configliere/define_spec.rb
78
82
  - spec/configliere/encrypted_spec.rb
@@ -113,6 +117,8 @@ test_files:
113
117
  - spec/configliere/commandline_spec.rb
114
118
  - spec/configliere/config_block_spec.rb
115
119
  - spec/configliere/config_file_spec.rb
120
+ - spec/configliere/core_ext/hash_spec.rb
121
+ - spec/configliere/core_ext/sash_spec.rb
116
122
  - spec/configliere/crypter_spec.rb
117
123
  - spec/configliere/define_spec.rb
118
124
  - spec/configliere/encrypted_spec.rb
@@ -121,4 +127,6 @@ test_files:
121
127
  - spec/configliere_spec.rb
122
128
  - spec/spec_helper.rb
123
129
  - examples/commandline_script.rb
130
+ - examples/config_block.rb
131
+ - examples/encrypted_script.rb
124
132
  - examples/simple_script.rb
@@ -1,30 +0,0 @@
1
- require 'logger'
2
- Log = Logger.new(STDERR) unless defined?(Log)
3
- module Configliere
4
- class CommandClient < Client
5
- attr_accessor :command
6
- COMMANDS[:help] = "Show this usage info"
7
-
8
- def usage
9
- %Q{usage: #{File.basename($0)} command [...--option=val...]
10
- where
11
- command: One of: #{COMMANDS.keys[0..-2].join(', ')} or #{COMMANDS.keys.last}
12
-
13
- Configuration taken from #{configliere_file} by default.}
14
- end
15
-
16
- #
17
- # Run the command
18
- #
19
- def run
20
- dump_help_if_requested
21
- # Check options
22
- die "Please give a command and the name of the configliere group to encrypt" unless command
23
- die "Please give the name of the configliere group to encrypt" unless handle || ([:help, :list].include?(command))
24
- die "\n**\nUnknown command\n**\n" unless COMMANDS.include?(command)
25
- #
26
- self.send(command)
27
- end
28
-
29
- end
30
- end
@@ -1,4 +0,0 @@
1
- module Configliere
2
- class Client
3
- end
4
- end