Skip to content

Commit

Permalink
Update to rails 7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
codez committed Nov 18, 2023
1 parent a23db37 commit 97e647a
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 36 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['3.0', '3.1', '3.2']
ruby-version: ['3.1', '3.2']
haml: [true, false]
steps:
- uses: actions/checkout@v4
Expand All @@ -34,7 +34,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
ruby-version: 3.1
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Run rubocop
run: bundle exec rubocop
Expand All @@ -47,7 +47,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
ruby-version: 3.1
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- uses: paambaati/codeclimate-action@v5.0.0
env:
Expand Down
8 changes: 3 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

gem 'rails', '~> 7.0.0'
gem 'rails', '~> 7.1.0'

gem 'puma'

Expand All @@ -19,11 +19,9 @@ gem "cssbundling-rails"
gem "turbo-rails"
gem "stimulus-rails"

gem 'sassc-rails'

gem 'bootsnap', require: false

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'tzinfo-data', platforms: [:windows, :jruby]

group :development do
gem 'web-console'
Expand All @@ -33,7 +31,7 @@ group :development do
end

gem 'simplecov', require: false
gem 'byebug', platforms: [:mri]
gem 'debug', platforms: [:mri, :windows]

# platform specific gems

Expand Down
9 changes: 4 additions & 5 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@ To integrate dry_crud into your code, only a few additions are required:
* Optionally define a +list+ scope in your models to be used in the +index+ action.
* Optionally define a +options_list+ scope in your models to be used in select dropdowns.

From version 5.0 onwards, the major and minor version numbers will be kept in sync with Rails, and only the matching Rails version is supported. Version 3.0 is compatible 4.2, Version 2.0 and higher are compatible with Rails 4 and Rails 3.2. dry_crud is tested with Ruby 2.5. If you are using Ruby 1.9.3, please refer to version 3.0.0.

From version 5.0 onwards, the major and minor version numbers will be kept in sync with Rails, and only the matching Rails version is supported.

== Background

In most Rails applications, you have some models that require basic CRUD (create, read, update, delete) functionality. There are various possibilities like Rails scaffolding, {Inherited Resources}[https://github.com/activeadmin/inherited_resources] or {Rails Admin}[https://github.com/sferik/rails_admin]. Still, various parts in your application remain duplicated. While you might pull up common methods into a common superclass controller, most views still contain very similar code. And then you also have to remember the entire API of these frameworks.
In most Rails applications, you have some models that require basic CRUD (create, read, update, delete) functionality. There are various possibilities like Rails scaffolding, {Inherited Resources}[https://github.com/activeadmin/inherited_resources] or {Rails Admin}[https://github.com/railsadminteam/rails_admin]. Still, various parts in your application remain duplicated. While you might pull up common methods into a common superclass controller, most views still contain very similar code. And then you also have to remember the entire API of these frameworks.

Enter dry_crud.

Expand All @@ -52,7 +51,7 @@ dry_crud is a Rails generator. All code resides in your application and is open

dry_crud does not depend on any other gems, but easily allows you to integrate them in order to unify the behavior of your CRUD controllers. You might even use the gems mentioned above to adapt your generated CrudController base class. All classes come with thorough tests that provide you with a solid foundation for implementing your own adaptions.

A basic CSS gets you started with your application's layout. For advanced needs, dry_crud supports the styles and classes used in {Bootstrap 4}[http://getbootstrap.com]. A great design never was so close.
A basic CSS gets you started with your application's layout. For advanced needs, dry_crud supports the styles and classes used in {Bootstrap}[http://getbootstrap.com]. As the views are generated into your application code, you are free to change the styling to your needs.

If you find yourself adapting the same parts of dry_crud for your applications over and over, please feel free to {fork me on Github}[http://github.com/codez/dry_crud].

Expand Down Expand Up @@ -163,7 +162,7 @@ To render custom columns, use the +col+ method with an appropriate block:
t.sortable_attrs(:lastname, :firstname)
t.col('', class: 'center') { |entry| image_tag(entry.picture) }
t.attr(:street)
t.col('Map') { |entry| link_to(entry.city, "http://maps.google.com/?q=#{entry.city}" }
t.col('Map') { |entry| link_to(entry.city, "http://maps.google.com/?q=#{entry.city}") }
end %>

For views of subclasses of ListController, you can directly use the +crud_table+ helper method, where you do not have to pass the <tt>@people</tt> list explicitly and actions are added automatically.
Expand Down
20 changes: 2 additions & 18 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace :test do
desc "Create a rails test application"
task :create do
unless File.exist?(TEST_APP_ROOT)
sh "rails new #{TEST_APP_ROOT} --css=bootstrap"
sh "rails new #{TEST_APP_ROOT} --css=bootstrap --js esbuild"
file_replace(File.join(TEST_APP_ROOT, 'Gemfile'),
/\z/,
File.read(File.join(File.dirname(__FILE__),
Expand Down Expand Up @@ -142,24 +142,8 @@ namespace :test do
"= paginate entries\n\n= render 'list'")
end

desc "Use Boostrap Icons in the test app"
desc "Remove sample scss in the test app"
task :use_bootstrap do
sh "cd #{TEST_APP_ROOT}; yarn add bootstrap-icons"

app_css = File.join(TEST_APP_ROOT, 'app', 'assets', 'stylesheets', 'application.bootstrap.scss')
if File.exist?(app_css) && File.read(app_css) !~ /bootstrap-icons/
file_replace(app_css,
/\n\z/,
"\n@import 'bootstrap-icons/font/bootstrap-icons';\n@import 'crud';\n")
end

assets = File.join(TEST_APP_ROOT, 'config', 'initializers', 'assets.rb')
if File.exist?(assets) && File.read(assets) !~ /bootstrap-icons/
file_replace(assets,
/\n\z/,
"\nRails.application.config.assets.paths << Rails.root.join('node_modules/bootstrap-icons/font')\n")
end

FileUtils.rm_f(File.join(TEST_APP_ROOT,
'app', 'assets', 'stylesheets', 'sample.scss'))
end
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.0.0
7.1.0
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
= csrf_meta_tag
= csp_meta_tag

= stylesheet_link_tag 'application', :media => 'all', 'data-turbo-track': 'reload'
= stylesheet_link_tag 'application', 'data-turbo-track': 'reload'
= javascript_include_tag 'application', 'data-turbo-track': 'reload', defer: true

= yield :head
Expand Down
2 changes: 1 addition & 1 deletion dry_crud.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ to DRY up the CRUD code in your Rails project. Start with these elements and
build a clean base to efficiently develop your application upon.
END

spec.add_dependency 'rails', '>= 7.0'
spec.add_dependency 'rails', '>= 7.1'

readmes = FileList.new('*') do |list|
list.exclude(/(^|[^.a-z])[a-z]+/)
Expand Down
2 changes: 0 additions & 2 deletions test/templates/Gemfile.append
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@ gem 'haml'
gem 'kaminari'

gem 'rspec-rails'

gem 'sassc-rails'

0 comments on commit 97e647a

Please sign in to comment.