ruby_smart-support 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -10
- data/docs/CHANGELOG.md +4 -0
- data/lib/ruby_smart/support/gem_info.rb +14 -8
- data/lib/ruby_smart/support/gem_version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ffa7fb2389de19763b239f720ab830e97178f07ab582168d3bff000f08061fe
|
4
|
+
data.tar.gz: 0d9e1695e4558759194c2b22d8f6a88e4e5cf91f0b527de9ab96c1e5a1799a95
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3868c6da69ac5a9a11357812cd2d5eb4ecdaba21ca3b805d90389068d52c6518f330da21873332f6e67207fa34d6eb536c307957ed2ed0249e7309fc9604c3a4
|
7
|
+
data.tar.gz: b72bbf4e9b768fa99af1245943a3ba1bd8e5302e790a316c4a5fcc9c17de9dafda83e5ef4b98a369cc28bc52b8b2cf7251abe935b3256f5cc7b8dc31999aa1e7
|
data/README.md
CHANGED
@@ -60,10 +60,10 @@ ThreadInfo.console?
|
|
60
60
|
|
61
61
|
# returns the current thread name (rake / rails)
|
62
62
|
ThreadInfo.name
|
63
|
-
# >
|
63
|
+
# > "RakeTaskName"
|
64
64
|
|
65
65
|
# returns true if thread has a 'window'
|
66
|
-
ThreadInfo.
|
66
|
+
ThreadInfo.windowed?
|
67
67
|
# > true
|
68
68
|
|
69
69
|
# returns the thread type string
|
@@ -130,14 +130,15 @@ GemInfo.safe_require('action_view/helpers/date_helper','actionview', '> 0.1.0')
|
|
130
130
|
# compares two versions against each other
|
131
131
|
GemInfo.match?('4.3.0', '4.3.0')
|
132
132
|
# > true
|
133
|
-
|
134
|
-
GemInfo.match?('
|
133
|
+
|
134
|
+
GemInfo.match?('4.3.0', '>= 3.0')
|
135
135
|
# > true
|
136
|
-
|
137
|
-
|
136
|
+
|
137
|
+
# also works with split operator
|
138
|
+
GemInfo.match?( '3.3.0', '~>', ' 3.1')
|
138
139
|
# > true
|
139
|
-
|
140
|
-
GemInfo.match?( '
|
140
|
+
|
141
|
+
GemInfo.match?( '0.1.0', '~> 1.1.0',)
|
141
142
|
# > false
|
142
143
|
```
|
143
144
|
|
@@ -172,12 +173,20 @@ namespace :db do
|
|
172
173
|
end
|
173
174
|
end
|
174
175
|
|
175
|
-
task(:migrate).append do |
|
176
|
+
task(:migrate).append do |_t|
|
176
177
|
puts "execution done!"
|
177
178
|
end
|
178
179
|
end
|
179
180
|
```
|
180
181
|
|
182
|
+
_So the execution of this rake task will now execute `prepend`, `default` & `append` blocks:_
|
183
|
+
```shell
|
184
|
+
rake db:migrate
|
185
|
+
# > executes prepend
|
186
|
+
# > executes previously defined block
|
187
|
+
# > executes append block
|
188
|
+
```
|
189
|
+
|
181
190
|
-----
|
182
191
|
|
183
192
|
## Docs
|
@@ -186,7 +195,7 @@ end
|
|
186
195
|
|
187
196
|
## Contributing
|
188
197
|
|
189
|
-
Bug reports and pull requests are welcome on GitHub
|
198
|
+
Bug reports and pull requests are welcome on [GitHub](https://github.com/ruby-smart/support).
|
190
199
|
This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](./docs/CODE_OF_CONDUCT.md).
|
191
200
|
|
192
201
|
## License
|
data/docs/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# RubySmart::Support - CHANGELOG
|
2
2
|
|
3
|
+
## [1.1.0] - 2022-11-12
|
4
|
+
* **[ref]** `GemInfo.match?` method to provide method parameters more intuitive like `.match?('3.4.0', '>', '3.1.0')`
|
5
|
+
* **[fix]** README
|
6
|
+
|
3
7
|
## [1.0.0] - 2022-11-08
|
4
8
|
* **[add]** `GemInfo` module
|
5
9
|
* **[add]** `ThreadInfo` module
|
@@ -36,7 +36,7 @@ module RubySmart
|
|
36
36
|
# @param [nil, String] version - optional version requirement
|
37
37
|
# @return [Boolean]
|
38
38
|
def self.installed?(name, version = nil)
|
39
|
-
installed.key?(name) && (version.nil? || installed[name].any? { |gem_version| match?(
|
39
|
+
installed.key?(name) && (version.nil? || installed[name].any? { |gem_version| match?(gem_version, version) })
|
40
40
|
end
|
41
41
|
|
42
42
|
# returns a hash of all loaded gems with its current version
|
@@ -62,7 +62,7 @@ module RubySmart
|
|
62
62
|
# @param [nil, String] version - optional version requirement
|
63
63
|
# @return [Boolean]
|
64
64
|
def self.loaded?(name, version = nil)
|
65
|
-
loaded.key?(name) && (version.nil? || match?(
|
65
|
+
loaded.key?(name) && (version.nil? || match?( loaded[name], version))
|
66
66
|
end
|
67
67
|
|
68
68
|
# returns an array of all active gems
|
@@ -95,7 +95,7 @@ module RubySmart
|
|
95
95
|
# @param [nil, String] version - optional version requirement
|
96
96
|
# @return [Boolean] activated?
|
97
97
|
def self.active?(name, version = nil)
|
98
|
-
active.include?(name) && (version.nil? || match?(version, version
|
98
|
+
active.include?(name) && (version.nil? || match?(self.version(name), version))
|
99
99
|
end
|
100
100
|
|
101
101
|
# returns an array of all loaded features
|
@@ -172,16 +172,22 @@ module RubySmart
|
|
172
172
|
# match?('4.3.0', '4.3.0')
|
173
173
|
# > true
|
174
174
|
#
|
175
|
-
# match?('
|
175
|
+
# match?('4.3.0', '>= 3.0')
|
176
176
|
# > true
|
177
177
|
#
|
178
|
-
# match?(
|
178
|
+
# match?('3.3.0', '~> 3.1')
|
179
179
|
# > true
|
180
180
|
#
|
181
|
-
# match?(
|
181
|
+
# match?('3.3.0', '~>', '3.1')
|
182
|
+
# > true
|
183
|
+
#
|
184
|
+
# match?('0.1.0', '~> 1.1.0')
|
182
185
|
# > false
|
183
|
-
def self.match?(
|
184
|
-
|
186
|
+
def self.match?(*args)
|
187
|
+
version_current = args.shift
|
188
|
+
version_requirement = args.join ' '
|
189
|
+
|
190
|
+
return true if version_requirement.nil? || version_requirement.strip == ''
|
185
191
|
|
186
192
|
# split version compare operators
|
187
193
|
version_requirement_str = version_requirement.gsub(/([=~>< ]+)/, '')
|
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.1.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: 2022-11-
|
11
|
+
date: 2022-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -70,7 +70,7 @@ description: 'RubySmart::Support is a toolkit of support libraries for Ruby - ma
|
|
70
70
|
features includes GemInfo & ThreadInfo, as well core extensions for Ruby & activesupport
|
71
71
|
(if installed).
|
72
72
|
|
73
|
-
|
73
|
+
'
|
74
74
|
email:
|
75
75
|
- info@ruby-smart.org
|
76
76
|
executables: []
|
@@ -114,7 +114,7 @@ metadata:
|
|
114
114
|
source_code_uri: https://github.com/ruby-smart/support
|
115
115
|
changelog_uri: https://github.com/ruby-smart/support/blob/main/docs/CHANGELOG.md
|
116
116
|
allowed_push_host: https://rubygems.org
|
117
|
-
post_install_message:
|
117
|
+
post_install_message:
|
118
118
|
rdoc_options: []
|
119
119
|
require_paths:
|
120
120
|
- lib
|
@@ -129,8 +129,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
129
|
- !ruby/object:Gem::Version
|
130
130
|
version: '0'
|
131
131
|
requirements: []
|
132
|
-
rubygems_version: 3.3.
|
133
|
-
signing_key:
|
132
|
+
rubygems_version: 3.3.22
|
133
|
+
signing_key:
|
134
134
|
specification_version: 4
|
135
135
|
summary: A toolkit of support libraries including GemInfo, ThreadInfo, Ruby core extensions
|
136
136
|
& optionally activesupport extensions
|