pdk 2.3.0 → 2.4.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 +1329 -1321
- data/LICENSE +201 -201
- data/README.md +163 -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 -277
- 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 +2094 -2094
- metadata +5 -6
data/lib/pdk/cli/new/task.rb
CHANGED
@@ -1,34 +1,34 @@
|
|
1
|
-
module PDK::CLI
|
2
|
-
@new_task_cmd = @new_cmd.define_command do
|
3
|
-
name 'task'
|
4
|
-
usage _('task [options] <name>')
|
5
|
-
summary _('Create a new task named <name> using given options')
|
6
|
-
|
7
|
-
option nil, :description, _('A short description of the purpose of the task'), argument: :required
|
8
|
-
|
9
|
-
run do |opts, args, _cmd|
|
10
|
-
require 'pdk/generate/task'
|
11
|
-
|
12
|
-
PDK::CLI::Util.ensure_in_module!(
|
13
|
-
message: _('Tasks can only be created from inside a valid module directory.'),
|
14
|
-
log_level: :info,
|
15
|
-
)
|
16
|
-
|
17
|
-
task_name = args[0]
|
18
|
-
|
19
|
-
if task_name.nil? || task_name.empty?
|
20
|
-
puts command.help
|
21
|
-
exit 1
|
22
|
-
end
|
23
|
-
|
24
|
-
unless Util::OptionValidator.valid_task_name?(task_name)
|
25
|
-
raise PDK::CLI::ExitWithError, _("'%{name}' is not a valid task name") % { name: task_name }
|
26
|
-
end
|
27
|
-
|
28
|
-
PDK::CLI::Util.analytics_screen_view('new_task', opts)
|
29
|
-
|
30
|
-
updates = PDK::Generate::Task.new(PDK.context, task_name, opts).run
|
31
|
-
PDK::CLI::Util::UpdateManagerPrinter.print_summary(updates, tense: :past)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
1
|
+
module PDK::CLI
|
2
|
+
@new_task_cmd = @new_cmd.define_command do
|
3
|
+
name 'task'
|
4
|
+
usage _('task [options] <name>')
|
5
|
+
summary _('Create a new task named <name> using given options')
|
6
|
+
|
7
|
+
option nil, :description, _('A short description of the purpose of the task'), argument: :required
|
8
|
+
|
9
|
+
run do |opts, args, _cmd|
|
10
|
+
require 'pdk/generate/task'
|
11
|
+
|
12
|
+
PDK::CLI::Util.ensure_in_module!(
|
13
|
+
message: _('Tasks can only be created from inside a valid module directory.'),
|
14
|
+
log_level: :info,
|
15
|
+
)
|
16
|
+
|
17
|
+
task_name = args[0]
|
18
|
+
|
19
|
+
if task_name.nil? || task_name.empty?
|
20
|
+
puts command.help
|
21
|
+
exit 1
|
22
|
+
end
|
23
|
+
|
24
|
+
unless Util::OptionValidator.valid_task_name?(task_name)
|
25
|
+
raise PDK::CLI::ExitWithError, _("'%{name}' is not a valid task name") % { name: task_name }
|
26
|
+
end
|
27
|
+
|
28
|
+
PDK::CLI::Util.analytics_screen_view('new_task', opts)
|
29
|
+
|
30
|
+
updates = PDK::Generate::Task.new(PDK.context, task_name, opts).run
|
31
|
+
PDK::CLI::Util::UpdateManagerPrinter.print_summary(updates, tense: :past)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/pdk/cli/new/test.rb
CHANGED
@@ -1,52 +1,52 @@
|
|
1
|
-
module PDK::CLI
|
2
|
-
@new_define_cmd = @new_cmd.define_command do
|
3
|
-
name 'test'
|
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
|
-
PDK::CLI.puppet_version_options(self)
|
8
|
-
PDK::CLI.puppet_dev_option(self)
|
9
|
-
|
10
|
-
run do |opts, args, _cmd|
|
11
|
-
require 'pdk/util/puppet_strings'
|
12
|
-
require 'pdk/util/bundler'
|
13
|
-
|
14
|
-
PDK::CLI::Util.validate_puppet_version_opts(opts)
|
15
|
-
PDK::CLI::Util.ensure_in_module!(
|
16
|
-
message: _('Tests can only be created from inside a valid module directory.'),
|
17
|
-
log_level: :info,
|
18
|
-
)
|
19
|
-
|
20
|
-
object_name = args[0]
|
21
|
-
|
22
|
-
if object_name.nil? || object_name.empty?
|
23
|
-
puts command.help
|
24
|
-
exit 1
|
25
|
-
end
|
26
|
-
|
27
|
-
unless opts[:unit]
|
28
|
-
# At a future time, we'll replace this conditional with an interactive
|
29
|
-
# question to choose the test type.
|
30
|
-
PDK.logger.info _('Test type not specified, assuming unit.')
|
31
|
-
opts[:unit] = true
|
32
|
-
end
|
33
|
-
|
34
|
-
puppet_env = PDK::CLI::Util.puppet_from_opts_or_env(opts)
|
35
|
-
PDK::Util::RubyVersion.use(puppet_env[:ruby_version])
|
36
|
-
PDK::Util::Bundler.ensure_bundle!(puppet_env[:gemset])
|
37
|
-
|
38
|
-
begin
|
39
|
-
generator, obj = PDK::Util::PuppetStrings.find_object(object_name)
|
40
|
-
|
41
|
-
PDK::CLI::Util.analytics_screen_view('new_test', opts)
|
42
|
-
|
43
|
-
updates = generator.new(PDK.context, obj['name'], opts.merge(spec_only: true)).run
|
44
|
-
PDK::CLI::Util::UpdateManagerPrinter.print_summary(updates, tense: :past)
|
45
|
-
rescue PDK::Util::PuppetStrings::NoObjectError
|
46
|
-
raise PDK::CLI::ExitWithError, _('Unable to find anything called "%{object}" to generate unit tests for.') % { object: object_name }
|
47
|
-
rescue PDK::Util::PuppetStrings::NoGeneratorError => e
|
48
|
-
raise PDK::CLI::ExitWithError, _('PDK does not support generating unit tests for "%{object_type}" objects.') % { object_type: e.message }
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
1
|
+
module PDK::CLI
|
2
|
+
@new_define_cmd = @new_cmd.define_command do
|
3
|
+
name 'test'
|
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
|
+
PDK::CLI.puppet_version_options(self)
|
8
|
+
PDK::CLI.puppet_dev_option(self)
|
9
|
+
|
10
|
+
run do |opts, args, _cmd|
|
11
|
+
require 'pdk/util/puppet_strings'
|
12
|
+
require 'pdk/util/bundler'
|
13
|
+
|
14
|
+
PDK::CLI::Util.validate_puppet_version_opts(opts)
|
15
|
+
PDK::CLI::Util.ensure_in_module!(
|
16
|
+
message: _('Tests can only be created from inside a valid module directory.'),
|
17
|
+
log_level: :info,
|
18
|
+
)
|
19
|
+
|
20
|
+
object_name = args[0]
|
21
|
+
|
22
|
+
if object_name.nil? || object_name.empty?
|
23
|
+
puts command.help
|
24
|
+
exit 1
|
25
|
+
end
|
26
|
+
|
27
|
+
unless opts[:unit]
|
28
|
+
# At a future time, we'll replace this conditional with an interactive
|
29
|
+
# question to choose the test type.
|
30
|
+
PDK.logger.info _('Test type not specified, assuming unit.')
|
31
|
+
opts[:unit] = true
|
32
|
+
end
|
33
|
+
|
34
|
+
puppet_env = PDK::CLI::Util.puppet_from_opts_or_env(opts)
|
35
|
+
PDK::Util::RubyVersion.use(puppet_env[:ruby_version])
|
36
|
+
PDK::Util::Bundler.ensure_bundle!(puppet_env[:gemset])
|
37
|
+
|
38
|
+
begin
|
39
|
+
generator, obj = PDK::Util::PuppetStrings.find_object(object_name)
|
40
|
+
|
41
|
+
PDK::CLI::Util.analytics_screen_view('new_test', opts)
|
42
|
+
|
43
|
+
updates = generator.new(PDK.context, obj['name'], opts.merge(spec_only: true)).run
|
44
|
+
PDK::CLI::Util::UpdateManagerPrinter.print_summary(updates, tense: :past)
|
45
|
+
rescue PDK::Util::PuppetStrings::NoObjectError
|
46
|
+
raise PDK::CLI::ExitWithError, _('Unable to find anything called "%{object}" to generate unit tests for.') % { object: object_name }
|
47
|
+
rescue PDK::Util::PuppetStrings::NoGeneratorError => e
|
48
|
+
raise PDK::CLI::ExitWithError, _('PDK does not support generating unit tests for "%{object_type}" objects.') % { object_type: e.message }
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -1,27 +1,27 @@
|
|
1
|
-
module PDK::CLI
|
2
|
-
@new_transport_cmd = @new_cmd.define_command do
|
3
|
-
name 'transport'
|
4
|
-
usage _('transport [options] <name>')
|
5
|
-
summary _('[experimental] Create a new ruby transport named <name> using given options')
|
6
|
-
|
7
|
-
run do |opts, args, _cmd|
|
8
|
-
PDK::CLI::Util.ensure_in_module!
|
9
|
-
|
10
|
-
transport_name = args[0]
|
11
|
-
|
12
|
-
if transport_name.nil? || transport_name.empty?
|
13
|
-
puts command.help
|
14
|
-
exit 1
|
15
|
-
end
|
16
|
-
|
17
|
-
unless Util::OptionValidator.valid_transport_name?(transport_name)
|
18
|
-
raise PDK::CLI::ExitWithError, _("'%{name}' is not a valid transport name") % { name: transport_name }
|
19
|
-
end
|
20
|
-
|
21
|
-
require 'pdk/generate/transport'
|
22
|
-
|
23
|
-
updates = PDK::Generate::Transport.new(PDK.context, transport_name, opts).run
|
24
|
-
PDK::CLI::Util::UpdateManagerPrinter.print_summary(updates, tense: :past)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
1
|
+
module PDK::CLI
|
2
|
+
@new_transport_cmd = @new_cmd.define_command do
|
3
|
+
name 'transport'
|
4
|
+
usage _('transport [options] <name>')
|
5
|
+
summary _('[experimental] Create a new ruby transport named <name> using given options')
|
6
|
+
|
7
|
+
run do |opts, args, _cmd|
|
8
|
+
PDK::CLI::Util.ensure_in_module!
|
9
|
+
|
10
|
+
transport_name = args[0]
|
11
|
+
|
12
|
+
if transport_name.nil? || transport_name.empty?
|
13
|
+
puts command.help
|
14
|
+
exit 1
|
15
|
+
end
|
16
|
+
|
17
|
+
unless Util::OptionValidator.valid_transport_name?(transport_name)
|
18
|
+
raise PDK::CLI::ExitWithError, _("'%{name}' is not a valid transport name") % { name: transport_name }
|
19
|
+
end
|
20
|
+
|
21
|
+
require 'pdk/generate/transport'
|
22
|
+
|
23
|
+
updates = PDK::Generate::Transport.new(PDK.context, transport_name, opts).run
|
24
|
+
PDK::CLI::Util::UpdateManagerPrinter.print_summary(updates, tense: :past)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/pdk/cli/new.rb
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
module PDK::CLI
|
2
|
-
@new_cmd = @base_cmd.define_command do
|
3
|
-
name 'new'
|
4
|
-
usage _('new <thing> [options]')
|
5
|
-
summary _('create a new module, etc.')
|
6
|
-
description _('Creates a new <thing> using relevant options.')
|
7
|
-
default_subcommand 'help'
|
8
|
-
end
|
9
|
-
|
10
|
-
@new_cmd.add_command Cri::Command.new_basic_help
|
11
|
-
end
|
12
|
-
|
13
|
-
require 'pdk/cli/new/class'
|
14
|
-
require 'pdk/cli/new/defined_type'
|
15
|
-
require 'pdk/cli/new/module'
|
16
|
-
require 'pdk/cli/new/provider'
|
17
|
-
require 'pdk/cli/new/task'
|
18
|
-
require 'pdk/cli/new/test'
|
19
|
-
require 'pdk/cli/new/transport'
|
20
|
-
require 'pdk/cli/new/fact'
|
21
|
-
require 'pdk/cli/new/function'
|
1
|
+
module PDK::CLI
|
2
|
+
@new_cmd = @base_cmd.define_command do
|
3
|
+
name 'new'
|
4
|
+
usage _('new <thing> [options]')
|
5
|
+
summary _('create a new module, etc.')
|
6
|
+
description _('Creates a new <thing> using relevant options.')
|
7
|
+
default_subcommand 'help'
|
8
|
+
end
|
9
|
+
|
10
|
+
@new_cmd.add_command Cri::Command.new_basic_help
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'pdk/cli/new/class'
|
14
|
+
require 'pdk/cli/new/defined_type'
|
15
|
+
require 'pdk/cli/new/module'
|
16
|
+
require 'pdk/cli/new/provider'
|
17
|
+
require 'pdk/cli/new/task'
|
18
|
+
require 'pdk/cli/new/test'
|
19
|
+
require 'pdk/cli/new/transport'
|
20
|
+
require 'pdk/cli/new/fact'
|
21
|
+
require 'pdk/cli/new/function'
|
data/lib/pdk/cli/release/prep.rb
CHANGED
@@ -1,39 +1,39 @@
|
|
1
|
-
require 'pdk/cli/release'
|
2
|
-
|
3
|
-
module PDK::CLI
|
4
|
-
@release_prep_cmd = @release_cmd.define_command do
|
5
|
-
name 'prep'
|
6
|
-
usage _('prep [options]')
|
7
|
-
summary _('(Experimental) Performs all the pre-release checks to ensure module is ready to be released')
|
8
|
-
|
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
|
-
|
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
|
-
argument: :required
|
17
|
-
|
18
|
-
run do |opts, _args, cmd|
|
19
|
-
# Make sure build is being run in a valid module directory with a metadata.json
|
20
|
-
PDK::CLI::Util.ensure_in_module!(
|
21
|
-
message: _("`pdk release #{cmd.name}` can only be run from inside a valid module with a metadata.json."),
|
22
|
-
log_level: :info,
|
23
|
-
)
|
24
|
-
|
25
|
-
opts[:'skip-build'] = true
|
26
|
-
opts[:'skip-publish'] = true
|
27
|
-
|
28
|
-
Release.prepare_interview(opts) unless opts[:force]
|
29
|
-
|
30
|
-
Release.send_analytics("release #{cmd.name}", opts)
|
31
|
-
|
32
|
-
release = PDK::Module::Release.new(nil, opts)
|
33
|
-
|
34
|
-
Release.module_compatibility_checks!(release, opts)
|
35
|
-
|
36
|
-
release.run
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
1
|
+
require 'pdk/cli/release'
|
2
|
+
|
3
|
+
module PDK::CLI
|
4
|
+
@release_prep_cmd = @release_cmd.define_command do
|
5
|
+
name 'prep'
|
6
|
+
usage _('prep [options]')
|
7
|
+
summary _('(Experimental) Performs all the pre-release checks to ensure module is ready to be released')
|
8
|
+
|
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
|
+
|
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
|
+
argument: :required
|
17
|
+
|
18
|
+
run do |opts, _args, cmd|
|
19
|
+
# Make sure build is being run in a valid module directory with a metadata.json
|
20
|
+
PDK::CLI::Util.ensure_in_module!(
|
21
|
+
message: _("`pdk release #{cmd.name}` can only be run from inside a valid module with a metadata.json."),
|
22
|
+
log_level: :info,
|
23
|
+
)
|
24
|
+
|
25
|
+
opts[:'skip-build'] = true
|
26
|
+
opts[:'skip-publish'] = true
|
27
|
+
|
28
|
+
Release.prepare_interview(opts) unless opts[:force]
|
29
|
+
|
30
|
+
Release.send_analytics("release #{cmd.name}", opts)
|
31
|
+
|
32
|
+
release = PDK::Module::Release.new(nil, opts)
|
33
|
+
|
34
|
+
Release.module_compatibility_checks!(release, opts)
|
35
|
+
|
36
|
+
release.run
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -1,50 +1,50 @@
|
|
1
|
-
require 'pdk/cli/release'
|
2
|
-
|
3
|
-
module PDK::CLI
|
4
|
-
@release_publish_cmd = @release_cmd.define_command do
|
5
|
-
name 'publish'
|
6
|
-
usage _('publish [options] <tarball>')
|
7
|
-
summary _('(Experimental) Publishes the module <tarball> to the Forge.')
|
8
|
-
|
9
|
-
flag nil, :force, _('Publish the module automatically, with no prompts.')
|
10
|
-
|
11
|
-
option nil, :'forge-upload-url', _('Set forge upload url path.'),
|
12
|
-
argument: :required, default: 'https://forgeapi.puppetlabs.com/v3/releases'
|
13
|
-
|
14
|
-
option nil, :'forge-token', _('Set Forge API token (you may also set via environment variable PDK_FORGE_TOKEN)'), argument: :required
|
15
|
-
|
16
|
-
run do |opts, _args, cmd|
|
17
|
-
# Make sure build is being run in a valid module directory with a metadata.json
|
18
|
-
PDK::CLI::Util.ensure_in_module!(
|
19
|
-
message: _("`pdk release #{cmd.name}` can only be run from inside a valid module with a metadata.json."),
|
20
|
-
log_level: :info,
|
21
|
-
)
|
22
|
-
|
23
|
-
opts[:'skip-validation'] = true
|
24
|
-
opts[:'skip-changelog'] = true
|
25
|
-
opts[:'skip-dependency'] = true
|
26
|
-
opts[:'skip-documentation'] = true
|
27
|
-
opts[:'skip-build'] = true
|
28
|
-
opts[:'skip-versionset'] = true
|
29
|
-
opts[:force] = true unless PDK::CLI::Util.interactive?
|
30
|
-
opts[:'forge-token'] ||= PDK::Util::Env['PDK_FORGE_TOKEN']
|
31
|
-
|
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
|
-
|
38
|
-
exit 1
|
39
|
-
end
|
40
|
-
|
41
|
-
Release.prepare_publish_interview(TTY::Prompt.new(help_color: :cyan), opts) unless opts[:force]
|
42
|
-
|
43
|
-
Release.send_analytics("release #{cmd.name}", opts)
|
44
|
-
|
45
|
-
release = PDK::Module::Release.new(nil, opts)
|
46
|
-
|
47
|
-
release.run
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
1
|
+
require 'pdk/cli/release'
|
2
|
+
|
3
|
+
module PDK::CLI
|
4
|
+
@release_publish_cmd = @release_cmd.define_command do
|
5
|
+
name 'publish'
|
6
|
+
usage _('publish [options] <tarball>')
|
7
|
+
summary _('(Experimental) Publishes the module <tarball> to the Forge.')
|
8
|
+
|
9
|
+
flag nil, :force, _('Publish the module automatically, with no prompts.')
|
10
|
+
|
11
|
+
option nil, :'forge-upload-url', _('Set forge upload url path.'),
|
12
|
+
argument: :required, default: 'https://forgeapi.puppetlabs.com/v3/releases'
|
13
|
+
|
14
|
+
option nil, :'forge-token', _('Set Forge API token (you may also set via environment variable PDK_FORGE_TOKEN)'), argument: :required
|
15
|
+
|
16
|
+
run do |opts, _args, cmd|
|
17
|
+
# Make sure build is being run in a valid module directory with a metadata.json
|
18
|
+
PDK::CLI::Util.ensure_in_module!(
|
19
|
+
message: _("`pdk release #{cmd.name}` can only be run from inside a valid module with a metadata.json."),
|
20
|
+
log_level: :info,
|
21
|
+
)
|
22
|
+
|
23
|
+
opts[:'skip-validation'] = true
|
24
|
+
opts[:'skip-changelog'] = true
|
25
|
+
opts[:'skip-dependency'] = true
|
26
|
+
opts[:'skip-documentation'] = true
|
27
|
+
opts[:'skip-build'] = true
|
28
|
+
opts[:'skip-versionset'] = true
|
29
|
+
opts[:force] = true unless PDK::CLI::Util.interactive?
|
30
|
+
opts[:'forge-token'] ||= PDK::Util::Env['PDK_FORGE_TOKEN']
|
31
|
+
|
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
|
+
|
38
|
+
exit 1
|
39
|
+
end
|
40
|
+
|
41
|
+
Release.prepare_publish_interview(TTY::Prompt.new(help_color: :cyan), opts) unless opts[:force]
|
42
|
+
|
43
|
+
Release.send_analytics("release #{cmd.name}", opts)
|
44
|
+
|
45
|
+
release = PDK::Module::Release.new(nil, opts)
|
46
|
+
|
47
|
+
release.run
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|