pdk 1.14.0 → 1.14.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -0
  3. data/lib/pdk.rb +63 -8
  4. data/lib/pdk/analytics.rb +14 -28
  5. data/lib/pdk/analytics/client/google_analytics.rb +2 -0
  6. data/lib/pdk/analytics/client/noop.rb +2 -0
  7. data/lib/pdk/analytics/util.rb +2 -0
  8. data/lib/pdk/answer_file.rb +2 -21
  9. data/lib/pdk/cli.rb +25 -13
  10. data/lib/pdk/cli/errors.rb +2 -0
  11. data/lib/pdk/cli/exec.rb +5 -0
  12. data/lib/pdk/cli/exec/command.rb +10 -6
  13. data/lib/pdk/cli/exec/interactive_command.rb +1 -1
  14. data/lib/pdk/cli/exec_group.rb +2 -0
  15. data/lib/pdk/cli/module/generate.rb +1 -1
  16. data/lib/pdk/cli/new/module.rb +8 -1
  17. data/lib/pdk/cli/new/test.rb +0 -1
  18. data/lib/pdk/cli/test/unit.rb +0 -3
  19. data/lib/pdk/cli/util.rb +24 -13
  20. data/lib/pdk/cli/util/command_redirector.rb +3 -2
  21. data/lib/pdk/cli/util/interview.rb +2 -1
  22. data/lib/pdk/cli/util/option_normalizer.rb +2 -0
  23. data/lib/pdk/cli/util/option_validator.rb +2 -0
  24. data/lib/pdk/cli/validate.rb +0 -1
  25. data/lib/pdk/config.rb +19 -13
  26. data/lib/pdk/config/json.rb +1 -1
  27. data/lib/pdk/config/json_schema_namespace.rb +3 -4
  28. data/lib/pdk/config/json_schema_setting.rb +1 -1
  29. data/lib/pdk/config/json_with_schema.rb +1 -2
  30. data/lib/pdk/config/namespace.rb +2 -0
  31. data/lib/pdk/config/setting.rb +2 -0
  32. data/lib/pdk/config/validator.rb +31 -0
  33. data/lib/pdk/config/yaml.rb +1 -2
  34. data/lib/pdk/config/yaml_with_schema.rb +1 -1
  35. data/lib/pdk/generate.rb +19 -13
  36. data/lib/pdk/generate/defined_type.rb +1 -1
  37. data/lib/pdk/generate/module.rb +1 -1
  38. data/lib/pdk/generate/provider.rb +2 -2
  39. data/lib/pdk/generate/puppet_class.rb +1 -1
  40. data/lib/pdk/generate/puppet_object.rb +2 -0
  41. data/lib/pdk/generate/task.rb +1 -1
  42. data/lib/pdk/generate/transport.rb +1 -1
  43. data/lib/pdk/logger.rb +1 -4
  44. data/lib/pdk/module.rb +7 -0
  45. data/lib/pdk/module/build.rb +2 -0
  46. data/lib/pdk/module/convert.rb +2 -0
  47. data/lib/pdk/module/metadata.rb +2 -1
  48. data/lib/pdk/module/templatedir.rb +2 -0
  49. data/lib/pdk/module/update.rb +1 -1
  50. data/lib/pdk/module/update_manager.rb +2 -0
  51. data/lib/pdk/report.rb +3 -1
  52. data/lib/pdk/report/event.rb +2 -0
  53. data/lib/pdk/template_file.rb +1 -0
  54. data/lib/pdk/tests/unit.rb +8 -3
  55. data/lib/pdk/util.rb +25 -7
  56. data/lib/pdk/util/bundler.rb +2 -0
  57. data/lib/pdk/util/env.rb +30 -0
  58. data/lib/pdk/util/filesystem.rb +4 -1
  59. data/lib/pdk/util/git.rb +3 -1
  60. data/lib/pdk/util/puppet_strings.rb +4 -2
  61. data/lib/pdk/util/puppet_version.rb +11 -1
  62. data/lib/pdk/util/ruby_version.rb +1 -0
  63. data/lib/pdk/util/template_uri.rb +2 -0
  64. data/lib/pdk/util/vendored_file.rb +2 -0
  65. data/lib/pdk/util/version.rb +2 -0
  66. data/lib/pdk/util/windows.rb +1 -0
  67. data/lib/pdk/util/windows/api_types.rb +32 -0
  68. data/lib/pdk/util/windows/process.rb +79 -0
  69. data/lib/pdk/validate.rb +24 -5
  70. data/lib/pdk/validate/base_validator.rb +2 -0
  71. data/lib/pdk/validate/metadata/metadata_json_lint.rb +1 -1
  72. data/lib/pdk/validate/metadata/metadata_syntax.rb +1 -1
  73. data/lib/pdk/validate/metadata_validator.rb +1 -3
  74. data/lib/pdk/validate/puppet/puppet_epp.rb +2 -2
  75. data/lib/pdk/validate/puppet/puppet_lint.rb +1 -1
  76. data/lib/pdk/validate/puppet/puppet_syntax.rb +2 -2
  77. data/lib/pdk/validate/puppet_validator.rb +1 -4
  78. data/lib/pdk/validate/ruby/rubocop.rb +1 -1
  79. data/lib/pdk/validate/ruby_validator.rb +1 -2
  80. data/lib/pdk/validate/tasks/metadata_lint.rb +1 -1
  81. data/lib/pdk/validate/tasks/name.rb +1 -1
  82. data/lib/pdk/validate/tasks_validator.rb +1 -3
  83. data/lib/pdk/validate/yaml/syntax.rb +1 -1
  84. data/lib/pdk/validate/yaml_validator.rb +1 -2
  85. data/lib/pdk/version.rb +1 -1
  86. data/locales/pdk.pot +243 -207
  87. metadata +7 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b164195fde06a45412e475f2afc5916a45208da08c90841dd30b9b01808ca6f
