Skip to content

Commit

Permalink
Added version to bin and apps files; updated version-bump.sh and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Mar 29, 2024
1 parent 4f1748b commit 42e123b
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 41 deletions.
8 changes: 5 additions & 3 deletions .github/ISSUE_TEMPLATE/Code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ body:
Please, understand that code issues are reserved for real, reproducible pagy bugs.
_If you are not sure that your problem is actually a bug, please ask for [support](https://github.com/ddnexus/pagy/discussions/categories/q-a) instead._
_If you are not sure that your problem is actually a bug,
please ask for [support](https://github.com/ddnexus/pagy/discussions/categories/q-a) instead._
- type: checkboxes
id: prereq
attributes:
label: Before submitting...
options:
- label: I upgraded to the last pagy version
- label: I upgraded to pagy version 7.0.11
required: true
- label: I searched through the [Documentation](https://ddnexus.github.io/pagy/)
required: true
Expand Down Expand Up @@ -49,7 +50,8 @@ body:
_(without any other setup step, installation or guessing, and with no or minimal interaction required)_
If anything is unclear to you, please ask for [support](https://github.com/ddnexus/pagy/discussions/categories/q-a). We will be happy to help.
_If anything is unclear to you, please ask for [support](https://github.com/ddnexus/pagy/discussions/categories/q-a).
We will be happy to help._
- type: checkboxes
id: support
Expand Down
1 change: 1 addition & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Layout/ExtraSpacing:
Enabled: true
Exclude:
- test/**/*
- lib/bin/pagy

Layout/EmptyLines:
Exclude:
Expand Down
6 changes: 4 additions & 2 deletions lib/apps/demo.ru
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
# Self-contained sinatra app to play with the pagy styles in the browser

# USAGE
# pagy start demo
# pagy demo
# ...point your browser to http://0.0.0.0:8000

# Help:
# pagy help
# pagy -h

VERSION = '7.0.11'

require 'bundler/inline'
gemfile true do
Expand Down
8 changes: 5 additions & 3 deletions lib/apps/repro.ru
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@

# USAGE
# To reproduce some issue:
# pagy create repro
# pagy develop ./repro.ru
# pagy new repro
# pagy ./repro.ru
# ...point your browser to http://0.0.0.0:8000
# Edit something in the "repro.ru" just created in your current dir and it will
# be automatically restarted, so you can reload your browser page and see the effect

# HELP:
# pagy help
# pagy -h

VERSION = '7.0.11'

require 'bundler/inline'
gemfile true do
Expand Down
23 changes: 15 additions & 8 deletions lib/bin/pagy
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

VERSION = '7.0.11'

require 'bundler/inline'
gemfile true do
source 'https://rubygems.org'
Expand Down Expand Up @@ -28,25 +30,30 @@ help = <<~HELP
Other options
-q, --quiet Quiet mode
-h, --help Print this message and exit
-v, --version Print the version and exit
EXAMPLES
pagy demo Run the demo app on port 8000
pagy repro Run the repro app on port 8000
pagy demo Run the demo app at http://0.0.0.0:8000
pagy repro Run the repro app at http://0.0.0.0:8000
pagy new repro Create a new repro app at ./repro.ru
pagy ~/my-repro.ru -o 127.0.0.1 -p 8001
Run your app at http://127.0.0.1:8001
HELP

opts = Slop.parse(validate_types: true) do |o|
o.string '-o', '--host', 'Custom host', default: '0.0.0.0'
o.integer '-p', '--port', 'Custom port', default: 8000
o.bool '-c', '--clear', 'Clear screen before each rerun', default: false
o.bool '-r', '--rerun', 'Enable rerun for **/*.ru', default: true
o.bool '-q', '--quiet', 'Quiet mode'
o.on '-h', '--help', 'Print this message and exit' do
o.string '-o', '--host', 'Custom host', default: '0.0.0.0'
o.integer '-p', '--port', 'Custom port', default: 8000
o.bool '-c', '--clear', 'Clear screen before each rerun', default: false
o.bool '-r', '--rerun', 'Enable rerun for **/*.ru', default: true
o.bool '-q', '--quiet', 'Quiet mode'
o.on '-h', '--help', 'Print this message and exit' do
puts help
exit
end
o.on '-v', '--version', 'Print the version and exit' do # rubocop:disable Layout/SpaceBeforeFirstArg
puts "Pagy #{VERSION}"
exit
end
end

def path(app)
Expand Down
4 changes: 4 additions & 0 deletions scripts/version-bump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ function bump(){
}

bump "$ROOT/retype.yml"
bunp "$ROOT/.github/ISSUE_TEMPLATE/Code.yml"
bump "$ROOT/lib/pagy.rb"
bump "$ROOT/lib/apps/demo.ru"
bump "$ROOT/lib/apps/repro.ru"
bump "$ROOT/lib/bin/pagy"
bump "$ROOT/lib/config/pagy.rb"
bump "$ROOT/src/pagy.ts"

Expand Down
10 changes: 10 additions & 0 deletions test/pagy_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,19 @@ def series_for(page, *expected)
it 'defines the same version in retype.yml' do
_(File.read('./retype.yml')).must_match "label: #{Pagy::VERSION}"
end
it 'defines the same version in .github/ISSUE_TEMPLATE/Code.yml' do
_(File.read('./.github/ISSUE_TEMPLATE/Code.yml')).must_match "I upgraded to pagy version #{Pagy::VERSION}"
end
it 'defines the same version in config/pagy.rb' do
_(Pagy.root.join('config', 'pagy.rb').read).must_match "# Pagy initializer file (#{Pagy::VERSION})"
end
it 'defines the same version in bin/pagy' do
_(Pagy.root.join('bin', 'pagy').read).must_match "VERSION = '#{Pagy::VERSION}'"
end
it 'defines the same version in apps/*.ru' do
_(Pagy.root.join('apps', 'demo.ru').read).must_match "VERSION = '#{Pagy::VERSION}'"
_(Pagy.root.join('apps', 'repro.ru').read).must_match "VERSION = '#{Pagy::VERSION}'"
end
it 'defines the same version in javascripts/pagy.js' do
_(Pagy.root.join('javascripts', 'pagy.js').read).must_match "version:\"#{Pagy::VERSION}\","
end
Expand Down
51 changes: 26 additions & 25 deletions try-it.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,37 +65,38 @@ Edit it at will.
```txt
$ pagy -h
Pagy utility to run, create and develop pagy demo apps
USAGE
pagy new [demo|repro]
pagy [demo|repro|**/*.ru] [options]
Rackup options
-o, --host Custom host (default: 0.0.0.0)
-p, --port Custom port (default: 8000)
Rerun options
-c, --clear Clear screen before each rerun
--no-rerun Disable rerun
Other options
-q, --quiet Quiet mode
-h, --help Print this message and exit
EXAMPLES
pagy demo Run the demo app on port 8000
pagy repro Run the repro app on port 8000
pagy new repro Create a new repro app at ./repro.ru
pagy ~/my-repro.ru -o 127.0.0.1 -p 8001
Run your app at http://127.0.0.1:8001
Pagy utility to run, create and develop pagy demo apps
USAGE
pagy new [demo|repro]
pagy [demo|repro|**/*.ru] [options]
Rackup options
-o, --host Custom host (default: 0.0.0.0)
-p, --port Custom port (default: 8000)
Rerun options
-c, --clear Clear screen before each rerun
--no-rerun Disable rerun
Other options
-q, --quiet Quiet mode
-h, --help Print this message and exit
-v, --version Print the version and exit
EXAMPLES
pagy demo Run the demo app at http://0.0.0.0:8000
pagy repro Run the repro app at http://0.0.0.0:8000
pagy new repro Create a new repro app at ./repro.ru
pagy ~/my-repro.ru -o 127.0.0.1 -p 8001
Run your app at http://127.0.0.1:8001
```

### Rerun

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

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

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

Expand Down

0 comments on commit 42e123b

Please sign in to comment.