mongoid-app_settings 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Appraisals CHANGED
@@ -6,3 +6,7 @@ end
6
6
  appraise "mongoid3" do
7
7
  gem "mongoid", "~> 3.0"
8
8
  end
9
+
10
+ appraise "mongoid-git" do
11
+ gem "mongoid", git: 'git@github.com:mongoid/mongoid.git'
12
+ end
data/Gemfile.lock CHANGED
@@ -1,34 +1,40 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mongoid-app_settings (1.1.0)
4
+ mongoid-app_settings (1.1.1)
5
5
  activesupport
6
6
  mongoid (>= 2.0)
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- activemodel (3.2.11)
12
- activesupport (= 3.2.11)
11
+ activemodel (3.2.13)
12
+ activesupport (= 3.2.13)
13
13
  builder (~> 3.0.0)
14
- activesupport (3.2.11)
15
- i18n (~> 0.6)
14
+ activesupport (3.2.13)
15
+ i18n (= 0.6.1)
16
16
  multi_json (~> 1.0)
17
17
  appraisal (0.5.1)
18
18
  bundler
19
19
  rake
20
20
  builder (3.0.4)
21
+ coderay (1.0.9)
21
22
  database_cleaner (0.9.1)
22
23
  diff-lcs (1.1.3)
23
24
  i18n (0.6.1)
25
+ method_source (0.8.1)
24
26
  mongoid (3.0.16)
25
27
  activemodel (~> 3.1)
26
28
  moped (~> 1.1)
27
29
  origin (~> 1.0)
28
30
  tzinfo (~> 0.3.22)
29
- moped (1.3.2)
30
- multi_json (1.5.0)
31
- origin (1.0.11)
31
+ moped (1.5.0)
32
+ multi_json (1.7.7)
33
+ origin (1.1.0)
34
+ pry (0.9.12.2)
35
+ coderay (~> 1.0.5)
36
+ method_source (~> 0.8)
37
+ slop (~> 3.4)
32
38
  rake (10.0.3)
33
39
  rspec (2.11.0)
34
40
  rspec-core (~> 2.11.0)
@@ -38,7 +44,8 @@ GEM
38
44
  rspec-expectations (2.11.3)
39
45
  diff-lcs (~> 1.1.3)
40
46
  rspec-mocks (2.11.3)
41
- tzinfo (0.3.35)
47
+ slop (3.4.5)
48
+ tzinfo (0.3.37)
42
49
 
43
50
  PLATFORMS
44
51
  ruby
@@ -47,4 +54,5 @@ DEPENDENCIES
47
54
  appraisal
48
55
  database_cleaner (~> 0.9)
49
56
  mongoid-app_settings!
57
+ pry
50
58
  rspec (~> 2.11)
