slack-ruby-bot-server 1.2.1 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/danger.yml +1 -1
- data/.github/workflows/test-mongodb.yml +4 -0
- data/.github/workflows/test-postgresql.yml +4 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +12 -0
- data/CONTRIBUTING.md +7 -0
- data/Gemfile +6 -5
- data/README.md +3 -3
- data/UPGRADING.md +12 -0
- data/lib/slack-ruby-bot-server/api/helpers/cursor_helpers.rb +8 -2
- data/lib/slack-ruby-bot-server/config/database_adapters/activerecord.rb +3 -0
- data/lib/slack-ruby-bot-server/config/pagy.rb +236 -0
- data/lib/slack-ruby-bot-server/config.rb +1 -1
- data/lib/slack-ruby-bot-server/ext/bson/object_id.rb +9 -7
- data/lib/slack-ruby-bot-server/ext.rb +2 -3
- data/lib/slack-ruby-bot-server/version.rb +1 -1
- metadata +8 -8
- data/lib/slack-ruby-bot-server/ext/mongoid/slack-ruby-bot/commands/base.rb +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6481784d4c29658a885d478d88734ff06e79ee6f9a30ec895e4c5872fecbd50b
|
4
|
+
data.tar.gz: 28d14d45d3f338d9a002a8e7ab697cc3dd4c70e9103b8b68fd86382b7a7ac20b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71d5b984953b8137f3636f501d38fcac2023ebc4b9633a90b4d5dbd30ddec03a2ecfd661eb2c647c01e80e6f847eccd76e8f7b9d69918d3839573032628d633e
|
7
|
+
data.tar.gz: b021b45e89ae3f85932e8fde979bf082a47d05fe527d27017edb4ea76717517fcb21c13a87c757fb988188d6435a4039d6433bbe5edc07bcc50e0cfc5acfe18e
|
@@ -19,5 +19,5 @@ jobs:
|
|
19
19
|
run: |
|
20
20
|
bundle install
|
21
21
|
# the personal token is public, this is ok, base64 encode to avoid tripping Github
|
22
|
-
TOKEN=$(echo -n
|
22
|
+
TOKEN=$(echo -n Z2hwX0xNQ3VmanBFeTBvYkZVTWh6NVNqVFFBOEUxU25abzBqRUVuaAo= | base64 --decode)
|
23
23
|
DANGER_GITHUB_API_TOKEN=$TOKEN bundle exec danger --verbose
|
@@ -10,6 +10,8 @@ jobs:
|
|
10
10
|
- { ruby: 2.6.2, mongoid: 6.4.8, mongodb: 4.4 }
|
11
11
|
- { ruby: 2.6.2, mongoid: 7.2.3, mongodb: 4.4 }
|
12
12
|
- { ruby: 2.6.2, mongoid: 7.3.0, mongodb: 4.4 }
|
13
|
+
- { ruby: 3.1.1, mongoid: 7.3.0, mongodb: 4.4 }
|
14
|
+
- { ruby: 3.1.1, mongoid: 7.3.0, mongodb: 5.0 }
|
13
15
|
name: test (ruby=${{ matrix.entry.ruby }}, mongoid=${{ matrix.entry.mongoid }}, mongodb=${{ matrix.entry.mongodb }})
|
14
16
|
steps:
|
15
17
|
- uses: actions/checkout@v2
|
@@ -17,6 +19,8 @@ jobs:
|
|
17
19
|
with:
|
18
20
|
ruby-version: ${{ matrix.entry.ruby }}
|
19
21
|
- uses: browser-actions/setup-geckodriver@latest
|
22
|
+
with:
|
23
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
20
24
|
- run: geckodriver --version
|
21
25
|
- uses: supercharge/mongodb-github-action@1.7.0
|
22
26
|
with:
|
@@ -8,6 +8,8 @@ jobs:
|
|
8
8
|
matrix:
|
9
9
|
entry:
|
10
10
|
- { ruby: 2.6.2, postgresql: 11 }
|
11
|
+
- { ruby: 3.1.1, postgresql: 11 }
|
12
|
+
- { ruby: 3.1.1, postgresql: 14 }
|
11
13
|
name: test (ruby=${{ matrix.entry.ruby }}, postgresql=${{ matrix.entry.postgresql }})
|
12
14
|
steps:
|
13
15
|
- uses: actions/checkout@v2
|
@@ -15,6 +17,8 @@ jobs:
|
|
15
17
|
with:
|
16
18
|
ruby-version: ${{ matrix.entry.ruby }}
|
17
19
|
- uses: browser-actions/setup-geckodriver@latest
|
20
|
+
with:
|
21
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
18
22
|
- run: geckodriver --version
|
19
23
|
- uses: harmon758/postgresql-action@v1
|
20
24
|
with:
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
### Changelog
|
2
2
|
|
3
|
+
#### 2.0.0 (2023/02/20)
|
4
|
+
|
5
|
+
* [#145](https://github.com/slack-ruby/slack-ruby-bot-server/pull/145): Added support for Ruby 3.1 - [@dblock](https://github.com/dblock).
|
6
|
+
* [#146](https://github.com/slack-ruby/slack-ruby-bot-server/pull/146): Added support for MongoDB 5.0 - [@dblock](https://github.com/dblock).
|
7
|
+
* [#147](https://github.com/slack-ruby/slack-ruby-bot-server/pull/147): Added support for PostgreSQL 14 - [@dblock](https://github.com/dblock).
|
8
|
+
* [#155](https://github.com/slack-ruby/slack-ruby-bot-server/pull/155): Enable mongoid to get connection URI from ENV for test - [@crazyoptimist](https://github.com/crazyoptimist).
|
9
|
+
* [#157](https://github.com/slack-ruby/slack-ruby-bot-server/pull/157): Added test env setup guide for linux users - [@crazyoptimist](https://github.com/crazyoptimist).
|
10
|
+
* [#158](https://github.com/slack-ruby/slack-ruby-bot-server/pull/158): Replace `cursor_pagination` with `pagy_cursor` - [@crazyoptimist](https://github.com/crazyoptimist).
|
11
|
+
* [#160](https://github.com/slack-ruby/slack-ruby-bot-server/pull/160): Document upgrading to 2.0.0 - [@crazyoptimist](https://github.com/crazyoptimist).
|
12
|
+
* [#161](https://github.com/slack-ruby/slack-ruby-bot-server/pull/161): Removed unused `ext` module - [@dblock](https://github.com/dblock).
|
13
|
+
* [#162](https://github.com/slack-ruby/slack-ruby-bot-server/pull/162): Fix: scopes are comma-separated - [@dblock](https://github.com/dblock).
|
14
|
+
|
3
15
|
#### 1.2.1 (2022/03/06)
|
4
16
|
|
5
17
|
* [#140](https://github.com/slack-ruby/slack-ruby-bot-server/pull/140): Fix: `NameError` for `Boolean` types with mongoid >= 7.3.0 - [@dblock](https://github.com/dblock).
|
data/CONTRIBUTING.md
CHANGED
@@ -35,6 +35,13 @@ bundle install
|
|
35
35
|
bundle exec rake
|
36
36
|
```
|
37
37
|
|
38
|
+
If you are a linux user, you will need to install [geckodriver](https://github.com/mozilla/geckodriver/releases), [firefox](https://download-installer.cdn.mozilla.net/pub/firefox/releases/), and `Xvfb`.
|
39
|
+
And, to get a display for the headless browser, run `Xvfb` manually. You can see more explanations [here](http://elementalselenium.com/tips/38-headless).
|
40
|
+
|
41
|
+
```
|
42
|
+
xvfb-run --auto-servernum bundle exec rake
|
43
|
+
```
|
44
|
+
|
38
45
|
## Write Tests
|
39
46
|
|
40
47
|
Try to write a test that reproduces the problem you're trying to fix or describes a feature that you want to build.
|
data/Gemfile
CHANGED
@@ -7,9 +7,9 @@ when 'mongoid' then
|
|
7
7
|
gem 'mongoid-scroll'
|
8
8
|
gem 'mongoid-shell'
|
9
9
|
when 'activerecord' then
|
10
|
-
gem 'activerecord', '~>
|
11
|
-
gem 'otr-activerecord'
|
12
|
-
gem '
|
10
|
+
gem 'activerecord', '~> 6.0.0'
|
11
|
+
gem 'otr-activerecord'
|
12
|
+
gem 'pagy_cursor'
|
13
13
|
gem 'pg'
|
14
14
|
when nil
|
15
15
|
warn "Missing ENV['DATABASE_ADAPTER']."
|
@@ -22,18 +22,19 @@ gemspec
|
|
22
22
|
group :development, :test do
|
23
23
|
gem 'bundler'
|
24
24
|
gem 'byebug'
|
25
|
-
gem 'capybara', '~>
|
25
|
+
gem 'capybara', '~> 3.36.0'
|
26
26
|
gem 'database_cleaner', '~> 1.8.5'
|
27
27
|
gem 'fabrication'
|
28
28
|
gem 'faker'
|
29
29
|
gem 'faraday', '0.17.5'
|
30
30
|
gem 'hyperclient', '~> 0.9.3'
|
31
|
+
gem 'rack', '~> 2.2.3'
|
31
32
|
gem 'rack-server-pages'
|
32
33
|
gem 'rack-test'
|
33
34
|
gem 'rake'
|
34
35
|
gem 'rspec'
|
35
36
|
gem 'rubocop', '0.81.0'
|
36
|
-
gem 'selenium-webdriver', '~>
|
37
|
+
gem 'selenium-webdriver', '~> 4.1.0'
|
37
38
|
gem 'vcr'
|
38
39
|
gem 'webmock'
|
39
40
|
gem 'webrick', '~> 1.6.1'
|
data/README.md
CHANGED
@@ -40,7 +40,7 @@ A library that contains a web server and a RESTful [Grape](http://github.com/rub
|
|
40
40
|
|
41
41
|
## Stable Release
|
42
42
|
|
43
|
-
You're reading the documentation for the **stable** release of slack-ruby-bot-server. See [UPGRADING](UPGRADING.md) when upgrading from an older version. See [MIGRATING](MIGRATING.md) for help with migrating Legacy Slack Apps to Granular Scopes.
|
43
|
+
You're reading the documentation for the **stable** release of slack-ruby-bot-server, 2.0.0. See [UPGRADING](UPGRADING.md) when upgrading from an older version. See [MIGRATING](MIGRATING.md) for help with migrating Legacy Slack Apps to Granular Scopes.
|
44
44
|
|
45
45
|
## Make Your Own
|
46
46
|
|
@@ -65,14 +65,14 @@ gem 'slack-ruby-bot-server'
|
|
65
65
|
|
66
66
|
#### ActiveRecord
|
67
67
|
|
68
|
-
Use ActiveRecord with, for example, PostgreSQL via [pg](https://github.com/ged/ruby-pg). Add the `activerecord`, `pg`, `otr-activerecord` and `
|
68
|
+
Use ActiveRecord with, for example, PostgreSQL via [pg](https://github.com/ged/ruby-pg). Add the `activerecord`, `pg`, `otr-activerecord` and `pagy_cursor` gems to your Gemfile.
|
69
69
|
|
70
70
|
```
|
71
71
|
gem 'pg'
|
72
72
|
gem 'activerecord', require: 'active_record'
|
73
73
|
gem 'slack-ruby-bot-server'
|
74
74
|
gem 'otr-activerecord'
|
75
|
-
gem '
|
75
|
+
gem 'pagy_cursor'
|
76
76
|
```
|
77
77
|
|
78
78
|
Configure the database connection in `config/postgresql.yml`.
|
data/UPGRADING.md
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
Upgrading Slack-Ruby-Bot-Server
|
2
2
|
===============================
|
3
3
|
|
4
|
+
### Upgrading to >= 2.0.0
|
5
|
+
|
6
|
+
#### Replaced Pagination Gem for ActiveRecord
|
7
|
+
|
8
|
+
[`cursor_pagination`](https://github.com/Kukunin/cursor_pagination) is abandoned and no longer maintained. It is repaced with [`pagy_cursor`](https://github.com/Uysim/pagy-cursor).
|
9
|
+
|
10
|
+
If you're using ActiveRecord, replace `cursor_pagination` with `pagy_cursor` in the Gemfile.
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'pagy_cursor'
|
14
|
+
```
|
15
|
+
|
4
16
|
### Upgrading to >= 1.2.0
|
5
17
|
|
6
18
|
#### New Team Fields
|
@@ -25,6 +25,8 @@ module SlackRubyBotServer
|
|
25
25
|
results
|
26
26
|
end
|
27
27
|
elsif SlackRubyBotServer::Config.activerecord?
|
28
|
+
include Pagy::Cursor::Backend
|
29
|
+
|
28
30
|
def paginate_by_cursor(coll, options)
|
29
31
|
raise 'Both cursor and offset parameters are present, these are mutually exclusive.' if params.key?(:offset) && params.key?(:cursor)
|
30
32
|
|
@@ -33,12 +35,16 @@ module SlackRubyBotServer
|
|
33
35
|
results[:total_count] = coll.count(:all) if params[:total_count]
|
34
36
|
coll = coll.offset(params[:offset].to_i) if params.key?(:offset)
|
35
37
|
sort_options = {}
|
38
|
+
cursor_direction = :after
|
36
39
|
sort_order(options).each do |order|
|
37
40
|
sort_options[order[:column]] = { reverse: true } if order[:direction] == :desc
|
41
|
+
cursor_direction = :before if order[:column] == coll.primary_key && order[:direction] == :desc
|
38
42
|
end
|
39
|
-
|
43
|
+
cursor_vars = { items: size }
|
44
|
+
cursor_vars[cursor_direction] = params[:cursor].to_i if params.key?(:cursor)
|
45
|
+
pagy_cursor, coll = pagy_cursor(coll, cursor_vars, { order: sort_options })
|
40
46
|
results[:results] = coll.to_a
|
41
|
-
results[:next] = coll.
|
47
|
+
results[:next] = coll.last[:id].to_s if pagy_cursor.has_more?
|
42
48
|
results
|
43
49
|
end
|
44
50
|
end
|
@@ -0,0 +1,236 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Pagy initializer file (6.0.0)
|
4
|
+
# Customize only what you really need and notice that the core Pagy works also without any of the following lines.
|
5
|
+
# Should you just cherry pick part of this file, please maintain the require-order of the extras
|
6
|
+
|
7
|
+
# Pagy DEFAULT Variables
|
8
|
+
# See https://ddnexus.github.io/pagy/docs/api/pagy#variables
|
9
|
+
# All the Pagy::DEFAULT are set for all the Pagy instances but can be overridden per instance by just passing them to
|
10
|
+
# Pagy.new|Pagy::Countless.new|Pagy::Calendar::*.new or any of the #pagy* controller methods
|
11
|
+
|
12
|
+
# Instance variables
|
13
|
+
# See https://ddnexus.github.io/pagy/docs/api/pagy#instance-variables
|
14
|
+
# Pagy::DEFAULT[:page] = 1 # default
|
15
|
+
# Pagy::DEFAULT[:items] = 20 # default
|
16
|
+
# Pagy::DEFAULT[:outset] = 0 # default
|
17
|
+
|
18
|
+
# Other Variables
|
19
|
+
# See https://ddnexus.github.io/pagy/docs/api/pagy#other-variables
|
20
|
+
# Pagy::DEFAULT[:size] = [1,4,4,1] # default
|
21
|
+
# Pagy::DEFAULT[:page_param] = :page # default
|
22
|
+
# The :params can be also set as a lambda e.g ->(params){ params.exclude('useless').merge!('custom' => 'useful') }
|
23
|
+
# Pagy::DEFAULT[:params] = {} # default
|
24
|
+
# Pagy::DEFAULT[:fragment] = '#fragment' # example
|
25
|
+
# Pagy::DEFAULT[:link_extra] = 'data-remote="true"' # example
|
26
|
+
# Pagy::DEFAULT[:i18n_key] = 'pagy.item_name' # default
|
27
|
+
# Pagy::DEFAULT[:cycle] = true # example
|
28
|
+
# Pagy::DEFAULT[:request_path] = "/foo" # example
|
29
|
+
|
30
|
+
# Extras
|
31
|
+
# See https://ddnexus.github.io/pagy/docs/extras
|
32
|
+
|
33
|
+
# Backend Extras
|
34
|
+
|
35
|
+
# Array extra: Paginate arrays efficiently, avoiding expensive array-wrapping and without overriding
|
36
|
+
# See https://ddnexus.github.io/pagy/docs/extras/array
|
37
|
+
# require 'pagy/extras/array'
|
38
|
+
|
39
|
+
# Calendar extra: Add pagination filtering by calendar time unit (year, quarter, month, week, day)
|
40
|
+
# See https://ddnexus.github.io/pagy/docs/extras/calendar
|
41
|
+
# require 'pagy/extras/calendar'
|
42
|
+
# Default for each unit
|
43
|
+
# Pagy::Calendar::Year::DEFAULT[:order] = :asc # Time direction of pagination
|
44
|
+
# Pagy::Calendar::Year::DEFAULT[:format] = '%Y' # strftime format
|
45
|
+
#
|
46
|
+
# Pagy::Calendar::Quarter::DEFAULT[:order] = :asc # Time direction of pagination
|
47
|
+
# Pagy::Calendar::Quarter::DEFAULT[:format] = '%Y-Q%q' # strftime format
|
48
|
+
#
|
49
|
+
# Pagy::Calendar::Month::DEFAULT[:order] = :asc # Time direction of pagination
|
50
|
+
# Pagy::Calendar::Month::DEFAULT[:format] = '%Y-%m' # strftime format
|
51
|
+
#
|
52
|
+
# Pagy::Calendar::Week::DEFAULT[:order] = :asc # Time direction of pagination
|
53
|
+
# Pagy::Calendar::Week::DEFAULT[:format] = '%Y-%W' # strftime format
|
54
|
+
#
|
55
|
+
# Pagy::Calendar::Day::DEFAULT[:order] = :asc # Time direction of pagination
|
56
|
+
# Pagy::Calendar::Day::DEFAULT[:format] = '%Y-%m-%d' # strftime format
|
57
|
+
#
|
58
|
+
# Uncomment the following lines, if you need calendar localization without using the I18n extra
|
59
|
+
# module LocalizePagyCalendar
|
60
|
+
# def localize(time, opts)
|
61
|
+
# ::I18n.l(time, **opts)
|
62
|
+
# end
|
63
|
+
# end
|
64
|
+
# Pagy::Calendar.prepend LocalizePagyCalendar
|
65
|
+
|
66
|
+
# Countless extra: Paginate without any count, saving one query per rendering
|
67
|
+
# See https://ddnexus.github.io/pagy/docs/extras/countless
|
68
|
+
# require 'pagy/extras/countless'
|
69
|
+
# Pagy::DEFAULT[:countless_minimal] = false # default (eager loading)
|
70
|
+
|
71
|
+
# Elasticsearch Rails extra: Paginate `ElasticsearchRails::Results` objects
|
72
|
+
# See https://ddnexus.github.io/pagy/docs/extras/elasticsearch_rails
|
73
|
+
# Default :pagy_search method: change only if you use also
|
74
|
+
# the searchkick or meilisearch extra that defines the same
|
75
|
+
# Pagy::DEFAULT[:elasticsearch_rails_pagy_search] = :pagy_search
|
76
|
+
# Default original :search method called internally to do the actual search
|
77
|
+
# Pagy::DEFAULT[:elasticsearch_rails_search] = :search
|
78
|
+
# require 'pagy/extras/elasticsearch_rails'
|
79
|
+
|
80
|
+
# Headers extra: http response headers (and other helpers) useful for API pagination
|
81
|
+
# See http://ddnexus.github.io/pagy/extras/headers
|
82
|
+
# require 'pagy/extras/headers'
|
83
|
+
# Pagy::DEFAULT[:headers] = { page: 'Current-Page',
|
84
|
+
# items: 'Page-Items',
|
85
|
+
# count: 'Total-Count',
|
86
|
+
# pages: 'Total-Pages' } # default
|
87
|
+
|
88
|
+
# Meilisearch extra: Paginate `Meilisearch` result objects
|
89
|
+
# See https://ddnexus.github.io/pagy/docs/extras/meilisearch
|
90
|
+
# Default :pagy_search method: change only if you use also
|
91
|
+
# the elasticsearch_rails or searchkick extra that define the same method
|
92
|
+
# Pagy::DEFAULT[:meilisearch_pagy_search] = :pagy_search
|
93
|
+
# Default original :search method called internally to do the actual search
|
94
|
+
# Pagy::DEFAULT[:meilisearch_search] = :ms_search
|
95
|
+
# require 'pagy/extras/meilisearch'
|
96
|
+
|
97
|
+
# Metadata extra: Provides the pagination metadata to Javascript frameworks like Vue.js, react.js, etc.
|
98
|
+
# See https://ddnexus.github.io/pagy/docs/extras/metadata
|
99
|
+
# you must require the frontend helpers internal extra (BEFORE the metadata extra) ONLY if you need also the :sequels
|
100
|
+
# require 'pagy/extras/frontend_helpers'
|
101
|
+
# require 'pagy/extras/metadata'
|
102
|
+
# For performance reasons, you should explicitly set ONLY the metadata you use in the frontend
|
103
|
+
# Pagy::DEFAULT[:metadata] = %i[scaffold_url page prev next last] # example
|
104
|
+
|
105
|
+
# Searchkick extra: Paginate `Searchkick::Results` objects
|
106
|
+
# See https://ddnexus.github.io/pagy/docs/extras/searchkick
|
107
|
+
# Default :pagy_search method: change only if you use also
|
108
|
+
# the elasticsearch_rails or meilisearch extra that defines the same
|
109
|
+
# DEFAULT[:searchkick_pagy_search] = :pagy_search
|
110
|
+
# Default original :search method called internally to do the actual search
|
111
|
+
# Pagy::DEFAULT[:searchkick_search] = :search
|
112
|
+
# require 'pagy/extras/searchkick'
|
113
|
+
# uncomment if you are going to use Searchkick.pagy_search
|
114
|
+
# Searchkick.extend Pagy::Searchkick
|
115
|
+
|
116
|
+
# Frontend Extras
|
117
|
+
|
118
|
+
# Bootstrap extra: Add nav, nav_js and combo_nav_js helpers and templates for Bootstrap pagination
|
119
|
+
# See https://ddnexus.github.io/pagy/docs/extras/bootstrap
|
120
|
+
# require 'pagy/extras/bootstrap'
|
121
|
+
|
122
|
+
# Bulma extra: Add nav, nav_js and combo_nav_js helpers and templates for Bulma pagination
|
123
|
+
# See https://ddnexus.github.io/pagy/docs/extras/bulma
|
124
|
+
# require 'pagy/extras/bulma'
|
125
|
+
|
126
|
+
# Foundation extra: Add nav, nav_js and combo_nav_js helpers and templates for Foundation pagination
|
127
|
+
# See https://ddnexus.github.io/pagy/docs/extras/foundation
|
128
|
+
# require 'pagy/extras/foundation'
|
129
|
+
|
130
|
+
# Materialize extra: Add nav, nav_js and combo_nav_js helpers for Materialize pagination
|
131
|
+
# See https://ddnexus.github.io/pagy/docs/extras/materialize
|
132
|
+
# require 'pagy/extras/materialize'
|
133
|
+
|
134
|
+
# Navs extra: Add nav_js and combo_nav_js javascript helpers
|
135
|
+
# Notice: the other frontend extras add their own framework-styled versions,
|
136
|
+
# so require this extra only if you need the unstyled version
|
137
|
+
# See https://ddnexus.github.io/pagy/docs/extras/navs
|
138
|
+
# require 'pagy/extras/navs'
|
139
|
+
|
140
|
+
# Semantic extra: Add nav, nav_js and combo_nav_js helpers for Semantic UI pagination
|
141
|
+
# See https://ddnexus.github.io/pagy/docs/extras/semantic
|
142
|
+
# require 'pagy/extras/semantic'
|
143
|
+
|
144
|
+
# UIkit extra: Add nav helper and templates for UIkit pagination
|
145
|
+
# See https://ddnexus.github.io/pagy/docs/extras/uikit
|
146
|
+
# require 'pagy/extras/uikit'
|
147
|
+
|
148
|
+
# Multi size var used by the *_nav_js helpers
|
149
|
+
# See https://ddnexus.github.io/pagy/docs/extras/navs#steps
|
150
|
+
# Pagy::DEFAULT[:steps] = { 0 => [2,3,3,2], 540 => [3,5,5,3], 720 => [5,7,7,5] } # example
|
151
|
+
|
152
|
+
# Feature Extras
|
153
|
+
|
154
|
+
# Gearbox extra: Automatically change the number of items per page depending on the page number
|
155
|
+
# See https://ddnexus.github.io/pagy/docs/extras/gearbox
|
156
|
+
# require 'pagy/extras/gearbox'
|
157
|
+
# set to false only if you want to make :gearbox_extra an opt-in variable
|
158
|
+
# Pagy::DEFAULT[:gearbox_extra] = false # default true
|
159
|
+
# Pagy::DEFAULT[:gearbox_items] = [15, 30, 60, 100] # default
|
160
|
+
|
161
|
+
# Items extra: Allow the client to request a custom number of items per page with an optional selector UI
|
162
|
+
# See https://ddnexus.github.io/pagy/docs/extras/items
|
163
|
+
# require 'pagy/extras/items'
|
164
|
+
# set to false only if you want to make :items_extra an opt-in variable
|
165
|
+
# Pagy::DEFAULT[:items_extra] = false # default true
|
166
|
+
# Pagy::DEFAULT[:items_param] = :items # default
|
167
|
+
# Pagy::DEFAULT[:max_items] = 100 # default
|
168
|
+
|
169
|
+
# Overflow extra: Allow for easy handling of overflowing pages
|
170
|
+
# See https://ddnexus.github.io/pagy/docs/extras/overflow
|
171
|
+
# require 'pagy/extras/overflow'
|
172
|
+
# Pagy::DEFAULT[:overflow] = :empty_page # default (other options: :last_page and :exception)
|
173
|
+
|
174
|
+
# Support extra: Extra support for features like: incremental, infinite, auto-scroll pagination
|
175
|
+
# See https://ddnexus.github.io/pagy/docs/extras/support
|
176
|
+
# require 'pagy/extras/support'
|
177
|
+
|
178
|
+
# Trim extra: Remove the page=1 param from links
|
179
|
+
# See https://ddnexus.github.io/pagy/docs/extras/trim
|
180
|
+
# require 'pagy/extras/trim'
|
181
|
+
# set to false only if you want to make :trim_extra an opt-in variable
|
182
|
+
# Pagy::DEFAULT[:trim_extra] = false # default true
|
183
|
+
|
184
|
+
# Standalone extra: Use pagy in non Rack environment/gem
|
185
|
+
# See https://ddnexus.github.io/pagy/docs/extras/standalone
|
186
|
+
# require 'pagy/extras/standalone'
|
187
|
+
# Pagy::DEFAULT[:url] = 'http://www.example.com/subdir' # optional default
|
188
|
+
|
189
|
+
# Rails
|
190
|
+
# Enable the .js file required by the helpers that use javascript
|
191
|
+
# (pagy*_nav_js, pagy*_combo_nav_js, and pagy_items_selector_js)
|
192
|
+
# See https://ddnexus.github.io/pagy/docs/extras#javascript
|
193
|
+
|
194
|
+
# With the asset pipeline
|
195
|
+
# Sprockets need to look into the pagy javascripts dir, so add it to the assets paths
|
196
|
+
# Rails.application.config.assets.paths << Pagy.root.join('javascripts')
|
197
|
+
|
198
|
+
# I18n
|
199
|
+
|
200
|
+
# Pagy internal I18n: ~18x faster using ~10x less memory than the i18n gem
|
201
|
+
# See https://ddnexus.github.io/pagy/docs/api/frontend#i18n
|
202
|
+
# Notice: No need to configure anything in this section if your app uses only "en"
|
203
|
+
# or if you use the i18n extra below
|
204
|
+
#
|
205
|
+
# Examples:
|
206
|
+
# load the "de" built-in locale:
|
207
|
+
# Pagy::I18n.load(locale: 'de')
|
208
|
+
#
|
209
|
+
# load the "de" locale defined in the custom file at :filepath:
|
210
|
+
# Pagy::I18n.load(locale: 'de', filepath: 'path/to/pagy-de.yml')
|
211
|
+
#
|
212
|
+
# load the "de", "en" and "es" built-in locales:
|
213
|
+
# (the first passed :locale will be used also as the default_locale)
|
214
|
+
# Pagy::I18n.load({ locale: 'de' },
|
215
|
+
# { locale: 'en' },
|
216
|
+
# { locale: 'es' })
|
217
|
+
#
|
218
|
+
# load the "en" built-in locale, a custom "es" locale,
|
219
|
+
# and a totally custom locale complete with a custom :pluralize proc:
|
220
|
+
# (the first passed :locale will be used also as the default_locale)
|
221
|
+
# Pagy::I18n.load({ locale: 'en' },
|
222
|
+
# { locale: 'es', filepath: 'path/to/pagy-es.yml' },
|
223
|
+
# { locale: 'xyz', # not built-in
|
224
|
+
# filepath: 'path/to/pagy-xyz.yml',
|
225
|
+
# pluralize: lambda{ |count| ... } )
|
226
|
+
|
227
|
+
# I18n extra: uses the standard i18n gem which is ~18x slower using ~10x more memory
|
228
|
+
# than the default pagy internal i18n (see above)
|
229
|
+
# See https://ddnexus.github.io/pagy/docs/extras/i18n
|
230
|
+
# require 'pagy/extras/i18n'
|
231
|
+
|
232
|
+
# Default i18n key
|
233
|
+
# Pagy::DEFAULT[:i18n_key] = 'pagy.item_name' # default
|
234
|
+
|
235
|
+
# When you are done setting your own default freeze it, so it will not get changed accidentally
|
236
|
+
Pagy::DEFAULT.freeze
|
@@ -1,12 +1,14 @@
|
|
1
1
|
# see https://groups.google.com/forum/#!msg/mongoid/MaXFVw7D_4s/T3sl6Flg428J
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
if defined?(:BSON)
|
3
|
+
module BSON
|
4
|
+
class ObjectId
|
5
|
+
def as_json(_options = {})
|
6
|
+
to_s
|
7
|
+
end
|
7
8
|
|
8
|
-
|
9
|
-
|
9
|
+
def to_bson_key(encoded = ''.force_encoding(BINARY))
|
10
|
+
to_s.to_bson_key(encoded)
|
11
|
+
end
|
10
12
|
end
|
11
13
|
end
|
12
14
|
end
|
@@ -1,3 +1,2 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
end
|
1
|
+
require_relative 'ext/bson/object_id'
|
2
|
+
require_relative 'ext/grape/sort_extension'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slack-ruby-bot-server
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Doubrovkine
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -150,7 +150,7 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
-
description:
|
153
|
+
description:
|
154
154
|
email:
|
155
155
|
- dblock@dblock.org
|
156
156
|
executables: []
|
@@ -202,10 +202,10 @@ files:
|
|
202
202
|
- lib/slack-ruby-bot-server/config.rb
|
203
203
|
- lib/slack-ruby-bot-server/config/database_adapters/activerecord.rb
|
204
204
|
- lib/slack-ruby-bot-server/config/database_adapters/mongoid.rb
|
205
|
+
- lib/slack-ruby-bot-server/config/pagy.rb
|
205
206
|
- lib/slack-ruby-bot-server/ext.rb
|
206
207
|
- lib/slack-ruby-bot-server/ext/bson/object_id.rb
|
207
208
|
- lib/slack-ruby-bot-server/ext/grape/sort_extension.rb
|
208
|
-
- lib/slack-ruby-bot-server/ext/mongoid/slack-ruby-bot/commands/base.rb
|
209
209
|
- lib/slack-ruby-bot-server/info.rb
|
210
210
|
- lib/slack-ruby-bot-server/loggable.rb
|
211
211
|
- lib/slack-ruby-bot-server/models/team/activerecord.rb
|
@@ -230,7 +230,7 @@ files:
|
|
230
230
|
homepage: https://github.com/slack-ruby/slack-ruby-bot-server
|
231
231
|
licenses: []
|
232
232
|
metadata: {}
|
233
|
-
post_install_message:
|
233
|
+
post_install_message:
|
234
234
|
rdoc_options: []
|
235
235
|
require_paths:
|
236
236
|
- lib
|
@@ -245,8 +245,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
245
245
|
- !ruby/object:Gem::Version
|
246
246
|
version: '0'
|
247
247
|
requirements: []
|
248
|
-
rubygems_version: 3.
|
249
|
-
signing_key:
|
248
|
+
rubygems_version: 3.3.26
|
249
|
+
signing_key:
|
250
250
|
specification_version: 4
|
251
251
|
summary: A Grape API serving a Slack bot to multiple teams.
|
252
252
|
test_files: []
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module SlackRubyBot
|
2
|
-
module Commands
|
3
|
-
class Base
|
4
|
-
class << self
|
5
|
-
alias _invoke invoke
|
6
|
-
|
7
|
-
def invoke(client, data)
|
8
|
-
_invoke client, data
|
9
|
-
rescue Mongoid::Errors::Validations => e
|
10
|
-
logger.info "#{name.demodulize.upcase}: #{client.owner}, error - #{e.document.class}, #{e.document.errors.to_hash}"
|
11
|
-
client.say(channel: data.channel, text: e.document.errors.first[1])
|
12
|
-
true
|
13
|
-
rescue StandardError => e
|
14
|
-
logger.info "#{name.demodulize.upcase}: #{client.owner}, #{e.class}: #{e}"
|
15
|
-
logger.debug e.backtrace.join("\n")
|
16
|
-
client.say(channel: data.channel, text: e.message)
|
17
|
-
true
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|