bens-hello-world 0.3.5 → 4.10.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/{manual-release.yml → publish-gem-and-tag.yml} +26 -20
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77463a548a5ed111182a38263777fd453a27e4d54bee020cd12d4b39c7b7c2c9
|
4
|
+
data.tar.gz: 7e6746a72924383abc7609cdb5300200a476094731533affd57703a27d0edbfd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de2e45f7f0d7f42a1ed1cc416ffa8c554daeb9955cdc7eb986f0217ee2649b8ac3a1bc31059949e191c430b836a7155bca1a04d472ece2e7848c03afbf2ddc59
|
7
|
+
data.tar.gz: 2b7e596be68233359b1baa06888e2a5a093af6c4dd9cc81f9f3dd6d949e1c2da8cbe29b054f07dc049376ac986c732648338708a5aad4e4be16bbcf625652820
|
@@ -1,24 +1,21 @@
|
|
1
1
|
|
2
|
-
name:
|
2
|
+
name: publish-gem-and-tag
|
3
3
|
|
4
4
|
on:
|
5
5
|
workflow_dispatch:
|
6
6
|
|
7
7
|
jobs:
|
8
|
-
|
8
|
+
publish-gem-and-tag:
|
9
9
|
runs-on: ubuntu-latest
|
10
|
-
|
11
|
-
VERSION: $(sed -nr "s/.*VERSION\s*=\s*('|\")([^'\"]+).*$/\2/p" $(echo "$GITHUB_WORKSPACE/lib/bens/hello/world/version.rb"))
|
10
|
+
|
12
11
|
steps:
|
13
12
|
|
14
|
-
- uses: actions/checkout@v2
|
15
|
-
# checks out the default branch (which is master)
|
13
|
+
- uses: actions/checkout@v2 # checks out default branch
|
16
14
|
|
17
15
|
- uses: ruby/setup-ruby@v1
|
18
16
|
with:
|
19
17
|
ruby-version: 3.0.0
|
20
|
-
- run: bundle install
|
21
|
-
|
18
|
+
- run: bundle install
|
22
19
|
|
23
20
|
- name: publish gem
|
24
21
|
run: |
|
@@ -28,33 +25,42 @@ jobs:
|
|
28
25
|
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
29
26
|
gem build *.gemspec
|
30
27
|
gem push *.gem
|
31
|
-
env:
|
32
|
-
# Make sure to update the secret name
|
33
|
-
# if yours isn't named RUBYGEMS_AUTH_TOKEN
|
28
|
+
env:
|
34
29
|
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
|
35
30
|
|
36
|
-
|
37
|
-
|
38
|
-
# ideally we would read the version in the gem file and commit that.
|
31
|
+
# now, after the gem has been successfully published
|
32
|
+
# we would need to automatically tag based on the current commit
|
39
33
|
|
40
|
-
|
41
|
-
|
34
|
+
# # We wanna use this one for pagy
|
35
|
+
# echo "::set-output name=version::$(sed -nr "s/.*VERSION\s*=\s*('|\")([^'\"]+).*$/\2/p" $(echo "$GITHUB_WORKSPACE/lib/pagy.rb"))"
|
42
36
|
|
43
37
|
# - name: Get version number
|
44
38
|
# id: version
|
45
39
|
# run: |
|
46
40
|
# echo "::set-output name=version::$(sed -nr "s/.*VERSION\s*=\s*('|\")([^'\"]+).*$/\2/p" $(echo "$GITHUB_WORKSPACE/lib/bens/hello/world/version.rb"))"
|
47
|
-
|
41
|
+
# - name: Create tag
|
42
|
+
# uses: actions/github-script@v3
|
43
|
+
# with:
|
44
|
+
# github-token: ${{ github.token }}
|
45
|
+
# script: |
|
46
|
+
# github.git.createRef({
|
47
|
+
# owner: context.repo.owner,
|
48
|
+
# repo: context.repo.repo,
|
49
|
+
# ref: `refs/tags/${{steps.version.outputs.version}}`,
|
50
|
+
# sha: context.sha
|
51
|
+
# })
|
52
|
+
|
48
53
|
- name: Create tag
|
49
54
|
uses: actions/github-script@v3
|
50
55
|
with:
|
51
56
|
github-token: ${{ github.token }}
|
52
57
|
script: |
|
58
|
+
const fs = require("fs")
|
59
|
+
eval(fs.readFileSync("./lib/javascripts/pagy.js").toString())
|
60
|
+
|
53
61
|
github.git.createRef({
|
54
62
|
owner: context.repo.owner,
|
55
63
|
repo: context.repo.repo,
|
56
|
-
ref: `refs/tags/${
|
64
|
+
ref: `refs/tags/${Pagy.version}`,
|
57
65
|
sha: context.sha
|
58
66
|
})
|
59
|
-
|
60
|
-
|
@@ -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.2'
|
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.2
|
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-02 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/publish-gem-and-tag.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
|