Skip to content

Commit

Permalink
Fix canonical gem root:
Browse files Browse the repository at this point in the history
- Correct script.build: "NODE_PATH=\"$(bundle show 'pagy')/javascripts\"
- Move pagy.gemspec inside the gem root dir
- Remove rake:manifest gem
  • Loading branch information
ddnexus committed Apr 6, 2024
1 parent e782ceb commit e406a56
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 148 deletions.
3 changes: 0 additions & 3 deletions .github/gemfiles/default
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ gem 'oj', require: false # false is for testing with or without it
gem 'rack'
gem 'rackup'
gem 'rake'
gem 'rake-manifest'

group :test do
gem 'activesupport'
Expand All @@ -29,6 +28,4 @@ group :apps do
gem 'puma'
gem 'sinatra'
gem 'sinatra-contrib'
# gem 'slim'
# gem 'haml'
end
3 changes: 0 additions & 3 deletions .github/workflows/pagy-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ jobs:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically

- name: Check gem manifest
run: bundle exec rake manifest:check

- name: Check Rubocop compliance
run: bundle exec rubocop --format github

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/.bundle/
/coverage/
node_modules/
/pkg/
/gem/pkg/
/tmp/
pnpm
.pnpm-debug.log
32 changes: 20 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ icon: versions-24

## ⚠ WARNING

We may drop pagy's less used CSS extras.
We may drop pagy's less used CSS extras.

