cantango-config 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. data/Gemfile +5 -5
  2. data/Gemfile.lock +14 -19
  3. data/README.mdown +39 -1
  4. data/VERSION +1 -1
  5. data/cantango-config.gemspec +18 -11
  6. data/lib/cantango/config.rb +4 -2
  7. data/lib/cantango/config_ext/loader/yaml.rb +15 -0
  8. data/lib/cantango/config_ext/loader.rb +5 -0
  9. data/lib/cantango/config_ext.rb +5 -0
  10. data/lib/cantango/configuration/ability.rb +1 -1
  11. data/lib/cantango/configuration/accounts.rb +1 -1
  12. data/lib/cantango/configuration/categories.rb +0 -17
  13. data/lib/cantango/configuration/category.rb +20 -0
  14. data/lib/cantango/configuration/engine.rb +1 -1
  15. data/lib/cantango/configuration/engines.rb +0 -2
  16. data/lib/cantango/configuration/execution_modes.rb +21 -0
  17. data/lib/cantango/configuration/models/mongo_mapper.rb +1 -1
  18. data/lib/cantango/configuration/models.rb +1 -1
  19. data/lib/cantango/configuration/modes.rb +3 -16
  20. data/lib/cantango/configuration/registry/{candidate.rb → clazz.rb} +1 -1
  21. data/lib/cantango/configuration/registry.rb +1 -1
  22. data/lib/cantango/configuration/users.rb +1 -1
  23. data/lib/cantango/configuration.rb +6 -5
  24. data/spec/cantango/configuration/ability_spec.rb +2 -2
  25. data/spec/cantango/configuration/accounts_spec.rb +2 -2
  26. data/spec/cantango/configuration/categories_spec.rb +3 -3
  27. data/spec/cantango/configuration/engines_spec.rb +1 -1
  28. data/spec/cantango/configuration/execution_modes_spec.rb +15 -0
  29. data/spec/cantango/configuration/modes_spec.rb +18 -0
  30. data/spec/cantango/configuration/registry/candidate_spec.rb +3 -3
  31. data/spec/cantango/configuration/shared/{modes_ex.rb → execution_modes_ex.rb} +1 -1
  32. data/spec/cantango/configuration/shared/registry/{candidate_ex.rb → clazz_ex.rb} +1 -1
  33. data/spec/cantango/configuration/users_spec.rb +2 -2
  34. metadata +34 -27
data/Gemfile CHANGED
@@ -1,12 +1,12 @@
1
1
  source :rubygems
2
2
 
3
3
  group :default do
4
- gem 'rails', '>= 3.1'
5
- gem 'sugar-high', '>= 0.6.0'
6
- gem 'sweetloader', '~> 0.1.0'
7
- gem 'hashie'
4
+ gem 'rails', '>= 3.1'
5
+ gem 'sugar-high', '>= 0.6.0'
6
+ gem 'sweetloader', '~> 0.1.6'
7
+ gem 'hashie', '~> 0.4.0'
8
8
 
9
- gem 'cantango-core', :git => 'git://github.com/kristianmandrup/cantango-core.git'
9
+ gem 'cantango-core' #, :git => 'git://github.com/kristianmandrup/cantango-core.git'
10
10
  end
11
11
 
12
12
  group :development do
data/Gemfile.lock CHANGED
@@ -1,14 +1,3 @@
1
- GIT
2
- remote: git://github.com/kristianmandrup/cantango-core.git
3
- revision: 1eaa3a2ee8a2be798e80e0da7e56e4fb6b30d2b8
4
- specs:
5
- cantango-core (1.0.0.beta1)
6
- cancan (>= 1.4)
7
- hashie
8
- rails (>= 3.0.1)
9
- sugar-high (>= 0.6.0)
10
- sweetloader (~> 0.1.0)
11
-
12
1
  GEM
13
2
  remote: http://rubygems.org/
14
3
  specs:
@@ -43,6 +32,12 @@ GEM
43
32
  arel (2.2.1)
44
33
  builder (3.0.0)
45
34
  cancan (1.6.7)
35
+ cantango-core (0.1.4)
36
+ cancan (>= 1.4)
37
+ hashie
38
+ rails (>= 3.0.1)
39
+ sugar-high (>= 0.6.0)
40
+ sweetloader (~> 0.1.5)
46
41
  colorize (0.5.8)
