Skip to content

Commit

Permalink
Install gems in pagy CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Jun 19, 2024
1 parent 3f470ff commit 6a05d41
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions gem/bin/pagy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
VERSION = '8.4.4'
APPS = %w[repro rails demo calendar].freeze
LINUX = RbConfig::CONFIG['host_os'].include?('linux')
DIR = __dir__ || ''

require_relative '../lib/optimist'
opts = Optimist.options do
Expand Down Expand Up @@ -40,9 +41,9 @@ opts = Optimist.options do
end
Optimist.educate if ARGV.empty?

run_from_repo = File.exist?(File.expand_path('../pagy.gemspec', __dir__))
run_from_repo = File.exist?(File.expand_path('../pagy.gemspec', DIR))
# Never install if run from pagy repo (for pagy devs)
opts[:install] = false if run_from_repo
opts[:install] = false if run_from_repo && !ENV['CI']

# Handles gems
require 'bundler/inline'
Expand All @@ -54,7 +55,7 @@ gemfile(opts[:install]) do
gem 'rerun' if LINUX
end

path = ->(app) { File.expand_path("../apps/#{app}.ru", __dir__) }
path = ->(app) { File.expand_path("../apps/#{app}.ru", DIR) }
arg = ARGV.shift
if arg.eql?('clone')
arg = ARGV.shift
Expand All @@ -81,7 +82,7 @@ else
end
Optimist.die("#{file.inspect} app not found") unless File.exist?(file)
# Run command
gem_dir = File.expand_path('..', __dir__)
gem_dir = File.expand_path('..', DIR)
rackup = "rackup -I #{gem_dir}/lib -r pagy -o #{opts[:host]} -p #{opts[:port]} -E #{opts[:env]} #{file}"
rackup << ' -q' if opts[:quiet]
if opts[:rerun]
Expand Down

0 comments on commit 6a05d41

Please sign in to comment.