simp-rake-helpers 5.24.0 → 6.0.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.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +20 -1
  3. data/CHANGELOG.md +33 -0
  4. data/Gemfile +14 -6
  5. data/lib/simp/command_utils.rb +6 -3
  6. data/lib/simp/componentinfo.rb +47 -33
  7. data/lib/simp/local_gpg_signing_key.rb +302 -303
  8. data/lib/simp/packer/iso_vars_json.rb +17 -15
  9. data/lib/simp/rake/build/auto.rb +415 -432
  10. data/lib/simp/rake/build/build.rb +119 -124
  11. data/lib/simp/rake/build/clean.rb +39 -39
  12. data/lib/simp/rake/build/code.rb +125 -128
  13. data/lib/simp/rake/build/constants.rb +7 -4
  14. data/lib/simp/rake/build/deps.rb +196 -207
  15. data/lib/simp/rake/build/helpers.rb +17 -13
  16. data/lib/simp/rake/build/iso.rb +404 -411
  17. data/lib/simp/rake/build/pkg.rb +752 -759
  18. data/lib/simp/rake/build/rpmdeps.rb +70 -70
  19. data/lib/simp/rake/build/spec.rb +44 -46
  20. data/lib/simp/rake/build/tar.rb +169 -173
  21. data/lib/simp/rake/build/unpack.rb +105 -107
  22. data/lib/simp/rake/build/upload.rb +93 -102
  23. data/lib/simp/rake/fixtures.rb +69 -66
  24. data/lib/simp/rake/helpers/rpm_spec.rb +10 -7
  25. data/lib/simp/rake/helpers/version.rb +3 -1
  26. data/lib/simp/rake/helpers.rb +12 -10
  27. data/lib/simp/rake/pkg.rb +417 -440
  28. data/lib/simp/rake/pupmod/helpers.rb +100 -87
  29. data/lib/simp/rake/pupmod/module_build.rb +39 -0
  30. data/lib/simp/rake/rubygem.rb +57 -56
  31. data/lib/simp/rake.rb +34 -29
  32. data/lib/simp/relchecks.rb +52 -43
  33. data/lib/simp/rpm.rb +123 -127
  34. data/lib/simp/rpm_signer.rb +57 -55
  35. data/lib/simp/yum.rb +54 -53
  36. data/spec/acceptance/nodesets/{default_ruby3_1.yml → almalinux10.yml} +4 -4
  37. data/spec/acceptance/nodesets/{default.yml → almalinux8.yml} +2 -2
  38. data/spec/acceptance/nodesets/almalinux9.yml +25 -0
  39. data/spec/acceptance/suites/default/00_pkg_rpm_custom_scriptlets_spec.rb +23 -28
  40. data/spec/acceptance/suites/default/10_pkg_rpm_spec.rb +54 -56
  41. data/spec/acceptance/suites/default/30_pkg_misc_spec.rb +17 -19
  42. data/spec/acceptance/suites/default/50_local_gpg_signing_key_spec.rb +5 -5
  43. data/spec/acceptance/suites/default/55_build_pkg_signing_spec.rb +109 -101
  44. data/spec/acceptance/suites/default/files/testpackage/spec/classes/init_spec.rb +1 -0
  45. data/spec/acceptance/suites/default/files/testpackage/spec/files/mock_something.rb +3 -1
  46. data/spec/acceptance/suites/default/files/testpackage/utils/convert_v1_to_v2.rb +2 -0
  47. data/spec/acceptance/suites/default/support/build_project_helpers.rb +20 -17
  48. data/spec/acceptance/suites/default/support/build_user_helpers.rb +4 -2
  49. data/spec/acceptance/suites/default/support/pkg_rpm_helpers.rb +30 -31
  50. data/spec/acceptance/support/simp_rake_helpers.rb +3 -1
  51. data/spec/lib/simp/command_utils_spec.rb +13 -10
  52. data/spec/lib/simp/componentinfo_changelog_regex_spec.rb +33 -33
  53. data/spec/lib/simp/componentinfo_spec.rb +99 -86
  54. data/spec/lib/simp/packer/iso_vars_json_spec.rb +16 -14
  55. data/spec/lib/simp/rake/build/helpers_spec.rb +7 -7
  56. data/spec/lib/simp/rake/build/rpmdeps_spec.rb +48 -46
  57. data/spec/lib/simp/rake/helpers_spec.rb +6 -5
  58. data/spec/lib/simp/rake/pkg_spec.rb +7 -5
  59. data/spec/lib/simp/rake/pupmod/fixtures/othermod/spec/classes/init_spec.rb +3 -1
  60. data/spec/lib/simp/rake/pupmod/fixtures/othermod/spec/spec_helper.rb +2 -0
  61. data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/acceptance/suites/default/class_spec.rb +6 -5
  62. data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/classes/init_spec.rb +51 -33
  63. data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/spec_helper.rb +15 -16
  64. data/spec/lib/simp/rake/pupmod/fixtures/simpmod/spec/spec_helper_acceptance.rb +9 -9
  65. data/spec/lib/simp/rake/pupmod/helpers_spec.rb +20 -19
  66. data/spec/lib/simp/rake/pupmod/module_build_spec.rb +87 -0
  67. data/spec/lib/simp/rake_spec.rb +7 -6
  68. data/spec/lib/simp/relchecks_check_rpm_changelog_spec.rb +26 -31
  69. data/spec/lib/simp/relchecks_compare_latest_tag_spec.rb +32 -26
  70. data/spec/lib/simp/relchecks_create_tag_changelog_spec.rb +27 -19
  71. data/spec/lib/simp/rpm_signer_spec.rb +45 -39
  72. data/spec/lib/simp/rpm_spec.rb +190 -194
  73. data/spec/spec_helper.rb +4 -2
  74. data/spec/spec_helper_acceptance.rb +3 -5
  75. metadata +47 -76
  76. data/bin/simp_rake_helpers +0 -3
  77. data/lib/simp/ci/gitlab.rb +0 -226
  78. data/lib/simp/rake/ci.rb +0 -31
  79. data/spec/lib/simp/ci/files/global_nodesets_only/spec/acceptance/nodesets/default.yml +0 -41
  80. data/spec/lib/simp/ci/files/global_nodesets_only/spec/acceptance/nodesets/oel.yml +0 -41
  81. data/spec/lib/simp/ci/files/job_broken_link_nodeset/spec/acceptance/nodesets/centos.yml +0 -41
  82. data/spec/lib/simp/ci/files/job_broken_link_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
  83. data/spec/lib/simp/ci/files/job_broken_link_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
  84. data/spec/lib/simp/ci/files/job_invalid_nodeset/spec/acceptance/nodesets/default.yml +0 -41
  85. data/spec/lib/simp/ci/files/job_invalid_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
  86. data/spec/lib/simp/ci/files/job_invalid_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
  87. data/spec/lib/simp/ci/files/job_invalid_suite/spec/acceptance/nodesets/default.yml +0 -41
  88. data/spec/lib/simp/ci/files/job_invalid_suite/spec/acceptance/nodesets/oel.yml +0 -41
  89. data/spec/lib/simp/ci/files/job_invalid_suite/spec/acceptance/suites/default/class_spec.rb +0 -0
  90. data/spec/lib/simp/ci/files/job_missing_nodeset/spec/acceptance/nodesets/default.yml +0 -41
  91. data/spec/lib/simp/ci/files/job_missing_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
  92. data/spec/lib/simp/ci/files/job_missing_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
  93. data/spec/lib/simp/ci/files/job_missing_suite_and_nodeset/spec/acceptance/nodesets/default.yml +0 -41
  94. data/spec/lib/simp/ci/files/job_missing_suite_and_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
  95. data/spec/lib/simp/ci/files/job_missing_suite_and_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
  96. data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/nodesets/default.yml +0 -41
  97. data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/nodesets/oel.yml +0 -41
  98. data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/default/class_spec.rb +0 -0
  99. data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/feature-1/feature-1_spec.rb +0 -0
  100. data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/feature_2/feature_2_spec.rb +0 -0
  101. data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/feature_2/nodesets/default.yml +0 -35
  102. data/spec/lib/simp/ci/files/multiple_invalid_jobs/spec/acceptance/suites/feature_2/nodesets/oel.yml +0 -35
  103. data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/nodesets/default.yml +0 -41
  104. data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/nodesets/oel.yml +0 -41
  105. data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/default/class_spec.rb +0 -0
  106. data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/feature-1/feature-1_spec.rb +0 -0
  107. data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/feature_2/feature_2_spec.rb +0 -0
  108. data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/feature_2/nodesets/default.yml +0 -35
  109. data/spec/lib/simp/ci/files/multiple_valid_jobs/spec/acceptance/suites/feature_2/nodesets/oel.yml +0 -35
  110. data/spec/lib/simp/ci/files/no_acceptance_tests/spec/spec_helper.rb +0 -0
  111. data/spec/lib/simp/ci/files/no_gitlab_config_with_tests/spec/acceptance/nodesets/default.yml +0 -41
  112. data/spec/lib/simp/ci/files/no_gitlab_config_with_tests/spec/acceptance/nodesets/oel.yml +0 -41
  113. data/spec/lib/simp/ci/files/no_gitlab_config_with_tests/spec/acceptance/suites/default/class_spec.rb +0 -0
  114. data/spec/lib/simp/ci/files/no_gitlab_config_without_tests/spec/acceptance/nodesets/default.yml +0 -41
  115. data/spec/lib/simp/ci/files/no_gitlab_config_without_tests/spec/acceptance/nodesets/oel.yml +0 -41
  116. data/spec/lib/simp/ci/files/suite_skeleton_only/spec/acceptance/nodesets/centos.yml +0 -41
  117. data/spec/lib/simp/ci/files/suite_skeleton_only/spec/acceptance/nodesets/oel.yml +0 -41
  118. data/spec/lib/simp/ci/files/valid_job_global_nodeset/spec/acceptance/nodesets/default.yml +0 -41
  119. data/spec/lib/simp/ci/files/valid_job_global_nodeset/spec/acceptance/nodesets/oel.yml +0 -41
  120. data/spec/lib/simp/ci/files/valid_job_global_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
  121. data/spec/lib/simp/ci/files/valid_job_nodeset_dir_link/spec/acceptance/nodesets/default.yml +0 -41
  122. data/spec/lib/simp/ci/files/valid_job_nodeset_dir_link/spec/acceptance/nodesets/oel.yml +0 -41
  123. data/spec/lib/simp/ci/files/valid_job_nodeset_dir_link/spec/acceptance/suites/default/class_spec.rb +0 -0
  124. data/spec/lib/simp/ci/files/valid_job_nodeset_link/spec/acceptance/suites/default/class_spec.rb +0 -0
  125. data/spec/lib/simp/ci/files/valid_job_nodeset_link/spec/acceptance/suites/default/nodesets/centos.yml +0 -41
  126. data/spec/lib/simp/ci/files/valid_job_nodeset_link/spec/acceptance/suites/default/nodesets/oel.yml +0 -41
  127. data/spec/lib/simp/ci/files/valid_job_suite_nodeset/spec/acceptance/suites/default/class_spec.rb +0 -0
  128. data/spec/lib/simp/ci/files/valid_job_suite_nodeset/spec/acceptance/suites/default/nodesets/default.yml +0 -41
  129. data/spec/lib/simp/ci/files/valid_job_suite_nodeset/spec/acceptance/suites/default/nodesets/oel.yml +0 -41
  130. data/spec/lib/simp/ci/gitlab_spec.rb +0 -245
