Skip to content

Commit

Permalink
Merge pull request #11 from Stex/release/1.0
Browse files Browse the repository at this point in the history
Release/1.0
  • Loading branch information
stex committed Nov 26, 2018
2 parents c8a2814 + 5f41683 commit 4510182
Show file tree
Hide file tree
Showing 109 changed files with 2,525 additions and 2,294 deletions.
66 changes: 0 additions & 66 deletions .codeclimate.yml

This file was deleted.

10 changes: 10 additions & 0 deletions .editorconfig
@@ -0,0 +1,10 @@
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .rspec
@@ -0,0 +1 @@
--require spec_helper
131 changes: 131 additions & 0 deletions .rubocop.yml
@@ -0,0 +1,131 @@
AllCops:
TargetRubyVersion: 2.3
Exclude:
- tmp/**/*
- gemfiles/**/*

#---------------------------------------------
# Layout
#---------------------------------------------

# Hashes do not need padding
Layout/SpaceInsideHashLiteralBraces:
Enabled: false

# Allow 2 space indentation for when inside a case
Layout/CaseIndentation:
Enabled: false

# Allow empty lines in classes
Layout/EmptyLinesAroundClassBody:
Enabled: false

# Allow multiple spaces before first argument
Layout/SpaceBeforeFirstArg:
Enabled: false

# Allow extra spacing, e.g. to align components
Layout/ExtraSpacing:
Enabled: false

# Usually good, but in some cases not possible
Layout/AlignHash:
Enabled: false

# Allow an empty line after do / before end
Layout/EmptyLinesAroundBlockBody:
Enabled: false

# Again, generally a good idea, but it has problems with multiline operations in
# combination with assignments
Layout/MultilineOperationIndentation:
Enabled: false

# See the corresponding other cops
Layout/EmptyLinesAroundModuleBody:
Enabled: false

Layout/SpaceInLambdaLiteral:
Enabled: false

#---------------------------------------------
# Metrics
#---------------------------------------------

# Allow bigger classes
Metrics/ClassLength:
Enabled: false

Metrics/LineLength:
Max: 120

# To make it possible to copy or click on URIs in the code, we allow lines
# containing a URI to be longer than Max.
AllowHeredoc: true
AllowURI: true

Metrics/BlockLength:
Max: 75
Exclude:
- spec/**/*.rb

# Allow longer methods
Metrics/MethodLength:
Enabled: false

# Allow bigger modules
Metrics/ModuleLength:
Enabled: false

#---------------------------------------------
# Naming
#---------------------------------------------

Naming/HeredocDelimiterNaming:
Enabled: false

#---------------------------------------------
# Style
#---------------------------------------------

# Allow fail() for initial exception, raise() for re-raise
# It seems that the cop decision was mainly based on "more people use raise than fail"...
Style/SignalException:
Enabled: false

# Allow assigning multiple variables in one line.
# This should not be overused, but comes in handy when assigning initializer values to instance variables
Style/ParallelAssignment:
Enabled: false

# Depending on the situation, it might make more sense to use
# [:symbol1, :symbol2] over %i[symbol1 symbol2], e.g. for multiline aligning reasons.
Style/SymbolArray:
Enabled: false

# Not all modules have to have top level comments
Style/Documentation:
Enabled: false

# Allow class variable usage
Style/ClassVars:
Enabled: false

# Allow block comments
Style/BlockComments:
Enabled: false

# Allow the use of !! (conversion of nil/object to true/false)
Style/DoubleNegation:
Enabled: false

# Allow unless/if blocks even for one-liners
Style/IfUnlessModifier:
Enabled: false

Style/GuardClause:
Enabled: false

Style/MissingRespondToMissing:
Exclude:
- lib/setting_accessors/setting_scaffold.rb
18 changes: 11 additions & 7 deletions .travis.yml
Expand Up @@ -2,19 +2,23 @@ language: ruby
cache: bundler

rvm:
- 2.2
- 2.3.1
- 2.3.0
- 2.3.3
- 2.4.0
- 2.4.4
- 2.5.0
- 2.5.3

env:
- DISABLE_DATABASE_ENVIRONMENT_CHECK=1
gemfile:
- gemfiles/rails_4.2.gemfile
- gemfiles/rails_5.0.gemfile
- gemfiles/rails_5.1.gemfile
- gemfiles/rails_5.2.gemfile

before_install: 'gem install bundler'
script: 'bundle exec rake'

notifications:
email:
recipients:
- stex@sterex.de
on_failure: change
on_success: never

17 changes: 17 additions & 0 deletions Appraisals
@@ -0,0 +1,17 @@
# frozen_string_literal: true

appraise 'rails-4.2' do
gem 'rails', '~> 4.2.0'
end

appraise 'rails-5.0' do
gem 'rails', '~> 5.0.0'
end

appraise 'rails-5.1' do
gem 'rails', '~> 5.1.0'
end

appraise 'rails-5.2' do
gem 'rails', '~> 5.2.0'
end
39 changes: 38 additions & 1 deletion CHANGELOG.md
@@ -1,5 +1,42 @@
# Changelog

## 1.0.0

This is almost a complete refactoring of the gem which also removes some not really needed functionality.
It is the first release fully compatible with Rails 5.

New minimum versions:

* Ruby: 2.3
* Rails: 4.2

#### General

* Removed globally defined settings (`config/settings.yml`) and therefore also global validations and type conversions.
It is still possible to create global Settings, but each developer has to make sure that the assigned
value is valid and correctly typed.
* Type conversion follows AR's type conversions more strictly now.
This means that e.g. assigning `1.0` to a boolean setting will result in `true` instead of `nil` as before.
* Updating an attribute created through `setting_accessor` now leads to the record being touched,
similar to what would happen when a normal database attribute was changed. (#4)
* Setting a new value for an attribute created through `attribute_accessor` will now mark
the record as "dirty", meaning `changed?` returns true. (#9)
This was especially needed for Rails 5 as it only even performs a database operation in this case.

#### Tests

* Tests are now written in RSpec
* The dummy Rails application has been removed and replaced with `with_model`
* Appraisal was added to test against multiple Rails versions

#### API Changes

* `method_missing` is now part of the SettingScaffold and therefore no longer needed in the actual Setting model.
You should remove `method_missing` from your model.
* Setting.create_or_update was renamed to Setting.set and now uses a keyword argument for `assignable`
* `setting_accessor` no longer supports the `fallback` option.
If a `default` option is given, it is automatically used as fallback.

## 0.3.0

* Fixed a bug that caused setting accessors not being initialized when being called as part of a rake task chain (#6)
* Fixed a bug that caused setting accessors not being initialized when being called as part of a rake task chain (#6)
2 changes: 2 additions & 0 deletions Gemfile
@@ -1,3 +1,5 @@
# frozen_string_literal: true

source 'https://rubygems.org'

# Specify your gem's dependencies in setting_accessors.gemspec
Expand Down

0 comments on commit 4510182

Please sign in to comment.