pdk 2.4.0 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +803 -1329
- data/LICENSE +201 -201
- data/README.md +165 -163
- data/exe/pdk +10 -10
- data/lib/pdk/analytics/client/google_analytics.rb +143 -143
- data/lib/pdk/analytics/client/noop.rb +25 -25
- data/lib/pdk/analytics/util.rb +19 -19
- data/lib/pdk/analytics.rb +30 -30
- data/lib/pdk/answer_file.rb +12 -12
- data/lib/pdk/bolt.rb +19 -19
- data/lib/pdk/cli/build.rb +82 -82
- data/lib/pdk/cli/bundle.rb +48 -48
- data/lib/pdk/cli/config/get.rb +26 -26
- data/lib/pdk/cli/config.rb +22 -22
- data/lib/pdk/cli/console.rb +148 -148
- data/lib/pdk/cli/convert.rb +52 -52
- data/lib/pdk/cli/env.rb +52 -52
- data/lib/pdk/cli/errors.rb +25 -25
- data/lib/pdk/cli/exec/command.rb +293 -293
- data/lib/pdk/cli/exec/interactive_command.rb +114 -114
- data/lib/pdk/cli/exec.rb +84 -84
- data/lib/pdk/cli/exec_group.rb +104 -104
- data/lib/pdk/cli/get/config.rb +24 -24
- data/lib/pdk/cli/get.rb +20 -20
- data/lib/pdk/cli/module/build.rb +12 -12
- data/lib/pdk/cli/module/generate.rb +47 -47
- data/lib/pdk/cli/module.rb +14 -14
- data/lib/pdk/cli/new/class.rb +32 -32
- data/lib/pdk/cli/new/defined_type.rb +32 -32
- data/lib/pdk/cli/new/fact.rb +29 -29
- data/lib/pdk/cli/new/function.rb +29 -29
- data/lib/pdk/cli/new/module.rb +53 -53
- data/lib/pdk/cli/new/provider.rb +29 -29
- data/lib/pdk/cli/new/task.rb +34 -34
- data/lib/pdk/cli/new/test.rb +52 -52
- data/lib/pdk/cli/new/transport.rb +27 -27
- data/lib/pdk/cli/new.rb +21 -21
- data/lib/pdk/cli/release/prep.rb +39 -39
- data/lib/pdk/cli/release/publish.rb +50 -50
- data/lib/pdk/cli/release.rb +194 -194
- data/lib/pdk/cli/remove/config.rb +80 -80
- data/lib/pdk/cli/remove.rb +20 -20
- data/lib/pdk/cli/set/config.rb +119 -119
- data/lib/pdk/cli/set.rb +20 -20
- data/lib/pdk/cli/test/unit.rb +90 -90
- data/lib/pdk/cli/test.rb +11 -11
- data/lib/pdk/cli/update.rb +64 -64
- data/lib/pdk/cli/util/command_redirector.rb +27 -27
- data/lib/pdk/cli/util/interview.rb +72 -72
- data/lib/pdk/cli/util/option_normalizer.rb +55 -55
- data/lib/pdk/cli/util/option_validator.rb +68 -68
- data/lib/pdk/cli/util/spinner.rb +13 -13
- data/lib/pdk/cli/util/update_manager_printer.rb +82 -82
- data/lib/pdk/cli/util.rb +305 -305
- data/lib/pdk/cli/validate.rb +116 -116
- data/lib/pdk/cli.rb +175 -175
- data/lib/pdk/config/analytics_schema.json +26 -26
- data/lib/pdk/config/errors.rb +5 -5
- data/lib/pdk/config/ini_file.rb +183 -183
- data/lib/pdk/config/ini_file_setting.rb +39 -39
- data/lib/pdk/config/json.rb +34 -34
- data/lib/pdk/config/json_schema_namespace.rb +142 -142
- data/lib/pdk/config/json_schema_setting.rb +53 -53
- data/lib/pdk/config/json_with_schema.rb +49 -49
- data/lib/pdk/config/namespace.rb +354 -354
- data/lib/pdk/config/setting.rb +135 -135
- data/lib/pdk/config/validator.rb +31 -31
- data/lib/pdk/config/yaml.rb +46 -46
- data/lib/pdk/config/yaml_with_schema.rb +59 -59
- data/lib/pdk/config.rb +390 -390
- data/lib/pdk/context/control_repo.rb +60 -60
- data/lib/pdk/context/module.rb +28 -28
- data/lib/pdk/context/none.rb +22 -22
- data/lib/pdk/context.rb +99 -99
- data/lib/pdk/control_repo.rb +90 -90
- data/lib/pdk/generate/defined_type.rb +43 -43
- data/lib/pdk/generate/fact.rb +25 -25
- data/lib/pdk/generate/function.rb +48 -48
- data/lib/pdk/generate/module.rb +352 -352
- data/lib/pdk/generate/provider.rb +28 -28
- data/lib/pdk/generate/puppet_class.rb +43 -43
- data/lib/pdk/generate/puppet_object.rb +232 -232
- data/lib/pdk/generate/task.rb +68 -68
- data/lib/pdk/generate/transport.rb +33 -33
- data/lib/pdk/generate.rb +24 -24
- data/lib/pdk/i18n.rb +4 -4
- data/lib/pdk/logger.rb +45 -45
- data/lib/pdk/module/build.rb +322 -322
- data/lib/pdk/module/convert.rb +296 -296
- data/lib/pdk/module/metadata.rb +202 -202
- data/lib/pdk/module/release.rb +260 -260
- data/lib/pdk/module/update.rb +131 -131
- data/lib/pdk/module/update_manager.rb +227 -227
- data/lib/pdk/module.rb +30 -30
- data/lib/pdk/report/event.rb +370 -370
- data/lib/pdk/report.rb +121 -121
- data/lib/pdk/template/fetcher/git.rb +85 -85
- data/lib/pdk/template/fetcher/local.rb +28 -28
- data/lib/pdk/template/fetcher.rb +98 -98
- data/lib/pdk/template/renderer/v1/legacy_template_dir.rb +116 -116
- data/lib/pdk/template/renderer/v1/renderer.rb +132 -132
- data/lib/pdk/template/renderer/v1/template_file.rb +102 -102
- data/lib/pdk/template/renderer/v1.rb +25 -25
- data/lib/pdk/template/renderer.rb +96 -96
- data/lib/pdk/template/template_dir.rb +67 -67
- data/lib/pdk/template.rb +59 -59
- data/lib/pdk/tests/unit.rb +252 -252
- data/lib/pdk/util/bundler.rb +259 -259
- data/lib/pdk/util/changelog_generator.rb +137 -137
- data/lib/pdk/util/env.rb +47 -47
- data/lib/pdk/util/filesystem.rb +138 -138
- data/lib/pdk/util/git.rb +179 -179
- data/lib/pdk/util/json_finder.rb +85 -85
- data/lib/pdk/util/puppet_strings.rb +125 -125
- data/lib/pdk/util/puppet_version.rb +266 -266
- data/lib/pdk/util/ruby_version.rb +179 -179
- data/lib/pdk/util/template_uri.rb +295 -295
- data/lib/pdk/util/vendored_file.rb +93 -93
- data/lib/pdk/util/version.rb +43 -43
- data/lib/pdk/util/windows/api_types.rb +82 -82
- data/lib/pdk/util/windows/file.rb +36 -36
- data/lib/pdk/util/windows/process.rb +79 -79
- data/lib/pdk/util/windows/string.rb +16 -16
- data/lib/pdk/util/windows.rb +15 -15
- data/lib/pdk/util.rb +278 -278
- data/lib/pdk/validate/control_repo/control_repo_validator_group.rb +23 -23
- data/lib/pdk/validate/control_repo/environment_conf_validator.rb +98 -98
- data/lib/pdk/validate/external_command_validator.rb +208 -208
- data/lib/pdk/validate/internal_ruby_validator.rb +100 -100
- data/lib/pdk/validate/invokable_validator.rb +228 -228
- data/lib/pdk/validate/metadata/metadata_json_lint_validator.rb +86 -86
- data/lib/pdk/validate/metadata/metadata_syntax_validator.rb +78 -78
- data/lib/pdk/validate/metadata/metadata_validator_group.rb +20 -20
- data/lib/pdk/validate/puppet/puppet_epp_validator.rb +133 -133
- data/lib/pdk/validate/puppet/puppet_lint_validator.rb +66 -66
- data/lib/pdk/validate/puppet/puppet_syntax_validator.rb +137 -137
- data/lib/pdk/validate/puppet/puppet_validator_group.rb +21 -21
- data/lib/pdk/validate/ruby/ruby_rubocop_validator.rb +80 -80
- data/lib/pdk/validate/ruby/ruby_validator_group.rb +19 -19
- data/lib/pdk/validate/tasks/tasks_metadata_lint_validator.rb +88 -88
- data/lib/pdk/validate/tasks/tasks_name_validator.rb +50 -50
- data/lib/pdk/validate/tasks/tasks_validator_group.rb +20 -20
- data/lib/pdk/validate/validator.rb +118 -118
- data/lib/pdk/validate/validator_group.rb +104 -104
- data/lib/pdk/validate/yaml/yaml_syntax_validator.rb +95 -95
- data/lib/pdk/validate/yaml/yaml_validator_group.rb +19 -19
- data/lib/pdk/validate.rb +94 -94
- data/lib/pdk/version.rb +4 -4
- data/lib/pdk.rb +76 -76
- data/locales/config.yaml +21 -21
- data/locales/pdk.pot +2111 -2094
- metadata +3 -3
@@ -1,179 +1,179 @@
|
|
1
|
-
require 'pdk'
|
2
|
-
require 'forwardable'
|
3
|
-
|
4
|
-
module PDK
|
5
|
-
module Util
|
6
|
-
class RubyVersion
|
7
|
-
class << self
|
8
|
-
extend Forwardable
|
9
|
-
|
10
|
-
def_delegators :instance, :gem_path, :gem_paths_raw, :gem_home, :available_puppet_versions, :bin_path
|
11
|
-
|
12
|
-
# TODO: resolve this
|
13
|
-
# rubocop:disable Lint/DuplicateMethods
|
14
|
-
attr_reader :instance
|
15
|
-
|
16
|
-
def instance(version = nil)
|
17
|
-
use(version) unless version.nil?
|
18
|
-
|
19
|
-
if @instance.nil?
|
20
|
-
@instance = {}
|
21
|
-
@instance.default_proc = proc do |hash, key|
|
22
|
-
hash[key] = new(key)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
@instance[active_ruby_version]
|
26
|
-
end
|
27
|
-
# rubocop:enable Lint/DuplicateMethods
|
28
|
-
|
29
|
-
def active_ruby_version
|
30
|
-
@active_ruby_version || default_ruby_version
|
31
|
-
end
|
32
|
-
|
33
|
-
def use(version)
|
34
|
-
if versions.key?(version)
|
35
|
-
@active_ruby_version = version
|
36
|
-
else
|
37
|
-
raise ArgumentError, _('Unknown Ruby version "%{ruby_version}"') % {
|
38
|
-
ruby_version: version,
|
39
|
-
}
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
def scan_for_packaged_rubies
|
44
|
-
require 'pdk/util'
|
45
|
-
|
46
|
-
ruby_basedir = File.join(PDK::Util.pdk_package_basedir, 'private', 'ruby', '*')
|
47
|
-
PDK::Util::Filesystem.glob(ruby_basedir).sort.map { |ruby_dir|
|
48
|
-
version = File.basename(ruby_dir)
|
49
|
-
[version, version.split('.').take(2).concat(['0']).join('.')]
|
50
|
-
}.reverse.to_h
|
51
|
-
end
|
52
|
-
|
53
|
-
def default_ruby_version
|
54
|
-
require 'pdk/util'
|
55
|
-
require 'pdk/util/puppet_version'
|
56
|
-
|
57
|
-
@default_ruby_version ||= if PDK::Util.package_install?
|
58
|
-
# Default to the ruby that supports the latest puppet gem. If you wish to default to a
|
59
|
-
# specific Puppet Gem version use the following example;
|
60
|
-
#
|
61
|
-
# PDK::Util::PuppetVersion.find_gem_for('5.5.10')[:ruby_version]
|
62
|
-
#
|
63
|
-
# For using the latest puppet gem:
|
64
|
-
# PDK::Util::PuppetVersion.latest_available[:ruby_version]
|
65
|
-
#
|
66
|
-
# Temporarily lock to Ruby 2.5.x as default until 2.7.x ecosystem is sorted
|
67
|
-
versions.keys.detect { |v| v =~ %r{^2\.5} }
|
68
|
-
else
|
69
|
-
# TODO: may not be a safe assumption that highest available version should be default
|
70
|
-
# WARNING Do NOT use PDK::Util::PuppetVersion.*** methods as it can recurse into this
|
71
|
-
# method and cause Stack Level Too Deep errors.
|
72
|
-
latest_ruby_version
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def latest_ruby_version
|
77
|
-
versions.keys.sort { |a, b| Gem::Version.new(b) <=> Gem::Version.new(a) }.first
|
78
|
-
end
|
79
|
-
|
80
|
-
def versions
|
81
|
-
require 'pdk/util'
|
82
|
-
|
83
|
-
@versions ||= if PDK::Util.package_install?
|
84
|
-
scan_for_packaged_rubies
|
85
|
-
else
|
86
|
-
{ RbConfig::CONFIG['RUBY_PROGRAM_VERSION'] => RbConfig::CONFIG['ruby_version'] }
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
attr_reader :ruby_version
|
92
|
-
|
93
|
-
def initialize(ruby_version = nil)
|
94
|
-
@ruby_version = ruby_version || default_ruby_version
|
95
|
-
end
|
96
|
-
|
97
|
-
def bin_path
|
98
|
-
require 'pdk/util'
|
99
|
-
|
100
|
-
if PDK::Util.package_install?
|
101
|
-
File.join(PDK::Util.pdk_package_basedir, 'private', 'ruby', ruby_version, 'bin')
|
102
|
-
else
|
103
|
-
RbConfig::CONFIG['bindir']
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
def gem_paths_raw
|
108
|
-
require 'pdk/util'
|
109
|
-
|
110
|
-
if PDK::Util.package_install?
|
111
|
-
# Subprocesses use their own set of gems which are managed by pdk or
|
112
|
-
# installed with the package. We also include the separate gem path
|
113
|
-
# where our packaged multi-puppet installations live.
|
114
|
-
[
|
115
|
-
File.join(PDK::Util.pdk_package_basedir, 'private', 'ruby', ruby_version, 'lib', 'ruby', 'gems', versions[ruby_version]),
|
116
|
-
File.join(PDK::Util.package_cachedir, 'ruby', versions[ruby_version]),
|
117
|
-
File.join(PDK::Util.pdk_package_basedir, 'private', 'puppet', 'ruby', versions[ruby_version]),
|
118
|
-
]
|
119
|
-
else
|
120
|
-
# This allows the subprocess to find the 'bundler' gem, which isn't
|
121
|
-
# in GEM_HOME for gem installs.
|
122
|
-
[File.absolute_path(File.join(bundler_basedir, '..', '..', '..'))]
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
def gem_path
|
127
|
-
gem_paths_raw.join(File::PATH_SEPARATOR)
|
128
|
-
end
|
129
|
-
|
130
|
-
def gem_home
|
131
|
-
require 'pdk/util'
|
132
|
-
|
133
|
-
# TODO: bundle install --path is deprecated
|
134
|
-
# `bundle install --path` ignores all "system" installed gems and
|
135
|
-
# causes unnecessary package installs. `bundle install` (without
|
136
|
-
# --path) installs into GEM_HOME, which by default is non-user
|
137
|
-
# writeable.
|
138
|
-
# To still use the pre-installed packages, but allow folks to install
|
139
|
-
# additional gems, we set GEM_HOME to the user's cachedir and put all
|
140
|
-
# other cache locations onto GEM_PATH.
|
141
|
-
# See https://stackoverflow.com/a/11277228 for background
|
142
|
-
File.join(PDK::Util.cachedir, 'ruby', versions[ruby_version])
|
143
|
-
end
|
144
|
-
|
145
|
-
def available_puppet_versions
|
146
|
-
return @available_puppet_versions unless @available_puppet_versions.nil?
|
147
|
-
|
148
|
-
puppet_spec_files = PDK::Util::Filesystem.glob(File.join(gem_home, 'specifications', '**', 'puppet*.gemspec'))
|
149
|
-
|
150
|
-
gem_path.split(File::PATH_SEPARATOR).each do |path|
|
151
|
-
puppet_spec_files += PDK::Util::Filesystem.glob(File.join(path, 'specifications', '**', 'puppet*.gemspec'))
|
152
|
-
end
|
153
|
-
|
154
|
-
puppet_specs = []
|
155
|
-
|
156
|
-
puppet_spec_files.each do |specfile|
|
157
|
-
spec = Gem::Specification.load(specfile)
|
158
|
-
puppet_specs << spec if spec.name == 'puppet'
|
159
|
-
end
|
160
|
-
|
161
|
-
@available_puppet_versions = puppet_specs.map(&:version).sort { |a, b| b <=> a }
|
162
|
-
end
|
163
|
-
|
164
|
-
private
|
165
|
-
|
166
|
-
def default_ruby_version
|
167
|
-
self.class.default_ruby_version
|
168
|
-
end
|
169
|
-
|
170
|
-
def versions
|
171
|
-
self.class.versions
|
172
|
-
end
|
173
|
-
|
174
|
-
def bundler_basedir
|
175
|
-
Gem::Specification.latest_specs.find { |spec| spec.name.eql?('bundler') }.base_dir
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
1
|
+
require 'pdk'
|
2
|
+
require 'forwardable'
|
3
|
+
|
4
|
+
module PDK
|
5
|
+
module Util
|
6
|
+
class RubyVersion
|
7
|
+
class << self
|
8
|
+
extend Forwardable
|
9
|
+
|
10
|
+
def_delegators :instance, :gem_path, :gem_paths_raw, :gem_home, :available_puppet_versions, :bin_path
|
11
|
+
|
12
|
+
# TODO: resolve this
|
13
|
+
# rubocop:disable Lint/DuplicateMethods
|
14
|
+
attr_reader :instance
|
15
|
+
|
16
|
+
def instance(version = nil)
|
17
|
+
use(version) unless version.nil?
|
18
|
+
|
19
|
+
if @instance.nil?
|
20
|
+
@instance = {}
|
21
|
+
@instance.default_proc = proc do |hash, key|
|
22
|
+
hash[key] = new(key)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
@instance[active_ruby_version]
|
26
|
+
end
|
27
|
+
# rubocop:enable Lint/DuplicateMethods
|
28
|
+
|
29
|
+
def active_ruby_version
|
30
|
+
@active_ruby_version || default_ruby_version
|
31
|
+
end
|
32
|
+
|
33
|
+
def use(version)
|
34
|
+
if versions.key?(version)
|
35
|
+
@active_ruby_version = version
|
36
|
+
else
|
37
|
+
raise ArgumentError, _('Unknown Ruby version "%{ruby_version}"') % {
|
38
|
+
ruby_version: version,
|
39
|
+
}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def scan_for_packaged_rubies
|
44
|
+
require 'pdk/util'
|
45
|
+
|
46
|
+
ruby_basedir = File.join(PDK::Util.pdk_package_basedir, 'private', 'ruby', '*')
|
47
|
+
PDK::Util::Filesystem.glob(ruby_basedir).sort.map { |ruby_dir|
|
48
|
+
version = File.basename(ruby_dir)
|
49
|
+
[version, version.split('.').take(2).concat(['0']).join('.')]
|
50
|
+
}.reverse.to_h
|
51
|
+
end
|
52
|
+
|
53
|
+
def default_ruby_version
|
54
|
+
require 'pdk/util'
|
55
|
+
require 'pdk/util/puppet_version'
|
56
|
+
|
57
|
+
@default_ruby_version ||= if PDK::Util.package_install?
|
58
|
+
# Default to the ruby that supports the latest puppet gem. If you wish to default to a
|
59
|
+
# specific Puppet Gem version use the following example;
|
60
|
+
#
|
61
|
+
# PDK::Util::PuppetVersion.find_gem_for('5.5.10')[:ruby_version]
|
62
|
+
#
|
63
|
+
# For using the latest puppet gem:
|
64
|
+
# PDK::Util::PuppetVersion.latest_available[:ruby_version]
|
65
|
+
#
|
66
|
+
# Temporarily lock to Ruby 2.5.x as default until 2.7.x ecosystem is sorted
|
67
|
+
versions.keys.detect { |v| v =~ %r{^2\.5} }
|
68
|
+
else
|
69
|
+
# TODO: may not be a safe assumption that highest available version should be default
|
70
|
+
# WARNING Do NOT use PDK::Util::PuppetVersion.*** methods as it can recurse into this
|
71
|
+
# method and cause Stack Level Too Deep errors.
|
72
|
+
latest_ruby_version
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def latest_ruby_version
|
77
|
+
versions.keys.sort { |a, b| Gem::Version.new(b) <=> Gem::Version.new(a) }.first
|
78
|
+
end
|
79
|
+
|
80
|
+
def versions
|
81
|
+
require 'pdk/util'
|
82
|
+
|
83
|
+
@versions ||= if PDK::Util.package_install?
|
84
|
+
scan_for_packaged_rubies
|
85
|
+
else
|
86
|
+
{ RbConfig::CONFIG['RUBY_PROGRAM_VERSION'] => RbConfig::CONFIG['ruby_version'] }
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
attr_reader :ruby_version
|
92
|
+
|
93
|
+
def initialize(ruby_version = nil)
|
94
|
+
@ruby_version = ruby_version || default_ruby_version
|
95
|
+
end
|
96
|
+
|
97
|
+
def bin_path
|
98
|
+
require 'pdk/util'
|
99
|
+
|
100
|
+
if PDK::Util.package_install?
|
101
|
+
File.join(PDK::Util.pdk_package_basedir, 'private', 'ruby', ruby_version, 'bin')
|
102
|
+
else
|
103
|
+
RbConfig::CONFIG['bindir']
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
def gem_paths_raw
|
108
|
+
require 'pdk/util'
|
109
|
+
|
110
|
+
if PDK::Util.package_install?
|
111
|
+
# Subprocesses use their own set of gems which are managed by pdk or
|
112
|
+
# installed with the package. We also include the separate gem path
|
113
|
+
# where our packaged multi-puppet installations live.
|
114
|
+
[
|
115
|
+
File.join(PDK::Util.pdk_package_basedir, 'private', 'ruby', ruby_version, 'lib', 'ruby', 'gems', versions[ruby_version]),
|
116
|
+
File.join(PDK::Util.package_cachedir, 'ruby', versions[ruby_version]),
|
117
|
+
File.join(PDK::Util.pdk_package_basedir, 'private', 'puppet', 'ruby', versions[ruby_version]),
|
118
|
+
]
|
119
|
+
else
|
120
|
+
# This allows the subprocess to find the 'bundler' gem, which isn't
|
121
|
+
# in GEM_HOME for gem installs.
|
122
|
+
[File.absolute_path(File.join(bundler_basedir, '..', '..', '..'))]
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def gem_path
|
127
|
+
gem_paths_raw.join(File::PATH_SEPARATOR)
|
128
|
+
end
|
129
|
+
|
130
|
+
def gem_home
|
131
|
+
require 'pdk/util'
|
132
|
+
|
133
|
+
# TODO: bundle install --path is deprecated
|
134
|
+
# `bundle install --path` ignores all "system" installed gems and
|
135
|
+
# causes unnecessary package installs. `bundle install` (without
|
136
|
+
# --path) installs into GEM_HOME, which by default is non-user
|
137
|
+
# writeable.
|
138
|
+
# To still use the pre-installed packages, but allow folks to install
|
139
|
+
# additional gems, we set GEM_HOME to the user's cachedir and put all
|
140
|
+
# other cache locations onto GEM_PATH.
|
141
|
+
# See https://stackoverflow.com/a/11277228 for background
|
142
|
+
File.join(PDK::Util.cachedir, 'ruby', versions[ruby_version])
|
143
|
+
end
|
144
|
+
|
145
|
+
def available_puppet_versions
|
146
|
+
return @available_puppet_versions unless @available_puppet_versions.nil?
|
147
|
+
|
148
|
+
puppet_spec_files = PDK::Util::Filesystem.glob(File.join(gem_home, 'specifications', '**', 'puppet*.gemspec'))
|
149
|
+
|
150
|
+
gem_path.split(File::PATH_SEPARATOR).each do |path|
|
151
|
+
puppet_spec_files += PDK::Util::Filesystem.glob(File.join(path, 'specifications', '**', 'puppet*.gemspec'))
|
152
|
+
end
|
153
|
+
|
154
|
+
puppet_specs = []
|
155
|
+
|
156
|
+
puppet_spec_files.each do |specfile|
|
157
|
+
spec = Gem::Specification.load(specfile)
|
158
|
+
puppet_specs << spec if spec.name == 'puppet'
|
159
|
+
end
|
160
|
+
|
161
|
+
@available_puppet_versions = puppet_specs.map(&:version).sort { |a, b| b <=> a }
|
162
|
+
end
|
163
|
+
|
164
|
+
private
|
165
|
+
|
166
|
+
def default_ruby_version
|
167
|
+
self.class.default_ruby_version
|
168
|
+
end
|
169
|
+
|
170
|
+
def versions
|
171
|
+
self.class.versions
|
172
|
+
end
|
173
|
+
|
174
|
+
def bundler_basedir
|
175
|
+
Gem::Specification.latest_specs.find { |spec| spec.name.eql?('bundler') }.base_dir
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|