gfsm 0.6.0 → 0.8.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: 1e82f5cdce1d37aced2b895cabbc7a9b24019ddfb0838a35b623ff097307c343
4
- data.tar.gz: ef83dd15b50de4d9db1e28e92e354864379294f9f8485fd093682e59525afd7d
3
+ metadata.gz: 264d0008a9d209415a6fe539a3b46d371ec57e903f7164ced417928fa60601e4
4
+ data.tar.gz: b92b89c8d6f9f28a907c47e2fa385f00262c01ab06bc225800168c853600add1
5
5
  SHA512:
6
- metadata.gz: b2c98d7dce54ec8b5bed5a4a3f328b97778a95fb622d977af7051ad9c034e344fba153da0a495b5288ddf3498e2970b88a6e1b07c0760b67c9dd0da1974e758b
7
- data.tar.gz: 67c36f148426d0f397fe076aae8bdcbe1cf94f17d8aef7098221bce59e2f864f63286ceabfa7bc34020c78718b5a96ab9f84ee4fc88e8e872fdc429fbfa2cc05
6
+ metadata.gz: 7830847278316f5bdfaef45b248ee357c300f0ec70f82b2bc4bd0fe95b9b64d2d7edbb3d48b23155a34d6cf455e126ca6eb89f9b237ffaa2576fe4f04e30336f
7
+ data.tar.gz: ad67bf616ddb43cc8780d649fdbb570bcf34a7f7efa07db677556a1be2743093b0d619cf414342acd527e51033f24e7306efdc07114c95edd90723e26373b4fe
data/gfsmrc.yml CHANGED
@@ -38,4 +38,7 @@ change_types:
38
38
  title: "Other"
39
39
  matcher: other
40
40
  bump: patch
41
- priority: 0
41
+ priority: 0
42
+ ignore:
43
+ matcher: ignore
44
+ ignore_on_changelog: true
@@ -105,7 +105,9 @@ module GFSM
105
105
  subdivisions.each do |subdivision_data|
106
106
  change_type = subdivision_data[0]
107
107
  commits = subdivision_data[1]
108
-
108
+
109
+ next if change_type.ignore_on_changelog?
110
+
109
111
  changelog_entries += "#{change_type.to_changelog_entry}\n\n"
110
112
 
111
113
  commits.each do |commit|
@@ -3,13 +3,14 @@
3
3
  module GFSM
4
4
  module Data
5
5
  class ChangeType
6
- attr_reader :matcher, :title, :bump_type, :priority, :commits
6
+ attr_reader :matcher, :title, :bump_type, :priority, :ignore_on_changelog, :commits
7
7
 
8
- def initialize(matcher, title, bump_type, priority)
8
+ def initialize(matcher, title, bump_type, priority, ignore_on_changelog)
9
9
  @matcher = matcher
10
10
  @title = title
11
11
  @bump_type = bump_type
12
12
  @priority = priority
13
+ @ignore_on_changelog = ignore_on_changelog
13
14
  @commits = []
14
15
  end
15
16
 
@@ -25,6 +26,10 @@ module GFSM
25
26
  @bump_type == :patch
26
27
  end
27
28
 
29
+ def ignore_on_changelog?
30
+ @ignore_on_changelog
31
+ end
32
+
28
33
  def to_s
29
34
  @title
30
35
  end
@@ -31,15 +31,16 @@ module GFSM
31
31
 
32
32
  def load_change_types(change_types_config)
33
33
  change_types_config.each do |key, value|
34
- if !value.include?("title") || !value.include?("matcher") || !value.include?("bump")
35
- raise "Change type has invalid configuration"
34
+ if !value.include?("matcher")
35
+ raise "Change type #{key} is missing the matcher"
36
36
  end
37
37
 
38
38
  @change_types << GFSM::Data::ChangeType.new(
39
39
  /#{Regexp.quote(value["matcher"])}/i,
40
- value["title"],
41
- value["bump"].to_sym,
42
- value.include?("priority") ? value["priority"] : -100
40
+ value.include?("title") ? value["title"] : 'no-title',
41
+ value.include?("bump") ? value["bump"].to_sym : :patch,
42
+ value.include?("priority") ? value["priority"] : -100,
43
+ value.include?("ignore_on_changelog") ? value["ignore_on_changelog"] : false,
43
44
  )
44
45
  end
45
46
  end
@@ -12,9 +12,9 @@ module GFSM
12
12
  def initialize(cli_args)
13
13
  @repository = GFSM::Tools::GitUtilities.load_repo(get_repository_path(cli_args))
14
14
  @configuration = GFSM::Data::Configuration.new(get_configuration_file_path(cli_args))
15
- @force = ENV.has_key?("FORCE_BUMP") || cli_args.include?("--force")
15
+ @force = get_force(cli_args)
16
16
  @force_version = get_force_version(cli_args)
17
- @prerelease = ENV.has_key?("PRERELEASE") || cli_args.include?("--prerelease")
17
+ @prerelease = get_prerelease(cli_args)
18
18
  @prerelease_name = get_prerelease_name(cli_args)
19
19
  @from = get_from(cli_args)
20
20
  @to = get_to(cli_args)
@@ -68,9 +68,29 @@ module GFSM
68
68
  args[switch_index + 1]
69
69
  end
70
70
 
71
+ def extract_boolean_value(args, switch, default_value, env_name = nil)
72
+ if ENV.has_key?(env_name)
73
+ return ENV.fetch(env_name) == "true"
74
+ end
75
+
76
+ switch_index = args.find_index(switch)
77
+
78
+ return default_value unless switch_index
79
+
80
+ true
81
+ end
82
+
83
+ def get_force(args)
84
+ extract_boolean_value(args, "--force", false, "FORCE_BUMP")
85
+ end
86
+
71
87
  def get_configuration_file_path(args)
72
88
  extract_switch_value(args, "--configuration", "./gfsmrc.yml", "CONFIGURATION_FILE")
73
89
  end
90
+
91
+ def get_prerelease(args)
92
+ extract_boolean_value(args, "--prerelease", false, "PRERELEASE")
93
+ end
74
94
 
75
95
  def get_prerelease_name(args)
76
96
  extract_switch_value(args, "--prerelease-name", "pre", "PRERELEASE_NAME")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gfsm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zille Marco
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-03 00:00:00.000000000 Z
11
+ date: 2024-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yaml