Skip to content

Commit ae01a87

Browse files
committed
Add Github CI with custom action
1 parent 54877a2 commit ae01a87

File tree

24 files changed

+112
-101
lines changed

24 files changed

+112
-101
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
on: [push]
2+
3+
jobs:
4+
run_tests:
5+
runs-on: ubuntu-22.04
6+
name: Run tests on ...
7+
steps:
8+
- uses: actions/checkout@v4
9+
- id: foo
10+
uses: friendlycart/action-solidus-extension@main

Gemfile

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# frozen_string_literal: true
22

3-
source 'https://rubygems.org'
3+
source "https://rubygems.org"
44
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
55

6-
branch = ENV.fetch('SOLIDUS_BRANCH', 'v3.2')
7-
gem 'solidus', github: 'solidusio/solidus', branch: branch
6+
branch = ENV.fetch("SOLIDUS_BRANCH", "v3.2")
7+
gem "solidus", github: "solidusio/solidus", branch: branch
88

99
# Needed to help Bundler figure out how to resolve dependencies,
1010
# otherwise it takes forever to resolve them.
1111
# See https://github.com/bundler/bundler/issues/6677
12-
gem 'rails', ENV.fetch('RAILS_VERSION', '>0.a')
12+
gem "rails", ENV.fetch("RAILS_VERSION", ">0.a")
1313

14-
case ENV['DB']
15-
when 'mysql'
16-
gem 'mysql2'
17-
when 'postgresql'
18-
gem 'pg'
14+
case ENV["DB"]
15+
when "mysql"
16+
gem "mysql2"
17+
when "postgresql"
18+
gem "pg"
1919
else
20-
gem 'sqlite3', "~> 1.7"
20+
gem "sqlite3", "~> 1.7"
2121
end
2222

2323
gemspec
@@ -27,10 +27,11 @@ gemspec
2727
#
2828
# We use `send` instead of calling `eval_gemfile` to work around an issue with
2929
# how Dependabot parses projects: https://github.com/dependabot/dependabot-core/issues/1658.
30-
send(:eval_gemfile, 'Gemfile-local') if File.exist? 'Gemfile-local'
30+
send(:eval_gemfile, "Gemfile-local") if File.exist? "Gemfile-local"
3131

3232
group :test do
33-
gem 'shoulda-matchers', '~> 4.0'
33+
gem "shoulda-matchers", "~> 4.0"
34+
gem "standardrb"
3435
end
3536

3637
gem "concurrent-ruby", "< 1.3.5"

Rakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
require 'solidus_dev_support/rake_tasks'
3+
require "solidus_dev_support/rake_tasks"
44
SolidusDevSupport::RakeTasks.install
55

6-
task default: 'extension:specs'
6+
task default: "extension:specs"

app/controllers/solidus_configurable_kits/admin/kit_requirements_controller.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
module SolidusConfigurableKits
44
module Admin
55
class KitRequirementsController < ::Spree::Admin::ResourceController
6-
belongs_to 'spree/product', find_by: :slug
6+
belongs_to "spree/product", find_by: :slug
77

8-
def index; end
8+
def index
9+
end
910

1011
private
1112

app/controllers/solidus_configurable_kits/orders_controller.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
module SolidusConfigurableKits
44
class OrdersController < ::Spree::StoreController
5-
helper 'spree/products', 'spree/orders'
5+
helper "spree/products", "spree/orders"
66

77
respond_to :html
88

@@ -14,13 +14,13 @@ def populate_kit
1414
@order = current_order(create_order_if_necessary: true)
1515
authorize! :update, @order, cookies.signed[:guest_token]
1616

17-
variant = ::Spree::Variant.find(params[:variant_id])
17+
variant = ::Spree::Variant.find(params[:variant_id])
1818
quantity = params[:quantity].present? ? params[:quantity].to_i : 1
19-
options = { kit_variant_ids: params[:kit_variant_ids] }
19+
options = {kit_variant_ids: params[:kit_variant_ids]}
2020

