Skip to content

Commit

Permalink
Limit the playground --rerun option to linux platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Jun 3, 2024
1 parent e1a6aa4 commit 2b7e314
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
11 changes: 7 additions & 4 deletions gem/bin/pagy
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

VERSION = '8.4.1'
APPS = %w[repro rails demo calendar].freeze
LINUX = RbConfig::CONFIG['host_os'].include?('linux')

require_relative '../lib/optimist'
opts = Optimist.options do
Expand All @@ -28,9 +29,11 @@ opts = Optimist.options do
opt :host, 'Host', default: '0.0.0.0', short: :o
opt :port, 'Port', default: 8000
opt :install, 'Install bundle for users', default: true
text 'Rerun options'
opt :rerun, 'Enable rerun for development', default: true
opt :clear, 'Clear screen before each rerun'
if LINUX
text 'Rerun options'
opt :rerun, 'Enable rerun for development', default: true
opt :clear, 'Clear screen before each rerun'
end
text 'Other options'
opt :quiet, 'Quiet mode for development'
version VERSION
Expand All @@ -48,7 +51,7 @@ Bundler.configure
gemfile(opts[:install]) do
source 'https://rubygems.org'
gem 'rackup'
gem 'rerun'
gem 'rerun' if LINUX
end

path = ->(app) { File.expand_path("../apps/#{app}.ru", __dir__) }
Expand Down
20 changes: 5 additions & 15 deletions playground.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ You should find the `./repro.ru` cloned app file in the current dir. Feel free t
|||
||| Develop it

This command runs your `rackup` app with a `puma` server, with `rerun` that auto-restart it when it changes:
This command runs your `rackup` app with a `puma` server. It also uses `rerun` to auto-restart it when it changes (only on
linux platforms):

```sh
pagy path/to/your-repro.ru
Expand Down Expand Up @@ -129,27 +130,16 @@ then `gem pristine GEMNAME` should solve the problem.

==- Rerun

[Rerun](https://github.com/alexch/rerun) is used for restarting your app automatically during development.
[Rerun](https://github.com/alexch/rerun) is used for restarting your app automatically during development (only on linux
platforms).

That's very convenient, but it may still have some rough edges:

!!!warning ** ERROR: directory is already being watched! **

Your app is in a dir with looping simlinks, and the `listen` gem cannot handle it.
Your app is in a dir with looping symlinks, and the `listen` gem cannot handle it.

!!!success Move your app in a different dir
!!!

!!!warning On certain filesystems...

It might not work properly or it may require additional dependencies.

!!!success
Pass the `--no-rerun` option to work with rackup only.

```sh
pagy ./my-repro.ru --no-rerun
```

!!!
===

0 comments on commit 2b7e314

Please sign in to comment.