47
42
  cutter (0.8.2)
48
43
  activesupport (>= 2.3.5)
@@ -51,26 +46,26 @@ GEM
51
46
  diff-lcs (1.1.3)
52
47
  dkastner-moneta (1.2.0)
53
48
  erubis (2.7.0)
54
- factory_girl (2.3.1)
49
+ factory_girl (2.3.2)
55
50
  activesupport
56
51
  file-tail (1.0.7)
57
52
  tins (~> 0.3)
58
53
  forgery (0.5.0)
59
54
  git (1.2.5)
60
- hashie (1.2.0)
55
+ hashie (0.4.0)
61
56
  hike (1.2.1)
62
57
  i18n (0.6.0)
63
58
  jeweler (1.6.4)
64
59
  bundler (~> 1.0)
65
60
  git (>= 1.2.5)
66
61
  rake
67
- json (1.6.1)
62
+ json (1.6.3)
68
63
  mail (2.3.0)
69
64
  i18n (>= 0.4.0)
70
65
  mime-types (~> 1.16)
71
66
  treetop (~> 1.4.8)
72
67
  mime-types (1.17.2)
73
- multi_json (1.0.3)
68
+ multi_json (1.0.4)
74
69
  polyglot (0.3.3)
75
70
  rack (1.3.5)
76
71
  rack-cache (1.1)
@@ -128,7 +123,7 @@ GEM
128
123
  sqlite3 (1.3.4)
129
124
  sugar-high (0.6.0)
130
125
  activesupport (>= 3.0.1)
131
- sweetloader (0.1.1)
126
+ sweetloader (0.1.6)
132
127
  activesupport (>= 3.0.1)
133
128
  i18n
134
129
  thor (0.14.6)
@@ -144,13 +139,13 @@ PLATFORMS
144
139
 
145
140
  DEPENDENCIES
146
141
  bundler (>= 1.1.rc)
147
- cantango-core!
142
+ cantango-core
148
143
  cutter
149
144
  database_cleaner
150
145
  dkastner-moneta (>= 1.0)
151
146
  factory_girl
152
147
  forgery
153
- hashie
148
+ hashie (~> 0.4.0)
154
149
  jeweler (>= 1.6.4)
155
150
  rails (>= 3.1)
156
151
  rcov
@@ -160,4 +155,4 @@ DEPENDENCIES
160
155
  spork
161
156
  sqlite3
162
157
  sugar-high (>= 0.6.0)
163
- sweetloader (~> 0.1.0)
158
+ sweetloader (~> 0.1.6)
data/README.mdown CHANGED
@@ -1,9 +1,47 @@
1
1
  # Cantango Configuration
2
2
 
3
- Configuration for [CanTango](https://github.com/kristianmandrup/cantango)
3
+ Configuration for [CanTango](https://github.com/kristianmandrup/cantango).
4
+
5
+ ## Status: Dec 1 2011
4
6
 
5
7
  The Configuration DSL has now been almost fully "spec'ed".
6
8
 
9
+ ## Dependencies
10
+
11
+ This extension depends on the CanTango [core](https://github.com/kristianmandrup/cantango-core) and follows the extension conventions as described there.
12
+
13
+ ## Core extensions
14
+
15
+ * YAML Loader - use of Config to set where (which folder) to load the YAML file from
16
+
17
+ ## Configuration
18
+
19
+ Configuration allows configuration of the following components:
20
+
21
+ * Ability
22
+ * Account
23
+ * Accounts
24
+ * Adapters
25
+ * Categories
26
+ * Debug
27
+ * Engines
28
+ * Guest
29
+ * Hooks
30
+ * Localhosts
31
+ * Models
32
+ * Modes
33
+ * Orms
34
+ * User
35
+ * Users
36
+
37
+ Example:
38
+
39
+ ```ruby
40
+ CanTango.config.accounts do |accounts|
41
+ # configure accounts
42
+ end
43
+ ```
44
+
7
45
  ## Contributing to cantango-config
8
46
 
9
47
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cantango-config}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Kristian Mandrup}]
12
- s.date = %q{2011-11-25}
12
+ s.date = %q{2011-12-04}
13
13
  s.description = %q{Configuration DSL for configuring CanTango}