@@ -1,132 +1,123 @@
1
1
  #!/usr/bin/rake -T
2
+ # frozen_string_literal: true
3
+
2
4
  require 'open3'
3
5
  require 'simp/rpm'
4
6
  require 'simp/rake/build/constants'
5
7
 
6
8
  module Simp; end
7
9
  module Simp::Rake; end
8
- module Simp::Rake::Build
9
-
10
- class Upload < ::Rake::TaskLib
11
- include Simp::Rake::Build::Constants
12
10
 
13
- def initialize( base_dir )
14
- init_member_vars( base_dir )
11
+ class Simp::Rake::Build::Upload < Rake::TaskLib
12
+ include Simp::Rake::Build::Constants
15
13
 
16
- define_tasks
17
- end
14
+ def initialize(base_dir)
15
+ init_member_vars(base_dir)
18
16
 
19
- def define_tasks
17
+ define_tasks
18
+ end
20
19
 
21
- namespace :upload do
22
- task :prep do
23
- if $simp6
24
- @build_dir = $simp6_build_dir || @distro_build_dir
25
- end
20
+ def define_tasks
21
+ namespace :upload do
22
+ task :prep do
23
+ if $simp6
24
+ @build_dir = $simp6_build_dir || @distro_build_dir
26
25
  end
