Skip to content

Commit

Permalink
Upgrade packages
Browse files Browse the repository at this point in the history
  • Loading branch information
binos30 committed Jul 20, 2024
1 parent 77f2b12 commit c292861
Show file tree
Hide file tree
Showing 18 changed files with 230 additions and 134 deletions.
5 changes: 1 addition & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

yarn lint-staged
lint-staged
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.15.0
20.15.1
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.3
3.3.4
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# syntax = docker/dockerfile:1

# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.3.3
ARG RUBY_VERSION=3.3.4
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim AS base

# Rails app lives here
Expand All @@ -22,7 +22,7 @@ RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential curl git libpq-dev libvips node-gyp pkg-config python-is-python3

# Install JavaScript dependencies
ARG NODE_VERSION=20.15.0
ARG NODE_VERSION=20.15.1
ARG YARN_VERSION=4.3.1
ENV PATH=/usr/local/node/bin:$PATH
RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source "https://rubygems.org"

ruby "3.3.3"
ruby "3.3.4"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.1.3.4"
Expand Down
50 changes: 28 additions & 22 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ GEM
bootsnap (1.18.3)
msgpack (~> 1.2)
builder (3.3.0)
bullet (7.1.6)
bullet (7.2.0)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
capybara (3.40.0)
Expand Down Expand Up @@ -126,7 +126,7 @@ GEM
railties (>= 6.1)
drb (2.2.1)
erubi (1.13.0)
faker (3.4.1)
faker (3.4.2)
i18n (>= 1.8.11, < 2)
faraday (2.10.0)
faraday-net_http (>= 2.0, < 3.2)
Expand All @@ -144,6 +144,7 @@ GEM
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86-linux-gnu)
ffi (1.17.0-x86-linux-musl)
ffi (1.17.0-x86_64-darwin)
ffi (1.17.0-x86_64-linux-gnu)
ffi (1.17.0-x86_64-linux-musl)
friendly_id (5.5.1)
Expand Down Expand Up @@ -182,7 +183,7 @@ GEM
net-smtp
marcel (1.0.4)
matrix (0.4.2)
mini_magick (4.13.1)
mini_magick (4.13.2)
mini_mime (1.1.5)
minitest (5.24.1)
msgpack (1.7.2)
Expand All @@ -208,12 +209,14 @@ GEM
racc (~> 1.4)
nokogiri (1.16.6-x86-linux)
racc (~> 1.4)
nokogiri (1.16.6-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.6-x86_64-linux)
racc (~> 1.4)
orm_adapter (0.5.0)
pagy (8.6.3)
pagy (9.0.2)
parallel (1.25.1)
parser (3.3.3.0)
parser (3.3.4.0)
ast (~> 2.4.1)
racc
pg (1.5.6)
Expand Down Expand Up @@ -263,7 +266,7 @@ GEM
zeitwerk (~> 2.6)
rainbow (3.1.1)
rake (13.2.1)
rbs (3.5.1)
rbs (3.5.2)
logger
rdoc (6.7.0)
psych (>= 4.0.0)
Expand All @@ -277,7 +280,7 @@ GEM
responders (3.1.1)
actionpack (>= 5.2)
railties (>= 5.2)
rexml (3.3.1)
rexml (3.3.2)
strscan
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
Expand All @@ -296,13 +299,13 @@ GEM
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.1)
rubocop (1.64.1)
rubocop (1.65.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
regexp_parser (>= 2.4, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
Expand All @@ -325,16 +328,17 @@ GEM
rubocop-minitest
rubocop-performance
rubocop-rails
rubocop-rspec (3.0.2)
rubocop-rspec (3.0.3)
rubocop (~> 1.61)
rubocop-rspec_rails (2.30.0)
rubocop (~> 1.61)
rubocop-rspec (~> 3, >= 3.0.1)
ruby-progressbar (1.13.0)
ruby-vips (2.2.1)
ruby-vips (2.2.2)
ffi (~> 1.12)
logger
rubyzip (2.3.2)
selenium-webdriver (4.22.0)
selenium-webdriver (4.23.0)
base64 (~> 0.2)
logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
Expand All @@ -360,7 +364,7 @@ GEM
stimulus-rails (1.3.3)
railties (>= 6.0.0)
stringio (3.1.1)
stripe (12.1.0)
stripe (12.3.0)
strscan (3.1.0)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)
Expand All @@ -372,21 +376,23 @@ GEM
prettier_print
rbs
syntax_tree (>= 2.0.1)
tailwindcss-rails (2.6.1)
tailwindcss-rails (2.6.3)
railties (>= 7.0.0)
tailwindcss-rails (2.6.3-aarch64-linux)
railties (>= 7.0.0)
tailwindcss-rails (2.6.1-aarch64-linux)
tailwindcss-rails (2.6.3-arm-linux)
railties (>= 7.0.0)
tailwindcss-rails (2.6.1-arm-linux)
tailwindcss-rails (2.6.3-arm64-darwin)
railties (>= 7.0.0)
tailwindcss-rails (2.6.1-arm64-darwin)
tailwindcss-rails (2.6.3-x86_64-darwin)
railties (>= 7.0.0)
tailwindcss-rails (2.6.1-x86_64-linux)
tailwindcss-rails (2.6.3-x86_64-linux)
railties (>= 7.0.0)
temple (0.10.3)
thor (1.3.1)
tilt (2.4.0)
timeout (0.4.1)
turbo-rails (2.0.5)
turbo-rails (2.0.6)
actionpack (>= 6.0.0)
activejob (>= 6.0.0)
railties (>= 6.0.0)
Expand Down Expand Up @@ -422,7 +428,7 @@ PLATFORMS
x86-linux
x86-linux-gnu
x86-linux-musl
x86_64-linux
x86_64-darwin
x86_64-linux-gnu
x86_64-linux-musl

Expand Down Expand Up @@ -466,7 +472,7 @@ DEPENDENCIES
web-console

RUBY VERSION
ruby 3.3.3p89
ruby 3.3.4p94

BUNDLED WITH
2.5.14
2.5.16
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ E-commerce app. Shop online with Shopline. You shop, we ship!

Prerequisites

- [Ruby 3.3.3](https://www.ruby-lang.org/en/downloads/)
- [Ruby 3.3.4](https://github.com/rbenv/rbenv)
- [PostgreSQL](https://www.postgresql.org/download/)
- [Node.js 20.15.0](https://nodejs.org/en/blog/release/v20.15.0)
- [Node.js 20.15.1](https://github.com/nvm-sh/nvm)

Create `.env` file at the root of the project directory. Copy the content of `.env.template.erb` to `.env` then update the `username` and `password` based on your database credentials. Get `STRIPE_SECRET_KEY` and `STRIPE_WEBHOOK_SECRET` from your [Stripe](https://dashboard.stripe.com) account

Expand Down
61 changes: 48 additions & 13 deletions app/controllers/admin/categories_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ class CategoriesController < AdminController

# GET /admin/categories or /admin/categories.json
def index
@categories = Category.filters(params.slice(:name)).includes(image_attachment: :blob).order(:name)
@pagy, @categories = pagy(@categories, items: count_per_page)
@categories =
Category
.filters(params.slice(:name))
.includes(image_attachment: :blob)
.order(:name)
@pagy, @categories = pagy(@categories, limit: count_per_page)
end

# GET /admin/categories/1 or /admin/categories/1.json
Expand All @@ -24,26 +28,39 @@ def edit
end

# POST /admin/categories or /admin/categories.json
def create # rubocop:disable Metrics/AbcSize
def create # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
@category = Category.new(category_params)

respond_to do |format|
if @category.save
format.html do
redirect_to admin_category_url(@category),
notice: t("record.create", record: Category.name, name: @category.name)
notice:
t(
"record.create",
record: Category.name,
name: @category.name
)
end
format.json do
render :show,
status: :created,
location: admin_category_url(@category)
end
format.json { render :show, status: :created, location: admin_category_url(@category) }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @category.errors, status: :unprocessable_entity }
format.json do
render json: @category.errors, status: :unprocessable_entity
end
end
end
rescue ActiveRecord::RecordNotUnique => e
@category.errors.add(:base, e)
respond_to do |format|
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @category.errors, status: :unprocessable_entity }
format.json do
render json: @category.errors, status: :unprocessable_entity
end
end
end

Expand All @@ -53,19 +70,30 @@ def update # rubocop:disable Metrics/AbcSize
if @category.update(category_params)
format.html do
redirect_to admin_category_url(@category),
notice: t("record.update", record: Category.name, name: @category.name)
notice:
t(
"record.update",
record: Category.name,
name: @category.name
)
end
format.json do
render :show, status: :ok, location: admin_category_url(@category)
end
format.json { render :show, status: :ok, location: admin_category_url(@category) }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @category.errors, status: :unprocessable_entity }
format.json do
render json: @category.errors, status: :unprocessable_entity
end
end
end
rescue ActiveRecord::RecordNotUnique => e
@category.errors.add(:base, e)
respond_to do |format|
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @category.errors, status: :unprocessable_entity }
format.json do
render json: @category.errors, status: :unprocessable_entity
end
end
end

Expand All @@ -75,11 +103,18 @@ def destroy # rubocop:disable Metrics/AbcSize

respond_to do |format|
format.html do
redirect_to admin_categories_url, notice: t("record.delete", record: Category.name, name: @category.name)
redirect_to admin_categories_url,
notice:
t(
"record.delete",
record: Category.name,
name: @category.name
)
end
format.json { head :no_content }
end
rescue ActiveRecord::DeleteRestrictionError, ActiveRecord::InvalidForeignKey => e
rescue ActiveRecord::DeleteRestrictionError,
ActiveRecord::InvalidForeignKey => e
logger.tagged("Delete Category##{@category.id} Error") { logger.error e }
redirect_to admin_categories_url, alert: e
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/customers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class CustomersController < AdminController
# GET /admin/customers
def index
@customers = User.customers.filters(params.slice(:name))
@pagy, @customers = pagy(@customers, items: count_per_page)
@pagy, @customers = pagy(@customers, limit: count_per_page)
end
end
end
5 changes: 3 additions & 2 deletions app/controllers/admin/orders_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class OrdersController < AdminController
# GET /admin/orders or /admin/orders.json
def index
@orders = Order.datatable.filters(params.slice(:order_code, :customer))
@pagy, @orders = pagy(@orders, items: count_per_page)
@pagy, @orders = pagy(@orders, limit: count_per_page)
end

# GET /admin/orders/1 or /admin/orders/1.json
Expand All @@ -16,7 +16,8 @@ def show

def fulfill
@order.fulfill!
redirect_to admin_order_url(@order), notice: t("record.fulfill", code: @order.order_code)
redirect_to admin_order_url(@order),
notice: t("record.fulfill", code: @order.order_code)
rescue ActiveRecord::RecordInvalid => e
logger.tagged("Fulfill Order Error") { logger.error e.message }
flash.now[:alert] = e.message
Expand Down
Loading

0 comments on commit c292861

Please sign in to comment.