forked from raymondtangsc/activerecord-userstamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Support Rails >= 6.0 and Ruby >= 3 #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
dc6a60f
chore(test): setup test and change requirement
bivanalhar 020bc75
chore(dep): change dependency
bivanalhar b0526b5
chore(setting): update settings
bivanalhar ff9d5d8
fix(function): column accepts **args instead of array
bivanalhar bcbeb2c
refactor(spec): remove dep for rails < 6
bivanalhar 2038f30
refactor(controller): update instead of update_attributes
bivanalhar c21d524
refactor(spec): modify spec to be in line with rails 6/7
bivanalhar 7b80196
chore(test): add pipeline to test in github
bivanalhar 7f8257d
chore(README): update README
bivanalhar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake | ||
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby | ||
|
||
name: Ruby | ||
|
||
on: | ||
push: | ||
branches: ['master'] | ||
pull_request: | ||
branches: ['master'] | ||
schedule: | ||
- cron: '0 0 * * 0' | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
ruby-version: ['3.0', '3.1'] | ||
activerecord: ['6.0', '6.1', '7.0', '7.1'] | ||
env: | ||
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rails_${{ matrix.activerecord }}.gemfile | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Ruby | ||
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby, | ||
# change this to (see https://github.com/ruby/setup-ruby#versioning): | ||
# uses: ruby/setup-ruby@v1 | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby-version }} | ||
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | ||
- name: Run tests | ||
run: bundle exec rake |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,7 @@ | |
*.sqlite3 | ||
/.rdoc | ||
/spec/examples.txt | ||
.ruby-version | ||
gemfiles/*.lock | ||
Gemfile.lock | ||
coverage/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.0.6 |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
appraise "rails-6.0" do | ||
gem 'rails', '~> 6.0' | ||
gem "rspec-rails", '~> 5' | ||
end | ||
|
||
appraise "rails-6.1" do | ||
gem 'rails', '~> 6.1' | ||
gem "rspec-rails", '>= 6' | ||
end | ||
|
||
appraise "rails-7.0" do | ||
gem 'rails', '~> 7.0' | ||
gem "rspec-rails", '>= 6' | ||
end | ||
|
||
appraise "rails-7.1" do | ||
gem 'rails', '~> 7.1' | ||
gem "rspec-rails", '>= 6' | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,39 +6,29 @@ require 'active_record/userstamp/version' | |
Gem::Specification.new do |s| | ||
s.name = 'activerecord-userstamp' | ||
s.version = ActiveRecord::Userstamp::VERSION | ||
s.authors = ['Joel Low'] | ||
s.email = ['[email protected]'] | ||
s.authors = ['Bivan Alzacky Harmanto'] | ||
s.email = ['[email protected]'] | ||
|
||
s.summary = 'Adds magic creator and updater attributes to your ActiveRecord models.' | ||
s.description = 'This gem extends ActiveRecord::Base to add automatic updating of created_by and updated_by attributes of your models in much the same way that the ActiveRecord::Timestamp module updates created_(at/on) and updated_(at/on) attributes.' | ||
s.homepage = 'https://github.com/lowjoel/activerecord-userstamp' | ||
s.homepage = 'https://github.com/Coursemology/activerecord-userstamp' | ||
s.license = 'MIT' | ||
|
||
s.files = `git ls-files`.split("\n") | ||
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) } | ||
s.require_paths = ['lib'] | ||
|
||
if ENV['CI'] == 'true' | ||
rails_version = | ||
case ENV['RAILS_VERSION'] | ||
when nil, '' | ||
'>= 4.1' | ||
else | ||
"~> #{ENV['RAILS_VERSION']}" | ||
end | ||
else | ||
rails_version = '>= 6' | ||
end | ||
s.add_dependency 'rails', '>= 6' | ||
|
||
s.add_dependency 'rails', rails_version | ||
s.required_ruby_version = ">= 3.0" | ||
|
||
s.add_development_dependency 'tzinfo-data' if RUBY_PLATFORM =~ /mswin|mingw/ | ||
s.add_development_dependency 'rake' | ||
s.add_development_dependency 'rdoc' | ||
s.add_development_dependency 'rspec-rails', '>= 3.3' | ||
s.add_development_dependency 'simplecov' | ||
s.add_development_dependency 'coveralls' | ||
s.add_development_dependency 'codeclimate-test-reporter' | ||
s.add_development_dependency 'sqlite3' | ||
s.add_development_dependency 'sqlite3', "~> 1.7" | ||
s.add_development_dependency "appraisal", "~> 2.1" | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This file was generated by Appraisal | ||
|
||
source "https://rubygems.org" | ||
|
||
gem "rails", "~> 6.0" | ||
gem "rspec-rails", "~> 5" | ||
|
||
gemspec path: "../" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This file was generated by Appraisal | ||
|
||
source "https://rubygems.org" | ||
|
||
gem "rails", "~> 6.1" | ||
gem "rspec-rails", ">= 6" | ||
|
||
gemspec path: "../" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This file was generated by Appraisal | ||
|
||
source "https://rubygems.org" | ||
|
||
gem "rails", "~> 7.0" | ||
gem "rspec-rails", ">= 6" | ||
|
||
gemspec path: "../" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This file was generated by Appraisal | ||
|
||
source "https://rubygems.org" | ||
|
||
gem "rails", "~> 7.1" | ||
gem "rspec-rails", ">= 6" | ||
|
||
gemspec path: "../" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
module ActiveRecord::Userstamp::MigrationHelper | ||
module ActiveRecord::Userstamp::MigrationAdditions | ||
extend ActiveSupport::Concern | ||
|
||
def userstamps(*args) | ||
def userstamps(**args) | ||
config = ActiveRecord::Userstamp.config | ||
column(config.creator_attribute, :integer, *args) | ||
column(config.updater_attribute, :integer, *args) | ||
column(config.deleter_attribute, :integer, *args) if config.deleter_attribute.present? | ||
column(config.creator_attribute, :integer, **args) | ||
column(config.updater_attribute, :integer, **args) | ||
column(config.deleter_attribute, :integer, **args) if config.deleter_attribute.present? | ||
end | ||
end | ||
|
||
ActiveRecord::ConnectionAdapters::TableDefinition.class_eval do | ||
include ActiveRecord::Userstamp::MigrationHelper | ||
include ActiveRecord::Userstamp::MigrationAdditions | ||
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.