26
+ end
27
27
 
28
- ##############################################################################
29
- # Helper methods
30
- ##############################################################################
31
-
32
- # Get a list of all packages that have been updated since the passed
33
- # date or git identifier (tag, branch, or commit).
28
+ ##############################################################################
29
+ # Helper methods
30
+ ##############################################################################
34
31
 
35
- def get_updated_packages(start,script_format)
36
- pkg_info = Hash.new
37
- printed_info = false
32
+ # Get a list of all packages that have been updated since the passed
33
+ # date or git identifier (tag, branch, or commit).
38
34
 
39
- to_check = []
40
- # Find all static RPMs and GPGKEYS that we may need to update so
41
- # that we can see if we have newer versions to upload!
42
- Find.find(@build_dir) do |file|
43
- next if file == @build_dir
44
- Find.prune if file !~ /^#{@build_dir}\/(Ext.*(\.rpm)?|GPGKEYS)/
45
- to_check << file if File.file?(file)
46
- end
35
+ def get_updated_packages(start, script_format)
36
+ pkg_info = {}
37
+ printed_info = false
47
38
 
48
- # Smash in all of the file files!
49
- to_check += Dir.glob("#{@spec_dir}/*.spec")
50
- to_check += Dir.glob("#{@src_dir}/puppet/modules/*/pkg/*.spec")
51
-
52
- to_check.each do |file|
53
-
54
- is_commit = false
55
- oldstart = start
56
- humanstart = ''
57
- # Before changing the directory, see if we've got a commit or a
58
- # date. If we've got a tag or branch from the top level, then we
59
- # need to get the date from there and use it later.
60
- Dir.chdir(@spec_dir) do
61
- stdin,stdout,stderr = Open3.popen3('git','rev-list',start)
62
- stderr.read !~ /^fatal:/ and is_commit = true
63
-
64
- if is_commit
65
- # Snag the date.
66
- start, humanstart = `git log #{start} --pretty=format:"%ct##%cd" --max-count=1`.chomp.split('##')
67
- else
68
- printed_info = true
69
- end
70
- end
39
+ to_check = []
40
+ # Find all static RPMs and GPGKEYS that we may need to update so
41
+ # that we can see if we have newer versions to upload!
42
+ Find.find(@build_dir) do |file|
43
+ next if file == @build_dir
71
44
 
