smart_todo 1.1.0 → 1.2.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 +4 -4
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +1 -1
- data/lib/smart_todo.rb +1 -0
- data/lib/smart_todo/events.rb +9 -0
- data/lib/smart_todo/events/gem_bump.rb +57 -0
- data/lib/smart_todo/parser/metadata_parser.rb +2 -0
- data/lib/smart_todo/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f43df881f5ab5894069683abbe3d09571232a896a429d0d2795d57e8102e42dc
|
4
|
+
data.tar.gz: 070dc363e6e1aa44e605e1fe53126bfc613af23985cfc7cdb48a145fe93362e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69d9f4f170b854769a3141a41135c25463b2839274be7a6cea062b2d524fa5cee37e64c0a134f9de10944b9fce9e3580ed8f3b5ca4c8a8101528c3f9691a1c36
|
7
|
+
data.tar.gz: c5b66f439a2176728ca2f8ef4297fceeaa6d9f08c1ba190d4a255b8e3164264262536681d34a9cab4a9837c2455e75ecdf1dd9dc6b7b8b9877e37ef026719c01
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.2.0] - 2019-11-25
|
10
|
+
### Fixed
|
11
|
+
- Fixed crash with badly formated TODO(on:) (i.e. `TODO(on: 'blabla'))
|
12
|
+
|
13
|
+
### Added
|
14
|
+
- Added the `on: gem_bump` event which will remind you when a gem inside your
|
15
|
+
Gemfile.lock snapshot gets updated to a specific version.
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
# TODO(on: gem_bump('rails', '6.1'), to: '...')
|
19
|
+
```
|
20
|
+
|
9
21
|
## [1.1.0] - 2019-09-06
|
10
22
|
### Fixed
|
11
23
|
- Fixed the SmartTodo cop to add an offense in case a SmartTodo has a wrong event.
|
data/Gemfile.lock
CHANGED
data/lib/smart_todo.rb
CHANGED
data/lib/smart_todo/events.rb
CHANGED
@@ -38,6 +38,15 @@ module SmartTodo
|
|
38
38
|
GemRelease.new(gem_name, requirements).met?
|
39
39
|
end
|
40
40
|
|
41
|
+
# Check if +gem_name+ was bumped to the +requirements+ expected
|
42
|
+
#
|
43
|
+
# @param gem_name [String]
|
44
|
+
# @param requirements [Array<String>] a list of version specifiers
|
45
|
+
# @return [false, String]
|
46
|
+
def gem_bump(gem_name, *requirements)
|
47
|
+
GemBump.new(gem_name, requirements).met?
|
48
|
+
end
|
49
|
+
|
41
50
|
# Check if the issue +issue_number+ is closed
|
42
51
|
#
|
43
52
|
# @param organization [String] the GitHub organization name
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
gem('bundler')
|
4
|
+
require 'bundler'
|
5
|
+
|
6
|
+
module SmartTodo
|
7
|
+
module Events
|
8
|
+
# An event that compare the version of a gem specified in your Gemfile.lock
|
9
|
+
# with the expected version specifiers.
|
10
|
+
class GemBump
|
11
|
+
# @param gem_name [String]
|
12
|
+
# @param requirements [Array] a list of version specifiers.
|
13
|
+
# The specifiers are the same as the one used in Gemfiles or Gemspecs
|
14
|
+
#
|
15
|
+
# @example Expecting a specific version
|
16
|
+
# GemBump.new('rails', ['6.0'])
|
17
|
+
#
|
18
|
+
# @example Expecting a version in the 5.x.x series
|
19
|
+
# GemBump.new('rails', ['> 5.2', '< 6'])
|
20
|
+
def initialize(gem_name, requirements)
|
21
|
+
@gem_name = gem_name
|
22
|
+
@requirements = Gem::Requirement.new(requirements)
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [String, false]
|
26
|
+
def met?
|
27
|
+
return error_message if spec_set[@gem_name].empty?
|
28
|
+
|
29
|
+
installed_version = spec_set[@gem_name].first.version
|
30
|
+
if @requirements.satisfied_by?(installed_version)
|
31
|
+
message(installed_version)
|
32
|
+
else
|
33
|
+
false
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Error message send to Slack in case a gem couldn't be found
|
38
|
+
#
|
39
|
+
# @return [String]
|
40
|
+
def error_message
|
41
|
+
"The gem *#{@gem_name}* is not in your dependencies, I can't determine if your TODO is ready to be addressed."
|
42
|
+
end
|
43
|
+
|
44
|
+
# @return [String]
|
45
|
+
def message(version_number)
|
46
|
+
"The gem *#{@gem_name}* was updated to version *#{version_number}* and your TODO is now ready to be addressed."
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
# @return [Bundler::SpecSet] an instance of Bundler::SpecSet
|
52
|
+
def spec_set
|
53
|
+
@spec_set ||= Bundler.load.specs
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/smart_todo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_todo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- lib/smart_todo/dispatchers/slack.rb
|
115
115
|
- lib/smart_todo/events.rb
|
116
116
|
- lib/smart_todo/events/date.rb
|
117
|
+
- lib/smart_todo/events/gem_bump.rb
|
117
118
|
- lib/smart_todo/events/gem_release.rb
|
118
119
|
- lib/smart_todo/events/issue_close.rb
|
119
120
|
- lib/smart_todo/parser/comment_parser.rb
|