If you wish to keep them alive, please, [vote here](https://github.com/ddnexus/pagy/discussions/categories/survey).

Expand All @@ -30,7 +30,8 @@ None

## Version 8.0.1

- Reorganize the gem root dir: it was the lib dir (containing everything), now is the gem dir (containing lib and everything else).
- Reorganize the gem root dir: it was the lib dir (containing everything), now is the gem dir (containing lib and everything
else).
- Fix broken link in README

## Version 8.0.0
Expand All @@ -44,28 +45,35 @@ None
- The `item_i18n_key` has been removed: pass the interpolated/pluralized value as the `item_name:` argument
- The `link_extra:` has been removed: its cumulative mechanism was confusing and error prone. The `:anchor_string` pagy
variable substitutes it, however it's not an helper argument anymore, so you can assign it as the `DEFAULT[:anchor_string]`
and/or pass it as any other pagy variable at object construction. (See [customize the link attributes](https://ddnexus.github.io/pagy/docs/how-to/#customize-the-link-attributes))
- HTML structure, classes and internal methods have been changed: they may break your views if you used custom stylesheets,
and/or pass it as any other pagy variable at object construction. (
See [customize the link attributes](https://ddnexus.github.io/pagy/docs/how-to/#customize-the-link-attributes))
- HTML structure, classes and internal methods have been changed: they may break your views if you used custom stylesheets,
templates or helper overrides. See the complete changes below if you notice any cosmetic changes or get some exception.
- The `navs` and `support` extras has been merged into the new [pagy extra](https://ddnexus.github.io/pagy/docs/extras/pagy).
Search for `"extra/navs"` and
- The `navs` and `support` extras has been merged into the new [pagy extra](https://ddnexus.github.io/pagy/docs/extras/pagy).
Search for `"extra/navs"` and
`"extras/support"` and replace with `"extras/pagy"` (remove the duplicate if you used both)
- The build path for javascript builders has moved from the `lib` to the `gem` dir so the correct setup in `package.json` is:
`build: "NODE_PATH=\"$(bundle show 'pagy')/gem/javascripts\" <your original command>"`
- The build path for javascript builders has been updated to the canonical paths for gems, and has moved from the `lib` to
the gem root. Notice that the correct setup in `package json` was still wrongly wrapped in the `gem` dir for 8.0.0-8.0.1, and it
has finally been fixed in 8.0.2 (sorry for that):
- 8.0.0-8.0.1 only: `build: "NODE_PATH=\"$(bundle show 'pagy')/gem/javascripts\" <your original command>"`
- 8.0.2+: `build: "NODE_PATH=\"$(bundle show 'pagy')/javascripts\" <your original command>"`

### Changes

- Streamlined HTML and CSS helper structure. You may want to look at the actual output by running the [pagy demo](https://ddnexus.github.io/pagy/playground.md#3-demo-app)
- Streamlined HTML and CSS helper structure. You may want to look at the actual output by running
the [pagy demo](https://ddnexus.github.io/pagy/playground.md#3-demo-app)
- The `pagy_nav` and `pagy_nav_js` helpers output a series of `a` tags inside a wrapper `nav` tag (nothing else)
- The disabled links are so because they are missing the `href` attributes. (They also have the `role="link"` and `aria-disabled="true"` attributes)
- The disabled links are so because they are missing the `href` attributes. (They also have the `role="link"`
and `aria-disabled="true"` attributes)
- The `current` and `gap` classes are assigned to the specific `a` tags
- HTML changes
- All the pagy helper root classes have been changed according to the following rule. For example:
- `"pagy-nav"` > `"pagy nav"`
- `"pagy-bootstrap-nav-js"` > `"pagy-bootstrap nav-js"`
- and so on for all the helpers
- The `active` class of the `*nav`/`*nav_js` links as been renamed as `current`
- The `disabled`, `prev`, `next` and `pagy-combo-input` link classes have been removed (see the [stylesheets](https://ddnexus.github.io/pagy/docs/api/stylesheets/#pagy-scss) for details)
- The `disabled`, `prev`, `next` and `pagy-combo-input` link classes have been removed (see
the [stylesheets](https://ddnexus.github.io/pagy/docs/api/stylesheets/#pagy-scss) for details)
- The `rel="prev"` and `rel="next"` attributes have been dropped (they are obsolete)
- The `<label>`/`</label>` and `<b>`/`</b>` wrappers in the dictionary files have been removed
- The `pagy_link_proc` method (only used internally or in your custom overriding) has been renamed to `pagy_anchor` and it works
Expand All @@ -83,7 +91,7 @@ None
- The [stylesheets](https://ddnexus.github.io/pagy/docs/api/stylesheets/) are a lot simpler as a consequence of the changes above
- All the `*combo-nav_js` of the framework extras use simpler structure and improve the look and feel consistently with their
respective frameworks
- All the frontend extra have been normalized and are totally consistent with each other; a few may add the `classes:`
- All the frontend extra have been normalized and are totally consistent with each other; a few may add the `classes:`
argument to a few components, when the framework allows it.
- Created the [pagy playground](https://ddnexus.github.io/pagy/playground) system of apps working with the `pagy` executable.
- Internal renaming `FrontendHelpers` > `JSTools`
Expand Down
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ group :test do
gem 'oj', require: false # false is for testing with or without it
gem 'rack'
gem 'rackup'
gem 'rake-manifest'
gem 'rematch'
gem 'rubocop'
gem 'rubocop-minitest'
Expand All @@ -33,7 +32,6 @@ group :apps do
gem 'rouge'
gem 'sinatra'
gem 'sinatra-contrib'
gem 'slop'
end

group :performance do
Expand Down
4 changes: 0 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ GEM
webrick (~> 1.8)
rainbow (3.1.1)
rake (13.1.0)
rake-manifest (0.2.3)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
Expand Down Expand Up @@ -139,7 +138,6 @@ GEM
rack-protection (= 4.0.0)
sinatra (= 4.0.0)
tilt (~> 2.0)
slop (4.10.1)
tilt (2.3.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
Expand All @@ -163,7 +161,6 @@ DEPENDENCIES
rack
rackup
rake
rake-manifest
readline-ext
rematch
rerun
Expand All @@ -176,7 +173,6 @@ DEPENDENCIES
simplecov
sinatra
sinatra-contrib
slop

BUNDLED WITH
2.5.3
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

Rake.add_rakelib 'tasks'

task default: %i[manifest:check rubocop test check_coverage]
task default: %i[rubocop test check_coverage]
task test_cov: %i[test check_coverage]
6 changes: 3 additions & 3 deletions docs/api/javascript/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,15 @@ unless Rails.env.production?
Prepend the `NODE_PATH` environment variable to the `scripts.build` command:
```json package.json
{
"build": "NODE_PATH=\"$(bundle show 'pagy')/gem/javascripts\" <your original command>"
"build": "NODE_PATH=\"$(bundle show 'pagy')/javascripts\" <your original command>"
}
```

+++ Webpack
Prepend the `NODE_PATH` environment variable to the `scripts.build` command:
```json package.json
{
"build": "NODE_PATH=\"$(bundle show 'pagy')/gem/javascripts\" <your original command>"
"build": "NODE_PATH=\"$(bundle show 'pagy')/javascripts\" <your original command>"
}
```

Expand Down Expand Up @@ -215,7 +215,7 @@ import './pagy.js.erb'
Prepend the `NODE_PATH` environment variable to the `scripts.build` command:
```json package.json
{
"build": "NODE_PATH=\"$(bundle show 'pagy')/gem/javascripts\" <your original command>"
"build": "NODE_PATH=\"$(bundle show 'pagy')/javascripts\" <your original command>"
}
```

Expand Down
12 changes: 0 additions & 12 deletions gem/locales/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ You can create a Pull Request for your language, and get all the help you need t
for `one`, `few`, `many` and `other`, if it uses `:one_other`, you should provide `one` and `other` plurals. If it uses `:other`
you should only provide a single value. Look into other dictionary files to get some example. Ask if in doubt.

- [ ] Update the manifest file.

```sh
rake manifest:generate
```

and then confirm it with:

```sh
rake manifest:check
```

Feel free to ask for help in your Pull Request.

### Useful Links
Expand Down
10 changes: 4 additions & 6 deletions pagy.gemspec → gem/pagy.gemspec
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# frozen_string_literal: true

lib = File.expand_path('gem/lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'pagy'
require_relative 'lib/pagy'

Gem::Specification.new do |s|
s.name = 'pagy'
Expand All @@ -13,15 +11,15 @@ Gem::Specification.new do |s|
s.description = 'Agnostic pagination in plain ruby. It does it all. Better.'
s.homepage = 'https://github.com/ddnexus/pagy'
s.license = 'MIT'
s.files = File.read('pagy.manifest').split
s.files = Dir.glob('**/*')
.reject { |f| f.end_with?('.md', '.gemspec') }
.select { |f| File.file?(f) } + ['LICENSE.txt'] # LICENSE.txt is copied and deleted around build
s.metadata = { 'rubygems_mfa_required' => 'true',
'homepage_uri' => 'https://github.com/ddnexus/pagy',
'documentation_uri' => 'https://ddnexus.github.io/pagy',
'bug_tracker_uri' => 'https://github.com/ddnexus/pagy/issues',
'changelog_uri' => 'https://github.com/ddnexus/pagy/blob/master/CHANGELOG.md',
'support' => 'https://github.com/ddnexus/pagy/discussions/categories/q-a' }
s.require_paths = ['gem/lib']
s.bindir = 'gem/bin'
s.executables << 'pagy'
s.post_install_message = <<~PIM
*********************** PAGY WARNING! ***********************
Expand Down
90 changes: 0 additions & 90 deletions pagy.manifest

This file was deleted.

2 changes: 1 addition & 1 deletion tasks/check_coverage.rake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require 'json'

desc 'Display coverage summary. Fail if not 100%'
task :check_coverage do
last_run = JSON.parse(File.read(File.expand_path('../coverage/.last_run.json', __dir__)))
last_run = JSON.parse(File.read('coverage/.last_run.json'))
line = last_run['result']['line']
branch = last_run['result']['branch']
message = "\n>>> Coverage -> line: #{line}% -> branch: #{branch}%\n"
Expand Down
16 changes: 6 additions & 10 deletions tasks/rubygem_release.rake
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
# frozen_string_literal: true

# Gem release cycle

require 'bundler/gem_tasks'
require 'rake/manifest'

Rake::Manifest::Task.new do |t|
t.patterns = FileList.new.include('gem/**/*', 'LICENSE.txt').exclude('**/*.md')
t.manifest_file = 'pagy.manifest'
end
require 'bundler/gem_helper'
Bundler::GemHelper.install_tasks(dir: 'gem', name: 'pagy')

module Bundler # :nodoc: all
class GemHelper
Expand All @@ -26,8 +20,10 @@ task :rubygem_release do
branch = `git rev-parse --abbrev-ref HEAD`
abort 'Wrong branch to release!' unless /^master/.match?(branch)

Rake::Task['manifest:check'].invoke
FileUtils.cp('LICENSE.txt', 'gem/LICENSE.txt')
Rake::Task['build'].invoke
FileUtils.rm_f('gem/LICENSE.txt')

Rake::Task['release'].invoke
FileUtils.rm_rf('pkg', secure: true)
FileUtils.rm_rf('gem/pkg', secure: true)
end

0 comments on commit e406a56

Please sign in to comment.