Skip to content

Commit

Permalink
Add support for Pundit v2 (#104)
Browse files Browse the repository at this point in the history
* Allow to use Pundit v2

* Use Appraisal to test Pundit v2

* Add more Rails versions to test Pundit v2
  • Loading branch information
jpalumickas authored and valscion committed Aug 13, 2018
1 parent a34dbe9 commit 5bece91
Show file tree
Hide file tree
Showing 14 changed files with 134 additions and 30 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
/spec/dummy/tmp/
*.orig
.ruby-version
/gemfiles/*.gemfile.lock
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ AllCops:
Style/FileName:
Exclude:
- lib/jsonapi-authorization.rb
- Appraisals

Metrics/LineLength:
Enabled: true
Expand Down
16 changes: 9 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
language: ruby
env:
- JSONAPI_RESOURCES_VERSION=0.9 RAILS_VERSION=4.2.0
- JSONAPI_RESOURCES_VERSION=0.9 RAILS_VERSION=5.0.0
- JSONAPI_RESOURCES_VERSION=0.9 RAILS_VERSION=5.1.0
- JSONAPI_RESOURCES_VERSION=0.9 RAILS_VERSION=5.2.0
install:
- bundle install
rvm:
- 2.3
gemfile:
- gemfiles/rails_4_2_pundit_1.gemfile
- gemfiles/rails_5_0_pundit_1.gemfile
- gemfiles/rails_5_1_pundit_1.gemfile
- gemfiles/rails_5_2_pundit_1.gemfile
- gemfiles/rails_4_2_pundit_2.gemfile
- gemfiles/rails_5_0_pundit_2.gemfile
- gemfiles/rails_5_1_pundit_2.gemfile
- gemfiles/rails_5_2_pundit_2.gemfile
before_install: gem install bundler -v 1.16.2
notifications:
email: false
Expand Down
47 changes: 47 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
appraise 'rails-4-2 pundit-1' do
gem 'rails', '4.2.0'
gem 'jsonapi-resources', '0.9'
gem 'pundit', '~> 1.0'
end

appraise 'rails-5-0 pundit-1' do
gem 'rails', '5.0.0'
gem 'jsonapi-resources', '0.9'
gem 'pundit', '~> 1.0'
end

appraise 'rails-5-1 pundit-1' do
gem "rails", "5.1.0"
gem 'jsonapi-resources', '0.9'
gem 'pundit', '~> 1.0'
end

appraise 'rails-5-2 pundit-1' do
gem 'rails', '5.2.0'
gem 'jsonapi-resources', '0.9'
gem 'pundit', '~> 1.0'
end

appraise 'rails-4-2 pundit-2' do
gem 'rails', '4.2.0'
gem 'jsonapi-resources', '0.9'
gem 'pundit', '~> 2.0'
end

appraise 'rails-5-0 pundit-2' do
gem 'rails', '5.0.0'
gem 'jsonapi-resources', '0.9'
gem 'pundit', '~> 2.0'
end

appraise 'rails-5-1 pundit-2' do
gem 'rails', '5.1.0'
gem 'jsonapi-resources', '0.9'
gem 'pundit', '~> 2.0'
end

appraise 'rails-5-2 pundit-2' do
gem 'rails', '5.2.0'
gem 'jsonapi-resources', '0.9'
gem 'pundit', '~> 2.0'
end
20 changes: 0 additions & 20 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,3 @@
source 'https://rubygems.org'

gemspec

rails_version = ENV['RAILS_VERSION'] || 'default'
jsonapi_resources_version = ENV['JSONAPI_RESOURCES_VERSION'] || 'default'

case rails_version
when 'master'
gem 'rails', git: 'https://github.com/rails/rails.git'
gem 'arel', git: 'https://github.com/rails/arel.git'
when 'default'
gem 'rails', '>= 4.2'
else
gem 'rails', "~> #{rails_version}"
end

case jsonapi_resources_version
when 'default'
gem 'jsonapi-resources', '0.9'
else
gem 'jsonapi-resources', jsonapi_resources_version
end
9 changes: 9 additions & 0 deletions gemfiles/rails_4_2_pundit_1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "4.2.0"
gem "jsonapi-resources", "0.9"
gem "pundit", "~> 1.0"

gemspec path: "../"
9 changes: 9 additions & 0 deletions gemfiles/rails_4_2_pundit_2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "4.2.0"
gem "jsonapi-resources", "0.9"
gem "pundit", "~> 2.0"

gemspec path: "../"
9 changes: 9 additions & 0 deletions gemfiles/rails_5_0_pundit_1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "5.0.0"
gem "jsonapi-resources", "0.9"
gem "pundit", "~> 1.0"

gemspec path: "../"
9 changes: 9 additions & 0 deletions gemfiles/rails_5_0_pundit_2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "5.0.0"
gem "jsonapi-resources", "0.9"
gem "pundit", "~> 2.0"

gemspec path: "../"
9 changes: 9 additions & 0 deletions gemfiles/rails_5_1_pundit_1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "5.1.0"
gem "jsonapi-resources", "0.9"
gem "pundit", "~> 1.0"

gemspec path: "../"
9 changes: 9 additions & 0 deletions gemfiles/rails_5_1_pundit_2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "5.1.0"
gem "jsonapi-resources", "0.9"
gem "pundit", "~> 2.0"

gemspec path: "../"
9 changes: 9 additions & 0 deletions gemfiles/rails_5_2_pundit_1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "5.2.0"
gem "jsonapi-resources", "0.9"
gem "pundit", "~> 1.0"

gemspec path: "../"
9 changes: 9 additions & 0 deletions gemfiles/rails_5_2_pundit_2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "rails", "5.2.0"
gem "jsonapi-resources", "0.9"
gem "pundit", "~> 2.0"

gemspec path: "../"
7 changes: 4 additions & 3 deletions jsonapi-authorization.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]

spec.add_dependency "jsonapi-resources", "~> 0.9"
spec.add_dependency "pundit", "~> 1.0"
spec.add_dependency "pundit", ">= 1.0.0", "< 3.0.0"

spec.add_development_dependency "appraisal"
spec.add_development_dependency "bundler", "~> 1.11"
spec.add_development_dependency "rake", "~> 12.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "rspec-rails", "~> 3.7"
spec.add_development_dependency "rspec", "~> 3.8"
spec.add_development_dependency "rspec-rails", "~> 3.8"
spec.add_development_dependency "pry"
spec.add_development_dependency "pry-byebug"
spec.add_development_dependency "pry-doc"
Expand Down

0 comments on commit 5bece91

Please sign in to comment.