pdk 2.6.1 → 2.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -1
- data/lib/pdk/analytics/client/google_analytics.rb +4 -2
- data/lib/pdk/cli/build.rb +17 -21
- data/lib/pdk/cli/bundle.rb +4 -5
- data/lib/pdk/cli/config/get.rb +6 -6
- data/lib/pdk/cli/config.rb +3 -3
- data/lib/pdk/cli/console.rb +7 -7
- data/lib/pdk/cli/convert.rb +11 -11
- data/lib/pdk/cli/env.rb +3 -4
- data/lib/pdk/cli/errors.rb +1 -1
- data/lib/pdk/cli/exec/command.rb +12 -14
- data/lib/pdk/cli/exec/interactive_command.rb +11 -11
- data/lib/pdk/cli/exec.rb +4 -4
- data/lib/pdk/cli/exec_group.rb +1 -3
- data/lib/pdk/cli/get/config.rb +5 -5
- data/lib/pdk/cli/get.rb +2 -2
- data/lib/pdk/cli/module/build.rb +3 -3
- data/lib/pdk/cli/module/generate.rb +4 -4
- data/lib/pdk/cli/module.rb +3 -3
- data/lib/pdk/cli/new/class.rb +4 -4
- data/lib/pdk/cli/new/defined_type.rb +4 -4
- data/lib/pdk/cli/new/fact.rb +3 -3
- data/lib/pdk/cli/new/function.rb +4 -4
- data/lib/pdk/cli/new/module.rb +10 -11
- data/lib/pdk/cli/new/provider.rb +3 -3
- data/lib/pdk/cli/new/task.rb +5 -5
- data/lib/pdk/cli/new/test.rb +7 -7
- data/lib/pdk/cli/new/transport.rb +3 -3
- data/lib/pdk/cli/new.rb +3 -3
- data/lib/pdk/cli/release/prep.rb +9 -9
- data/lib/pdk/cli/release/publish.rb +7 -11
- data/lib/pdk/cli/release.rb +35 -39
- data/lib/pdk/cli/remove/config.rb +15 -15
- data/lib/pdk/cli/remove.rb +2 -2
- data/lib/pdk/cli/set/config.rb +16 -16
- data/lib/pdk/cli/set.rb +2 -2
- data/lib/pdk/cli/test/unit.rb +13 -13
- data/lib/pdk/cli/test.rb +2 -2
- data/lib/pdk/cli/update.rb +19 -29
- data/lib/pdk/cli/util/command_redirector.rb +1 -1
- data/lib/pdk/cli/util/interview.rb +4 -4
- data/lib/pdk/cli/util/option_normalizer.rb +2 -2
- data/lib/pdk/cli/util/option_validator.rb +1 -1
- data/lib/pdk/cli/util.rb +19 -20
- data/lib/pdk/cli/validate.rb +16 -18
- data/lib/pdk/cli.rb +16 -33
- data/lib/pdk/config/ini_file_setting.rb +2 -2
- data/lib/pdk/config/json_schema_namespace.rb +3 -3
- data/lib/pdk/config/json_schema_setting.rb +1 -1
- data/lib/pdk/config/json_with_schema.rb +1 -1
- data/lib/pdk/config/namespace.rb +4 -4
- data/lib/pdk/config/setting.rb +5 -5
- data/lib/pdk/config/validator.rb +2 -2
- data/lib/pdk/config/yaml.rb +2 -2
- data/lib/pdk/config/yaml_with_schema.rb +3 -3
- data/lib/pdk/config.rb +18 -20
- data/lib/pdk/context/control_repo.rb +1 -1
- data/lib/pdk/context/module.rb +1 -1
- data/lib/pdk/context/none.rb +1 -1
- data/lib/pdk/generate/module.rb +52 -64
- data/lib/pdk/generate/puppet_object.rb +6 -6
- data/lib/pdk/generate/task.rb +1 -1
- data/lib/pdk/module/build.rb +11 -16
- data/lib/pdk/module/convert.rb +14 -16
- data/lib/pdk/module/metadata.rb +12 -12
- data/lib/pdk/module/release.rb +20 -19
- data/lib/pdk/module/update.rb +5 -5
- data/lib/pdk/module/update_manager.rb +6 -6
- data/lib/pdk/report/event.rb +11 -11
- data/lib/pdk/template/fetcher/git.rb +4 -4
- data/lib/pdk/template/fetcher.rb +1 -1
- data/lib/pdk/template/renderer/v1/legacy_template_dir.rb +1 -1
- data/lib/pdk/template/renderer/v1/renderer.rb +5 -7
- data/lib/pdk/template/renderer/v1/template_file.rb +3 -1
- data/lib/pdk/template/template_dir.rb +1 -1
- data/lib/pdk/template.rb +2 -2
- data/lib/pdk/tests/unit.rb +12 -12
- data/lib/pdk/util/bundler.rb +14 -14
- data/lib/pdk/util/changelog_generator.rb +6 -8
- data/lib/pdk/util/filesystem.rb +2 -2
- data/lib/pdk/util/git.rb +5 -5
- data/lib/pdk/util/puppet_strings.rb +2 -2
- data/lib/pdk/util/puppet_version.rb +24 -17
- data/lib/pdk/util/ruby_version.rb +2 -5
- data/lib/pdk/util/template_uri.rb +8 -8
- data/lib/pdk/util/vendored_file.rb +3 -3
- data/lib/pdk/util/windows/api_types.rb +3 -4
- data/lib/pdk/util/windows/file.rb +1 -1
- data/lib/pdk/util/windows/process.rb +5 -8
- data/lib/pdk/util.rb +2 -2
- data/lib/pdk/validate/control_repo/environment_conf_validator.rb +5 -5
- data/lib/pdk/validate/invokable_validator.rb +6 -6
- data/lib/pdk/validate/metadata/metadata_json_lint_validator.rb +2 -2
- data/lib/pdk/validate/metadata/metadata_syntax_validator.rb +2 -2
- data/lib/pdk/validate/puppet/puppet_epp_validator.rb +1 -1
- data/lib/pdk/validate/puppet/puppet_lint_validator.rb +1 -1
- data/lib/pdk/validate/puppet/puppet_plan_syntax_validator.rb +38 -0
- data/lib/pdk/validate/puppet/puppet_syntax_validator.rb +1 -1
- data/lib/pdk/validate/puppet/puppet_validator_group.rb +1 -0
- data/lib/pdk/validate/ruby/ruby_rubocop_validator.rb +1 -1
- data/lib/pdk/validate/tasks/tasks_metadata_lint_validator.rb +4 -4
- data/lib/pdk/validate/tasks/tasks_name_validator.rb +2 -5
- data/lib/pdk/validate/validator.rb +1 -1
- data/lib/pdk/validate/validator_group.rb +1 -1
- data/lib/pdk/validate/yaml/yaml_syntax_validator.rb +4 -4
- data/lib/pdk/validate.rb +2 -1
- data/lib/pdk/version.rb +2 -2
- data/lib/pdk.rb +0 -2
- metadata +32 -54
- data/lib/pdk/i18n.rb +0 -4
- data/locales/config.yaml +0 -21
- data/locales/pdk.pot +0 -2111
@@ -1,8 +1,8 @@
|
|
1
1
|
module PDK::CLI
|
2
2
|
@module_generate_cmd = @module_cmd.define_command do
|
3
3
|
name 'generate'
|
4
|
-
usage
|
5
|
-
summary
|
4
|
+
usage 'generate [options] <module_name>'
|
5
|
+
summary 'This command is now \'pdk new module\'.'
|
6
6
|
|
7
7
|
PDK::CLI.template_url_option(self)
|
8
8
|
PDK::CLI.template_ref_option(self)
|
@@ -21,7 +21,7 @@ module PDK::CLI
|
|
21
21
|
|
22
22
|
PDK::CLI::Util.validate_template_opts(opts)
|
23
23
|
|
24
|
-
PDK.logger.info(
|
24
|
+
PDK.logger.info("New modules are created using the 'pdk new module' command.")
|
25
25
|
prompt = TTY::Prompt.new(help_color: :cyan)
|
26
26
|
redirect = PDK::CLI::Util::CommandRedirector.new(prompt)
|
27
27
|
redirect.target_command('pdk new module')
|
@@ -37,7 +37,7 @@ module PDK::CLI
|
|
37
37
|
end
|
38
38
|
opts[:target_dir] = opts[:module_name]
|
39
39
|
|
40
|
-
PDK.logger.info(
|
40
|
+
PDK.logger.info('Creating new module: %{modname}' % { modname: module_name })
|
41
41
|
PDK::Generate::Module.invoke(opts)
|
42
42
|
else
|
43
43
|
exit 1
|
data/lib/pdk/cli/module.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module PDK::CLI
|
2
2
|
@module_cmd = @base_cmd.define_command do
|
3
3
|
name 'module'
|
4
|
-
usage
|
5
|
-
summary
|
6
|
-
description
|
4
|
+
usage 'module [options]'
|
5
|
+
summary 'Provide CLI-backwards compatibility to the puppet module tool.'
|
6
|
+
description 'This command is only for reminding you how to accomplish tasks with the PDK, when you were previously doing them with the puppet module command.'
|
7
7
|
default_subcommand 'help'
|
8
8
|
end
|
9
9
|
|
data/lib/pdk/cli/new/class.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
module PDK::CLI
|
2
2
|
@new_class_cmd = @new_cmd.define_command do
|
3
3
|
name 'class'
|
4
|
-
usage
|
5
|
-
summary
|
4
|
+
usage 'class [options] <class_name>'
|
5
|
+
summary 'Create a new class named <class_name> using given options'
|
6
6
|
|
7
7
|
run do |opts, args, _cmd|
|
8
8
|
require 'pdk/generate/puppet_class'
|
9
9
|
|
10
10
|
PDK::CLI::Util.ensure_in_module!(
|
11
|
-
message:
|
11
|
+
message: 'Classes can only be created from inside a valid module directory.',
|
12
12
|
log_level: :info,
|
13
13
|
)
|
14
14
|
|
@@ -20,7 +20,7 @@ module PDK::CLI
|
|
20
20
|
end
|
21
21
|
|
22
22
|
unless Util::OptionValidator.valid_class_name?(class_name)
|
23
|
-
raise PDK::CLI::ExitWithError,
|
23
|
+
raise PDK::CLI::ExitWithError, "'%{name}' is not a valid class name" % { name: class_name }
|
24
24
|
end
|
25
25
|
|
26
26
|
PDK::CLI::Util.analytics_screen_view('new_class', opts)
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module PDK::CLI
|
2
2
|
@new_define_cmd = @new_cmd.define_command do
|
3
3
|
name 'defined_type'
|
4
|
-
usage
|
5
|
-
summary
|
4
|
+
usage 'defined_type [options] <name>'
|
5
|
+
summary 'Create a new defined type named <name> using given options'
|
6
6
|
|
7
7
|
run do |opts, args, _cmd|
|
8
8
|
PDK::CLI::Util.ensure_in_module!(
|
9
|
-
message:
|
9
|
+
message: 'Defined types can only be created from inside a valid module directory.',
|
10
10
|
log_level: :info,
|
11
11
|
)
|
12
12
|
|
@@ -18,7 +18,7 @@ module PDK::CLI
|
|
18
18
|
end
|
19
19
|
|
20
20
|
unless Util::OptionValidator.valid_defined_type_name?(defined_type_name)
|
21
|
-
raise PDK::CLI::ExitWithError,
|
21
|
+
raise PDK::CLI::ExitWithError, "'%{name}' is not a valid defined type name" % { name: defined_type_name }
|
22
22
|
end
|
23
23
|
|
24
24
|
PDK::CLI::Util.analytics_screen_view('new_defined_type', opts)
|
data/lib/pdk/cli/new/fact.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module PDK::CLI
|
2
2
|
@new_fact_cmd = @new_cmd.define_command do
|
3
3
|
name 'fact'
|
4
|
-
usage
|
5
|
-
summary
|
4
|
+
usage 'fact [options] <name>'
|
5
|
+
summary 'Create a new custom fact named <name> using given options'
|
6
6
|
|
7
7
|
run do |opts, args, _cmd|
|
8
8
|
PDK::CLI::Util.ensure_in_module!
|
@@ -15,7 +15,7 @@ module PDK::CLI
|
|
15
15
|
end
|
16
16
|
|
17
17
|
unless Util::OptionValidator.valid_fact_name?(fact_name)
|
18
|
-
raise PDK::CLI::ExitWithError,
|
18
|
+
raise PDK::CLI::ExitWithError, "'%{name}' is not a valid fact name" % { name: fact_name }
|
19
19
|
end
|
20
20
|
|
21
21
|
PDK::CLI::Util.analytics_screen_view('new_fact', opts)
|
data/lib/pdk/cli/new/function.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module PDK::CLI
|
2
2
|
@new_function_cmd = @new_cmd.define_command do
|
3
3
|
name 'function'
|
4
|
-
usage
|
5
|
-
summary
|
6
|
-
option :t, :type,
|
4
|
+
usage 'function [options] <name>'
|
5
|
+
summary 'Create a new function named <name> using given options'
|
6
|
+
option :t, :type, 'The function type, (native or v4)', argument: :required, default: 'native'
|
7
7
|
|
8
8
|
run do |opts, args, _cmd|
|
9
9
|
PDK::CLI::Util.ensure_in_module!
|
@@ -16,7 +16,7 @@ module PDK::CLI
|
|
16
16
|
end
|
17
17
|
|
18
18
|
unless Util::OptionValidator.valid_function_name?(function_name)
|
19
|
-
raise PDK::CLI::ExitWithError,
|
19
|
+
raise PDK::CLI::ExitWithError, "'%{name}' is not a valid function name" % { name: function_name }
|
20
20
|
end
|
21
21
|
|
22
22
|
PDK::CLI::Util.analytics_screen_view('new_function', opts)
|
data/lib/pdk/cli/new/module.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
module PDK::CLI
|
2
2
|
@new_module_cmd = @new_cmd.define_command do
|
3
3
|
name 'module'
|
4
|
-
usage
|
5
|
-
summary
|
4
|
+
usage 'module [options] [module_name] [target_dir]'
|
5
|
+
summary 'Create a new module named [module_name] using given options'
|
6
6
|
|
7
7
|
PDK::CLI.template_url_option(self)
|
8
8
|
PDK::CLI.template_ref_option(self)
|
9
9
|
PDK::CLI.skip_interview_option(self)
|
10
10
|
PDK::CLI.full_interview_option(self)
|
11
11
|
|
12
|
-
option nil, 'license',
|
13
|
-
"This should be a identifier from https://spdx.org/licenses/. Common values are 'Apache-2.0', 'MIT', or 'proprietary'."
|
14
|
-
option nil, 'skip-bundle-install',
|
12
|
+
option nil, 'license', 'Specifies the license this module is written under. ' \
|
13
|
+
"This should be a identifier from https://spdx.org/licenses/. Common values are 'Apache-2.0', 'MIT', or 'proprietary'.", argument: :required
|
14
|
+
option nil, 'skip-bundle-install', 'Do not automatically run `bundle install` after creating the module.', hidden: true
|
15
15
|
|
16
16
|
run do |opts, args, _cmd|
|
17
17
|
require 'pdk/generate/module'
|
@@ -24,16 +24,15 @@ module PDK::CLI
|
|
24
24
|
PDK::CLI::Util.analytics_screen_view('new_module', opts)
|
25
25
|
|
26
26
|
if opts[:'skip-interview'] && opts[:'full-interview']
|
27
|
-
PDK.logger.info
|
27
|
+
PDK.logger.info 'Ignoring --full-interview and continuing with --skip-interview.'
|
28
28
|
opts[:'full-interview'] = false
|
29
29
|
end
|
30
30
|
|
31
31
|
if module_name.nil? || module_name.empty?
|
32
32
|
if opts[:'skip-interview']
|
33
|
-
raise PDK::CLI::ExitWithError,
|
34
|
-
|
35
|
-
|
36
|
-
)
|
33
|
+
raise PDK::CLI::ExitWithError,
|
34
|
+
'You must specify a module name on the command line when running ' \
|
35
|
+
'with --skip-interview.'
|
37
36
|
end
|
38
37
|
else
|
39
38
|
module_name_parts = module_name.split('-', 2)
|
@@ -46,7 +45,7 @@ module PDK::CLI
|
|
46
45
|
opts[:target_dir] = target_dir.nil? ? opts[:module_name] : target_dir
|
47
46
|
end
|
48
47
|
|
49
|
-
PDK.logger.info(
|
48
|
+
PDK.logger.info('Creating new module: %{modname}' % { modname: module_name })
|
50
49
|
PDK::Generate::Module.invoke(opts)
|
51
50
|
end
|
52
51
|
end
|
data/lib/pdk/cli/new/provider.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module PDK::CLI
|
2
2
|
@new_provider_cmd = @new_cmd.define_command do
|
3
3
|
name 'provider'
|
4
|
-
usage
|
5
|
-
summary
|
4
|
+
usage 'provider [options] <name>'
|
5
|
+
summary '[experimental] Create a new ruby provider named <name> using given options'
|
6
6
|
|
7
7
|
run do |opts, args, _cmd|
|
8
8
|
PDK::CLI::Util.ensure_in_module!
|
@@ -15,7 +15,7 @@ module PDK::CLI
|
|
15
15
|
end
|
16
16
|
|
17
17
|
unless Util::OptionValidator.valid_provider_name?(provider_name)
|
18
|
-
raise PDK::CLI::ExitWithError,
|
18
|
+
raise PDK::CLI::ExitWithError, "'%{name}' is not a valid provider name" % { name: provider_name }
|
19
19
|
end
|
20
20
|
|
21
21
|
PDK::CLI::Util.analytics_screen_view('new_provider', opts)
|
data/lib/pdk/cli/new/task.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
module PDK::CLI
|
2
2
|
@new_task_cmd = @new_cmd.define_command do
|
3
3
|
name 'task'
|
4
|
-
usage
|
5
|
-
summary
|
4
|
+
usage 'task [options] <name>'
|
5
|
+
summary 'Create a new task named <name> using given options'
|
6
6
|
|
7
|
-
option nil, :description,
|
7
|
+
option nil, :description, 'A short description of the purpose of the task', argument: :required
|
8
8
|
|
9
9
|
run do |opts, args, _cmd|
|
10
10
|
require 'pdk/generate/task'
|
11
11
|
|
12
12
|
PDK::CLI::Util.ensure_in_module!(
|
13
|
-
message:
|
13
|
+
message: 'Tasks can only be created from inside a valid module directory.',
|
14
14
|
log_level: :info,
|
15
15
|
)
|
16
16
|
|
@@ -22,7 +22,7 @@ module PDK::CLI
|
|
22
22
|
end
|
23
23
|
|
24
24
|
unless Util::OptionValidator.valid_task_name?(task_name)
|
25
|
-
raise PDK::CLI::ExitWithError,
|
25
|
+
raise PDK::CLI::ExitWithError, "'%{name}' is not a valid task name" % { name: task_name }
|
26
26
|
end
|
27
27
|
|
28
28
|
PDK::CLI::Util.analytics_screen_view('new_task', opts)
|
data/lib/pdk/cli/new/test.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module PDK::CLI
|
2
2
|
@new_define_cmd = @new_cmd.define_command do
|
3
3
|
name 'test'
|
4
|
-
usage
|
5
|
-
summary
|
6
|
-
flag :u, :unit,
|
4
|
+
usage 'test [options] <name>'
|
5
|
+
summary 'Create a new test for the object named <name>'
|
6
|
+
flag :u, :unit, 'Create a new unit test.'
|
7
7
|
PDK::CLI.puppet_version_options(self)
|
8
8
|
PDK::CLI.puppet_dev_option(self)
|
9
9
|
|
@@ -13,7 +13,7 @@ module PDK::CLI
|
|
13
13
|
|
14
14
|
PDK::CLI::Util.validate_puppet_version_opts(opts)
|
15
15
|
PDK::CLI::Util.ensure_in_module!(
|
16
|
-
message:
|
16
|
+
message: 'Tests can only be created from inside a valid module directory.',
|
17
17
|
log_level: :info,
|
18
18
|
)
|
19
19
|
|
@@ -27,7 +27,7 @@ module PDK::CLI
|
|
27
27
|
unless opts[:unit]
|
28
28
|
# At a future time, we'll replace this conditional with an interactive
|
29
29
|
# question to choose the test type.
|
30
|
-
PDK.logger.info
|
30
|
+
PDK.logger.info 'Test type not specified, assuming unit.'
|
31
31
|
opts[:unit] = true
|
32
32
|
end
|
33
33
|
|
@@ -43,9 +43,9 @@ module PDK::CLI
|
|
43
43
|
updates = generator.new(PDK.context, obj['name'], opts.merge(spec_only: true)).run
|
44
44
|
PDK::CLI::Util::UpdateManagerPrinter.print_summary(updates, tense: :past)
|
45
45
|
rescue PDK::Util::PuppetStrings::NoObjectError
|
46
|
-
raise PDK::CLI::ExitWithError,
|
46
|
+
raise PDK::CLI::ExitWithError, 'Unable to find anything called "%{object}" to generate unit tests for.' % { object: object_name }
|
47
47
|
rescue PDK::Util::PuppetStrings::NoGeneratorError => e
|
48
|
-
raise PDK::CLI::ExitWithError,
|
48
|
+
raise PDK::CLI::ExitWithError, 'PDK does not support generating unit tests for "%{object_type}" objects.' % { object_type: e.message }
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module PDK::CLI
|
2
2
|
@new_transport_cmd = @new_cmd.define_command do
|
3
3
|
name 'transport'
|
4
|
-
usage
|
5
|
-
summary
|
4
|
+
usage 'transport [options] <name>'
|
5
|
+
summary '[experimental] Create a new ruby transport named <name> using given options'
|
6
6
|
|
7
7
|
run do |opts, args, _cmd|
|
8
8
|
PDK::CLI::Util.ensure_in_module!
|
@@ -15,7 +15,7 @@ module PDK::CLI
|
|
15
15
|
end
|
16
16
|
|
17
17
|
unless Util::OptionValidator.valid_transport_name?(transport_name)
|
18
|
-
raise PDK::CLI::ExitWithError,
|
18
|
+
raise PDK::CLI::ExitWithError, "'%{name}' is not a valid transport name" % { name: transport_name }
|
19
19
|
end
|
20
20
|
|
21
21
|
require 'pdk/generate/transport'
|
data/lib/pdk/cli/new.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module PDK::CLI
|
2
2
|
@new_cmd = @base_cmd.define_command do
|
3
3
|
name 'new'
|
4
|
-
usage
|
5
|
-
summary
|
6
|
-
description
|
4
|
+
usage 'new <thing> [options]'
|
5
|
+
summary 'create a new module, etc.'
|
6
|
+
description 'Creates a new <thing> using relevant options.'
|
7
7
|
default_subcommand 'help'
|
8
8
|
end
|
9
9
|
|
data/lib/pdk/cli/release/prep.rb
CHANGED
@@ -3,22 +3,22 @@ require 'pdk/cli/release'
|
|
3
3
|
module PDK::CLI
|
4
4
|
@release_prep_cmd = @release_cmd.define_command do
|
5
5
|
name 'prep'
|
6
|
-
usage
|
7
|
-
summary
|
6
|
+
usage 'prep [options]'
|
7
|
+
summary '(Experimental) Performs all the pre-release checks to ensure module is ready to be released'
|
8
8
|
|
9
|
-
flag nil, :force,
|
10
|
-
flag nil, :'skip-validation',
|
11
|
-
flag nil, :'skip-changelog',
|
12
|
-
flag nil, :'skip-dependency',
|
13
|
-
flag nil, :'skip-documentation',
|
9
|
+
flag nil, :force, 'Prepare the module automatically, with no prompts.'
|
10
|
+
flag nil, :'skip-validation', 'Skips the module validation check.'
|
11
|
+
flag nil, :'skip-changelog', 'Skips the automatic changelog generation.'
|
12
|
+
flag nil, :'skip-dependency', 'Skips the module dependency check.'
|
13
|
+
flag nil, :'skip-documentation', 'Skips the documentation update.'
|
14
14
|
|
15
|
-
option nil, :version,
|
15
|
+
option nil, :version, 'Update the module to the specified version prior to release. When not specified, the new version will be computed from the Changelog where possible.',
|
16
16
|
argument: :required
|
17
17
|
|
18
18
|
run do |opts, _args, cmd|
|
19
19
|
# Make sure build is being run in a valid module directory with a metadata.json
|
20
20
|
PDK::CLI::Util.ensure_in_module!(
|
21
|
-
message:
|
21
|
+
message: "`pdk release #{cmd.name}` can only be run from inside a valid module with a metadata.json.",
|
22
22
|
log_level: :info,
|
23
23
|
)
|
24
24
|
|
@@ -3,20 +3,20 @@ require 'pdk/cli/release'
|
|
3
3
|
module PDK::CLI
|
4
4
|
@release_publish_cmd = @release_cmd.define_command do
|
5
5
|
name 'publish'
|
6
|
-
usage
|
7
|
-
summary
|
6
|
+
usage 'publish [options] <tarball>'
|
7
|
+
summary '(Experimental) Publishes the module <tarball> to the Forge.'
|
8
8
|
|
9
|
-
flag nil, :force,
|
9
|
+
flag nil, :force, 'Publish the module automatically, with no prompts.'
|
10
10
|
|
11
|
-
option nil, :'forge-upload-url',
|
11
|
+
option nil, :'forge-upload-url', 'Set forge upload url path.',
|
12
12
|
argument: :required, default: 'https://forgeapi.puppetlabs.com/v3/releases'
|
13
13
|
|
14
|
-
option nil, :'forge-token',
|
14
|
+
option nil, :'forge-token', 'Set Forge API token (you may also set via environment variable PDK_FORGE_TOKEN)', argument: :required
|
15
15
|
|
16
16
|
run do |opts, _args, cmd|
|
17
17
|
# Make sure build is being run in a valid module directory with a metadata.json
|
18
18
|
PDK::CLI::Util.ensure_in_module!(
|
19
|
-
message:
|
19
|
+
message: "`pdk release #{cmd.name}` can only be run from inside a valid module with a metadata.json.",
|
20
20
|
log_level: :info,
|
21
21
|
)
|
22
22
|
|
@@ -30,11 +30,7 @@ module PDK::CLI
|
|
30
30
|
opts[:'forge-token'] ||= PDK::Util::Env['PDK_FORGE_TOKEN']
|
31
31
|
|
32
32
|
if opts[:'forge-token'].nil? || opts[:'forge-token'].empty?
|
33
|
-
PDK.logger.error
|
34
|
-
'You must supply a Forge API token either via `--forge-token` option ' \
|
35
|
-
'or PDK_FORGE_TOKEN environment variable.',
|
36
|
-
)
|
37
|
-
|
33
|
+
PDK.logger.error 'You must supply a Forge API token either via `--forge-token` option or PDK_FORGE_TOKEN environment variable.'
|
38
34
|
exit 1
|
39
35
|
end
|
40
36
|
|
data/lib/pdk/cli/release.rb
CHANGED
@@ -8,33 +8,33 @@ require 'pdk/module/build'
|
|
8
8
|
module PDK::CLI
|
9
9
|
@release_cmd = @base_cmd.define_command do
|
10
10
|
name 'release'
|
11
|
-
usage
|
12
|
-
summary
|
13
|
-
|
14
|
-
flag nil, :force,
|
15
|
-
flag nil, :'skip-validation',
|
16
|
-
flag nil, :'skip-changelog',
|
17
|
-
flag nil, :'skip-dependency',
|
18
|
-
flag nil, :'skip-documentation',
|
19
|
-
flag nil, :'skip-build',
|
20
|
-
flag nil, :'skip-publish',
|
21
|
-
|
22
|
-
option nil, :'forge-upload-url',
|
11
|
+
usage 'release [options]'
|
12
|
+
summary '(Experimental) Release a module to the Puppet Forge.'
|
13
|
+
|
14
|
+
flag nil, :force, 'Release the module automatically, with no prompts.'
|
15
|
+
flag nil, :'skip-validation', 'Skips the module validation check.'
|
16
|
+
flag nil, :'skip-changelog', 'Skips the automatic changelog generation.'
|
17
|
+
flag nil, :'skip-dependency', 'Skips the module dependency check.'
|
18
|
+
flag nil, :'skip-documentation', 'Skips the documentation update.'
|
19
|
+
flag nil, :'skip-build', 'Skips module build.'
|
20
|
+
flag nil, :'skip-publish', 'Skips publishing the module to the forge.'
|
21
|
+
|
22
|
+
option nil, :'forge-upload-url', 'Set forge upload url path.',
|
23
23
|
argument: :required, default: 'https://forgeapi.puppetlabs.com/v3/releases'
|
24
24
|
|
25
|
-
option nil, :'forge-token',
|
25
|
+
option nil, :'forge-token', 'Set Forge API token.',
|
26
26
|
argument: :optional
|
27
27
|
|
28
|
-
option nil, :version,
|
28
|
+
option nil, :version, 'Update the module to the specified version prior to release. When not specified, the new version will be computed from the Changelog where possible.',
|
29
29
|
argument: :required
|
30
30
|
|
31
|
-
option nil, :file,
|
31
|
+
option nil, :file, 'Path to the built module to push to the Forge. This option can only be used when --skip-build is also used. Defaults to pkg/<module version>.tar.gz',
|
32
32
|
argument: :required
|
33
33
|
|
34
34
|
run do |opts, _args, _cmd|
|
35
35
|
# Make sure build is being run in a valid module directory with a metadata.json
|
36
36
|
PDK::CLI::Util.ensure_in_module!(
|
37
|
-
message:
|
37
|
+
message: '`pdk release` can only be run from inside a valid module with a metadata.json.',
|
38
38
|
log_level: :info,
|
39
39
|
)
|
40
40
|
|
@@ -57,12 +57,8 @@ module PDK::CLI
|
|
57
57
|
def self.module_compatibility_checks!(release, opts)
|
58
58
|
unless release.module_metadata.forge_ready?
|
59
59
|
if opts[:force]
|
60
|
-
PDK.logger.warn
|
61
|
-
|
62
|
-
'These missing fields may affect the visibility of the module on the Forge.',
|
63
|
-
) % {
|
64
|
-
fields: release.module_metadata.missing_fields.join(', '),
|
65
|
-
}
|
60
|
+
PDK.logger.warn "This module is missing the following fields in the metadata.json: #{release.module_metadata.missing_fields.join(', ')}. " \
|
61
|
+
'These missing fields may affect the visibility of the module on the Forge.'
|
66
62
|
else
|
67
63
|
release.module_metadata.interview_for_forge!
|
68
64
|
release.write_module_metadata!
|
@@ -71,13 +67,13 @@ module PDK::CLI
|
|
71
67
|
|
72
68
|
unless release.pdk_compatible? # rubocop:disable Style/GuardClause Nope!
|
73
69
|
if opts[:force]
|
74
|
-
PDK.logger.warn
|
70
|
+
PDK.logger.warn 'This module is not compatible with PDK, so PDK can not validate or test this build.'
|
75
71
|
else
|
76
|
-
PDK.logger.info
|
77
|
-
|
78
|
-
|
79
|
-
unless PDK::CLI::Util.prompt_for_yes(
|
80
|
-
PDK.logger.info
|
72
|
+
PDK.logger.info 'This module is not compatible with PDK, so PDK can not validate or test this build. ' \
|
73
|
+
'Unvalidated modules may have errors when uploading to the Forge. ' \
|
74
|
+
'To make this module PDK compatible and use validate features, cancel the build and run `pdk convert`.'
|
75
|
+
unless PDK::CLI::Util.prompt_for_yes('Continue build without converting?')
|
76
|
+
PDK.logger.info 'Build cancelled; exiting.'
|
81
77
|
PDK::Util.exit_process(1)
|
82
78
|
end
|
83
79
|
end
|
@@ -96,42 +92,42 @@ module PDK::CLI
|
|
96
92
|
unless opts[:'skip-validation']
|
97
93
|
questions << {
|
98
94
|
name: 'validation',
|
99
|
-
question:
|
95
|
+
question: 'Do you want to run the module validation ?',
|
100
96
|
type: :yes,
|
101
97
|
}
|
102
98
|
end
|
103
99
|
unless opts[:'skip-changelog']
|
104
100
|
questions << {
|
105
101
|
name: 'changelog',
|
106
|
-
question:
|
102
|
+
question: 'Do you want to run the automatic changelog generation ?',
|
107
103
|
type: :yes,
|
108
104
|
}
|
109
105
|
end
|
110
106
|
unless opts[:version]
|
111
107
|
questions << {
|
112
108
|
name: 'setversion',
|
113
|
-
question:
|
109
|
+
question: 'Do you want to set the module version ?',
|
114
110
|
type: :yes,
|
115
111
|
}
|
116
112
|
end
|
117
113
|
unless opts[:'skip-dependency']
|
118
114
|
questions << {
|
119
115
|
name: 'dependency',
|
120
|
-
question:
|
116
|
+
question: 'Do you want to run the dependency-checker on this module?',
|
121
117
|
type: :yes,
|
122
118
|
}
|
123
119
|
end
|
124
120
|
unless opts[:'skip-documentation']
|
125
121
|
questions << {
|
126
122
|
name: 'documentation',
|
127
|
-
question:
|
123
|
+
question: 'Do you want to update the documentation for this module?',
|
128
124
|
type: :yes,
|
129
125
|
}
|
130
126
|
end
|
131
127
|
unless opts[:'skip-publish']
|
132
128
|
questions << {
|
133
129
|
name: 'publish',
|
134
|
-
question:
|
130
|
+
question: 'Do you want to publish the module on the Puppet Forge?',
|
135
131
|
type: :yes,
|
136
132
|
}
|
137
133
|
end
|
@@ -159,11 +155,11 @@ module PDK::CLI
|
|
159
155
|
questions = [
|
160
156
|
{
|
161
157
|
name: 'version',
|
162
|
-
question:
|
163
|
-
help:
|
158
|
+
question: 'Please set the module version',
|
159
|
+
help: 'This value is the version that will be used in the changelog generator and building of the module.',
|
164
160
|
required: true,
|
165
161
|
validate_pattern: %r{(\*|\d+(\.\d+){0,2}(\.\*)?)$}i,
|
166
|
-
validate_message:
|
162
|
+
validate_message: 'The version format should be in the format x.y.z where x represents the major version, y the minor version and z the build number.',
|
167
163
|
},
|
168
164
|
]
|
169
165
|
interview = PDK::CLI::Util::Interview.new(prompt)
|
@@ -177,8 +173,8 @@ module PDK::CLI
|
|
177
173
|
questions = [
|
178
174
|
{
|
179
175
|
name: 'apikey',
|
180
|
-
question:
|
181
|
-
help:
|
176
|
+
question: 'Please set the api key(authorization token) to upload on the Puppet Forge',
|
177
|
+
help: 'This value is used for authentication on the Puppet Forge to upload your module tarball.',
|
182
178
|
required: true,
|
183
179
|
},
|
184
180
|
]
|
@@ -8,17 +8,17 @@ module PDK::CLI
|
|
8
8
|
|
9
9
|
force = opts[:force] || false
|
10
10
|
|
11
|
-
raise PDK::CLI::ExitWithError,
|
11
|
+
raise PDK::CLI::ExitWithError, 'Configuration name is required' if item_name.nil?
|
12
12
|
|
13
13
|
current_value = PDK.config.get(item_name)
|
14
|
-
raise PDK::CLI::ExitWithError,
|
14
|
+
raise PDK::CLI::ExitWithError, "The configuration item '%{name}' can not be removed." % { name: item_name } if current_value.is_a?(PDK::Config::Namespace)
|
15
15
|
if current_value.nil?
|
16
|
-
PDK.logger.info(
|
16
|
+
PDK.logger.info("Could not remove '%{name}' as it has not been set" % { name: item_name })
|
17
17
|
return 0
|
18
18
|
end
|
19
19
|
|
20
|
-
PDK.logger.info(
|
21
|
-
PDK.logger.info(
|
20
|
+
PDK.logger.info("Ignoring the item value '%{value}' as --force has been set" % { value: item_value }) if current_value.is_a?(Array) && !item_value.nil? && force
|
21
|
+
PDK.logger.info('Ignoring --force as the setting is not multi-valued') if !current_value.is_a?(Array) && force
|
22
22
|
|
23
23
|
# FIXME: It'd be nice to shortcircuit deleting default values. This causes the configuration file
|
24
24
|
# to be saved, even though nothing actually changes
|
@@ -31,9 +31,9 @@ module PDK::CLI
|
|
31
31
|
new_value = item_value.nil? ? [] : current_value.reject { |item| item.to_s == item_value }
|
32
32
|
if current_value.count == new_value.count
|
33
33
|
if item_value.nil?
|
34
|
-
PDK.logger.info(
|
34
|
+
PDK.logger.info("Could not remove '%{name}' as it is already empty" % { name: item_name })
|
35
35
|
else
|
36
|
-
PDK.logger.info(
|
36
|
+
PDK.logger.info("Could not remove '%{value}' from '%{name}' as it has not been set" % { value: item_value, name: item_name })
|
37
37
|
end
|
38
38
|
return 0
|
39
39
|
end
|
@@ -49,18 +49,18 @@ module PDK::CLI
|
|
49
49
|
# Arrays have a special output format. If item_value is nil then the user wanted to empty/clear
|
50
50
|
# the array otherwise they just wanted to remove a single entry.
|
51
51
|
if item_value.nil?
|
52
|
-
PDK.logger.info(
|
52
|
+
PDK.logger.info("Cleared '%{name}' which had a value of '%{from}'" % { name: item_name, from: current_value })
|
53
53
|
else
|
54
|
-
PDK.logger.info(
|
54
|
+
PDK.logger.info("Removed '%{value}' from '%{name}'" % { value: item_value, name: item_name })
|
55
55
|
end
|
56
56
|
elsif !new_value.nil?
|
57
|
-
PDK.logger.info(
|
57
|
+
PDK.logger.info("Could not remove '%{name}' as it using a default value of '%{to}'" % { name: item_name, to: new_value })
|
58
58
|
else
|
59
|
-
PDK.logger.info(
|
59
|
+
PDK.logger.info("Removed '%{name}' which had a value of '%{from}'" % { name: item_name, from: current_value })
|
60
60
|
end
|
61
61
|
|
62
62
|
# Same output as `get config`
|
63
|
-
$stdout.puts
|
63
|
+
$stdout.puts '%{name}=%{value}' % { name: item_name, value: new_value }
|
64
64
|
0
|
65
65
|
end
|
66
66
|
end
|
@@ -68,10 +68,10 @@ module PDK::CLI
|
|
68
68
|
|
69
69
|
@remove_config_cmd = @remove_cmd.define_command do
|
70
70
|
name 'config'
|
71
|
-
usage
|
72
|
-
summary
|
71
|
+
usage 'config [name] [value]'
|
72
|
+
summary 'Remove or delete the configuration for <name>'
|
73
73
|
|
74
|
-
option :f, :force,
|
74
|
+
option :f, :force, 'Force multi-value configuration settings to be removed instead of emptied.', argument: :forbidden
|
75
75
|
|
76
76
|
run do |opts, args, _cmd|
|
77
77
|
exit PDK::CLI::Remove::Config.run(opts, args)
|