ruby_smart-support 1.3.0 → 1.5.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 +26 -5
- data/docs/CHANGELOG.md +7 -0
- data/lib/ruby_smart/support/core_ext/ruby/enumerator.rb +1 -1
- data/lib/ruby_smart/support/core_ext/ruby/string.rb +1 -1
- data/lib/ruby_smart/support/gem_version.rb +1 -1
- data/lib/ruby_smart/support/thread_info.rb +13 -1
- data/ruby_smart-support.gemspec +2 -0
- metadata +35 -7
- /data/docs/{LICENSE.txt → LICENSE} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ab5e47e6138162f5f68e6f1433e208f8bcbef3ccca516c30b06f2bdb6ffbc76
|
4
|
+
data.tar.gz: 89c1e79af5aa755433b6160ab8af102ac47a596022989df5eb85f6f70c305009
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c0e045b0bd870da9f8995b1da17a449019ad477ad5a715c610905a1b8a07848b4ccab9c7cb47de34cb12468fed015582aa5e831ce4dc25651a42089f1790c02
|
7
|
+
data.tar.gz: cc4e5fe15bd1c24502cb2f3e4ae647e9c01c18faa0f4e7063ee24ac48b8878905da618234a802efe3b8ac818ea8d1c71b1ad78eedcd45b1302ed9f71c34ffba3
|
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
@@ -32,14 +32,15 @@ Or install it yourself as:
|
|
32
32
|
$ gem install ruby_smart-support
|
33
33
|
|
34
34
|
## Features
|
35
|
-
* validate & check gems through GemInfo
|
36
|
-
* resolve information about the current ruby's thread through ThreadInfo
|
35
|
+
* validate & check gems through **GemInfo**
|
36
|
+
* resolve information about the current ruby's thread through **ThreadInfo**
|
37
37
|
* extensions for Ruby
|
38
38
|
* *Array* `#only!`, `#only`
|
39
39
|
* *Float* `#round_down`, `#round_up`
|
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`
|
@@ -48,9 +49,6 @@ Or install it yourself as:
|
|
48
49
|
* to `append` & `prepend` additional blocks
|
49
50
|
* to check task-state with `#invoked?`, `#performed?` & `#running?`
|
50
51
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
52
|
-----
|
55
53
|
|
56
54
|
## ThreadInfo module
|
@@ -85,7 +83,9 @@ ThreadInfo.info
|
|
85
83
|
* .console?
|
86
84
|
* .irb?
|
87
85
|
* .pry?
|
86
|
+
* .sidekiq?
|
88
87
|
* .server?
|
88
|
+
* .debugger?
|
89
89
|
* .rails_console?
|
90
90
|
* .io_console?
|
91
91
|
* .thread?
|
@@ -119,6 +119,11 @@ GemInfo.installed
|
|
119
119
|
GemInfo.loaded
|
120
120
|
# > {'bundler' => '2.2.30', ...}
|
121
121
|
|
122
|
+
# returns a hash of all loaded gems with its current license
|
123
|
+
# (gems from the Gemfile)
|
124
|
+
GemInfo.licenses
|
125
|
+
# > {'bundler' => 'MIT', ...}
|
126
|
+
|
122
127
|
# returns an array of all active gems
|
123
128
|
GemInfo.active
|
124
129
|
# > ['bundler', ...]
|
@@ -155,6 +160,7 @@ GemInfo.match?( '0.1.0', '~> 1.1.0',)
|
|
155
160
|
* .installed?
|
156
161
|
* .loaded
|
157
162
|
* .loaded?
|
163
|
+
* .licenses
|
158
164
|
* .active
|
159
165
|
* .active?
|
160
166
|
* .features
|
@@ -195,6 +201,21 @@ rake db:migrate
|
|
195
201
|
# > executes append block
|
196
202
|
```
|
197
203
|
|
204
|
+
|
205
|
+
## Enumerator extensions
|
206
|
+
|
207
|
+
With the new method `from_hash` you can now easily map values from an array of hashes.
|
208
|
+
|
209
|
+
```ruby
|
210
|
+
ary = [{a: 34, b: 12}, {a: 19, c: 4}, {b: 3, c: 11}]
|
211
|
+
ary.map.from_hash(:a)
|
212
|
+
# > [34, 19, nil]
|
213
|
+
|
214
|
+
```
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
198
219
|
-----
|
199
220
|
|
200
221
|
## Docs
|
data/docs/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# RubySmart::Support - CHANGELOG
|
2
2
|
|
3
|
+
## [1.5.0] - 2024-07-03
|
4
|
+
* **[add]** `RubySmart::Support::ThreadInfo.debugger?`-detection to determinate if a **Debugger** gem is active
|
5
|
+
* **[fix]** `String#to_boolean`-method to detect false-values (which makes all other values become true - similar to `::ActiveRecord::Type::Boolean`)
|
6
|
+
|
7
|
+
## [1.4.0] - 2023-10-19
|
8
|
+
* **[ref]** `RubySmart::Support::ThreadInfo.sidekiq?`-detection to determinate if the current thread is a sidekiq process
|
9
|
+
|
3
10
|
## [1.3.0] - 2023-08-08
|
4
11
|
* **[add]** `Enumerator.from_hash` to easily resolve values from Array-of-Hashes (use: ary.map.from_hash(key))
|
5
12
|
* **[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]
|
@@ -46,6 +52,12 @@ module RubySmart
|
|
46
52
|
!!defined?(Rails::Server)
|
47
53
|
end
|
48
54
|
|
55
|
+
# returns true, if this runs in a debug environment (like: ruby-debug-ide / Device)
|
56
|
+
# @return [Boolean]
|
57
|
+
def self.debugger?
|
58
|
+
!!defined?(Debugger.handler)
|
59
|
+
end
|
60
|
+
|
49
61
|
# returns true if this is a running rails console process
|
50
62
|
# @return [Boolean]
|
51
63
|
def self.rails_console?
|
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.5.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:
|
11
|
+
date: 2024-07-03 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).
|
@@ -102,7 +130,7 @@ files:
|
|
102
130
|
- bin/setup
|
103
131
|
- docs/CHANGELOG.md
|
104
132
|
- docs/CODE_OF_CONDUCT.md
|
105
|
-
- docs/LICENSE
|
133
|
+
- docs/LICENSE
|
106
134
|
- lib/gem_info.rb
|
107
135
|
- lib/ruby_smart-support.rb
|
108
136
|
- lib/ruby_smart/support.rb
|
@@ -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.5.14
|
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
|
File without changes
|