72
- !printed_info and puts "Info: Comparing to '#{humanstart}' based on input of '#{oldstart}'"
73
-
74
- Dir.chdir(File.dirname(file)) do
75
- # Get the file HEAD commit
76
- # If we're not in a git repo, this will explode, but that's just
77
- # fine.
78
- current_head = `git rev-list HEAD --max-count=1`.chomp
79
-
80
- begin
81
- # Convert the spec files to something more human readable...
82
- pkg_info[file] = {
83
- :is_new => false
84
- }
85
- pkg_info[file][:alias] = file
86
- if file =~ /.spec$/
87
- if script_format
88
- pkg_info[file][:alias] = "#{@build_dir}/RPMS/#{Simp::RPM.new(file).name}*.rpm"
89
- else
90
- pkg_info[file][:alias] = Simp::RPM.new(file).name
91
- end
92
- end
93
- rescue
94
- raise "Error: There was an issue getting information from #{file}"
95
- end
45
+ Find.prune unless %r{^#{@build_dir}/(Ext.*(\.rpm)?|GPGKEYS)}.match?(file)
46
+ to_check << file if File.file?(file)
47
+ end
96
48
 
97
- commit_head = nil
98
- # It turns out that an invalid date will just return
99
- # everything
100
- commit_head = `git log --before="#{start}" --pretty=format:%H --max-count=1 #{File.basename(file)}`.chomp
49
+ # Smash in all of the file files!
50
+ to_check += Dir.glob("#{@spec_dir}/*.spec")
51
+ to_check += Dir.glob("#{@src_dir}/puppet/modules/*/pkg/*.spec")
52
+
53
+ to_check.each do |file|
54
+ is_commit = false
55
+ oldstart = start
56
+ humanstart = ''
57
+ # Before changing the directory, see if we've got a commit or a
58
+ # date. If we've got a tag or branch from the top level, then we
59
+ # need to get the date from there and use it later.
60
+ Dir.chdir(@spec_dir) do
61
+ _, _, stderr = Open3.popen3('git', 'rev-list', start)
62
+ stderr.read !~ %r{^fatal:} and is_commit = true
63
+
64
+ if is_commit
65
+ # Snag the date.
66
+ start, humanstart = `git log #{start} --pretty=format:"%ct##%cd" --max-count=1`.chomp.split('##')
67
+ else
68
+ printed_info = true
69
+ end
70
+ end
101
71
 
102
- # Did we find something different?
103
- if commit_head.empty?
104
- pkg_info[file][:is_new] = true
105
- else
106
- pkg_info[file][:is_new] = !system('git','diff','--quiet',commit_head,File.basename(file))
72
+ !printed_info and puts "Info: Comparing to '#{humanstart}' based on input of '#{oldstart}'"
73
+
74
+ Dir.chdir(File.dirname(file)) do
75
+ # Get the file HEAD commit
76
+ # If we're not in a git repo, this will explode, but that's just
77
+ # fine.
78
+ `git rev-list HEAD --max-count=1`.chomp
79
+
80
+ begin
81
+ # Convert the spec files to something more human readable...
82
+ pkg_info[file] = {
83
+ :is_new => false
84
+ }
85
+ pkg_info[file][:alias] = file
86
+ if %r{.spec$}.match?(file)
87
+ pkg_info[file][:alias] = if script_format
88
+ "#{@build_dir}/RPMS/#{Simp::RPM.new(file).name}*.rpm"
89
+ else
90
+ Simp::RPM.new(file).name
91
+ end
107
92
  end
93
+ rescue StandardError
94
+ raise "Error: There was an issue getting information from #{file}"
108
95
  end
109
- end
96
+ # It turns out that an invalid date will just return
97
+ # everything
98
+ commit_head = `git log --before="#{start}" --pretty=format:%H --max-count=1 #{File.basename(file)}`.chomp
110
99
 
111
- return pkg_info
100
+ # Did we find something different?
101
+ pkg_info[file][:is_new] = (commit_head.empty? || !system('git', 'diff', '--quiet', commit_head, File.basename(file)))
102
+ end
112
103
  end
113
104
 
114
- =begin
115
- desc <<-EOM
116
- Get a list of modified packages.
105
+ pkg_info
106
+ end
117
107
 
118
- The package list is created from the given date or git identifier (tag, branch, or hash)
119
- EOM
120
- =end
121
- task :get_modified,[:start,:script_format] => [:prep] do |t,args|
122
- args.with_defaults(:script_format => false)
108
+ # desc <<-EOM
109
+ # Get a list of modified packages.
110
+ #
111
+ # The package list is created from the given date or git identifier (tag, branch, or hash)
112
+ # EOM
113
+ task :get_modified, [:start, :script_format] => [:prep] do |_t, args|
114
+ args.with_defaults(:script_format => false)
123
115
 
124
- args.start or raise "Error: You must specify a 'start'"
116
+ args.start or raise "Error: You must specify a 'start'"
125
117
 
126
- updated_pkgs = get_updated_packages(args.start, args.script_format)
127
- updated_pkgs.keys.sort.each do |k|
128
- updated_pkgs[k][:is_new] and puts "Updated: #{updated_pkgs[k][:alias]}"
129
- end
118
+ updated_pkgs = get_updated_packages(args.start, args.script_format)
119
+ updated_pkgs.keys.sort.each do |k|
120
+ updated_pkgs[k][:is_new] and puts "Updated: #{updated_pkgs[k][:alias]}"
130
121
  end
131
122
  end
132
123
  end
@@ -1,87 +1,90 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rake/tasklib'
2
4
 
3
5
  module Simp; end
4
- module Simp::Rake
5
- class Fixtures < ::Rake::TaskLib
6
- def initialize( dir )
7
- @base_dir = dir
8
- ###::CLEAN.include( '.fixtures.yml.local' )
9
- define
10
- end
11
6
 
12
- def define
13
- namespace :fixtures do
14
- def flatten_fixtures_hash(_f)
15
- _f
16
- .map{|k,v| v.values}
17
- .flatten
18
- .reduce({}){|h,pairs|
19
- pairs.each{|k,v|
20
- (h[k] ||= []) << v
21
- }; h
22
- }
23
- .keys
24
- .uniq
25
- .sort
26
- end
7
+ class Simp::Rake::Fixtures < Rake::TaskLib
8
+ def initialize(dir)
9
+ @base_dir = dir
10
+ # ##::CLEAN.include( '.fixtures.yml.local' )
11
+ define
12
+ end
27
13
 
28
- def fixtures_yml_local(_f)
29
- _f_m = flatten_fixtures_hash(_f)
14
+ def define
15
+ namespace :fixtures do
16
+ def flatten_fixtures_hash(_f)
17
+ _f
18
+ .map { |_k, v| v.values }
19
+ .flatten
20
+ .each_with_object({}) { |pairs, h|
21
+ pairs.each do |k, v|
22
+ (h[k] ||= []) << v
23
+ end
24
+ }
25
+ .keys
26
+ .uniq
27
+ .sort
28
+ end
30
29
 
31
- _s = Hash[_f_m.map{|k|
32
- v= _f['fixtures']['repositories'].key?(k) ? "#\{source_dir\}/../#{k}": _f['fixtures']['symlinks'].fetch(k)
33
- [k, v ]}
34
- ]
30
+ def fixtures_yml_local(_f)
31
+ _f_m = flatten_fixtures_hash(_f)
35
32
 
36
- {'fixtures'=> {'symlinks'=> _s }}
33
+ _s = _f_m.to_h do |k|
34
+ v = _f['fixtures']['repositories'].key?(k) ? "#\{source_dir}/../#{k}" : _f['fixtures']['symlinks'].fetch(k)
35
+ [k, v]
37
36
  end
38
37
 
39
- desc 'generate .fixtures.yml.local formm the entries in .fixtures.yml'
40
- task :generate do
41
- pwd = File.expand_path(@base_dir)
42
- _f = YAML.load_file(File.join(pwd,'.fixtures.yml'))
43
- _l = clean_yaml(fixtures_yml_local( _f ).to_yaml)
44
- _o = File.join(pwd,'.fixtures.yml.local')
45
- File.open( _o,'w'){|f| puts _l; f.puts _l}
46
- puts
47
- puts "# written to '#{_o}'"
48
- end
38
+ { 'fixtures' => { 'symlinks' => _s } }
39
+ end
49
40
 
41
+ desc 'generate .fixtures.yml.local formm the entries in .fixtures.yml'
42
+ task :generate do
43
+ pwd = File.expand_path(@base_dir)
44
+ _f = YAML.load_file(File.join(pwd, '.fixtures.yml'))
45
+ _l = clean_yaml(fixtures_yml_local(_f).to_yaml)
46
+ _o = File.join(pwd, '.fixtures.yml.local')
47
+ File.open(_o, 'w') do |f|
48
+ puts _l
49
+ f.puts _l
50
+ end
51
+ puts
52
+ puts "# written to '#{_o}'"
53
+ end
50
54
 
51
- desc "check for missing .fixture modules"
52
- task :diff do
53
- require 'yaml'
54
- pwd = File.expand_path(@base_dir)
55
- _f = YAML.load_file(File.join(pwd,'.fixtures.yml'))
55
+ desc 'check for missing .fixture modules'
56
+ task :diff do
57
+ require 'yaml'
58
+ pwd = File.expand_path(@base_dir)
59
+ _f = YAML.load_file(File.join(pwd, '.fixtures.yml'))
56
60
 
57
- unless File.file?(File.join(pwd,'.fixtures.yml.local'))
58
- fail "ERROR: Can't diff fixtures without a `.fixtures.yml.local` file"
59
- end
61
+ unless File.file?(File.join(pwd, '.fixtures.yml.local'))
62
+ raise "ERROR: Can't diff fixtures without a `.fixtures.yml.local` file"
63
+ end
60
64
 
61
- _fl = YAML.load_file(File.join(pwd,'.fixtures.yml.local'))
65
+ _fl = YAML.load_file(File.join(pwd, '.fixtures.yml.local'))
62
66
 
63
- # reduce modules
64
- _f_m = flatten_fixtures_hash(_f)
65
- _fl_m = flatten_fixtures_hash(_fl)
66
- _f_u = (_f_m-_fl_m)
67
- _fl_u = (_fl_m-_f_m)
67
+ # reduce modules
68
+ _f_m = flatten_fixtures_hash(_f)
69
+ _fl_m = flatten_fixtures_hash(_fl)
70
+ _f_u = (_f_m - _fl_m)
71
+ _fl_u = (_fl_m - _f_m)
68
72
 
69
- if (_f_u.size + _fl_u.size) > 0
73
+ if (_f_u.size + _fl_u.size).positive?
74
+ warn ''
75
+ warn 'WARNING: .fixtures.yml & .fixtures.yml.local have different files!'
76
+ warn ''
77
+ if _f_u.size.positive?
78
+ warn 'Unique modules to .fixtures.yml:'
79
+ _f_u.each { |x| warn " - #{x}" }
70
80
  warn ''
71
- warn "WARNING: .fixtures.yml & .fixtures.yml.local have different files!"
81
+ end
82
+ if _fl_u.size.positive?
83
+ warn 'Unique modules to .fixtures.yml.local:'
84
+ _fl_u.each { |x| warn " - #{x}" }
72
85
  warn ''
73
- if _f_u.size > 0
74
- warn 'Unique modules to .fixtures.yml:'
75
- _f_u.each{|x| warn " - #{x}"}
76
- warn ''
77
- end
78
- if _fl_u.size > 0
79
- warn 'Unique modules to .fixtures.yml.local:'
80
- _fl_u.each{|x| warn " - #{x}"}
81
- warn ''
82
- end
83
- exit 1
84
86
  end
87
+ exit 1
85
88
  end
86
89
  end
87
90
  end
@@ -1,25 +1,28 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Simp; end
2
4
  module Simp::Rake; end
5
+
3
6
  class Simp::Rake::Helpers
4
7
  module Simp::Rake::Helpers::RPMSpec
5
8
  require 'simp/rake/build/constants'
6
9
 
7
10
  include Simp::Rake::Build::Constants
8
11
 
9
- def rpm_template(simp_version=nil)
12
+ def rpm_template(simp_version = nil)
10
13
  simp_version = ENV.fetch('SIMP_BUILD_version', simp_version)
11
14
 
12
- if simp_version
13
- simp_main_version = simp_version.split('.').first
14
- else
15
- simp_main_version = 'default'
16
- end
15
+ simp_main_version = if simp_version
16
+ simp_version.split('.').first
17
+ else
18
+ 'default'
19
+ end
17
20
 
18
21
  template_file = File.join(File.dirname(__FILE__), 'assets', 'rpm_spec', "simp#{simp_main_version}.spec")
19
22
 
20
23
  raise "Error: Could not find template for SIMP version #{simp_version}" unless File.exist?(template_file)
21
24
 
22
- return File.read(template_file)
25
+ File.read(template_file)
23
26
  end
24
27
  end
25
28
  end
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Simp; end
2
4
  module Simp::Rake; end
3
5
 
4
6
  class Simp::Rake::Helpers
5
- VERSION = '5.24.0'
7
+ VERSION = '6.0.0'
6
8
  end
@@ -1,23 +1,25 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require File.expand_path('pkg', File.dirname(__FILE__))
2
4
  require File.expand_path('fixtures', File.dirname(__FILE__))
3
5
 
4
6
  module Simp; end
5
7
  module Simp::Rake; end
6
- class Simp::Rake::Helpers
7
8
 
9
+ class Simp::Rake::Helpers
8
10
  # dir = top-level of project,
9
- def initialize( dir = Dir.pwd )
10
- Simp::Rake::Pkg.new( dir ) do | t |
11
+ def initialize(dir = Dir.pwd)
12
+ Simp::Rake::Pkg.new(dir) do |t|
11
13
  t.clean_list << "#{t.base_dir}/spec/fixtures/hieradata/hiera.yaml"
12
14
  end
13
15
 
14
- Simp::Rake::Fixtures.new( dir )
16
+ Simp::Rake::Fixtures.new(dir)
15
17
  end
16
18
 
17
19
  def self.check_required_commands(required_commands)
18
20
  require 'facter'
19
21
 
20
- invalid_commands = Array.new
22
+ invalid_commands = []
21
23
 
22
24
  Array(required_commands).each do |command|
23
25
  unless Array(command).find { |x| Facter::Core::Execution.which(x) }
@@ -25,16 +27,16 @@ class Simp::Rake::Helpers
25
27
  end
26
28
  end
27
29
 
28
- unless invalid_commands.empty?
29
- errmsg = <<-EOM
30
+ return if invalid_commands.empty?
31
+
32
+ errmsg = <<-EOM
30
33
  Error: The following required commands were not found on your system:
31
34
 
32
35
  * #{invalid_commands.join("\n * ")}
33
36
 
34
37
  Please update your system and try again.
35
- EOM
38
+ EOM
36
39
 
37
- raise(errmsg)
38
- end
40
+ raise(errmsg)
39
41
  end
40
42
  end