2121
# 2,147,483,647 is crazy. See issue https://github.com/spree/spree/issues/2695.
2222
if !quantity.between?(1, 2_147_483_647)
23-
@order.errors.add(:base, t('spree.please_enter_reasonable_quantity'))
23+
@order.errors.add(:base, t("spree.please_enter_reasonable_quantity"))
2424
else
2525
begin
2626
@line_item = @order.contents.add(variant, quantity, options)

app/decorators/controllers/solidus_configurable_kits/spree/api/variants_controller_decorator.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ module VariantsControllerDecorator
88

99
def include_list
1010
list = [
11-
{ option_values: :option_type },
12-
{ product: :kit_requirements },
11+
{option_values: :option_type},
12+
{product: :kit_requirements},
1313
# :default_price,
1414
:images,
15-
{ stock_items: :stock_location },
15+
{stock_items: :stock_location}
1616
]
17-
list.push(:default_price) if ::Spree.solidus_gem_version < Gem::Version.new('3')
17+
list.push(:default_price) if ::Spree.solidus_gem_version < Gem::Version.new("3")
1818
list
1919
end
2020

app/decorators/models/solidus_configurable_kits/spree/product_decorator.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def self.prepended(base)
1212
base.delegate :resilient_money_price, to: :master
1313

1414
base.scope :with_kit_item_prices, -> {
15-
joins(variants_including_master: :prices).where(spree_prices: { kit_item: true }).distinct
15+
joins(variants_including_master: :prices).where(spree_prices: {kit_item: true}).distinct
1616
}
1717
end
1818

@@ -21,7 +21,7 @@ def self.prepended(base)
2121
# @return [Array<Spree::Variant>] all variants that can be part of a kit
2222
def kit_item_variants_for(pricing_options = Spree::Config.default_pricing_options)
2323
variants_including_master.includes(:option_values).with_prices(pricing_options).select do |variant|
24-
variant.option_values.any? || (variant.is_master? && variants.none? )
24+
variant.option_values.any? || (variant.is_master? && variants.none?)
2525
end
2626
end
2727

app/decorators/models/solidus_configurable_kits/spree/variant_decorator.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ def with_prices(pricing_options = ::Spree::Config.default_pricing_options)
1111
(spree_prices.country_iso IS NULL OR spree_prices.country_iso = ?)
1212
SQL
1313
where(
14-
::Spree::Price.
15-
where(::Spree::Variant.arel_table[:id].eq(::Spree::Price.arel_table[:variant_id])).
14+
::Spree::Price
15+
.where(::Spree::Variant.arel_table[:id].eq(::Spree::Price.arel_table[:variant_id])).
1616
# This next clause should just be `where(pricing_options.search_arguments)`, but ActiveRecord
1717
# generates invalid SQL, so the SQL here is written manually.
1818
where(
1919
query,
2020
pricing_options.search_arguments[:currency],
2121
pricing_options.search_arguments[:kit_item],
2222
pricing_options.search_arguments[:country_iso].compact
23-
).
24-
arel.exists
23+
)
24+
.arel.exists
2525
)
2626
end
2727
end

app/models/solidus_configurable_kits/shipping_manifest.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def items
77
kit_manifest_items = grouped_by_kit.keys.compact
88
result = []
99
kit_manifest_items.each do |kit_line_item|
10-
result += [grouped_by_kit[nil].detect{ |i| i.line_item = kit_line_item }]
10+
result += [grouped_by_kit[nil].detect { |i| i.line_item = kit_line_item }]
1111
result += grouped_by_kit[kit_line_item]
1212
end
1313
result += grouped_by_kit[nil]&.reject { |manifest_item| manifest_item.line_item.kit? } || []

app/services/solidus_configurable_kits/price_selector.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def price_for_options(price_options)
2727
(price.country_iso == price_options.desired_attributes[:country_iso] ||
2828
price.country_iso.nil?
2929
) && price.currency == price_options.desired_attributes[:currency] &&
30-
price.kit_item == price_options.desired_attributes[:kit_item]
30+
price.kit_item == price_options.desired_attributes[:kit_item]
3131
end
3232
end
3333
end

0 commit comments

Comments
 (0)