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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ddd076dedba91f00229b1a827c9d07f4d97670cfbac540ad050cb0b20817079
4
- data.tar.gz: 22d199ba3c75ab029323ff44589234e839b84a72de6cd45374300c85bba49d2a
3
+ metadata.gz: 0ffa7fb2389de19763b239f720ab830e97178f07ab582168d3bff000f08061fe
4
+ data.tar.gz: 0d9e1695e4558759194c2b22d8f6a88e4e5cf91f0b527de9ab96c1e5a1799a95
5
5
  SHA512:
6
- metadata.gz: e53d6679db01e5bcd40503cc6ced2657bcf431e465c7c45d877ca01fce9e4d3a3fbd142cdfb193582a843d9fe9e45019a31033bab34af762a530aadea2b57c45
7
- data.tar.gz: b0176b30822758271ea3028e0f15ca9020f529760bd7738b38dcba58a0594c5e3536cf078ad313bc65942dc1a53f952e84b39c02839fac46007dd8f66f434c1e
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
- # > true
63
+ # > "RakeTaskName"
64
64
 
65
65
  # returns true if thread has a 'window'
66
- ThreadInfo.window?
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?('>= 3.0', '4.3.0')
133
+
134
+ GemInfo.match?('4.3.0', '>= 3.0')
135
135
  # > true
136
- #
137
- GemInfo.match?( '~> 3.1', '3.3.0')
136
+
137
+ # also works with split operator
138
+ GemInfo.match?( '3.3.0', '~>', ' 3.1')
138
139
  # > true
139
- #
140
- GemInfo.match?( '~> 1.1.0', '0.1.0')
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 |t|
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 at [elasticsearch_record](https://github.com/ruby-smart/support).
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?(version, gem_version) })
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?(version, loaded[name]))
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(name)))
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?('>= 3.0', '4.3.0')
175
+ # match?('4.3.0', '>= 3.0')
176
176
  # > true
177
177
  #
178
- # match?( '~> 3.1', '3.3.0')
178
+ # match?('3.3.0', '~> 3.1')
179
179
  # > true
180
180
  #
181
- # match?( '~> 1.1.0', '0.1.0')
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?(version_requirement, version_current)
184
- return true if version_requirement.nil?
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(/([=~>< ]+)/, '')
@@ -9,7 +9,7 @@ module RubySmart
9
9
 
10
10
  module VERSION
11
11
  MAJOR = 1
12
- MINOR = 0
12
+ MINOR = 1
13
13
  TINY = 0
14
14
  PRE = nil
15
15
 
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.0.0
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 00:00:00.000000000 Z
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.7
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