ruby_smart-support 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e2254a95ec35c6fcbd887b968dbc6a75bdfdc68289450f19b79b302cd9010d9
4
- data.tar.gz: ade5163e4e702f1a9526da9619d40db03b60ba16505ec1e5c5408ce67642d00d
3
+ metadata.gz: 1ab5e47e6138162f5f68e6f1433e208f8bcbef3ccca516c30b06f2bdb6ffbc76
4
+ data.tar.gz: 89c1e79af5aa755433b6160ab8af102ac47a596022989df5eb85f6f70c305009
5
5
  SHA512:
6
- metadata.gz: e828e44eca0c4d4c7723a03f1364463d2c6d9d7190218a089ea401c8c40d3762ef491d5df0d8d9d7086144407db7253058e7beb424771369e4ac5f1b37209fa8
7
- data.tar.gz: c44c1784d5219dc885ab96c5dace9f877e8ded2f7c1d6ae4a2aab111a480de21ebaf03d4ae0ca63cd8f81e7625c5e3f386d1f02e55a6873b103b33ff001c0316
6
+ metadata.gz: 3c0e045b0bd870da9f8995b1da17a449019ad477ad5a715c610905a1b8a07848b4ccab9c7cb47de34cb12468fed015582aa5e831ce4dc25651a42089f1790c02
7
+ data.tar.gz: cc4e5fe15bd1c24502cb2f3e4ae647e9c01c18faa0f4e7063ee24ac48b8878905da618234a802efe3b8ac818ea8d1c71b1ad78eedcd45b1302ed9f71c34ffba3
@@ -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
- ruby-version: ['3.1', '3.0', '2.7', '2.6']
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
- - uses: actions/checkout@v3
29
- - name: Set up Ruby
30
- # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
31
- # change this to (see https://github.com/ruby/setup-ruby#versioning):
32
- # uses: ruby/setup-ruby@v1
33
- uses: ruby/setup-ruby@0a29871fe2b0200a17a4497bae54fe5df0d973aa # v1.115.3
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 @@ unless Enumerator.method_defined? :from_hash
7
7
  #
8
8
  # @example
9
9
  # ary = [{a: 34, b: 12}, {a: 19, c: 4}, {b: 3, c: 11}]
10
- # ary.with_hash(:a)
10
+ # ary.map.from_hash(:a)
11
11
  # > [34, 19, nil]
12
12
  #
13
13
  # @param [Object] key
@@ -7,7 +7,7 @@ unless String.method_defined? "to_boolean"
7
7
  # converts a string to 'boolean'
8
8
  # @return [Boolean] bool
9
9
  def to_boolean
10
- ['true','1'].include? self.downcase
10
+ !["0", "f", "false", "off",''].include?(self.downcase)
11
11
  end
12
12
  end
13
13
  end
@@ -9,7 +9,7 @@ module RubySmart
9
9
 
10
10
  module VERSION
11
11
  MAJOR = 1
12
- MINOR = 3
12
+ MINOR = 5
13
13
  TINY = 0
14
14
  PRE = nil
15
15
 
@@ -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?
@@ -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.3.0
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: 2023-08-08 00:00:00.000000000 Z
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.txt
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.3.7
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