git_validation_task 1.0.0 → 1.1.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 +4 -0
- data/README.md +5 -3
- data/Rakefile +2 -1
- data/lib/git_validation/task.rb +22 -3
- data/lib/git_validation/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: 43b3c1c85b70f5370555aa788df15d477c13d9c25b3681da3c8a31f139f79549
|
4
|
+
data.tar.gz: 5cc80dca73f948f8cb75fde7f0c1444e7a17a8994b31301346d8ab1378067d27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7540809b6f771f8113da746c651bbaae61b672467f96ea9dfd9630c278022732805049f593eda9af84dfa8a8577558313f87a2e1a1c7a79086e0248889bea04
|
7
|
+
data.tar.gz: ac02cc15bb583f8e43866c0e353d8e88fc42e26ffa630db9d42c8f10d56fc8aee99f9711d3c11b9afe968960c41ea95282e2c0dc6c79962556c5154f24706f90
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -20,6 +20,7 @@ You can pass two options:
|
|
20
20
|
this document).
|
21
21
|
2. `run`: the values to be passed to the `run` flag. If this is not used, then
|
22
22
|
the `-run` flag is not used.
|
23
|
+
3. `quiet`: whether or not the `-q` flag should be used.
|
23
24
|
|
24
25
|
Thus, a more complete example would be something like:
|
25
26
|
|
@@ -31,14 +32,15 @@ GitValidation::Task.new(:"git-validation") do |t|
|
|
31
32
|
end
|
32
33
|
```
|
33
34
|
|
34
|
-
|
35
|
+
And more complete:
|
35
36
|
|
36
37
|
```ruby
|
37
38
|
require "git_validation/task"
|
38
39
|
|
39
40
|
GitValidation::Task.new(:"git-validation") do |t|
|
40
|
-
t.from
|
41
|
-
t.run
|
41
|
+
t.from = "74a6c20fc4d3"
|
42
|
+
t.run = "DCO,message_regexp"
|
43
|
+
t.quiet = ENV["CI"] != "true"
|
42
44
|
end
|
43
45
|
```
|
44
46
|
|
data/Rakefile
CHANGED
@@ -32,7 +32,8 @@ RuboCop::RakeTask.new(:rubocop) do |t|
|
|
32
32
|
end
|
33
33
|
|
34
34
|
GitValidation::Task.new(:"git-validation") do |t|
|
35
|
-
t.from
|
35
|
+
t.from = "b821d057103680dfad784176e8175a973ecd769e"
|
36
|
+
t.quiet = ENV["CI"] != "true"
|
36
37
|
end
|
37
38
|
|
38
39
|
task default: :all
|
data/lib/git_validation/task.rb
CHANGED
@@ -28,10 +28,10 @@ module GitValidation
|
|
28
28
|
|
29
29
|
attr_accessor :from
|
30
30
|
attr_accessor :run
|
31
|
+
attr_accessor :quiet
|
31
32
|
|
32
33
|
def initialize(name = :"git-validation", *args, &block)
|
33
|
-
|
34
|
-
@run = nil
|
34
|
+
set_ivars
|
35
35
|
|
36
36
|
desc "Run git-validation" unless ::Rake.application.last_description
|
37
37
|
|
@@ -41,12 +41,24 @@ module GitValidation
|
|
41
41
|
yield(*[self, task_args].slice(0, block.arity)) if block_given?
|
42
42
|
|
43
43
|
abort("Bad type for 'from' option") unless @from.is_a?(String)
|
44
|
-
|
44
|
+
execute!
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
protected
|
49
49
|
|
50
|
+
# Initialize the ivars that are relevant to us.
|
51
|
+
def set_ivars
|
52
|
+
@from = nil
|
53
|
+
@run = nil
|
54
|
+
@quiet = false
|
55
|
+
end
|
56
|
+
|
57
|
+
# Execute the actual shell command with all the needed flags.
|
58
|
+
def execute!
|
59
|
+
sh("git-validation", *range_flag, *run_flag, *quiet_flag)
|
60
|
+
end
|
61
|
+
|
50
62
|
# Returns an array containing the arguments to be passed to the
|
51
63
|
# git-validation command for the '-range' flag (where '-range') is already
|
52
64
|
# included.
|
@@ -76,6 +88,13 @@ module GitValidation
|
|
76
88
|
["-run", @run]
|
77
89
|
end
|
78
90
|
|
91
|
+
# Returns an array containing the `-q` flag if it was specified.
|
92
|
+
def quiet_flag
|
93
|
+
return ["-q"] if @quiet
|
94
|
+
|
95
|
+
[]
|
96
|
+
end
|
97
|
+
|
79
98
|
# Returns true if the given string is not blank (nil nor empty).
|
80
99
|
def present?(str)
|
81
100
|
!str.nil? && str != ""
|