Mercurial > repos > other > Puppet
comparison modules/stdlib/Gemfile @ 275:d9352a684e62
Mass update of modules to remove deprecation warnings
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sun, 26 Jan 2020 11:36:07 +0000 |
parents | c42fb28cff86 |
children |
comparison
equal
deleted
inserted
replaced
274:b2571c28fc27 | 275:d9352a684e62 |
---|---|
1 source ENV['GEM_SOURCE'] || 'https://rubygems.org' | 1 source ENV['GEM_SOURCE'] || 'https://rubygems.org' |
2 | 2 |
3 def location_for(place_or_version, fake_version = nil) | 3 def location_for(place_or_version, fake_version = nil) |
4 if place_or_version =~ %r{\A(git[:@][^#]*)#(.*)} | 4 git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?} |
5 [fake_version, { git: Regexp.last_match(1), branch: Regexp.last_match(2), require: false }].compact | 5 file_url_regex = %r{\Afile:\/\/(?<path>.*)} |
6 elsif place_or_version =~ %r{\Afile:\/\/(.*)} | 6 |
7 ['>= 0', { path: File.expand_path(Regexp.last_match(1)), require: false }] | 7 if place_or_version && (git_url = place_or_version.match(git_url_regex)) |
8 [fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact | |
9 elsif place_or_version && (file_url = place_or_version.match(file_url_regex)) | |
10 ['>= 0', { path: File.expand_path(file_url[:path]), require: false }] | |
8 else | 11 else |
9 [place_or_version, { require: false }] | 12 [place_or_version, { require: false }] |
10 end | |
11 end | |
12 | |
13 def gem_type(place_or_version) | |
14 if place_or_version =~ %r{\Agit[:@]} | |
15 :git | |
16 elsif !place_or_version.nil? && place_or_version.start_with?('file:') | |
17 :file | |
18 else | |
19 :gem | |
20 end | 13 end |
21 end | 14 end |
22 | 15 |
23 ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments | 16 ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments |
24 minor_version = ruby_version_segments[0..1].join('.') | 17 minor_version = ruby_version_segments[0..1].join('.') |
25 | 18 |
26 group :development do | 19 group :development do |
27 gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0') | 20 gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0') |
28 gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0') | 21 gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0') |
29 gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0') | 22 gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0') |
30 gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9') | 23 gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9') |
31 gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: [:ruby] | 24 gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) |
32 gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby] | 25 gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) |
33 gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw] | 26 gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] |
34 gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw] | 27 gem "puppet-module-posix-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby] |
35 gem "puppet-blacksmith", '~> 3.4', require: false | 28 gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby] |
36 end | 29 gem "puppet-module-win-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw] |
37 group :system_tests do | 30 gem "puppet-module-win-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] |
38 gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby] | 31 gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2') |
39 gem "puppet-module-win-system-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw] | |
40 gem "beaker", *location_for(ENV['BEAKER_VERSION'] || '~> 3.13') | |
41 gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1') | |
42 gem "beaker-pe", require: false | |
43 gem "beaker-hostgenerator" | |
44 gem "beaker-rspec" | |
45 end | 32 end |
46 | 33 |
47 puppet_version = ENV['PUPPET_GEM_VERSION'] | 34 puppet_version = ENV['PUPPET_GEM_VERSION'] |
48 puppet_type = gem_type(puppet_version) | |
49 facter_version = ENV['FACTER_GEM_VERSION'] | 35 facter_version = ENV['FACTER_GEM_VERSION'] |
50 hiera_version = ENV['HIERA_GEM_VERSION'] | 36 hiera_version = ENV['HIERA_GEM_VERSION'] |
51 | |
52 def puppet_older_than?(version) | |
53 puppet_version = ENV['PUPPET_GEM_VERSION'] | |
54 !puppet_version.nil? && | |
55 Gem::Version.correct?(puppet_version) && | |
56 Gem::Requirement.new("< #{version}").satisfied_by?(Gem::Version.new(puppet_version.dup)) | |
57 end | |
58 | 37 |
59 gems = {} | 38 gems = {} |
60 | 39 |
61 gems['puppet'] = location_for(puppet_version) | 40 gems['puppet'] = location_for(puppet_version) |
62 | 41 |
63 # If facter or hiera versions have been specified via the environment | 42 # If facter or hiera versions have been specified via the environment |
64 # variables, use those versions. If not, and if the puppet version is < 3.5.0, | 43 # variables |
65 # use known good versions of both for puppet < 3.5.0. | |
66 if facter_version | |
67 gems['facter'] = location_for(facter_version) | |
68 elsif puppet_type == :gem && puppet_older_than?('3.5.0') | |
69 gems['facter'] = ['>= 1.6.11', '<= 1.7.5', require: false] | |
70 end | |
71 | 44 |
72 if hiera_version | 45 gems['facter'] = location_for(facter_version) if facter_version |
73 gems['hiera'] = location_for(ENV['HIERA_GEM_VERSION']) | 46 gems['hiera'] = location_for(hiera_version) if hiera_version |
74 elsif puppet_type == :gem && puppet_older_than?('3.5.0') | |
75 gems['hiera'] = ['>= 1.0.0', '<= 1.3.0', require: false] | |
76 end | |
77 | 47 |
78 if Gem.win_platform? && (puppet_type != :gem || puppet_older_than?('3.5.0')) | 48 if Gem.win_platform? && puppet_version =~ %r{^(file:///|git://)} |
79 # For Puppet gems < 3.5.0 (tested as far back as 3.0.0) on Windows | |
80 if puppet_type == :gem | |
81 gems['ffi'] = ['1.9.0', require: false] | |
82 gems['minitar'] = ['0.5.4', require: false] | |
83 gems['win32-eventlog'] = ['0.5.3', '<= 0.6.5', require: false] | |
84 gems['win32-process'] = ['0.6.5', '<= 0.7.5', require: false] | |
85 gems['win32-security'] = ['~> 0.1.2', '<= 0.2.5', require: false] | |
86 gems['win32-service'] = ['0.7.2', '<= 0.8.8', require: false] | |
87 else | |
88 gems['ffi'] = ['~> 1.9.0', require: false] | |
89 gems['minitar'] = ['~> 0.5.4', require: false] | |
90 gems['win32-eventlog'] = ['~> 0.5', '<= 0.6.5', require: false] | |
91 gems['win32-process'] = ['~> 0.6', '<= 0.7.5', require: false] | |
92 gems['win32-security'] = ['~> 0.1', '<= 0.2.5', require: false] | |
93 gems['win32-service'] = ['~> 0.7', '<= 0.8.8', require: false] | |
94 end | |
95 | |
96 gems['win32-dir'] = ['~> 0.3', '<= 0.4.9', require: false] | |
97 | |
98 if RUBY_VERSION.start_with?('1.') | |
99 gems['win32console'] = ['1.3.2', require: false] | |
100 # sys-admin was removed in Puppet 3.7.0 and doesn't compile under Ruby 2.x | |
101 gems['sys-admin'] = ['1.5.6', require: false] | |
102 end | |
103 | |
104 # Puppet < 3.7.0 requires these. | |
105 # Puppet >= 3.5.0 gem includes these as requirements. | |
106 # The following versions are tested to work with 3.0.0 <= puppet < 3.7.0. | |
107 gems['win32-api'] = ['1.4.8', require: false] | |
108 gems['win32-taskscheduler'] = ['0.2.2', require: false] | |
109 gems['windows-api'] = ['0.4.3', require: false] | |
110 gems['windows-pr'] = ['1.2.3', require: false] | |
111 elsif Gem.win_platform? | |
112 # If we're using a Puppet gem on Windows which handles its own win32-xxx gem | 49 # If we're using a Puppet gem on Windows which handles its own win32-xxx gem |
113 # dependencies (>= 3.5.0), set the maximum versions (see PUP-6445). | 50 # dependencies (>= 3.5.0), set the maximum versions (see PUP-6445). |
114 gems['win32-dir'] = ['<= 0.4.9', require: false] | 51 gems['win32-dir'] = ['<= 0.4.9', require: false] |
115 gems['win32-eventlog'] = ['<= 0.6.5', require: false] | 52 gems['win32-eventlog'] = ['<= 0.6.5', require: false] |
116 gems['win32-process'] = ['<= 0.7.5', require: false] | 53 gems['win32-process'] = ['<= 0.7.5', require: false] |
117 gems['win32-security'] = ['<= 0.2.5', require: false] | 54 gems['win32-security'] = ['<= 0.2.5', require: false] |
118 gems['win32-service'] = ['<= 0.8.8', require: false] | 55 gems['win32-service'] = ['0.8.8', require: false] |
119 end | 56 end |
120 | 57 |
121 gems.each do |gem_name, gem_params| | 58 gems.each do |gem_name, gem_params| |
122 gem gem_name, *gem_params | 59 gem gem_name, *gem_params |
123 end | 60 end |