bens-hello-world 0.3.6 → 4.10.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release-pagy.yml +41 -0
- data/.github/workflows/release.yml +47 -47
- data/Gemfile.lock +1 -1
- data/lib/bens/hello/world/version.rb +1 -1
- data/lib/javascripts/pagy.js +122 -0
- metadata +4 -4
- data/.github/workflows/main.yml +0 -18
- data/.github/workflows/manual-release.yml +0 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebe9ddd773c7713a2bd37531f2edb8bf4323843effd5d2c9070c39e4b707f331
|
4
|
+
data.tar.gz: 8e7b4519c2ab8e4384cabf4dd6f5326d1b21bcca99579449438e87e7aa93bcfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb9743f4010b6f1d4bf1e67d9fee6a9bbdd59815fdfc654be474bdee15b2f3469fc41c455a3e2e5952e5a7109dc287258b9aa5d9b6872e635d8ce4df11579dc5
|
7
|
+
data.tar.gz: 266508a87b71238b9a2f58f784ca7af0702ce54c24eaf140937942e410b001d6092d7964d5cc30a01cdbb8954b2b331cf01068a2057b2ba8ef530d6eb7dbf92f
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# This manual workflow build and push pagy to rubygems and creates a release tag at the current master commit
|
2
|
+
|
3
|
+
name: Release Pagy
|
4
|
+
on:
|
5
|
+
workflow_dispatch:
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
|
9
|
+
release-pagy:
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v2 # checks out default branch
|
13
|
+
|
14
|
+
- uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: 3.0.0
|
17
|
+
- run: bundle install
|
18
|
+
|
19
|
+
- name: Build and push
|
20
|
+
run: |
|
21
|
+
mkdir -p $HOME/.gem
|
22
|
+
printf -- "---\n:rubygems_api_key: ${RUBYGEMS_TOKEN}\n" > $HOME/.gem/credentials
|
23
|
+
chmod 0600 $HOME/.gem/credentials
|
24
|
+
gem build *.gemspec
|
25
|
+
gem push *.gem
|
26
|
+
env:
|
27
|
+
RUBYGEMS_TOKEN: "${{secrets.RUBYGEMS_TOKEN}}"
|
28
|
+
|
29
|
+
- name: Create the release tag
|
30
|
+
uses: actions/github-script@v3
|
31
|
+
with:
|
32
|
+
github-token: ${{ github.token }}
|
33
|
+
script: |
|
34
|
+
const fs = require("fs")
|
35
|
+
eval(fs.readFileSync("./lib/javascripts/pagy.js").toString())
|
36
|
+
github.git.createRef({
|
37
|
+
owner: context.repo.owner,
|
38
|
+
repo: context.repo.repo,
|
39
|
+
ref: `refs/tags/${Pagy.version}`,
|
40
|
+
sha: context.sha
|
41
|
+
})
|
@@ -1,52 +1,52 @@
|
|
1
|
-
name: release
|
1
|
+
# name: release
|
2
2
|
|
3
|
-
on:
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
# on:
|
4
|
+
# push:
|
5
|
+
# branches:
|
6
|
+
# - master
|
7
7
|
|
8
|
-
jobs:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
8
|
+
# jobs:
|
9
|
+
# release-please:
|
10
|
+
# runs-on: ubuntu-latest
|
11
|
+
# steps:
|
12
|
+
# - uses: GoogleCloudPlatform/release-please-action@v2
|
13
|
+
# id: release
|
14
|
+
# with:
|
15
|
+
# # The release type
|
16
|
+
# release-type: ruby
|
17
|
+
# # A name for the artifact releases are being created for
|
18
|
+
# # which is the name of our gem
|
19
|
+
# package-name: bens-hello-world
|
20
|
+
# # Should breaking changes before 1.0.0 produce minor bumps?
|
21
|
+
# bump-minor-pre-major: true
|
22
|
+
# # Path to our version file to increment
|
23
|
+
# version-file: "lib/bens/hello/world/version.rb"
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
25
|
+
# # Checkout code if release was created
|
26
|
+
# - uses: actions/checkout@v2
|
27
|
+
# if: ${{ steps.release.outputs.release_created }}
|
28
|
+
# # Setup ruby if a release was created
|
29
|
+
# - uses: ruby/setup-ruby@v1
|
30
|
+
# with:
|
31
|
+
# ruby-version: 3.0.0
|
32
|
+
# if: ${{ steps.release.outputs.release_created }}
|
33
|
+
# # Bundle install
|
34
|
+
# - run: bundle install
|
35
|
+
# if: ${{ steps.release.outputs.release_created }}
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
37
|
+
# # ## One can choose the publish the gem when the release is created too
|
38
|
+
# # - name: publish gem
|
39
|
+
# # run: |
|
40
|
+
# # mkdir -p $HOME/.gem
|
41
|
+
# # touch $HOME/.gem/credentials
|
42
|
+
# # chmod 0600 $HOME/.gem/credentials
|
43
|
+
# # printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
44
|
+
# # gem build *.gemspec
|
45
|
+
# # gem push *.gem
|
46
|
+
# # env:
|
47
|
+
# # # Make sure to update the secret name
|
48
|
+
# # # if yours isn't named RUBYGEMS_AUTH_TOKEN
|
49
|
+
# # GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
50
|
+
# # if: ${{ steps.release.outputs.release_created }}
|
51
51
|
|
52
|
-
|
52
|
+
#
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,122 @@
|
|
1
|
+
// See the Pagy documentation: https://ddnexus.github.io/pagy/extras#javascript
|
2
|
+
|
3
|
+
function Pagy(){}
|
4
|
+
|
5
|
+
Pagy.version = '4.10.4'
|
6
|
+
|
7
|
+
Pagy.delay = 100
|
8
|
+
|
9
|
+
Pagy.init =
|
10
|
+
function(arg) {
|
11
|
+
var target = arg instanceof Event || arg === undefined ? document : arg,
|
12
|
+
elements = target.querySelectorAll('[data-pagy-json]')
|
13
|
+
for (var i = 0, len = elements.length; i < len; i++) {
|
14
|
+
var args = JSON.parse(elements[i].getAttribute('data-pagy-json')),
|
15
|
+
fname = args.shift()
|
16
|
+
args.unshift(elements[i])
|
17
|
+
Pagy[fname].apply(null, args)
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
Pagy.nav =
|
22
|
+
function(pagyEl, tags, sequels, trimParam) {
|
23
|
+
var lastWidth,
|
24
|
+
pageREg = new RegExp(/__pagy_page__/g),
|
25
|
+
widths = []
|
26
|
+
for (var width in sequels) {
|
27
|
+
if (sequels.hasOwnProperty(width)) { widths.push(parseInt(width, 10)) }
|
28
|
+
}
|
29
|
+
widths.sort(function(a, b) { return b - a })
|
30
|
+
|
31
|
+
pagyEl.render =
|
32
|
+
function() {
|
33
|
+
var width, i, len
|
34
|
+
for (i = 0, len = widths.length; i < len; i++) {
|
35
|
+
if (this.parentElement.clientWidth > widths[i]) { width = widths[i]; break }
|
36
|
+
}
|
37
|
+
if (width !== lastWidth) {
|
38
|
+
var html = tags.before,
|
39
|
+
series = sequels[width]
|
40
|
+
for (i = 0, len = series.length; i < len; i++) {
|
41
|
+
var item = series[i]
|
42
|
+
if (typeof(trimParam) === 'string' && item === 1) { html += Pagy.trim(tags.link.replace(pageREg, item), trimParam) }
|
43
|
+
else if (typeof(item) === 'number') { html += tags.link.replace(pageREg, item) }
|
44
|
+
else if (item === 'gap') { html += tags.gap }
|
45
|
+
else if (typeof(item) === 'string') { html += tags.active.replace(pageREg, item) }
|
46
|
+
}
|
47
|
+
html += tags.after
|
48
|
+
this.innerHTML = ''
|
49
|
+
this.insertAdjacentHTML('afterbegin', html)
|
50
|
+
lastWidth = width
|
51
|
+
}
|
52
|
+
}.bind(pagyEl)
|
53
|
+
pagyEl.render()
|
54
|
+
}
|
55
|
+
|
56
|
+
Pagy.combo_nav =
|
57
|
+
function(pagyEl, page, link, trimParam) {
|
58
|
+
var input = pagyEl.getElementsByTagName('input')[0],
|
59
|
+
toPage =
|
60
|
+
function() {
|
61
|
+
if (page !== input.value) {
|
62
|
+
var html = link.replace(/__pagy_page__/, input.value)
|
63
|
+
if (typeof (trimParam) === 'string' && input.value === '1') { html = Pagy.trim(html, trimParam) }
|
64
|
+
pagyEl.insertAdjacentHTML('afterbegin', html)
|
65
|
+
pagyEl.getElementsByTagName('a')[0].click()
|
66
|
+
}
|
67
|
+
}
|
68
|
+
Pagy.addInputEventListeners(input, toPage)
|
69
|
+
}
|
70
|
+
|
71
|
+
Pagy.items_selector =
|
72
|
+
function(pagyEl, from, link, param) {
|
73
|
+
var input = pagyEl.getElementsByTagName('input')[0],
|
74
|
+
current = input.value,
|
75
|
+
toPage =
|
76
|
+
function() {
|
77
|
+
var items = input.value
|
78
|
+
if (current !== items) {
|
79
|
+
var page = Math.max(Math.ceil(from / items), 1),
|
80
|
+
html = link.replace(/__pagy_page__/, page).replace(/__pagy_items__/, items)
|
81
|
+
if (typeof (param) === 'string' && page === 1) { html = Pagy.trim(html, param) }
|
82
|
+
pagyEl.insertAdjacentHTML('afterbegin', html)
|
83
|
+
pagyEl.getElementsByTagName('a')[0].click()
|
84
|
+
}
|
85
|
+
}
|
86
|
+
Pagy.addInputEventListeners(input, toPage)
|
87
|
+
}
|
88
|
+
|
89
|
+
Pagy.addInputEventListeners =
|
90
|
+
function(input, toPage) {
|
91
|
+
// select the content on click: easier for typing a number
|
92
|
+
input.addEventListener('click', function() { this.select() })
|
93
|
+
// toPage when the input looses focus
|
94
|
+
input.addEventListener('focusout', toPage)
|
95
|
+
// … and when pressing enter inside the input
|
96
|
+
input.addEventListener('keyup', function(e) { if (e.which === 13) {toPage()} }.bind(this))
|
97
|
+
}
|
98
|
+
|
99
|
+
Pagy.trim =
|
100
|
+
function(html, param) {
|
101
|
+
var re = new RegExp('[?&]' + param + '=1\\b(?!&)|\\b' + param + '=1&')
|
102
|
+
return html.replace(re, '')
|
103
|
+
}
|
104
|
+
|
105
|
+
Pagy.renderNavs =
|
106
|
+
function() {
|
107
|
+
var navs = document.getElementsByClassName('pagy-njs') // 'pagy-njs' is common to all *nav_js helpers
|
108
|
+
for (var i = 0, len = navs.length; i < len; i++) { navs[i].render() }
|
109
|
+
}
|
110
|
+
|
111
|
+
Pagy.waitForMe =
|
112
|
+
function() {
|
113
|
+
if (typeof(Pagy.tid) === 'number') { clearTimeout(Pagy.tid) }
|
114
|
+
Pagy.tid = setTimeout(Pagy.renderNavs, Pagy.delay)
|
115
|
+
}
|
116
|
+
|
117
|
+
|
118
|
+
if (typeof window !== "undefined") {
|
119
|
+
window.addEventListener('resize', Pagy.waitForMe, true)
|
120
|
+
}
|
121
|
+
|
122
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bens-hello-world
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.10.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BK
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This is a pure dummy gem. Hello world. We wanna test out github actions
|
14
14
|
and publishing ruby gems.
|
@@ -18,8 +18,7 @@ executables: []
|
|
18
18
|
extensions: []
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
|
-
- ".github/workflows/
|
22
|
-
- ".github/workflows/manual-release.yml"
|
21
|
+
- ".github/workflows/release-pagy.yml"
|
23
22
|
- ".github/workflows/release.yml"
|
24
23
|
- ".gitignore"
|
25
24
|
- ".rspec"
|
@@ -36,6 +35,7 @@ files:
|
|
36
35
|
- bin/setup
|
37
36
|
- lib/bens/hello/world.rb
|
38
37
|
- lib/bens/hello/world/version.rb
|
38
|
+
- lib/javascripts/pagy.js
|
39
39
|
homepage: https://benkoshy.github.io/
|
40
40
|
licenses:
|
41
41
|
- MIT
|
data/.github/workflows/main.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
name: Ruby
|
2
|
-
|
3
|
-
on: [push,pull_request]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
build:
|
7
|
-
runs-on: ubuntu-latest
|
8
|
-
steps:
|
9
|
-
- uses: actions/checkout@v2
|
10
|
-
- name: Set up Ruby
|
11
|
-
uses: ruby/setup-ruby@v1
|
12
|
-
with:
|
13
|
-
ruby-version: 3.0.0
|
14
|
-
- name: Run the default task
|
15
|
-
run: |
|
16
|
-
gem install bundler -v 2.2.7
|
17
|
-
bundle install
|
18
|
-
bundle exec rake
|
@@ -1,60 +0,0 @@
|
|
1
|
-
|
2
|
-
name: manual-release
|
3
|
-
|
4
|
-
on:
|
5
|
-
workflow_dispatch:
|
6
|
-
|
7
|
-
jobs:
|
8
|
-
manual-release:
|
9
|
-
runs-on: ubuntu-latest
|
10
|
-
env:
|
11
|
-
VERSION: $(sed -nr "s/.*VERSION\s*=\s*('|\")([^'\"]+).*$/\2/p" $(echo "$GITHUB_WORKSPACE/lib/bens/hello/world/version.rb"))
|
12
|
-
steps:
|
13
|
-
|
14
|
-
- uses: actions/checkout@v2
|
15
|
-
# checks out the default branch (which is master)
|
16
|
-
|
17
|
-
- uses: ruby/setup-ruby@v1
|
18
|
-
with:
|
19
|
-
ruby-version: 3.0.0
|
20
|
-
- run: bundle install
|
21
|
-
|
22
|
-
|
23
|
-
- name: publish gem
|
24
|
-
run: |
|
25
|
-
mkdir -p $HOME/.gem
|
26
|
-
touch $HOME/.gem/credentials
|
27
|
-
chmod 0600 $HOME/.gem/credentials
|
28
|
-
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
29
|
-
gem build *.gemspec
|
30
|
-
gem push *.gem
|
31
|
-
env:
|
32
|
-
# Make sure to update the secret name
|
33
|
-
# if yours isn't named RUBYGEMS_AUTH_TOKEN
|
34
|
-
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
35
|
-
|
36
|
-
# now, after the gem has been successfully published
|
37
|
-
# we would need to automatically tag based on the current commit
|
38
|
-
# ideally we would read the version in the gem file and commit that.
|
39
|
-
|
40
|
-
## We wanna use this one for pagy
|
41
|
-
# echo "::set-output name=version::$(sed -nr "s/.*VERSION\s*=\s*('|\")([^'\"]+).*$/\2/p" $(echo "$GITHUB_WORKSPACE/lib/pagy.rb"))"
|
42
|
-
|
43
|
-
# - name: Get version number
|
44
|
-
# id: version
|
45
|
-
# run: |
|
46
|
-
# echo "::set-output name=version::$(sed -nr "s/.*VERSION\s*=\s*('|\")([^'\"]+).*$/\2/p" $(echo "$GITHUB_WORKSPACE/lib/bens/hello/world/version.rb"))"
|
47
|
-
|
48
|
-
- name: Create tag
|
49
|
-
uses: actions/github-script@v3
|
50
|
-
with:
|
51
|
-
github-token: ${{ github.token }}
|
52
|
-
script: |
|
53
|
-
github.git.createRef({
|
54
|
-
owner: context.repo.owner,
|
55
|
-
repo: context.repo.repo,
|
56
|
-
ref: "refs/tags/".concat(${{env.VERSION}}),
|
57
|
-
sha: context.sha
|
58
|
-
})
|
59
|
-
|
60
|
-
|