minitag 0.1.0 → 0.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/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/lib/minitag.rb +5 -0
- data/lib/minitag/tag.rb +14 -0
- data/lib/minitag/tag_mapper.rb +13 -2
- data/lib/minitag/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 683ead8b294111fdcd7f19206a0713fb85bc8ed632aa3a853fcbe72a75abf1d2
|
|
4
|
+
data.tar.gz: 3100c71052cd5fc151f0107d76e1abddcc6fe36d1ec649d3d2fc3c385cc5bfa5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a46ab8f1155605202144a8d6c44a4250409cd0ae94670fe1f748b7c08aacac9c937b9ea97488c7131d00f559be2ea52fc99a5cbb4f430f243e7ddaed0cc01b2d
|
|
7
|
+
data.tar.gz: ffa35e8148558a1210e48d92fc3672bae8d46e6eba4f9da49fde5142661af5b90f82d99db56da4d6aa07841b89056ef7012b66da6bbb105ddae64a7a5ea888ae
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
data/lib/minitag.rb
CHANGED
|
@@ -11,22 +11,27 @@ require 'minitag/tag_extension'
|
|
|
11
11
|
# to Minitest::Test
|
|
12
12
|
module Minitag
|
|
13
13
|
class << self
|
|
14
|
+
# Tags specified by the `--tag` or `-t` option.
|
|
14
15
|
def execution_tags
|
|
15
16
|
@execution_tags ||= []
|
|
16
17
|
end
|
|
17
18
|
|
|
19
|
+
# Add tag specified by the `--tag` or `-t` option.
|
|
18
20
|
def add_execution_tag(tag)
|
|
19
21
|
execution_tags << Tag.new(tag)
|
|
20
22
|
end
|
|
21
23
|
|
|
24
|
+
# Tags from the last `tag` method waiting to be associated with a test.
|
|
22
25
|
def pending_tags
|
|
23
26
|
@pending_tags || []
|
|
24
27
|
end
|
|
25
28
|
|
|
29
|
+
# Tags set from the `tag` method.
|
|
26
30
|
def pending_tags=(tags)
|
|
27
31
|
@pending_tags = Array(tags)
|
|
28
32
|
end
|
|
29
33
|
|
|
34
|
+
# The mapping of tags and tests.
|
|
30
35
|
def tag_mapping
|
|
31
36
|
@tag_mapping ||= Minitag::TagMapper.new
|
|
32
37
|
end
|
data/lib/minitag/tag.rb
CHANGED
|
@@ -9,6 +9,14 @@ module Minitag
|
|
|
9
9
|
class Tag
|
|
10
10
|
attr_reader :name
|
|
11
11
|
|
|
12
|
+
# Initializes a tag. Tags with a ~ prefix are deemed exclusive and
|
|
13
|
+
# inclusive otherwise.
|
|
14
|
+
#
|
|
15
|
+
# param [String] name the name of the tag
|
|
16
|
+
#
|
|
17
|
+
# Invariants:
|
|
18
|
+
# - A tag name will always be a String without the ~ prefix
|
|
19
|
+
# after initialization.
|
|
12
20
|
def initialize(name)
|
|
13
21
|
@name = name.to_s
|
|
14
22
|
@exclusive = false
|
|
@@ -19,10 +27,16 @@ module Minitag
|
|
|
19
27
|
@exclusive = true
|
|
20
28
|
end
|
|
21
29
|
|
|
30
|
+
# Whether this tag needs to be excluded or not.
|
|
31
|
+
#
|
|
32
|
+
# return [boolean]
|
|
22
33
|
def exclusive?
|
|
23
34
|
@exclusive
|
|
24
35
|
end
|
|
25
36
|
|
|
37
|
+
# Whether this tag needs to be included or not.
|
|
38
|
+
#
|
|
39
|
+
# return [boolean]
|
|
26
40
|
def inclusive?
|
|
27
41
|
!exclusive?
|
|
28
42
|
end
|
data/lib/minitag/tag_mapper.rb
CHANGED
|
@@ -3,16 +3,27 @@
|
|
|
3
3
|
module Minitag
|
|
4
4
|
# Stores the mapping between a test name and its existing tags.
|
|
5
5
|
class TagMapper
|
|
6
|
-
attr_reader :repository
|
|
7
|
-
|
|
8
6
|
def initialize
|
|
9
7
|
@repository = Hash.new { |h, k| h[k] = [] }
|
|
10
8
|
end
|
|
11
9
|
|
|
10
|
+
# Associates a tag with a test name takinto into account is context.
|
|
11
|
+
#
|
|
12
|
+
# @param [String] context the context which a test name belongs.
|
|
13
|
+
# @param [String] name the test name.
|
|
14
|
+
# @param [String] tag the tag name.
|
|
15
|
+
#
|
|
16
|
+
# @return [void]
|
|
12
17
|
def add(context:, name:, tag:)
|
|
13
18
|
@repository[key(context, name)] << Minitag::Tag.new(tag)
|
|
14
19
|
end
|
|
15
20
|
|
|
21
|
+
# Fetches tags associated with a test name and context.
|
|
22
|
+
#
|
|
23
|
+
# @param [String] context the context which a test name belongs.
|
|
24
|
+
# @param [String] name the test name.
|
|
25
|
+
#
|
|
26
|
+
# @return [Array] the tags associated with the test.
|
|
16
27
|
def fetch(context:, name:)
|
|
17
28
|
@repository[key(context, name)]
|
|
18
29
|
end
|
data/lib/minitag/version.rb
CHANGED