varvet--pundit/pundit.gemspec

34 lines
1.3 KiB
Ruby
Raw Permalink Normal View History

# frozen_string_literal: true
lib = File.expand_path("lib", __dir__)
2012-11-04 09:20:45 +00:00
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
2016-01-14 14:15:30 +00:00
require "pundit/version"
2012-11-04 09:20:45 +00:00
Gem::Specification.new do |gem|
gem.name = "pundit"
gem.version = Pundit::VERSION
2018-10-02 11:23:17 +00:00
gem.authors = ["Jonas Nicklas", "Varvet AB"]
2012-11-19 12:04:07 +00:00
gem.email = ["jonas.nicklas@gmail.com", "dev@elabs.se"]
2016-01-14 14:15:30 +00:00
gem.description = "Object oriented authorization for Rails applications"
gem.summary = "OO authorization for Rails"
2018-07-04 18:30:06 +00:00
gem.homepage = "https://github.com/varvet/pundit"
2013-10-04 11:36:35 +00:00
gem.license = "MIT"
2012-11-04 09:20:45 +00:00
gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
2016-01-14 14:15:30 +00:00
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
2012-11-04 09:20:45 +00:00
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
gem.require_paths = ["lib"]
2012-11-19 12:02:42 +00:00
2013-06-17 23:11:15 +00:00
gem.add_dependency "activesupport", ">= 3.0.0"
Specify development dependencies in gemspec This commit does two things: 1. Move development dependencies back to gemspec 2. Restrict versions of some gems It should also be noted that the recommendation is to commit Gemfile.lock, however in this case it is not possible to do so: 3. Why we don't commit Gemfile.lock Each of these requires a more detailed discussion: 1. Move development dependencies back to gemspec 9691355 originally moved all these dependencies into the Gemfile: https://github.com/varvet/pundit/pull/435 The recommendation in the docs seems to be to use the gemspec for development dependencies: https://bundler.io/guides/creating_gem.html#getting-started 2. Restrict versions of some gems While we want to be as flexible as possible with the gem's production dependencies, we need to be more specific with our development dependencies. In particular gems developed against one version of Rubocop cannot be expected to work with later versions, since Rubocop adds and renames cops in new versions. In particular version 0.70.0 renames a cop which we are specifying, resulting in the following errors. .rubocop.yml:81: `Style/TrivialAccessors` is concealed by line 96 Error: The `Layout/IndentHash` cop has been renamed to `Layout/IndentFirstHashElement`. (obsolete configuration found in .rubocop.yml, please update it) Rubocop version 0.67.2 passes without issues on the latest ruby version, but is incompatible with 2.2.x and earlier. 0.57.2 is the latest version which works everywhere. Note that when running `gem build pundit.gemspec` we get warnings about some open-ended dependencies: WARNING: open-ended dependency on activesupport (>= 3.0.0) is not recommended if activesupport is semantically versioned, use: add_runtime_dependency 'activesupport', '~> 3.0', '>= 3.0.0' However, I feel OK about these being loose, and since this gem is not so often maintained, I'd prefer not to place an upper limit on the runtime_dependency. The other gems with open-ended dependencies are also part of Rails, so I believe they'll need to be the same version as activesupport, which is why they have the same version constraint. For the gems where we don't specify any version constraint we also get this warning. For most of these (eg. pry) we genuinely don't care what version is used. 3. Why we don't commit Gemfile.lock When this gem was created the standard practice was to gitignore the Gemfile.lock, but the guidance has changed: > When Bundler first shipped, the Gemfile.lock was included in the > .gitignore file included with generated gems. Over time, however, it > became clear that this practice forces the pain of broken dependencies > onto new contributors, while leaving existing contributors potentially > unaware of the problem. Since bundle install is usually the first step > towards a contribution, the pain of broken dependencies would > discourage new contributors from contributing. As a result, we have > revised our guidance for gem authors to now recommend checking in the > lock for gems. https://bundler.io/man/bundle-install.1.html#THE-GEMFILE-LOCK The intention is that by committing the Gemfile.lock we ensure that all developers of this gem have the same dependencies. HOWEVER, we are currently supporting ruby 2.1 and 2.2. Newer versions of some gems (eg. i18n, which is required by activesupport) are only compatible with ruby 2.3 and up, so a lockfile compatible with the latest version of activesupport (which is a runtime dependency) will not be compatible with these versions. The impact of this is that we can't commit the lockfile without also dropping support for versions 2.1 and 2.2.
2019-08-05 12:50:51 +00:00
gem.add_development_dependency "actionpack", ">= 3.0.0"
gem.add_development_dependency "activemodel", ">= 3.0.0"
gem.add_development_dependency "bundler"
gem.add_development_dependency "pry"
gem.add_development_dependency "railties", ">= 3.0.0"
Specify development dependencies in gemspec This commit does two things: 1. Move development dependencies back to gemspec 2. Restrict versions of some gems It should also be noted that the recommendation is to commit Gemfile.lock, however in this case it is not possible to do so: 3. Why we don't commit Gemfile.lock Each of these requires a more detailed discussion: 1. Move development dependencies back to gemspec 9691355 originally moved all these dependencies into the Gemfile: https://github.com/varvet/pundit/pull/435 The recommendation in the docs seems to be to use the gemspec for development dependencies: https://bundler.io/guides/creating_gem.html#getting-started 2. Restrict versions of some gems While we want to be as flexible as possible with the gem's production dependencies, we need to be more specific with our development dependencies. In particular gems developed against one version of Rubocop cannot be expected to work with later versions, since Rubocop adds and renames cops in new versions. In particular version 0.70.0 renames a cop which we are specifying, resulting in the following errors. .rubocop.yml:81: `Style/TrivialAccessors` is concealed by line 96 Error: The `Layout/IndentHash` cop has been renamed to `Layout/IndentFirstHashElement`. (obsolete configuration found in .rubocop.yml, please update it) Rubocop version 0.67.2 passes without issues on the latest ruby version, but is incompatible with 2.2.x and earlier. 0.57.2 is the latest version which works everywhere. Note that when running `gem build pundit.gemspec` we get warnings about some open-ended dependencies: WARNING: open-ended dependency on activesupport (>= 3.0.0) is not recommended if activesupport is semantically versioned, use: add_runtime_dependency 'activesupport', '~> 3.0', '>= 3.0.0' However, I feel OK about these being loose, and since this gem is not so often maintained, I'd prefer not to place an upper limit on the runtime_dependency. The other gems with open-ended dependencies are also part of Rails, so I believe they'll need to be the same version as activesupport, which is why they have the same version constraint. For the gems where we don't specify any version constraint we also get this warning. For most of these (eg. pry) we genuinely don't care what version is used. 3. Why we don't commit Gemfile.lock When this gem was created the standard practice was to gitignore the Gemfile.lock, but the guidance has changed: > When Bundler first shipped, the Gemfile.lock was included in the > .gitignore file included with generated gems. Over time, however, it > became clear that this practice forces the pain of broken dependencies > onto new contributors, while leaving existing contributors potentially > unaware of the problem. Since bundle install is usually the first step > towards a contribution, the pain of broken dependencies would > discourage new contributors from contributing. As a result, we have > revised our guidance for gem authors to now recommend checking in the > lock for gems. https://bundler.io/man/bundle-install.1.html#THE-GEMFILE-LOCK The intention is that by committing the Gemfile.lock we ensure that all developers of this gem have the same dependencies. HOWEVER, we are currently supporting ruby 2.1 and 2.2. Newer versions of some gems (eg. i18n, which is required by activesupport) are only compatible with ruby 2.3 and up, so a lockfile compatible with the latest version of activesupport (which is a runtime dependency) will not be compatible with these versions. The impact of this is that we can't commit the lockfile without also dropping support for versions 2.1 and 2.2.
2019-08-05 12:50:51 +00:00
gem.add_development_dependency "rake"
gem.add_development_dependency "rspec", ">= 3.0.0"
2022-01-13 00:39:41 +00:00
gem.add_development_dependency "rubocop", "1.24.0"
gem.add_development_dependency "simplecov", ">= 0.17.0"
Specify development dependencies in gemspec This commit does two things: 1. Move development dependencies back to gemspec 2. Restrict versions of some gems It should also be noted that the recommendation is to commit Gemfile.lock, however in this case it is not possible to do so: 3. Why we don't commit Gemfile.lock Each of these requires a more detailed discussion: 1. Move development dependencies back to gemspec 9691355 originally moved all these dependencies into the Gemfile: https://github.com/varvet/pundit/pull/435 The recommendation in the docs seems to be to use the gemspec for development dependencies: https://bundler.io/guides/creating_gem.html#getting-started 2. Restrict versions of some gems While we want to be as flexible as possible with the gem's production dependencies, we need to be more specific with our development dependencies. In particular gems developed against one version of Rubocop cannot be expected to work with later versions, since Rubocop adds and renames cops in new versions. In particular version 0.70.0 renames a cop which we are specifying, resulting in the following errors. .rubocop.yml:81: `Style/TrivialAccessors` is concealed by line 96 Error: The `Layout/IndentHash` cop has been renamed to `Layout/IndentFirstHashElement`. (obsolete configuration found in .rubocop.yml, please update it) Rubocop version 0.67.2 passes without issues on the latest ruby version, but is incompatible with 2.2.x and earlier. 0.57.2 is the latest version which works everywhere. Note that when running `gem build pundit.gemspec` we get warnings about some open-ended dependencies: WARNING: open-ended dependency on activesupport (>= 3.0.0) is not recommended if activesupport is semantically versioned, use: add_runtime_dependency 'activesupport', '~> 3.0', '>= 3.0.0' However, I feel OK about these being loose, and since this gem is not so often maintained, I'd prefer not to place an upper limit on the runtime_dependency. The other gems with open-ended dependencies are also part of Rails, so I believe they'll need to be the same version as activesupport, which is why they have the same version constraint. For the gems where we don't specify any version constraint we also get this warning. For most of these (eg. pry) we genuinely don't care what version is used. 3. Why we don't commit Gemfile.lock When this gem was created the standard practice was to gitignore the Gemfile.lock, but the guidance has changed: > When Bundler first shipped, the Gemfile.lock was included in the > .gitignore file included with generated gems. Over time, however, it > became clear that this practice forces the pain of broken dependencies > onto new contributors, while leaving existing contributors potentially > unaware of the problem. Since bundle install is usually the first step > towards a contribution, the pain of broken dependencies would > discourage new contributors from contributing. As a result, we have > revised our guidance for gem authors to now recommend checking in the > lock for gems. https://bundler.io/man/bundle-install.1.html#THE-GEMFILE-LOCK The intention is that by committing the Gemfile.lock we ensure that all developers of this gem have the same dependencies. HOWEVER, we are currently supporting ruby 2.1 and 2.2. Newer versions of some gems (eg. i18n, which is required by activesupport) are only compatible with ruby 2.3 and up, so a lockfile compatible with the latest version of activesupport (which is a runtime dependency) will not be compatible with these versions. The impact of this is that we can't commit the lockfile without also dropping support for versions 2.1 and 2.2.
2019-08-05 12:50:51 +00:00
gem.add_development_dependency "yard"
2012-11-04 09:20:45 +00:00
end