ruby_smart-support 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +11 -15
- data/README.md +23 -0
- data/docs/CHANGELOG.md +3 -0
- data/lib/ruby_smart/support/core_ext/ruby/enumerator.rb +1 -1
- data/lib/ruby_smart/support/gem_version.rb +1 -1
- data/lib/ruby_smart/support/thread_info.rb +7 -1
- data/ruby_smart-support.gemspec +2 -0
- metadata +34 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1775b5245ce4c9ca6de799fc00e1144c3b9025f75c1dc2ddbeea2aefc45e7d66
|
4
|
+
data.tar.gz: 72749e09f012e15c978a50e03ecc2dc3c7a20bdefeda9b461b127174702e8802
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5073cc0aac8b4a59b79fc3809b2319bac5dd9cba53b2bd0c73110f40ef6aaa280a352b9b393c29c7a6745a4960b58536cdb54a743f5c2029734454048b4e1d2
|
7
|
+
data.tar.gz: bcc21095d341d019e833fe3bfb0fd39ed2bb0acaf18ac50a6a60a568a573349f465ab106dfe552e8f61e83685096b82fefd254bb4609ca0ad263a02e7ede6af2
|
data/.github/workflows/ruby.yml
CHANGED
@@ -18,21 +18,17 @@ permissions:
|
|
18
18
|
|
19
19
|
jobs:
|
20
20
|
test:
|
21
|
-
|
22
|
-
runs-on: ubuntu-latest
|
23
21
|
strategy:
|
22
|
+
fail-fast: false
|
24
23
|
matrix:
|
25
|
-
|
26
|
-
|
24
|
+
os: [ubuntu-latest]
|
25
|
+
# Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
|
26
|
+
ruby: ['3.2', '3.1', '3.0', '2.7', '2.6']
|
27
|
+
runs-on: ${{ matrix.os }}
|
27
28
|
steps:
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
with:
|
35
|
-
ruby-version: ${{ matrix.ruby-version }}
|
36
|
-
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
37
|
-
- name: Run tests
|
38
|
-
run: bundle exec rake
|
29
|
+
- uses: actions/checkout@v3
|
30
|
+
- uses: ruby/setup-ruby@v1
|
31
|
+
with:
|
32
|
+
ruby-version: ${{ matrix.ruby }}
|
33
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
34
|
+
- run: bundle exec rake
|
data/README.md
CHANGED
@@ -40,6 +40,7 @@ Or install it yourself as:
|
|
40
40
|
* *Hash* `#to_md5`, `#product`
|
41
41
|
* *Object* `#numeric?`, `#boolean?`, `#missing_method?`, `#alias_missing_method`
|
42
42
|
* *String* `#to_boolean`, `#to_md5`
|
43
|
+
* *Enumerator* `#from_hash`
|
43
44
|
|
44
45
|
* extensions for activesupport
|
45
46
|
* *Hash* `#only!`, `#without!`, `#deep_reject`
|
@@ -85,6 +86,7 @@ ThreadInfo.info
|
|
85
86
|
* .console?
|
86
87
|
* .irb?
|
87
88
|
* .pry?
|
89
|
+
* .sidekiq?
|
88
90
|
* .server?
|
89
91
|
* .rails_console?
|
90
92
|
* .io_console?
|
@@ -119,6 +121,11 @@ GemInfo.installed
|
|
119
121
|
GemInfo.loaded
|
120
122
|
# > {'bundler' => '2.2.30', ...}
|
121
123
|
|
124
|
+
# returns a hash of all loaded gems with its current license
|
125
|
+
# (gems from the Gemfile)
|
126
|
+
GemInfo.licenses
|
127
|
+
# > {'bundler' => 'MIT', ...}
|
128
|
+
|
122
129
|
# returns an array of all active gems
|
123
130
|
GemInfo.active
|
124
131
|
# > ['bundler', ...]
|
@@ -155,6 +162,7 @@ GemInfo.match?( '0.1.0', '~> 1.1.0',)
|
|
155
162
|
* .installed?
|
156
163
|
* .loaded
|
157
164
|
* .loaded?
|
165
|
+
* .licenses
|
158
166
|
* .active
|
159
167
|
* .active?
|
160
168
|
* .features
|
@@ -195,6 +203,21 @@ rake db:migrate
|
|
195
203
|
# > executes append block
|
196
204
|
```
|
197
205
|
|
206
|
+
|
207
|
+
## Enumerator extensions
|
208
|
+
|
209
|
+
With the new method `from_hash` you can now easily map values from an array of hashes.
|
210
|
+
|
211
|
+
```ruby
|
212
|
+
ary = [{a: 34, b: 12}, {a: 19, c: 4}, {b: 3, c: 11}]
|
213
|
+
ary.map.from_hash(:a)
|
214
|
+
# > [34, 19, nil]
|
215
|
+
|
216
|
+
```
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
198
221
|
-----
|
199
222
|
|
200
223
|
## Docs
|
data/docs/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# RubySmart::Support - CHANGELOG
|
2
2
|
|
3
|
+
## [1.4.0] - 2023-10-19
|
4
|
+
* **[ref]** `RubySmart::Support::ThreadInfo.sidekiq?`-detection to determinate if the current thread is a sidekiq process
|
5
|
+
|
3
6
|
## [1.3.0] - 2023-08-08
|
4
7
|
* **[add]** `Enumerator.from_hash` to easily resolve values from Array-of-Hashes (use: ary.map.from_hash(key))
|
5
8
|
* **[add]** `RubySmart::Support::GemInfo.licenses` to resolve a hash of licences per loaded gem
|
@@ -7,7 +7,7 @@ module RubySmart
|
|
7
7
|
module ThreadInfo
|
8
8
|
|
9
9
|
# defines a array of types which will be checked by resolving the current thread type
|
10
|
-
TYPE_ORDER = [:rake, :console, :server].freeze
|
10
|
+
TYPE_ORDER = [:rake, :console, :sidekiq, :server].freeze
|
11
11
|
|
12
12
|
# returns true if this is a running rake process
|
13
13
|
# @return [Boolean]
|
@@ -39,6 +39,12 @@ module RubySmart
|
|
39
39
|
!!defined?(Pry)
|
40
40
|
end
|
41
41
|
|
42
|
+
# returns true if this is a running 'sidekiq' server process.
|
43
|
+
# @return [Boolean]
|
44
|
+
def self.sidekiq?
|
45
|
+
!!defined?(Sidekiq) && Sidekiq.server?
|
46
|
+
end
|
47
|
+
|
42
48
|
# returns true if this is a running server process.
|
43
49
|
# currently only detects rails
|
44
50
|
# @return [Boolean]
|
data/ruby_smart-support.gemspec
CHANGED
@@ -36,4 +36,6 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_development_dependency 'rake', '~> 13.0'
|
37
37
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
38
38
|
spec.add_development_dependency 'yard', '~> 0.9'
|
39
|
+
spec.add_development_dependency 'yard-activesupport-concern', '~> 0.0.1'
|
40
|
+
spec.add_development_dependency 'yard-relative_markdown_links', '>= 0.4'
|
39
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_smart-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Gonsior
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -80,6 +80,34 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0.9'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: yard-activesupport-concern
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.0.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.0.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: yard-relative_markdown_links
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.4'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.4'
|
83
111
|
description: 'RubySmart::Support is a toolkit of support libraries for Ruby - major
|
84
112
|
features includes GemInfo & ThreadInfo, as well core extensions for Ruby & activesupport
|
85
113
|
(if installed).
|
@@ -131,7 +159,7 @@ metadata:
|
|
131
159
|
documentation_uri: https://rubydoc.info/gems/ruby_smart-support
|
132
160
|
changelog_uri: https://github.com/ruby-smart/support/blob/main/docs/CHANGELOG.md
|
133
161
|
allowed_push_host: https://rubygems.org
|
134
|
-
post_install_message:
|
162
|
+
post_install_message:
|
135
163
|
rdoc_options: []
|
136
164
|
require_paths:
|
137
165
|
- lib
|
@@ -146,8 +174,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
174
|
- !ruby/object:Gem::Version
|
147
175
|
version: '0'
|
148
176
|
requirements: []
|
149
|
-
rubygems_version: 3.
|
150
|
-
signing_key:
|
177
|
+
rubygems_version: 3.4.10
|
178
|
+
signing_key:
|
151
179
|
specification_version: 4
|
152
180
|
summary: A toolkit of support libraries including GemInfo, ThreadInfo, Ruby core extensions
|
153
181
|
& optionally activesupport extensions
|