data/README.markdown CHANGED
@@ -7,7 +7,7 @@ that's stored in Mongoid. It's inspired by a similar project called
7
7
  [rails-settings](https://github.com/ledermann/rails-settings), except this
8
8
  stores it in MongoDB using Mongoid.
9
9
 
10
- It's a little more explicit in that it requires you to define a list of
10
+ It's a little more explicit in that it requires you to define a list of
11
11
  settings beforehand.
12
12
 
13
13
  ## Usage
@@ -16,16 +16,16 @@ Simply create some class and include `Mongoid::AppSettings`.
16
16
 
17
17
  class MySettings
18
18
  include Mongoid::AppSettings
19
-
19
+
20
20
  setting :enable_my_feature, default: true
21
21
  setting :something_else
22
22
  end
23
23
 
24
24
  Then you can do things like:
25
25
 
26
- MySettings.enable_my_feature
26
+ MySettings.enable_my_feature
27
27
  => true
28
-
28
+
29
29
  MySettings.enable_my_feature = false
30
30
  MySettings.enable_my_feature
31
31
  => false
@@ -36,7 +36,7 @@ Then you can do things like:
36
36
 
37
37
  You can unset a value (reverting it to the default if given):
38
38
 
39
- MySettings.reset(:enable_my_feature)
39
+ MySettings.delete(:enable_my_feature)
40
40
  MySettings.enable_my_feature
41
41
  => true
42
42
 
@@ -49,13 +49,13 @@ You can get a list of defaults:
49
49
 
50
50
  MySettings.defaults
51
51
  => {:enable_my_feature => true, :something_else => nil}
52
-
52
+
53
53
  Settings are cached until manually reloaded. In your ApplicationController, you
54
54
  might want to do something like
55
55
 
56
56
  class ApplicationController < ActionController::Base
57
57
  before_filter :reload_settings
58
-
58
+
59
59
  def reload_settings
60
60
  Settings.reload
61
61
  end
@@ -63,11 +63,12 @@ might want to do something like
63
63
 
64
64
  # Changelog
65
65
 
66
- * 1.0 - Feature complete and stable. Until I need more features, that is.
66
+ * 1.1.1 - Add support for Mongoid 4 (available in git). Still supports Mongoid 2 and 3.
67
67
  * 1.1 - Add support for Mongoid 3. Mongoid 2 is still supported.
68
+ * 1.0 - Feature complete and stable. Until I need more features, that is.
68
69
 
69
70
  # Contributing to mongoid-app\_settings
70
-
71
+
71
72
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
72
73
  * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
73
74
  * Fork the project
@@ -21,9 +21,11 @@ GEM
21
21
  bson_ext (1.7.1)
22
22
  bson (~> 1.7.1)
23
23
  builder (3.0.4)
24
+ coderay (1.0.9)
24
25
  database_cleaner (0.9.1)
25
26
  diff-lcs (1.1.3)
26
27
  i18n (0.6.1)
28
+ method_source (0.8.1)
27
29
  mongo (1.7.0)
28
30
  bson (~> 1.7.0)
29
31
  mongoid (2.5.0)
@@ -31,6 +33,10 @@ GEM
31
33
  mongo (~> 1.7)
32
34
  tzinfo (~> 0.3.22)
33
35
  multi_json (1.5.0)
36
+ pry (0.9.12.2)
37
+ coderay (~> 1.0.5)
38
+ method_source (~> 0.8)
39
+ slop (~> 3.4)
34
40
  rake (10.0.3)
35
41
  rspec (2.11.0)
36
42
  rspec-core (~> 2.11.0)
@@ -40,6 +46,7 @@ GEM
40
46
  rspec-expectations (2.11.3)
41
47
  diff-lcs (~> 1.1.3)
42
48
  rspec-mocks (2.11.3)
49
+ slop (3.4.5)
43
50
  tzinfo (0.3.35)
44
51
 
45
52
  PLATFORMS
@@ -51,4 +58,5 @@ DEPENDENCIES
51
58
  database_cleaner (~> 0.9)
52
59
  mongoid (~> 2.0)
53
60
  mongoid-app_settings!
61
+ pry
54
62
  rspec (~> 2.11)
@@ -18,9 +18,11 @@ GEM
18
18
  bundler
19
19
  rake
20
20
  builder (3.0.4)
21
+ coderay (1.0.9)
21
22
  database_cleaner (0.9.1)
22
23
  diff-lcs (1.1.3)
23
24
  i18n (0.6.1)
25
+ method_source (0.8.1)
24
26
  mongoid (3.0.16)
25
27
  activemodel (~> 3.1)
26
28
  moped (~> 1.1)
@@ -29,6 +31,10 @@ GEM
29
31
  moped (1.3.2)
30
32
  multi_json (1.5.0)
31
33
  origin (1.0.11)
34
+ pry (0.9.12.2)
35
+ coderay (~> 1.0.5)
36
+ method_source (~> 0.8)
37
+ slop (~> 3.4)
32
38
  rake (10.0.3)
33
39
  rspec (2.11.0)
34
40
  rspec-core (~> 2.11.0)
@@ -38,6 +44,7 @@ GEM
38
44
  rspec-expectations (2.11.3)
39
45
  diff-lcs (~> 1.1.3)
40
46
  rspec-mocks (2.11.3)
47
+ slop (3.4.5)
41
48
  tzinfo (0.3.35)
42
49
 
43
50
  PLATFORMS
@@ -48,4 +55,5 @@ DEPENDENCIES
48
55
  database_cleaner (~> 0.9)
49
56
  mongoid (~> 3.0)
50
57
  mongoid-app_settings!
58
+ pry
51
59
  rspec (~> 2.11)
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "http://rubygems.org"
4
+
5
+ gem "mongoid", :git=>"git@github.com:mongoid/mongoid.git"
6
+
7
+ gemspec :path=>"../"
@@ -0,0 +1,71 @@
1
+ GIT
2
+ remote: git@github.com:mongoid/mongoid.git
3
+ revision: e1b32e598ec231cc7a7e191fd0432e4cd4910447
4
+ specs:
5
+ mongoid (4.0.0)
6
+ activemodel (~> 4.0.0.rc2)
7
+ moped (~> 1.4)
8
+ origin (~> 1.0)
9
+ tzinfo (~> 0.3.22)
10
+
11
+ PATH
12
+ remote: /Users/marten/prj/mongoid-app_settings
13
+ specs:
14
+ mongoid-app_settings (1.1.0)
15
+ activesupport
16
+ mongoid (>= 2.0)
17
+
18
+ GEM
19
+ remote: http://rubygems.org/
20
+ specs:
21
+ activemodel (4.0.0.rc2)
22
+ activesupport (= 4.0.0.rc2)
23
+ builder (~> 3.1.0)
24
+ activesupport (4.0.0.rc2)
25
+ i18n (~> 0.6, >= 0.6.4)
26
+ minitest (~> 4.2)
27
+ multi_json (~> 1.3)
28
+ thread_safe (~> 0.1)
29
+ tzinfo (~> 0.3.37)
30
+ appraisal (0.5.2)
31
+ bundler
32
+ rake
33
+ atomic (1.1.9)
34
+ builder (3.1.4)
35
+ coderay (1.0.9)
36
+ database_cleaner (0.9.1)
37
+ diff-lcs (1.2.4)
38
+ i18n (0.6.4)
39
+ method_source (0.8.1)
40
+ minitest (4.7.5)
41
+ moped (1.5.0)
42
+ multi_json (1.7.7)
43
+ origin (1.1.0)
44
+ pry (0.9.12.2)
45
+ coderay (~> 1.0.5)
46
+ method_source (~> 0.8)
47
+ slop (~> 3.4)
48
+ rake (10.1.0)
49
+ rspec (2.13.0)
50
+ rspec-core (~> 2.13.0)
51
+ rspec-expectations (~> 2.13.0)
52
+ rspec-mocks (~> 2.13.0)
53
+ rspec-core (2.13.1)
54
+ rspec-expectations (2.13.0)
55
+ diff-lcs (>= 1.1.3, < 2.0)
56
+ rspec-mocks (2.13.1)
57
+ slop (3.4.5)
58
+ thread_safe (0.1.0)
59
+ atomic
60
+ tzinfo (0.3.37)
61
+
62
+ PLATFORMS
63
+ ruby
64
+
65
+ DEPENDENCIES
66
+ appraisal
67
+ database_cleaner (~> 0.9)
68
+ mongoid!
69
+ mongoid-app_settings!
70
+ pry
71
+ rspec (~> 2.11)
@@ -47,7 +47,7 @@ module Mongoid
47
47
  end
48
48
  end
49
49
  end
50
-
50
+
51
51
  # Force a reload from the database
52
52
  def reload
53
53
  @record = nil
@@ -99,8 +99,12 @@ module Mongoid
99
99
 
100
100
  def []=(name, value) # :nodoc:
101
101
  if value
102
- record.set(name, value)
103
- else
102
+ if Mongoid::VERSION > '4'
103
+ record.set(name => value)
104
+ else
105
+ record.set(name, value)
106
+ end
107
+ else
104
108
  # FIXME Mongoid's #set doesn't work for false/nil.
105
109
  # Pull request has been submitted, but until then
106
110
  # this workaround is needed.
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module AppSettings
3
- VERSION = '1.1.0'
3
+ VERSION = '1.1.1'
4
4
  end
5
5
  end
@@ -24,5 +24,6 @@ Gem::Specification.new do |gem|
24
24
  gem.add_development_dependency('database_cleaner', ["~> 0.9"])
25
25
  gem.add_development_dependency('rspec', ["~> 2.11"])
26
26
  gem.add_development_dependency('appraisal')
27
+ gem.add_development_dependency('pry')
27
28
  end
28
29
 
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
2
 
3
3
  describe "Mongoid::AppSettings" do
4
4
  let(:settings) do
5
- settings = Class.new
5
+ settings = Class.new
6
6
  settings.instance_eval { include Mongoid::AppSettings }
7
7
  settings
8
8
  end
@@ -39,14 +39,14 @@ describe "Mongoid::AppSettings" do
39
39
 
40
40
  it "should define fields on the record" do
41
41
  settings.instance_eval { setting :something }
42
- expect {
43
- settings.send(:record).something
42
+ expect {
43
+ settings.send(:record).something
44
44
  }.not_to raise_error(NoMethodError)
45
45
  end
46
46
  end
47
47
 
48
48
  describe "setting values" do
49
- it "should be possible to save a setting" do
49
+ it "should be possible to save a setting" do
50
50
  settings.instance_eval { setting :something }
51
51
  settings.something = "some nice value"
52
52
  settings.something.should == "some nice value"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid-app_settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-13 00:00:00.000000000 Z
12
+ date: 2013-06-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mongoid
@@ -91,6 +91,22 @@ dependencies:
91
91
  - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: pry
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
94
110
  description: Mongoid::AppSettings allows you to store settings in MongoDB, and access
95
111
  them easily
96
112
  email: marten@veldthuis.com
@@ -112,6 +128,8 @@ files:
112
128
  - gemfiles/mongoid2.gemfile.lock
113
129
  - gemfiles/mongoid3.gemfile
114
130
  - gemfiles/mongoid3.gemfile.lock
131
+ - gemfiles/mongoid_git.gemfile
132
+ - gemfiles/mongoid_git.gemfile.lock
115
133
  - lib/mongoid-app_settings.rb
116
134
  - lib/mongoid/app_settings/version.rb
117
135
  - mongoid-app_settings.gemspec
@@ -134,7 +152,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
134
152
  version: '0'
135
153
  segments:
136
154
  - 0
137
- hash: 398499447771221044
155
+ hash: 2653410114827483253
138
156
  required_rubygems_version: !ruby/object:Gem::Requirement
139
157
  none: false
140
158
  requirements:
@@ -143,10 +161,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
161
  version: '0'
144
162
  segments:
145
163
  - 0
146
- hash: 398499447771221044
164
+ hash: 2653410114827483253
147
165
  requirements: []
148
166
  rubyforge_project:
149
- rubygems_version: 1.8.24
167
+ rubygems_version: 1.8.25
150
168
  signing_key:
151
169
  specification_version: 3
152
170
  summary: Store settings for your application in MongoDB