git_validation_task 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: c49022e1b839b61d03c2aac5884bd953c8f8626276570b75f5a7bf7492b44567
4
- data.tar.gz: ee24f55c225a23d5f7487ccb3bf164a6aeb02f626e58251b58fdfe86fe1e67f4
3
+ metadata.gz: 43b3c1c85b70f5370555aa788df15d477c13d9c25b3681da3c8a31f139f79549
4
+ data.tar.gz: 5cc80dca73f948f8cb75fde7f0c1444e7a17a8994b31301346d8ab1378067d27
5
5
  SHA512:
6
- metadata.gz: 8977a36725c4da93f24ff4d07fe8784c7102acaee59220e3f8391b00a60f20a2c4251d0e96d12b2d2b36225544a01c3c0648dab6a87616f778df7ba5e87f630f
7
- data.tar.gz: 1e16e9327671de2e7ea7d5e43c03447a0b0f0afe2c8387ea9cbdabcdbb4c6174ca02fc0badd94471291ac5b65b49afc82d4cf957c8a26f6b677e773270a23416
6
+ metadata.gz: a7540809b6f771f8113da746c651bbaae61b672467f96ea9dfd9630c278022732805049f593eda9af84dfa8a8577558313f87a2e1a1c7a79086e0248889bea04
7
+ data.tar.gz: ac02cc15bb583f8e43866c0e353d8e88fc42e26ffa630db9d42c8f10d56fc8aee99f9711d3c11b9afe968960c41ea95282e2c0dc6c79962556c5154f24706f90
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.0
4
+
5
+ - Added the `quiet` option.
6
+
3
7
  ## 1.0.0
4
8
 
5
9
  - Implemented the basic functionality of `git_validation_task`.
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
- Or:
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 = "74a6c20fc4d3"
41
- t.run = "DCO,message_regexp"
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 = "b821d057103680dfad784176e8175a973ecd769e"
35
+ t.from = "b821d057103680dfad784176e8175a973ecd769e"
36
+ t.quiet = ENV["CI"] != "true"
36
37
  end
37
38
 
38
39
  task default: :all
@@ -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
- @from = nil
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
- sh("git-validation", *range_flag, *run_flag)
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 != ""
@@ -19,5 +19,5 @@
19
19
 
20
20
  module GitValidation
21
21
  # The current version of GitValidation.
22
- VERSION = "1.0.0"
22
+ VERSION = "1.1.0"
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_validation_task
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
  - Miquel Sabaté Solà