4
- data.tar.gz: e449e823329c01f0542da0c7a864e91019a9dad86054083c62f7f2bdf67488e6
3
+ metadata.gz: fa7118858cde5b6a4ea492a22683a8a077386d31e00157469186a373f91d8559
4
+ data.tar.gz: 4feab9cf89fd58a0c4023d04905efaccb56021dc7f44d0110b332de0fd1c7781
5
5
  SHA512:
6
- metadata.gz: 76b3ccf9f3b8d4ab51784f9690d44b0faf165af9a7b6df9ebee00d4a2c612050bf29a69b413163177d330ad2bf354a34437c9b870506c8e32a67d26e0d24e220
7
- data.tar.gz: 78816fe4269f30053ac201c8eb8bb86be89cc0dc2440e4fa3c9c13312417621a843a8751b4b009ab33b699b835471f012ec18b5e7ba1723566301c1d8ada054e
6
+ metadata.gz: 63e8e385a5f17a12dd36d3d6938ee601e0020b0e8b55603ec409d111cd0add4f5b748c1cc493b7612d02381d1832d56ab7de7c933ab85c9773eee463e9c60dc9
7
+ data.tar.gz: 33063bc92b0d8678cf2ac33333e23a1c3ca2d51bfece32eb326376f8681334e8b9574cf9a9df9c19da931248afc88197c0367e4659a81df9b96fca3ab6ba74fa
@@ -4,6 +4,37 @@ All changes to this repo will be documented in this file.
4
4
  See the [release notes](https://puppet.com/docs/pdk/latest/release_notes.html) for a high-level summary.
5
5
 
6
6
 
7
+ ## [v1.14.1](https://github.com/puppetlabs/pdk/tree/v1.14.1) (2019-11-01)
8
+ [Full Changelog](https://github.com/puppetlabs/pdk/compare/v1.14.0...v1.14.1)
9
+
10
+ **Fixed bugs:**
11
+
12
+ - "pdk validate" fails with "uninitialized constant PDK::VERSION \(NameError\)" [\#786](https://github.com/puppetlabs/pdk/issues/786)
13
+ - Networking facts missing for RHEL7 and facter 2.x [\#776](https://github.com/puppetlabs/pdk/issues/776)
14
+ - 'pdk test unit --verbose' does not change the rspec output format [\#773](https://github.com/puppetlabs/pdk/issues/773)
15
+ - rake build gives error NoMethodError: undefined method `package\_install?' for PDK::Util:Module [\#770](https://github.com/puppetlabs/pdk/issues/770)
16
+ - PDK::Util.in\_module\_root? can give a false positive result [\#768](https://github.com/puppetlabs/pdk/issues/768)
17
+ - pdk console --puppet-dev does not grab latest Puppet source [\#764](https://github.com/puppetlabs/pdk/issues/764)
18
+ - \(PDK-1527\) Handle pdk new module --skip-interview without module name [\#788](https://github.com/puppetlabs/pdk/pull/788) ([rodjek](https://github.com/rodjek))
19
+
20
+ **Merged pull requests:**
21
+
22
+ - \(maint\) Raise error when template content is empty or nil [\#794](https://github.com/puppetlabs/pdk/pull/794) ([rodjek](https://github.com/rodjek))
23
+ - \(PDK-1530\) Disable schema validation of config files [\#793](https://github.com/puppetlabs/pdk/pull/793) ([glennsarti](https://github.com/glennsarti))
24
+ - \(\#764\) Ensure --puppet-dev checkout is always updated [\#792](https://github.com/puppetlabs/pdk/pull/792) ([rodjek](https://github.com/rodjek))
25
+ - \(\#773\) Respect --verbose in interactive pdk test unit [\#791](https://github.com/puppetlabs/pdk/pull/791) ([rodjek](https://github.com/rodjek))
26
+ - \(PDK-1443\) Windows safe Tempfiles & environment variable access [\#790](https://github.com/puppetlabs/pdk/pull/790) ([rodjek](https://github.com/rodjek))
27
+ - \(maint\) Use same rspec pattern in acceptance suite [\#789](https://github.com/puppetlabs/pdk/pull/789) ([glennsarti](https://github.com/glennsarti))
28
+ - \(PDK-1519\) Print deprecation notice on Ruby \< 2.4 [\#785](https://github.com/puppetlabs/pdk/pull/785) ([rodjek](https://github.com/rodjek))
29
+ - \(maint\) Setup autoloads for TTY::Prompt [\#784](https://github.com/puppetlabs/pdk/pull/784) ([rtib](https://github.com/rtib))
30
+ - \(GH-768\) Fix in\_module\_root? gives false positives [\#783](https://github.com/puppetlabs/pdk/pull/783) ([glennsarti](https://github.com/glennsarti))
31
+ - \(maint\) Run acceptance:local tests in parallel during CI [\#781](https://github.com/puppetlabs/pdk/pull/781) ([rodjek](https://github.com/rodjek))
32
+ - \(MAINT\) Fix new provider error message [\#780](https://github.com/puppetlabs/pdk/pull/780) ([michaeltlombardi](https://github.com/michaeltlombardi))
33
+ - \(PDK-1525\) Use less restrictive minitar version [\#779](https://github.com/puppetlabs/pdk/pull/779) ([glennsarti](https://github.com/glennsarti))
34
+ - \(maint\) PDK as a library [\#778](https://github.com/puppetlabs/pdk/pull/778) ([rodjek](https://github.com/rodjek))
35
+ - \(PDK-1517\) Bump version to 1.15.0.pre [\#772](https://github.com/puppetlabs/pdk/pull/772) ([scotje](https://github.com/scotje))
36
+ - \(\#770\) Add missing require to PDK::Module::Metadata.from\_file [\#771](https://github.com/puppetlabs/pdk/pull/771) ([hajee](https://github.com/hajee))
37
+
7
38
  ## [v1.14.0](https://github.com/puppetlabs/pdk/tree/v1.14.0) (2019-10-09)
8
39
  [Full Changelog](https://github.com/puppetlabs/pdk/compare/v1.13.0...v1.14.0)
9
40
 
data/lib/pdk.rb CHANGED
@@ -1,12 +1,67 @@
1
- require 'pdk/analytics'
2
- require 'pdk/answer_file'
3
- require 'pdk/config'
4
- require 'pdk/generate'
5
1
  require 'pdk/i18n'
6
- require 'pdk/logger'
7
- require 'pdk/report'
8
- require 'pdk/validate'
9
- require 'pdk/version'
10
2
 
11
3
  module PDK
4
+ autoload :Analytics, 'pdk/analytics'
5
+ autoload :AnswerFile, 'pdk/answer_file'
6
+ autoload :Config, 'pdk/config'
7
+ autoload :Generate, 'pdk/generate'
8
+ autoload :Logger, 'pdk/logger'
9
+ autoload :Module, 'pdk/module'
10
+ autoload :Report, 'pdk/report'
11
+ autoload :TemplateFile, 'pdk/template_file'
12
+ autoload :TEMPLATE_REF, 'pdk/version'
13
+ autoload :Util, 'pdk/util'
14
+ autoload :Validate, 'pdk/validate'
15
+ autoload :VERSION, 'pdk/version'
16
+
17
+ # TODO: Refactor backend code to not raise CLI errors or use CLI util
18
+ # methods.
19
+ module CLI
20
+ autoload :ExitWithError, 'pdk/cli/errors'
21
+ autoload :FatalError, 'pdk/cli/errors'
22
+ autoload :Util, 'pdk/cli/util'
23
+ autoload :Exec, 'pdk/cli/exec'
24
+ autoload :ExecGroup, 'pdk/cli/exec_group'
25
+ end
26
+
27
+ module Test
28
+ autoload :Unit, 'pdk/tests/unit'
29
+ end
30
+
31
+ # Singleton accessor to the current answer file being used by the PDK.
32
+ #
33
+ # @return [PDK::AnswerFile] The AnswerFile instance currently being used by
34
+ # the PDK.
35
+ def self.answers
36
+ @answer_file ||= PDK::AnswerFile.new
37
+ end
38
+
39
+ # Specify the path to a custom answer file that the PDK should use.
40
+ #
41
+ # @param path [String] A path on disk to the file where the PDK should store
42
+ # answers to interactive questions.
43
+ def self.answer_file=(path)
44
+ @answer_file = PDK::AnswerFile.new(path)
45
+ end
46
+
47
+ def self.logger
48
+ @logger ||= PDK::Logger.new
49
+ end
50
+
51
+ def self.config
52
+ @config ||= PDK::Config.new
53
+ end
54
+
55
+ def self.analytics
56
+ @analytics ||= PDK::Analytics.build_client(
57
+ logger: PDK.logger,
58
+ disabled: PDK::Util::Env['PDK_DISABLE_ANALYTICS'] || PDK.config.user['analytics']['disabled'],
59
+ user_id: PDK.config.user['analytics']['user-id'],
60
+ app_id: "UA-139917834-#{PDK::Util.development_mode? ? '2' : '1'}",
61
+ client: :google_analytics,
62
+ app_name: 'pdk',
63
+ app_version: PDK::VERSION,
64
+ app_installer: PDK::Util.package_install? ? 'package' : 'gem',
65
+ )
66
+ end
12
67
  end
@@ -1,30 +1,15 @@
1
- require 'pdk/analytics/client/google_analytics'
2
- require 'pdk/analytics/client/noop'
1
+ require 'pdk'
3
2
 
4
- module PDK
5
- def self.analytics
6
- require 'pdk/config'
7
- require 'pdk/logger'
8
- require 'pdk/util'
9
- require 'pdk/version'
10
-
11
- @analytics ||= PDK::Analytics.build_client(
12
- logger: PDK.logger,
13
- disabled: ENV['PDK_DISABLE_ANALYTICS'] || PDK.config.user['analytics']['disabled'],
14
- user_id: PDK.config.user['analytics']['user-id'],
15
- app_id: "UA-139917834-#{PDK::Util.development_mode? ? '2' : '1'}",
16
- client: :google_analytics,
17
- app_name: 'pdk',
18
- app_version: PDK::VERSION,
19
- app_installer: PDK::Util.package_install? ? 'package' : 'gem',
20
- )
21
- end
3
+ autoload :Logger, 'logger'
22
4
 
5
+ module PDK
23
6
  module Analytics
24
- CLIENTS = {
25
- noop: Client::Noop,
26
- google_analytics: Client::GoogleAnalytics,
27
- }.freeze
7
+ autoload :Util, 'pdk/analytics/util'
8
+
9
+ module Client
10
+ autoload :Noop, 'pdk/analytics/client/noop'
11
+ autoload :GoogleAnalytics, 'pdk/analytics/client/google_analytics'
12
+ end
28
13
 
29
14
  def self.build_client(opts = {})
30
15
  opts[:logger] ||= ::Logger.new(STDERR)
@@ -32,13 +17,14 @@ module PDK
32
17
 
33
18
  if opts[:disabled]
34
19
  opts[:logger].debug 'Analytics opt-out is set, analytics will be disabled'
35
- CLIENTS[:noop].new(opts)
36
- else
37
- CLIENTS[opts[:client]].new(opts)
20
+ opts[:client] = :noop
38
21
  end
22
+
23
+ client_const = opts[:client].to_s.split('_').map(&:capitalize).join
24
+ PDK::Analytics::Client.const_get(client_const).new(opts)
39
25
  rescue StandardError => e
40
26
  opts[:logger].debug "Failed to initialize analytics client, analytics will be disabled: #{e}"
41
- CLIENTS[:noop].new(opts)
27
+ PDK::Analytics::Client::Noop.new(opts)
42
28
  end
43
29
  end
44
30
  end
@@ -1,3 +1,5 @@
1
+ require 'pdk'
2
+
1
3
  module PDK
2
4
  module Analytics
3
5
  module Client
@@ -1,3 +1,5 @@
1
+ require 'pdk'
2
+
1
3
  module PDK
2
4
  module Analytics
3
5
  module Client
@@ -1,3 +1,5 @@
1
+ require 'pdk'
2
+
1
3
  module PDK
2
4
  module Analytics
3
5
  module Util
@@ -1,22 +1,7 @@
1
- require 'pdk/util/filesystem'
1
+ require 'pdk'
2
+ autoload :JSON, 'json'
2
3
 
3
4
  module PDK
4
- # Singleton accessor to the current answer file being used by the PDK.
5
- #
6
- # @return [PDK::AnswerFile] The AnswerFile instance currently being used by
7
- # the PDK.
8
- def self.answers
9
- @answer_file ||= PDK::AnswerFile.new
10
- end
11
-
12
- # Specify the path to a custom answer file that the PDK should use.
13
- #
14
- # @param path [String] A path on disk to the file where the PDK should store
15
- # answers to interactive questions.
16
- def self.answer_file=(path)
17
- @answer_file = PDK::AnswerFile.new(path)
18
- end
19
-
20
5
  class AnswerFile
21
6
  attr_reader :answers
22
7
  attr_reader :answer_file_path
@@ -79,8 +64,6 @@ module PDK
79
64
  #
80
65
  # @return [Hash{String => Object}] The existing questions and answers.
81
66
  def read_from_disk
82
- require 'json'
83
-
84
67
  return {} if !File.file?(answer_file_path) || File.zero?(answer_file_path)
85
68
 
86
69
  unless File.readable?(answer_file_path)
@@ -109,8 +92,6 @@ module PDK
109
92
  #
110
93
  # @raise [PDK::CLI::FatalError] if the answer file can not be written to.
111
94
  def save_to_disk
112
- require 'json'
113
-
114
95
  FileUtils.mkdir_p(File.dirname(answer_file_path))
115
96
 
116
97
  write_file(answer_file_path, JSON.pretty_generate(answers))
@@ -1,18 +1,12 @@
1
1
  require 'cri'
2
2
 
3
- require 'pdk/analytics'
3
+ require 'pdk'
4
4
  require 'pdk/cli/errors'
5
- require 'pdk/cli/util'
6
- require 'pdk/cli/util/command_redirector'
7
- require 'pdk/cli/util/option_normalizer'
8
- require 'pdk/cli/util/option_validator'
9
- require 'pdk/config'
10
- require 'pdk/i18n'
11
- require 'pdk/logger'
12
- require 'pdk/report'
13
- require 'pdk/util/version'
14
- require 'pdk/util/puppet_version'
15
- require 'pdk/util/filesystem'
5
+
6
+ module TTY
7
+ autoload :Prompt, 'tty/prompt'
8
+ autoload :TestPrompt, 'tty/test_prompt'
9
+ end
16
10
 
17
11
  class Cri::Command::CriExitException
18
12
  def initialize(is_error:)
@@ -22,6 +16,8 @@ class Cri::Command::CriExitException
22
16
  end
23
17
 
24
18
  module PDK::CLI
19
+ autoload :Util, 'pdk/cli/util'
20
+
25
21
  # Attempt to anonymise the raw ARGV array if the command parsing failed.
26
22
  #
27
23
  # If an item does not start with '-' but is preceeded by an item that does
@@ -50,9 +46,25 @@ module PDK::CLI
50
46
  end
51
47
  end
52
48
 
49
+ def self.deprecated_runtime?
50
+ Gem::Version.new(RbConfig::CONFIG['ruby_version']) < Gem::Version.new('2.4.0')
51
+ end
52
+
53
53
  def self.run(args)
54
+ if deprecated_runtime?
55
+ PDK.logger.info(
56
+ text: _(
57
+ 'Support for Ruby versions older than 2.4 will be dropped in the ' \
58
+ 'future PDK 2.0.0 release. We recommend updating your Ruby ' \
59
+ 'installation to ensure that you can continue using the latest ' \
60
+ 'version of PDK.',
61
+ ),
62
+ wrap: true,
63
+ )
64
+ end
65
+
54
66
  @args = args
55
- PDK::Config.analytics_config_interview! unless ENV['PDK_DISABLE_ANALYTICS'] || PDK::Config.analytics_config_exist?
67
+ PDK::Config.analytics_config_interview! unless PDK::Util::Env['PDK_DISABLE_ANALYTICS'] || PDK::Config.analytics_config_exist?
56
68
  @base_cmd.run(args)
57
69
  rescue PDK::CLI::ExitWithError => e
58
70
  PDK.logger.send(e.log_level, e.message)
@@ -1,3 +1,5 @@
1
+ require 'pdk'
2
+
1
3
  module PDK
2
4
  module CLI
3
5
  class FatalError < StandardError
@@ -1,6 +1,11 @@
1
+ require 'pdk'
2
+
1
3
  module PDK
2
4
  module CLI
3
5
  module Exec
6
+ autoload :Command, 'pdk/cli/exec/command'
7
+ autoload :InteractiveCommand, 'pdk/cli/exec/interactive_command'
8
+
4
9
  def self.execute(*cmd)
5
10
  require 'pdk/cli/exec/command'
6
11
 
@@ -1,3 +1,5 @@
1
+ require 'pdk'
2
+
1
3
  module PDK
2
4
  module CLI
3
5
  module Exec
@@ -8,6 +10,8 @@ module PDK
8
10
  attr_accessor :environment
9
11
  attr_writer :exec_group
10
12
 
13
+ TEMPFILE_MODE = File::RDWR | File::BINARY | File::CREAT | File::TRUNC
14
+
11
15
  def initialize(*argv)
12
16
  require 'childprocess'
13
17
  require 'tempfile'
@@ -17,8 +21,8 @@ module PDK
17
21
  @process = ChildProcess.build(*@argv)
18
22
  @process.leader = true
19
23
 
20
- @stdout = Tempfile.new('stdout').tap { |io| io.sync = true }
21
- @stderr = Tempfile.new('stderr').tap { |io| io.sync = true }
24
+ @stdout = Tempfile.new('stdout', mode: TEMPFILE_MODE).tap { |io| io.sync = true }
25
+ @stderr = Tempfile.new('stderr', mode: TEMPFILE_MODE).tap { |io| io.sync = true }
22
26
 
23
27
  @process.io.stdout = @stdout
24
28
  @process.io.stderr = @stderr
@@ -124,7 +128,7 @@ module PDK
124
128
  protected
125
129
 
126
130
  def warn_on_legacy_env_vars!
127
- if ENV['PUPPET_GEM_VERSION']
131
+ if PDK::Util::Env['PUPPET_GEM_VERSION']
128
132
  PDK.logger.warn_once _(
129
133
  'PUPPET_GEM_VERSION is not supported by PDK. ' \
130
134
  'Use the --puppet-version option on your PDK command ' \
@@ -133,7 +137,7 @@ module PDK
133
137
  end
134
138
 
135
139
  %w[FACTER HIERA].each do |gem|
136
- if ENV["#{gem}_GEM_VERSION"]
140
+ if PDK::Util::Env["#{gem}_GEM_VERSION"]
137
141
  PDK.logger.warn_once _('%{varname} is not supported by PDK.') % { varname: "#{gem}_GEM_VERSION" }
138
142
  end
139
143
  end
@@ -144,7 +148,7 @@ module PDK
144
148
 
145
149
  resolved_env = {}
146
150
 
147
- resolved_env['TERM'] = ENV['TERM']
151
+ resolved_env['TERM'] = PDK::Util::Env['TERM']
148
152
  resolved_env['PUPPET_GEM_VERSION'] = nil
149
153
  resolved_env['FACTER_GEM_VERSION'] = nil
150
154
  resolved_env['HIERA_GEM_VERSION'] = nil
@@ -170,7 +174,7 @@ module PDK
170
174
  PDK::Util::RubyVersion.gem_paths_raw.map { |gem_path| File.join(gem_path, 'bin') },
171
175
  package_binpath,
172
176
  PDK::Util.package_install? ? PDK::Util::Git.git_paths : nil,
173
- ENV['PATH'],
177
+ PDK::Util::Env['PATH'],
174
178
  ].compact.flatten.join(File::PATH_SEPARATOR)
175
179
  end
176
180
 
@@ -1,4 +1,4 @@
1
- require 'pdk/cli/exec/command'
1
+ require 'pdk'
2
2
 
3
3
  module PDK
4
4
  module CLI
@@ -1,3 +1,5 @@
1
+ require 'pdk'
2
+
1
3
  module PDK
2
4
  module CLI
3
5
  class ExecGroup
@@ -10,7 +10,7 @@ module PDK::CLI
10
10
 
11
11
  run do |opts, args, _cmd|
12
12
  require 'pdk/generate/module'
13
- require 'tty-prompt'
13
+ require 'tty/prompt'
14
14
 
15
15
  module_name = args[0]
16
16
 
@@ -28,7 +28,14 @@ module PDK::CLI
28
28
  opts[:'full-interview'] = false
29
29
  end
30
30
 
31
- unless module_name.nil? || module_name.empty?
31
+ if module_name.nil? || module_name.empty?
32
+ if opts[:'skip-interview']
33
+ raise PDK::CLI::ExitWithError, _(
34
+ 'You must specify a module name on the command line when running ' \
35
+ 'with --skip-interview.',
36
+ )
37
+ end
38
+ else
32
39
  module_name_parts = module_name.split('-', 2)
33
40
  if module_name_parts.size > 1
34
41
  opts[:username] = module_name_parts[0]
@@ -33,7 +33,6 @@ module PDK::CLI
33
33
  end
34
34
 
35
35
  puppet_env = PDK::CLI::Util.puppet_from_opts_or_env(opts)
36
- PDK::Util::PuppetVersion.fetch_puppet_dev if opts[:'puppet-dev']
37
36
  PDK::Util::RubyVersion.use(puppet_env[:ruby_version])
38
37
  PDK::Util::Bundler.ensure_bundle!(puppet_env[:gemset])
39
38
 
@@ -37,7 +37,6 @@ module PDK::CLI
37
37
 
38
38
  # Ensure that the bundled gems are up to date and correct Ruby is activated before running or listing tests.
39
39
  puppet_env = PDK::CLI::Util.puppet_from_opts_or_env(opts)
40
- PDK::Util::PuppetVersion.fetch_puppet_dev if opts[:'puppet-dev']
41
40
  PDK::Util::RubyVersion.use(puppet_env[:ruby_version])
42
41
 
43
42
  opts.merge!(puppet_env[:gemset])
@@ -66,8 +65,6 @@ module PDK::CLI
66
65
  end
67
66
  end
68
67
  else
69
- PDK.logger.info _('--verbose has no effect when not used with --list') if opts[:verbose]
70
-
71
68
  report = PDK::Report.new
72
69
  report_formats = if opts[:format]
73
70
  opts[:interactive] = false