14
14
  s.email = %q{kmandrup@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -30,6 +30,9 @@ Gem::Specification.new do |s|
30
30
  "lib/cantango/adapter/moneta.rb",
31
31
  "lib/cantango/class_methods.rb",
32
32
  "lib/cantango/config.rb",
33
+ "lib/cantango/config_ext.rb",
34
+ "lib/cantango/config_ext/loader.rb",
35
+ "lib/cantango/config_ext/loader/yaml.rb",
33
36
  "lib/cantango/configuration.rb",
34
37
  "lib/cantango/configuration/ability.rb",
35
38
  "lib/cantango/configuration/account.rb",
@@ -37,9 +40,11 @@ Gem::Specification.new do |s|
37
40
  "lib/cantango/configuration/adapters.rb",
38
41
  "lib/cantango/configuration/autoload.rb",
39
42
  "lib/cantango/configuration/categories.rb",
43
+ "lib/cantango/configuration/category.rb",
40
44
  "lib/cantango/configuration/debug.rb",
41
45
  "lib/cantango/configuration/engine.rb",
42
46
  "lib/cantango/configuration/engines.rb",
47
+ "lib/cantango/configuration/execution_modes.rb",
43
48
  "lib/cantango/configuration/factory.rb",
44
49
  "lib/cantango/configuration/guest.rb",
45
50
  "lib/cantango/configuration/hooks.rb",
@@ -56,7 +61,7 @@ Gem::Specification.new do |s|
56
61
  "lib/cantango/configuration/orms.rb",
57
62
  "lib/cantango/configuration/registry.rb",
58
63
  "lib/cantango/configuration/registry/base.rb",
59
- "lib/cantango/configuration/registry/candidate.rb",
64
+ "lib/cantango/configuration/registry/clazz.rb",
60
65
  "lib/cantango/configuration/registry/hash.rb",
61
66
  "lib/cantango/configuration/user.rb",
62
67
  "lib/cantango/configuration/users.rb",
@@ -70,19 +75,21 @@ Gem::Specification.new do |s|
70
75
  "spec/cantango/configuration/debug_spec.rb",
71
76
  "spec/cantango/configuration/engines/engine_shared.rb",
72
77
  "spec/cantango/configuration/engines_spec.rb",
78
+ "spec/cantango/configuration/execution_modes_spec.rb",
73
79
  "spec/cantango/configuration/factory_spec.rb",
74
80
  "spec/cantango/configuration/guest/find_guest_default_way_spec.rb",
75
81
  "spec/cantango/configuration/guest_spec.rb",
76
82
  "spec/cantango/configuration/localhosts_spec.rb",
77
83
  "spec/cantango/configuration/models_spec.rb",
84
+ "spec/cantango/configuration/modes_spec.rb",
78
85
  "spec/cantango/configuration/orms_spec.rb",
79
86
  "spec/cantango/configuration/registry/base_spec.rb",
80
87
  "spec/cantango/configuration/registry/candidate_spec.rb",
81
88
  "spec/cantango/configuration/registry/hash_spec.rb",
89
+ "spec/cantango/configuration/shared/execution_modes_ex.rb",
82
90
  "spec/cantango/configuration/shared/factory_ex.rb",
83
- "spec/cantango/configuration/shared/modes_ex.rb",
84
91
  "spec/cantango/configuration/shared/registry/base_ex.rb",
85
- "spec/cantango/configuration/shared/registry/candidate_ex.rb",
92
+ "spec/cantango/configuration/shared/registry/clazz_ex.rb",
86
93
  "spec/cantango/configuration/shared/registry/hash_ex.rb",
87
94
  "spec/cantango/configuration/user_spec.rb",
88
95
  "spec/cantango/configuration/users_spec.rb",
@@ -113,8 +120,8 @@ Gem::Specification.new do |s|
113
120
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
114
121
  s.add_runtime_dependency(%q<rails>, [">= 3.1"])
115
122
  s.add_runtime_dependency(%q<sugar-high>, [">= 0.6.0"])
116
- s.add_runtime_dependency(%q<sweetloader>, ["~> 0.1.0"])
117
- s.add_runtime_dependency(%q<hashie>, [">= 0"])
123
+ s.add_runtime_dependency(%q<sweetloader>, ["~> 0.1.6"])
124
+ s.add_runtime_dependency(%q<hashie>, ["~> 0.4.0"])
118
125
  s.add_runtime_dependency(%q<cantango-core>, [">= 0"])
119
126
  s.add_development_dependency(%q<bundler>, [">= 1.1.rc"])
120
127
  s.add_development_dependency(%q<jeweler>, [">= 1.6.4"])
@@ -123,8 +130,8 @@ Gem::Specification.new do |s|
123
130
  else
124
131
  s.add_dependency(%q<rails>, [">= 3.1"])
125
132
  s.add_dependency(%q<sugar-high>, [">= 0.6.0"])
126
- s.add_dependency(%q<sweetloader>, ["~> 0.1.0"])
127
- s.add_dependency(%q<hashie>, [">= 0"])
133
+ s.add_dependency(%q<sweetloader>, ["~> 0.1.6"])
134
+ s.add_dependency(%q<hashie>, ["~> 0.4.0"])
128
135
  s.add_dependency(%q<cantango-core>, [">= 0"])
129
136
  s.add_dependency(%q<bundler>, [">= 1.1.rc"])
130
137
  s.add_dependency(%q<jeweler>, [">= 1.6.4"])
@@ -134,8 +141,8 @@ Gem::Specification.new do |s|
134
141
  else
135
142
  s.add_dependency(%q<rails>, [">= 3.1"])
136
143
  s.add_dependency(%q<sugar-high>, [">= 0.6.0"])
137
- s.add_dependency(%q<sweetloader>, ["~> 0.1.0"])
138
- s.add_dependency(%q<hashie>, [">= 0"])
144
+ s.add_dependency(%q<sweetloader>, ["~> 0.1.6"])
145
+ s.add_dependency(%q<hashie>, ["~> 0.4.0"])
139
146
  s.add_dependency(%q<cantango-core>, [">= 0"])
140
147
  s.add_dependency(%q<bundler>, [">= 1.1.rc"])
141
148
  s.add_dependency(%q<jeweler>, [">= 1.6.4"])
@@ -5,9 +5,11 @@ require 'sweetloader'
5
5
 
6
6
  require 'cantango/core'
7
7
 
8
- AutoLoader.namespaces = {:CanTango => 'cantango'}
8
+ SweetLoader.namespaces = {:CanTango => 'cantango'}
9
+ SweetLoader.mode = :require
9
10
 
10
11
  module CanTango
11
12
  autoload_modules :Configuration, :ClassMethods
12
13
  include ClassMethods
13
- end
14
+ end
15
+ require 'cantango/config_ext'
@@ -0,0 +1,15 @@
1
+ module CanTango::Loader
2
+ class Yaml
3
+ module ClassMethods
4
+ protected
5
+
6
+ def config_file name
7
+ File.join(config_path, "#{name}.yml") if rails?
8
+ end
9
+
10
+ def config_path
11
+ CanTango.config.permissions.config_path
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ module CanTango
2
+ module Loader
3
+ autoload_modules :Yaml
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ module CanTango
2
+ sweet_scope :ns => {:CanTango => 'cantango/config_ext'} do
3
+ sweetload :Loader
4
+ end
5
+ end
@@ -5,7 +5,7 @@ module CanTango
5
5
  include ClassExt
6
6
 
7
7
  include CanTango::Configuration::Factory
8
- include CanTango::Configuration::Modes
8
+ include CanTango::Configuration::ExecutionModes
9
9
  end
10
10
  end
11
11
  end
@@ -1,6 +1,6 @@
1
1
  module CanTango
2
2
  class Configuration
3
- class Accounts < Registry::Candidate
3
+ class Accounts < Registry::Clazz
4
4
  include Singleton
5
5
  end
6
6
  end
@@ -35,23 +35,6 @@ module CanTango
35
35
  end
36
36
  found_categories.empty? ? {} : found_categories
37
37
  end
38
-
39
- class Category
40
- def initialize *subjects
41
- @subjects = subjects.flatten
42
- end
43
-
44
- def subjects
45
- @subjects ||= []
46
- end
47
-
48
- # test if a particular category has a certain subject
49
- def has_any? subject, &block
50
- found = subjects.include? subject
51
- yield if found && block
52
- found
53
- end
54
- end
55
38
  end
56
39
  end
57
40
  end
@@ -0,0 +1,20 @@
1
+ module CanTango
2
+ class Configuration
3
+ class Category
4
+ def initialize *subjects
5
+ @subjects = subjects.flatten
6
+ end
7
+
8
+ def subjects
9
+ @subjects ||= []
10
+ end
11
+
12
+ # test if a particular category has a certain subject
13
+ def has_any? subject, &block
14
+ found = subjects.include? subject
15
+ yield if found && block
16
+ found
17
+ end
18
+ end
19
+ end
20
+ end
@@ -4,7 +4,7 @@ module CanTango
4
4
  class Configuration
5
5
  class Engine
6
6
  include Singleton
7
- include CanTango::Configuration::Modes
7
+ include CanTango::Configuration::ExecutionModes
8
8
 
9
9
  def set state = :on
10
10
  raise ArgumentError, "Must be :on or :off" unless !state || [:on, :off].include?(state)
@@ -1,8 +1,6 @@
1
1
  module CanTango
2
2
  class Configuration
3
3
  class Engines < Registry::Hash
4
- autoload_modules :Permission, :Engine
5
-
6
4
  include Singleton
7
5
  include Enumerable
8
6
 
@@ -0,0 +1,21 @@
1
+ module CanTango
2
+ class Configuration
3
+ module ExecutionModes
4
+ def modes
5
+ @modes ||= [:no_cache]
6
+ end
7
+
8
+ def mode= mode_name
9
+ mode_name = mode_name.to_sym
10
+ raise ArgumentError, "Not a valid mode name" if !valid_mode_names.include? mode_name
11
+ @modes = (mode_name == :both) ? [:cache, :no_cache] : [mode_name]
12
+ end
13
+
14
+ private
15
+
16
+ def valid_mode_names
17
+ [:cache, :no_cache]
18
+ end
19
+ end
20
+ end
21
+ end
@@ -1,7 +1,7 @@
1
1
  module CanTango
2
2
  class Configuration
3
3
  class Models
4
- module MongoMapper < Mongo
4
+ class MongoMapper < Mongo
5
5
  def models
6
6
  MongoMapper.database.collections
7
7
  end
@@ -1,7 +1,7 @@
1
1
  module CanTango
2
2
  class Configuration
3
3
  class Models
4
- autoload_modules :Generic, :ActiveRecord, :DataMapper, :MongoMapper, :Mongoid
4
+ autoload_modules :Generic, :ActiveRecord, :DataMapper, :Mongo, :MongoMapper, :Mongoid
5
5
  autoload_modules :Actions
6
6
 
7
7
  include CanTango::Helpers::Debug
@@ -1,21 +1,8 @@
1
1
  module CanTango
2
2
  class Configuration
3
- module Modes
4
- def modes
5
- @modes ||= [:no_cache]
6
- end
7
-
8
- def mode= mode_name
9
- mode_name = mode_name.to_sym
10
- raise ArgumentError, "Not a valid mode name" if !valid_mode_names.include? mode_name
11
- @modes = (mode_name == :both) ? [:cache, :no_cache] : [mode_name]
12
- end
13
-
14
- private
15
-
16
- def valid_mode_names
17
- [:cache, :no_cache]
18
- end
3
+ class Modes < Registry::Clazz
4
+ include Singleton
19
5
  end
20
6
  end
21
7
  end
8
+
@@ -4,7 +4,7 @@ require 'sugar-high/kind_of'
4
4
  module CanTango
5
5
  class Configuration
6
6
  module Registry
7
- class Candidate
7
+ class Clazz
8
8
  def register label, value
9
9
  raise "first arg must be a label, was: #{label}" if !label.kind_of_label?
10
10
  raise "second arg must be a valid Class, was: #{value}" if !valid? value
@@ -1,7 +1,7 @@
1
1
  module CanTango
2
2
  class Configuration
3
3
  module Registry
4
- autoload_modules :Base, :Hash, :Candidate
4
+ autoload_modules :Base, :Hash, :Clazz
5
5
  end
6
6
  end
7
7
  end
@@ -1,6 +1,6 @@
1
1
  module CanTango
2
2
  class Configuration
3
- class Users < Registry::Candidate
3
+ class Users < Registry::Clazz
4
4
  include Singleton
5
5
  end
6
6
  end
@@ -1,6 +1,8 @@
1
1
  require 'set'
2
2
  require 'singleton'
3
3
 
4
+ require 'cantango/configuration'
5
+
4
6
  module CanTango
5
7
  # The main entry point to configure CanTango
6
8
  class << self
@@ -14,10 +16,9 @@ module CanTango
14
16
  end
15
17
 
16
18
  class Configuration
17
- autoload_modules :Categories
18
- autoload_modules :Models, :Engines, :Ability
19
- autoload_modules :Registry
20
- autoload_modules :Factory, :Autoload, :Adapters, :Debug, :Modes, :Orms, :Localhosts, :Hooks
19
+ autoload_modules :Models, :Registry, :Engines, :Factory, :ExecutionModes, :Modes, :Ability
20
+ autoload_modules :Categories, :Category
21
+ autoload_modules :Autoload, :Adapters, :Debug, :Orms, :Localhosts, :Hooks
21
22
  autoload_modules :Account, :Accounts
22
23
  autoload_modules :User, :Guest, :Users
23
24
 
@@ -25,7 +26,7 @@ module CanTango
25
26
 
26
27
  def ability
27
28
  @ability ||= conf::Ability.instance
28
- @ability.default_class ||= CanTango::Ability::Executor::Base
29
+ @ability.default_class ||= CanTango::Ability::Executor::Base # from cantango-core
29
30
  @ability
30
31
  end
31
32
 
@@ -1,13 +1,13 @@
1
1
  require 'spec_helper'
2
2
  require 'cantango/configuration/shared/factory_ex'
3
- require 'cantango/configuration/shared/modes_ex'
3
+ require 'cantango/configuration/shared/execution_modes_ex'
4
4
 
5
5
  describe CanTango::Configuration::Ability do
6
6
  subject { CanTango.config.ability }
7
7
 
8
8
  it_should_behave_like 'Factory'
9
9
 
10
- it_should_behave_like 'Modes'
10
+ it_should_behave_like 'Execution Modes'
11
11
  end
12
12
 
13
13
 
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'cantango/configuration/shared/registry/candidate_ex'
2
+ require 'cantango/configuration/shared/registry/clazz_ex'
3
3
 
4
4
  class UserAccount
5
5
  end
@@ -10,7 +10,7 @@ end
10
10
  describe CanTango::Configuration::Accounts do
11
11
  subject { CanTango.config.accounts }
12
12
 
13
- it_should_behave_like "Candidate Registry" do
13
+ it_should_behave_like "Clazz Registry" do
14
14
  let(:hash1) do
15
15
  {:a => UserAccount, :b => AdminAccount}
16
16
  end
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
  require 'cantango/configuration/shared/registry/hash_ex'
3
3
 
4
- describe CanTango::Configuration::Categories::Category do
5
- subject { CanTango::Configuration::Categories::Category.new }
4
+ describe CanTango::Configuration::Category do
5
+ subject { CanTango::Configuration::Category.new }
6
6
  specify { subject.has_any?(:x).should_not be_true }
7
7
 
8
- subject { CanTango::Configuration::Categories::Category.new :a, :b }
8
+ subject { CanTango::Configuration::Category.new :a, :b }
9
9
  specify { subject.has_any?(:a).should be_true }
10
10
  end
11
11
 
@@ -8,7 +8,7 @@ class MyOtherEngine < CanTango::Engine
8
8
  end
9
9
 
10
10
 
11
- describe CanTango::Configuration::Modes do
11
+ describe CanTango::Configuration::ExecutionModes do
12
12
  subject { CanTango.config.engines }
13
13
 
14
14
  it_should_behave_like "Hash Registry" do
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+ require 'cantango/configuration/shared/execution_modes_ex'
3
+
4
+ class User
5
+ end
6
+
7
+ class MyAbility
8
+ include CanTango::Configuration::ExecutionModes
9
+ end
10
+
11
+ describe CanTango::Configuration::ExecutionModes do
12
+ subject { MyAbility.new }
13
+
14
+ it_should_behave_like "Execution Modes"
15
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+ require 'cantango/configuration/shared/registry/clazz_ex'
3
+
4
+ class ModeA
5
+ end
6
+
7
+ class ModeB
8
+ end
9
+
10
+ describe CanTango::Configuration::Modes do
11
+ subject { CanTango.config.modes }
12
+
13
+ it_should_behave_like "Clazz Registry" do
14
+ let(:hash1) do
15
+ {:a => ModeA, :b => ModeB}
16
+ end
17
+ end
18
+ end
@@ -1,12 +1,12 @@
1
1
  require 'spec_helper'
2
- require 'cantango/configuration/shared/registry/candidate_ex'
2
+ require 'cantango/configuration/shared/registry/clazz_ex'
3
3
 
4
- class MyReg < CanTango::Configuration::Registry::Candidate
4
+ class MyReg < CanTango::Configuration::Registry::Clazz
5
5
  end
6
6
 
7
7
  describe MyReg do
8
8
  subject { MyReg.new }
9
9
 
10
- it_should_behave_like "Candidate Registry" do
10
+ it_should_behave_like "Clazz Registry" do
11
11
  end
12
12
  end
@@ -1,4 +1,4 @@
1
- shared_examples_for 'Modes' do
1
+ shared_examples_for 'Execution Modes' do
2
2
  describe 'valid mode=' do
3
3
  before do
4
4
  subject.mode = :cache
@@ -4,7 +4,7 @@ end
4
4
  class B
5
5
  end
6
6
 
7
- shared_examples_for 'Candidate Registry' do
7
+ shared_examples_for 'Clazz Registry' do
8
8
  let(:hash1) do
9
9
  {:a => A, :b => B}
10
10
  end
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'cantango/configuration/shared/registry/candidate_ex'
2
+ require 'cantango/configuration/shared/registry/clazz_ex'
3
3
 
4
4
  class User
5
5
  end
@@ -10,7 +10,7 @@ end
10
10
  describe CanTango::Configuration::Users do
11
11
  subject { CanTango.config.users }
12
12
 
13
- it_should_behave_like "Candidate Registry" do
13
+ it_should_behave_like "Clazz Registry" do
14
14
  let(:hash1) do
15
15
  {:a => User, :b => Admin}
16
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cantango-config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-25 00:00:00.000000000Z
12
+ date: 2011-12-04 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &70227713823060 !ruby/object:Gem::Requirement
16
+ requirement: &70338962967080 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70227713823060
24
+ version_requirements: *70338962967080
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: sugar-high
27
- requirement: &70227713821780 !ruby/object:Gem::Requirement
27
+ requirement: &70338962963200 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,32 +32,32 @@ dependencies:
32
32
  version: 0.6.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70227713821780
35
+ version_requirements: *70338962963200
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sweetloader
38
- requirement: &70227713820860 !ruby/object:Gem::Requirement
38
+ requirement: &70338962961760 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- version: 0.1.0
43
+ version: 0.1.6
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70227713820860
46
+ version_requirements: *70338962961760
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: hashie
49
- requirement: &70227713820000 !ruby/object:Gem::Requirement
49
+ requirement: &70338962960200 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
- - - ! '>='
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 0.4.0
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70227713820000
57
+ version_requirements: *70338962960200
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: cantango-core
60
- requirement: &70227713818460 !ruby/object:Gem::Requirement
60
+ requirement: &70338962953800 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70227713818460
68
+ version_requirements: *70338962953800
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
- requirement: &70227713817580 !ruby/object:Gem::Requirement
71
+ requirement: &70338962952620 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.1.rc
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70227713817580
79
+ version_requirements: *70338962952620
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: jeweler
82
- requirement: &70227713816480 !ruby/object:Gem::Requirement
82
+ requirement: &70338962951260 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 1.6.4
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70227713816480
90
+ version_requirements: *70338962951260
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rcov
93
- requirement: &70227713815620 !ruby/object:Gem::Requirement
93
+ requirement: &70338962946420 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70227713815620
101
+ version_requirements: *70338962946420
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rspec
104
- requirement: &70227713814980 !ruby/object:Gem::Requirement
104
+ requirement: &70338962935280 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,7 +109,7 @@ dependencies:
109
109
  version: 2.6.0
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70227713814980
112
+ version_requirements: *70338962935280
113
113
  description: Configuration DSL for configuring CanTango
114
114
  email: kmandrup@gmail.com
115
115
  executables: []
@@ -131,6 +131,9 @@ files:
131
131
  - lib/cantango/adapter/moneta.rb
132
132
  - lib/cantango/class_methods.rb
133
133
  - lib/cantango/config.rb
134
+ - lib/cantango/config_ext.rb
135
+ - lib/cantango/config_ext/loader.rb
136
+ - lib/cantango/config_ext/loader/yaml.rb
134
137
  - lib/cantango/configuration.rb
135
138
  - lib/cantango/configuration/ability.rb
136
139
  - lib/cantango/configuration/account.rb
@@ -138,9 +141,11 @@ files:
138
141
  - lib/cantango/configuration/adapters.rb
139
142
  - lib/cantango/configuration/autoload.rb
140
143
  - lib/cantango/configuration/categories.rb
144
+ - lib/cantango/configuration/category.rb
141
145
  - lib/cantango/configuration/debug.rb
142
146
  - lib/cantango/configuration/engine.rb
143
147
  - lib/cantango/configuration/engines.rb
148
+ - lib/cantango/configuration/execution_modes.rb
144
149
  - lib/cantango/configuration/factory.rb
145
150
  - lib/cantango/configuration/guest.rb
146
151
  - lib/cantango/configuration/hooks.rb
@@ -157,7 +162,7 @@ files:
157
162
  - lib/cantango/configuration/orms.rb
158
163
  - lib/cantango/configuration/registry.rb
159
164
  - lib/cantango/configuration/registry/base.rb
160
- - lib/cantango/configuration/registry/candidate.rb
165
+ - lib/cantango/configuration/registry/clazz.rb
161
166
  - lib/cantango/configuration/registry/hash.rb
162
167
  - lib/cantango/configuration/user.rb
163
168
  - lib/cantango/configuration/users.rb
@@ -171,19 +176,21 @@ files:
171
176
  - spec/cantango/configuration/debug_spec.rb
172
177
  - spec/cantango/configuration/engines/engine_shared.rb
173
178
  - spec/cantango/configuration/engines_spec.rb
179
+ - spec/cantango/configuration/execution_modes_spec.rb
174
180
  - spec/cantango/configuration/factory_spec.rb
175
181
  - spec/cantango/configuration/guest/find_guest_default_way_spec.rb
176
182
  - spec/cantango/configuration/guest_spec.rb
177
183
  - spec/cantango/configuration/localhosts_spec.rb
178
184
  - spec/cantango/configuration/models_spec.rb
185
+ - spec/cantango/configuration/modes_spec.rb
179
186
  - spec/cantango/configuration/orms_spec.rb
180
187
  - spec/cantango/configuration/registry/base_spec.rb
181
188
  - spec/cantango/configuration/registry/candidate_spec.rb
182
189
  - spec/cantango/configuration/registry/hash_spec.rb
190
+ - spec/cantango/configuration/shared/execution_modes_ex.rb
183
191
  - spec/cantango/configuration/shared/factory_ex.rb
184
- - spec/cantango/configuration/shared/modes_ex.rb
185
192
  - spec/cantango/configuration/shared/registry/base_ex.rb
186
- - spec/cantango/configuration/shared/registry/candidate_ex.rb
193
+ - spec/cantango/configuration/shared/registry/clazz_ex.rb
187
194
  - spec/cantango/configuration/shared/registry/hash_ex.rb
188
195
  - spec/cantango/configuration/user_spec.rb
189
196
  - spec/cantango/configuration/users_spec.rb
@@ -216,7 +223,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
216
223
  version: '0'
217
224
  segments:
218
225
  - 0
219
- hash: 3731651636575541962
226
+ hash: 1294283763259309837
220
227
  required_rubygems_version: !ruby/object:Gem::Requirement
221
228
  none: false
222
229
  requirements: