ledermann-rails-settings 2.4.0 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b32592febac17831f730dd18e33ef0af56c1251
4
- data.tar.gz: 6c4c04520451889bf5ad7ca407d53530415aa7e6
3
+ metadata.gz: 56218461e173338b8cd2b34d67ba7e0a311520f0
4
+ data.tar.gz: e71e1f8c6b46649cc3bbf5f3579aa464aa780fa1
5
5
  SHA512:
6
- metadata.gz: 71033242a7e5ff5cc1d6c1da91fc968aae2df1513e83678cd7fb7d199b71fa6f42b4354dd35cfaa8c70671a552adff2041cb7cb65920878b61e42ba0e83f9398
7
- data.tar.gz: dcb7360d13a853702e90efe91329ae3db9c052c8c4062164b68a170a9d97411fc8136c8ced228fad2d30bde7e871c36c257d456cb67bfb579b90ba93b8d738c8
6
+ metadata.gz: dd0f3484d470061f28df5a448163a72da41deecdb9d539ff5ef43002fc5c740333d87736c7e48463dd14d66f9086e5194f4e95027b084102bdcaad1cf63f84c1
7
+ data.tar.gz: 27ba22de825494fd3757558692260837a0bbb79e4b954fb30a2f23a8d11d2f7704bf56d4f1b2af293e9c0c3eb726ade13d3941dc3655b8a0ae946550c5e843c5
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ coverage/*
@@ -2,22 +2,38 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
- - 2.1.5
6
- - 2.2.1
5
+ - 2.1.8
6
+ - 2.2.4
7
+ - 2.3.0
7
8
  gemfile:
8
9
  - ci/Gemfile-rails-3-1
9
10
  - ci/Gemfile-rails-3-2
10
11
  - ci/Gemfile-rails-4-0
11
12
  - ci/Gemfile-rails-4-1
12
13
  - ci/Gemfile-rails-4-2
14
+ - ci/Gemfile-rails-5-0
13
15
  matrix:
14
16
  include:
15
- - rvm: 2.2.1
17
+ - rvm: 2.2.4
18
+ gemfile: ci/Gemfile-rails-4-2
19
+ env: PROTECTED_ATTRIBUTES=true
20
+ - rvm: 2.3.0
16
21
  gemfile: ci/Gemfile-rails-4-2
17
22
  env: PROTECTED_ATTRIBUTES=true
18
23
  exclude:
19
- - rvm: 2.2.1
24
+ - rvm: 1.9.3
25
+ gemfile: ci/Gemfile-rails-5-0
26
+ - rvm: 2.0.0
27
+ gemfile: ci/Gemfile-rails-5-0
28
+ - rvm: 2.1.8
29
+ gemfile: ci/Gemfile-rails-5-0
30
+ - rvm: 2.2.4
20
31
  gemfile: ci/Gemfile-rails-3-1
21
- - rvm: 2.2.1
32
+ - rvm: 2.3.0
33
+ gemfile: ci/Gemfile-rails-3-1
34
+ - rvm: 2.2.4
35
+ gemfile: ci/Gemfile-rails-3-2
36
+ - rvm: 2.3.0
22
37
  gemfile: ci/Gemfile-rails-3-2
23
38
  before_install: gem update bundler
39
+ sudo: false
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012-2015 Georg Ledermann
1
+ Copyright (c) 2012-2016 Georg Ledermann
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,14 +1,15 @@
1
1
  # Settings for Rails
2
2
 
3
- [![Build Status](https://travis-ci.org/ledermann/rails-settings.png?branch=master)](https://travis-ci.org/ledermann/rails-settings)
4
- [![Code Climate](https://codeclimate.com/github/ledermann/rails-settings.png)](https://codeclimate.com/github/ledermann/rails-settings)
3
+ [![Build Status](https://travis-ci.org/ledermann/rails-settings.svg?branch=master)](https://travis-ci.org/ledermann/rails-settings)
4
+ [![Code Climate](https://codeclimate.com/github/ledermann/rails-settings.svg)](https://codeclimate.com/github/ledermann/rails-settings)
5
+ [![Coverage Status](https://coveralls.io/repos/ledermann/rails-settings/badge.svg?branch=master)](https://coveralls.io/r/ledermann/rails-settings?branch=master)
5
6
 
6
7
  Ruby gem to handle settings for ActiveRecord instances by storing them as serialized Hash in a separate database table. Namespaces and defaults included.
7
8
 
8
9
  ## Requirements
9
10
 
10
11
  * Ruby 1.9.3 or newer
11
- * Rails 3.1 or greater (including Rails 4)
12
+ * Rails 3.1 or newer (including Rails 4.x and Rails 5)
12
13
 
13
14
 
14
15
  ## Installation
@@ -123,6 +124,11 @@ User.without_settings_for(:calendar)
123
124
  # => all users without having settings for 'calendar'
124
125
  ```
125
126
 
127
+ ### Eager Loading
128
+ ```ruby
129
+ User.includes(:setting_objects)
130
+ # => Eager load setting_objects when querying many users
131
+ ```
126
132
 
127
133
  ## Compatibility
128
134
 
@@ -140,6 +146,6 @@ See https://github.com/ledermann/rails-settings/releases
140
146
 
141
147
  MIT License
142
148
 
143
- Copyright (c) 2012-2015 [Georg Ledermann](http://www.georg-ledermann.de)
149
+ Copyright (c) 2012-2016 [Georg Ledermann](http://www.georg-ledermann.de)
144
150
 
145
151
  This gem is a complete rewrite of [rails-settings](https://github.com/Squeegy/rails-settings) by [Alex Wayne](https://github.com/Squeegy)
@@ -4,3 +4,4 @@ gem 'activerecord', '~> 3.1.12'
4
4
  gem 'sqlite3'
5
5
  gem 'rake'
6
6
  gem 'rspec'
7
+ gem 'coveralls'
@@ -1,6 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'activerecord', '~> 3.2.17'
3
+ gem 'activerecord', '~> 3.2.22'
4
4
  gem 'sqlite3'
5
5
  gem 'rake'
6
6
  gem 'rspec'
7
+ gem 'coveralls'
@@ -5,3 +5,4 @@ gem 'protected_attributes' if ENV['PROTECTED_ATTRIBUTES'] == 'true'
5
5
  gem 'sqlite3'
6
6
  gem 'rake'
7
7
  gem 'rspec'
8
+ gem 'coveralls'
@@ -5,3 +5,4 @@ gem 'protected_attributes' if ENV['PROTECTED_ATTRIBUTES'] == 'true'
5
5
  gem 'sqlite3'
6
6
  gem 'rake'
7
7
  gem 'rspec'
8
+ gem 'coveralls'
@@ -5,3 +5,4 @@ gem 'protected_attributes' if ENV['PROTECTED_ATTRIBUTES'] == 'true'
5
5
  gem 'sqlite3'
6
6
  gem 'rake'
7
7
  gem 'rspec'
8
+ gem 'coveralls'
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'activerecord', '5.0.0.beta3'
4
+ gem 'sqlite3'
5
+ gem 'rake'
6
+ gem 'rspec'
7
+ gem 'coveralls'
@@ -1,8 +1,13 @@
1
1
  module RailsSettings
2
2
  module Scopes
3
3
  def with_settings
4
- joins("INNER JOIN settings ON #{settings_join_condition}").
5
- uniq
4
+ result = joins("INNER JOIN settings ON #{settings_join_condition}")
5
+
6
+ if ActiveRecord::VERSION::MAJOR < 5
7
+ result.uniq
8
+ else
9
+ result.distinct
10
+ end
6
11
  end
7
12
 
8
13
  def with_settings_for(var)
@@ -1,3 +1,3 @@
1
1
  module RailsSettings
2
- VERSION = '2.4.0'
2
+ VERSION = '2.4.1'
3
3
  end
@@ -6,11 +6,13 @@ require 'rails-settings/version'
6
6
  Gem::Specification.new do |gem|
7
7
  gem.name = 'ledermann-rails-settings'
8
8
  gem.version = RailsSettings::VERSION
9
+ gem.licenses = ['MIT']
9
10
  gem.authors = ['Georg Ledermann']
10
11
  gem.email = ['mail@georg-ledermann.de']
11
12
  gem.description = %q{Settings gem for Ruby on Rails}
12
13
  gem.summary = %q{Ruby gem to handle settings for ActiveRecord instances by storing them as serialized Hash in a separate database table. Namespaces and defaults included.}
13
14
  gem.homepage = 'https://github.com/ledermann/rails-settings'
15
+ gem.required_ruby_version = '>= 1.9.3'
14
16
 
15
17
  gem.files = `git ls-files`.split($/)
16
18
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
@@ -22,4 +24,6 @@ Gem::Specification.new do |gem|
22
24
  gem.add_development_dependency 'rake'
23
25
  gem.add_development_dependency 'sqlite3'
24
26
  gem.add_development_dependency 'rspec'
27
+ gem.add_development_dependency 'coveralls'
28
+ gem.add_development_dependency 'simplecov', '~> 0.11.0'
25
29
  end
@@ -203,6 +203,13 @@ describe "Object with settings" do
203
203
 
204
204
  expect(user.settings?).to eq(false)
205
205
  end
206
+
207
+ it "should raise exception on assigning other than nil" do
208
+ expect {
209
+ user.settings = :foo
210
+ user.save!
211
+ }.to raise_error(ArgumentError)
212
+ end
206
213
  end
207
214
 
208
215
  describe "Customized SettingObject" do
@@ -1,3 +1,14 @@
1
+ require 'simplecov'
2
+ require 'coveralls'
3
+
4
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
5
+ SimpleCov::Formatter::HTMLFormatter,
6
+ Coveralls::SimpleCov::Formatter
7
+ ])
8
+ SimpleCov.start do
9
+ add_filter '/spec/'
10
+ end
11
+
1
12
  # Requires supporting ruby files with custom matchers and macros, etc,
2
13
  # in spec/support/ and its subdirectories.
3
14
  Dir[File.expand_path(File.join(File.dirname(__FILE__),'support','**','*.rb'))].each {|f| require f}
@@ -18,6 +29,10 @@ RSpec.configure do |config|
18
29
  config.before(:each) do
19
30
  clear_db
20
31
  end
32
+
33
+ config.after :suite do
34
+ RailsSettingsMigration.migrate(:down)
35
+ end
21
36
  end
22
37
 
23
38
  require 'active_record'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ledermann-rails-settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Georg Ledermann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-15 00:00:00.000000000 Z
11
+ date: 2016-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: coveralls
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.11.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.11.0
69
97
  description: Settings gem for Ruby on Rails
70
98
  email:
71
99
  - mail@georg-ledermann.de
@@ -84,6 +112,7 @@ files:
84
112
  - ci/Gemfile-rails-4-0
85
113
  - ci/Gemfile-rails-4-1
86
114
  - ci/Gemfile-rails-4-2
115
+ - ci/Gemfile-rails-5-0
87
116
  - lib/generators/rails_settings/migration/migration_generator.rb
88
117
  - lib/generators/rails_settings/migration/templates/migration.rb
89
118
  - lib/ledermann-rails-settings.rb
@@ -105,7 +134,8 @@ files:
105
134
  - spec/support/matchers/perform_queries.rb
106
135
  - spec/support/query_counter.rb
107
136
  homepage: https://github.com/ledermann/rails-settings
108
- licenses: []
137
+ licenses:
138
+ - MIT
109
139
  metadata: {}
110
140
  post_install_message:
111
141
  rdoc_options: []
@@ -115,7 +145,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
145
  requirements:
116
146
  - - ">="
117
147
  - !ruby/object:Gem::Version
118
- version: '0'
148
+ version: 1.9.3
119
149
  required_rubygems_version: !ruby/object:Gem::Requirement
120
150
  requirements:
121
151
  - - ">="
@@ -123,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
153
  version: '0'
124
154
  requirements: []
125
155
  rubyforge_project:
126
- rubygems_version: 2.4.6
156
+ rubygems_version: 2.6.2
127
157
  signing_key:
128
158
  specification_version: 4
129
159
  summary: Ruby gem to handle settings for ActiveRecord instances by storing them as