pdk 1.17.0 → 2.1.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 +148 -11
- data/README.md +1 -1
- data/lib/pdk.rb +1 -1
- data/lib/pdk/cli.rb +7 -1
- data/lib/pdk/cli/convert.rb +7 -9
- data/lib/pdk/cli/env.rb +52 -0
- data/lib/pdk/cli/exec/command.rb +11 -1
- data/lib/pdk/cli/new.rb +2 -0
- data/lib/pdk/cli/new/class.rb +2 -1
- data/lib/pdk/cli/new/defined_type.rb +2 -1
- data/lib/pdk/cli/new/fact.rb +29 -0
- data/lib/pdk/cli/new/function.rb +29 -0
- data/lib/pdk/cli/new/provider.rb +2 -1
- data/lib/pdk/cli/new/task.rb +2 -1
- data/lib/pdk/cli/new/test.rb +2 -1
- data/lib/pdk/cli/new/transport.rb +2 -1
- data/lib/pdk/cli/release.rb +1 -1
- data/lib/pdk/cli/release/publish.rb +11 -1
- data/lib/pdk/cli/remove.rb +20 -0
- data/lib/pdk/cli/remove/config.rb +80 -0
- data/lib/pdk/cli/set.rb +20 -0
- data/lib/pdk/cli/set/config.rb +119 -0
- data/lib/pdk/cli/update.rb +6 -8
- data/lib/pdk/cli/util.rb +1 -0
- data/lib/pdk/cli/util/option_validator.rb +6 -0
- data/lib/pdk/cli/util/update_manager_printer.rb +82 -0
- data/lib/pdk/config.rb +96 -13
- data/lib/pdk/context.rb +8 -5
- data/lib/pdk/generate/defined_type.rb +25 -32
- data/lib/pdk/generate/fact.rb +25 -0
- data/lib/pdk/generate/function.rb +48 -0
- data/lib/pdk/generate/module.rb +11 -10
- data/lib/pdk/generate/provider.rb +15 -64
- data/lib/pdk/generate/puppet_class.rb +25 -31
- data/lib/pdk/generate/puppet_object.rb +83 -187
- data/lib/pdk/generate/task.rb +28 -46
- data/lib/pdk/generate/transport.rb +20 -74
- data/lib/pdk/module.rb +1 -1
- data/lib/pdk/module/convert.rb +43 -23
- data/lib/pdk/module/metadata.rb +6 -2
- data/lib/pdk/module/release.rb +8 -2
- data/lib/pdk/module/update.rb +7 -11
- data/lib/pdk/module/update_manager.rb +7 -0
- data/lib/pdk/report.rb +3 -3
- data/lib/pdk/report/event.rb +8 -2
- data/lib/pdk/template.rb +59 -0
- data/lib/pdk/template/fetcher.rb +98 -0
- data/lib/pdk/template/fetcher/git.rb +85 -0
- data/lib/pdk/template/fetcher/local.rb +28 -0
- data/lib/pdk/template/renderer.rb +96 -0
- data/lib/pdk/template/renderer/v1.rb +25 -0
- data/lib/pdk/template/renderer/v1/legacy_template_dir.rb +116 -0
- data/lib/pdk/template/renderer/v1/renderer.rb +132 -0
- data/lib/pdk/template/renderer/v1/template_file.rb +102 -0
- data/lib/pdk/template/template_dir.rb +67 -0
- data/lib/pdk/tests/unit.rb +8 -1
- data/lib/pdk/util.rb +4 -35
- data/lib/pdk/util/bundler.rb +1 -1
- data/lib/pdk/util/changelog_generator.rb +20 -3
- data/lib/pdk/util/json_finder.rb +85 -0
- data/lib/pdk/util/puppet_strings.rb +3 -3
- data/lib/pdk/util/puppet_version.rb +2 -2
- data/lib/pdk/util/ruby_version.rb +5 -1
- data/lib/pdk/util/template_uri.rb +9 -11
- data/lib/pdk/util/vendored_file.rb +1 -2
- data/lib/pdk/validate.rb +17 -10
- data/lib/pdk/validate/control_repo/control_repo_validator_group.rb +23 -0
- data/lib/pdk/validate/control_repo/environment_conf_validator.rb +98 -0
- data/lib/pdk/validate/invokable_validator.rb +8 -4
- data/lib/pdk/validate/tasks/tasks_metadata_lint_validator.rb +1 -1
- data/lib/pdk/validate/validator.rb +7 -0
- data/lib/pdk/validate/validator_group.rb +1 -0
- data/lib/pdk/validate/yaml/yaml_syntax_validator.rb +2 -2
- data/lib/pdk/version.rb +1 -1
- data/locales/pdk.pot +356 -228
- metadata +65 -28
- data/lib/pdk/module/template_dir.rb +0 -115
- data/lib/pdk/module/template_dir/base.rb +0 -268
- data/lib/pdk/module/template_dir/git.rb +0 -91
- data/lib/pdk/module/template_dir/local.rb +0 -21
- data/lib/pdk/template_file.rb +0 -96
data/lib/pdk/generate/task.rb
CHANGED
@@ -3,44 +3,21 @@ require 'pdk'
|
|
3
3
|
module PDK
|
4
4
|
module Generate
|
5
5
|
class Task < PuppetObject
|
6
|
-
|
6
|
+
def friendly_name
|
7
|
+
'Task'
|
8
|
+
end
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
# @return [Hash{Symbol => Object}] a hash of information that will be
|
11
|
-
# provided to the task template during rendering. Additionally, this hash
|
12
|
-
# (with the :name key removed) makes up the task metadata.
|
13
|
-
def template_data
|
10
|
+
def template_files
|
11
|
+
return {} if spec_only?
|
14
12
|
{
|
15
|
-
|
16
|
-
puppet_task_version: 1,
|
17
|
-
supports_noop: false,
|
18
|
-
description: options.fetch(:description, 'A short description of this task'),
|
19
|
-
parameters: {},
|
13
|
+
'task.erb' => File.join('tasks', task_name + '.sh'),
|
20
14
|
}
|
21
15
|
end
|
22
16
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
@target_object_path ||= File.join(module_dir, 'tasks', "#{task_name}.sh")
|
28
|
-
end
|
29
|
-
|
30
|
-
# Calculates the path to the file where the tests for the new task will
|
31
|
-
# be written.
|
32
|
-
#
|
33
|
-
# @return [nil] as there is currently no test framework for Tasks.
|
34
|
-
def target_spec_path
|
35
|
-
nil
|
36
|
-
end
|
37
|
-
|
38
|
-
def run
|
39
|
-
check_if_task_already_exists
|
40
|
-
|
41
|
-
super
|
42
|
-
|
43
|
-
write_task_metadata
|
17
|
+
def template_data
|
18
|
+
{
|
19
|
+
name: object_name,
|
20
|
+
}
|
44
21
|
end
|
45
22
|
|
46
23
|
# Checks that the task has not already been defined with a different
|
@@ -48,30 +25,26 @@ module PDK
|
|
48
25
|
#
|
49
26
|
# @raise [PDK::CLI::ExitWithError] if files with the same name as the
|
50
27
|
# task exist in the <module>/tasks/ directory
|
51
|
-
|
52
|
-
|
53
|
-
|
28
|
+
def check_preconditions
|
29
|
+
super
|
30
|
+
|
54
31
|
error = _("A task named '%{name}' already exists in this module; defined in %{file}")
|
55
32
|
allowed_extensions = %w[.md .conf]
|
56
33
|
|
57
|
-
PDK::Util::Filesystem.glob(File.join(
|
34
|
+
PDK::Util::Filesystem.glob(File.join(context.root_path, 'tasks', task_name + '.*')).each do |file|
|
58
35
|
next if allowed_extensions.include?(File.extname(file))
|
59
36
|
|
60
37
|
raise PDK::CLI::ExitWithError, error % { name: task_name, file: file }
|
61
38
|
end
|
62
39
|
end
|
63
40
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
def write_task_metadata
|
68
|
-
write_file(File.join(module_dir, 'tasks', "#{task_name}.json")) do
|
69
|
-
task_metadata = template_data.dup
|
70
|
-
task_metadata.delete(:name)
|
71
|
-
JSON.pretty_generate(task_metadata)
|
72
|
-
end
|
41
|
+
def non_template_files
|
42
|
+
task_metadata_file = File.join('tasks', task_name + '.json')
|
43
|
+
{ task_metadata_file => JSON.pretty_generate(task_metadata) }
|
73
44
|
end
|
74
45
|
|
46
|
+
private
|
47
|
+
|
75
48
|
# Calculates the file name of the task files ('init' if the task has the
|
76
49
|
# same name as the module, otherwise use the specified task name).
|
77
50
|
#
|
@@ -81,6 +54,15 @@ module PDK
|
|
81
54
|
def task_name
|
82
55
|
(object_name == module_name) ? 'init' : object_name
|
83
56
|
end
|
57
|
+
|
58
|
+
def task_metadata
|
59
|
+
{
|
60
|
+
puppet_task_version: 1,
|
61
|
+
supports_noop: false,
|
62
|
+
description: options.fetch(:description, 'A short description of this task'),
|
63
|
+
parameters: {},
|
64
|
+
}
|
65
|
+
end
|
84
66
|
end
|
85
67
|
end
|
86
68
|
end
|
@@ -3,84 +3,30 @@ require 'pdk'
|
|
3
3
|
module PDK
|
4
4
|
module Generate
|
5
5
|
class Transport < PuppetObject
|
6
|
-
|
7
|
-
|
8
|
-
# Prepares the data needed to render the new defined type template.
|
9
|
-
#
|
10
|
-
# @return [Hash{Symbol => Object}] a hash of information that will be
|
11
|
-
# provided to the defined type and defined type spec templates during
|
12
|
-
# rendering.
|
13
|
-
def template_data
|
14
|
-
data = {
|
15
|
-
name: object_name,
|
16
|
-
transport_class: Transport.class_name_from_object_name(object_name),
|
17
|
-
}
|
18
|
-
|
19
|
-
data
|
20
|
-
end
|
21
|
-
|
22
|
-
def raise_precondition_error(error)
|
23
|
-
raise PDK::CLI::ExitWithError, _('%{error}: Creating a transport needs some local configuration in your module.' \
|
24
|
-
' Please follow the docs at https://github.com/puppetlabs/puppet-resource_api#getting-started.') % { error: error }
|
25
|
-
end
|
26
|
-
|
27
|
-
def check_preconditions
|
28
|
-
super
|
29
|
-
# These preconditions can be removed once the pdk-templates are carrying the puppet-resource_api gem by default, and have switched
|
30
|
-
# the default mock_with value.
|
31
|
-
sync_path = PDK::Util.find_upwards('.sync.yml')
|
32
|
-
if sync_path.nil?
|
33
|
-
raise_precondition_error(_('.sync.yml not found'))
|
34
|
-
end
|
35
|
-
sync = YAML.load_file(sync_path)
|
36
|
-
if !sync.is_a? Hash
|
37
|
-
raise_precondition_error(_('.sync.yml contents is not a Hash'))
|
38
|
-
elsif !sync.key? 'Gemfile'
|
39
|
-
raise_precondition_error(_('Gemfile configuration not found'))
|
40
|
-
elsif !sync['Gemfile'].key? 'optional'
|
41
|
-
raise_precondition_error(_('Gemfile.optional configuration not found'))
|
42
|
-
elsif !sync['Gemfile']['optional'].key? ':development'
|
43
|
-
raise_precondition_error(_('Gemfile.optional.:development configuration not found'))
|
44
|
-
elsif sync['Gemfile']['optional'][':development'].none? { |g| g['gem'] == 'puppet-resource_api' }
|
45
|
-
raise_precondition_error(_('puppet-resource_api not found in the Gemfile config'))
|
46
|
-
elsif !sync.key? 'spec/spec_helper.rb'
|
47
|
-
raise_precondition_error(_('spec/spec_helper.rb configuration not found'))
|
48
|
-
elsif !sync['spec/spec_helper.rb'].key? 'mock_with'
|
49
|
-
raise_precondition_error(_('spec/spec_helper.rb.mock_with configuration not found'))
|
50
|
-
elsif !sync['spec/spec_helper.rb']['mock_with'] == ':rspec'
|
51
|
-
raise_precondition_error(_('spec/spec_helper.rb.mock_with not set to \':rspec\''))
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
# @return [String] the path where the new transport will be written.
|
56
|
-
def target_object_path
|
57
|
-
@target_object_path ||= File.join(module_dir, 'lib', 'puppet', 'transport', object_name) + '.rb'
|
6
|
+
def friendly_name
|
7
|
+
'Resource API Transport'.freeze
|
58
8
|
end
|
59
9
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
@target_spec_path ||= File.join(module_dir, 'spec', 'unit', 'puppet', 'transport', object_name) + '_spec.rb'
|
74
|
-
end
|
75
|
-
|
76
|
-
# @return [String] the path where the tests for the new schema will be written.
|
77
|
-
def target_type_spec_path
|
78
|
-
@target_type_spec_path ||= File.join(module_dir, 'spec', 'unit', 'puppet', 'transport', 'schema', object_name) + '_spec.rb'
|
10
|
+
def template_files
|
11
|
+
# Note : Due to how the V1 templates work, the names of the source template files may be mismatched to
|
12
|
+
# their destination, e.g. transport_type.erb is really a transport schema
|
13
|
+
files = {
|
14
|
+
'transport_spec.erb' => File.join('spec', 'unit', 'puppet', 'transport', object_name) + '_spec.rb',
|
15
|
+
'transport_type_spec.erb' => File.join('spec', 'unit', 'puppet', 'transport', 'schema', object_name) + '_spec.rb',
|
16
|
+
}
|
17
|
+
return files if spec_only?
|
18
|
+
files.merge(
|
19
|
+
'transport.erb' => File.join('lib', 'puppet', 'transport', object_name) + '.rb',
|
20
|
+
'transport_device.erb' => File.join('lib', 'puppet', 'util', 'network_device', object_name, 'device.rb'),
|
21
|
+
'transport_type.erb' => File.join('lib', 'puppet', 'transport', 'schema', object_name) + '.rb',
|
22
|
+
)
|
79
23
|
end
|
80
24
|
|
81
|
-
|
82
|
-
|
83
|
-
|
25
|
+
def template_data
|
26
|
+
{
|
27
|
+
name: object_name,
|
28
|
+
transport_class: class_name_from_object_name(object_name),
|
29
|
+
}
|
84
30
|
end
|
85
31
|
end
|
86
32
|
end
|
data/lib/pdk/module.rb
CHANGED
@@ -4,7 +4,6 @@ module PDK
|
|
4
4
|
autoload :Convert, 'pdk/module/convert'
|
5
5
|
autoload :Metadata, 'pdk/module/metadata'
|
6
6
|
autoload :Release, 'pdk/module/release'
|
7
|
-
autoload :TemplateDir, 'pdk/module/template_dir'
|
8
7
|
autoload :UpdateManager, 'pdk/module/update_manager'
|
9
8
|
autoload :Update, 'pdk/module/update'
|
10
9
|
|
@@ -16,6 +15,7 @@ module PDK
|
|
16
15
|
'/REVISION',
|
17
16
|
'/spec/fixtures/modules/',
|
18
17
|
'/vendor/',
|
18
|
+
'.DS_Store',
|
19
19
|
].freeze
|
20
20
|
|
21
21
|
def default_ignored_pathspec(ignore_dotfiles = true)
|
data/lib/pdk/module/convert.rb
CHANGED
@@ -26,6 +26,7 @@ module PDK
|
|
26
26
|
unless update_manager.changes?
|
27
27
|
if adding_tests?
|
28
28
|
add_tests!
|
29
|
+
print_result 'Convert completed'
|
29
30
|
else
|
30
31
|
require 'pdk/report'
|
31
32
|
|
@@ -53,18 +54,15 @@ module PDK
|
|
53
54
|
return unless continue
|
54
55
|
end
|
55
56
|
|
56
|
-
# Remove these files straight away as these changes are not something
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
end
|
57
|
+
# Remove these files straight away as these changes are not something
|
58
|
+
# that the user needs to review.
|
59
|
+
update_manager.unlink_file('Gemfile.lock')
|
60
|
+
update_manager.unlink_file(File.join('.bundle', 'config'))
|
61
61
|
|
62
62
|
update_manager.sync_changes!
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
PDK::Util::Bundler.ensure_bundle!
|
67
|
-
end
|
64
|
+
require 'pdk/util/bundler'
|
65
|
+
PDK::Util::Bundler.ensure_bundle!
|
68
66
|
|
69
67
|
add_tests! if adding_tests?
|
70
68
|
|
@@ -88,41 +86,59 @@ module PDK
|
|
88
86
|
end
|
89
87
|
|
90
88
|
def missing_tests?
|
91
|
-
|
89
|
+
!available_test_generators.empty?
|
90
|
+
end
|
91
|
+
|
92
|
+
def available_test_generators
|
93
|
+
# Only select generators which can run and have no pre-existing files
|
94
|
+
test_generators.select do |gen|
|
95
|
+
if gen.can_run?
|
96
|
+
gen.template_files.none? { |_, dst_path| PDK::Util::Filesystem.exist?(File.join(gen.context.root_path, dst_path)) }
|
97
|
+
else
|
98
|
+
false
|
99
|
+
end
|
100
|
+
end
|
92
101
|
end
|
93
102
|
|
94
|
-
def test_generators
|
103
|
+
def test_generators(context = PDK.context)
|
95
104
|
return @test_generators unless @test_generators.nil?
|
96
105
|
require 'pdk/util/puppet_strings'
|
97
106
|
|
98
107
|
test_gens = PDK::Util::PuppetStrings.all_objects.map do |generator, objects|
|
99
108
|
(objects || []).map do |obj|
|
100
|
-
generator.new(
|
109
|
+
generator.new(context, obj['name'], spec_only: true)
|
101
110
|
end
|
102
111
|
end
|
103
112
|
|
104
113
|
@test_generators = test_gens.flatten
|
105
114
|
end
|
106
115
|
|
107
|
-
def
|
108
|
-
|
109
|
-
gen.
|
116
|
+
def stage_tests!(manager)
|
117
|
+
available_test_generators.each do |gen|
|
118
|
+
gen.stage_changes(manager)
|
110
119
|
end
|
120
|
+
manager
|
111
121
|
end
|
112
122
|
|
113
|
-
def
|
114
|
-
update_manager.
|
123
|
+
def add_tests!
|
124
|
+
update_manager.clear!
|
125
|
+
stage_tests!(update_manager)
|
126
|
+
|
127
|
+
if update_manager.changes?
|
128
|
+
update_manager.sync_changes!
|
129
|
+
print_summary
|
130
|
+
else
|
131
|
+
PDK::Report.default_target.puts(_('No test changes required.'))
|
132
|
+
end
|
115
133
|
end
|
116
134
|
|
117
|
-
def stage_changes!
|
135
|
+
def stage_changes!(context = PDK.context)
|
118
136
|
require 'pdk/util/filesystem'
|
119
137
|
|
120
138
|
metadata_path = File.join(module_dir, 'metadata.json')
|
121
139
|
|
122
|
-
PDK::
|
123
|
-
new_metadata = update_metadata(metadata_path,
|
124
|
-
templates.module_metadata = new_metadata.data unless new_metadata.nil?
|
125
|
-
|
140
|
+
PDK::Template.with(template_uri, context) do |template_dir|
|
141
|
+
new_metadata = update_metadata(metadata_path, template_dir.metadata)
|
126
142
|
if options[:noop] && new_metadata.nil?
|
127
143
|
update_manager.add_file(metadata_path, '')
|
128
144
|
elsif PDK::Util::Filesystem.file?(metadata_path)
|
@@ -131,7 +147,11 @@ module PDK
|
|
131
147
|
update_manager.add_file(metadata_path, new_metadata.to_json)
|
132
148
|
end
|
133
149
|
|
134
|
-
|
150
|
+
# new_metadata == nil when creating a new module but with --noop@
|
151
|
+
module_name = new_metadata.nil? ? 'new-module' : new_metadata.data['name']
|
152
|
+
metadata_for_render = new_metadata.nil? ? {} : new_metadata.data
|
153
|
+
|
154
|
+
template_dir.render_new_module(module_name, metadata_for_render) do |relative_file_path, file_content, file_status|
|
135
155
|
absolute_file_path = File.join(module_dir, relative_file_path)
|
136
156
|
case file_status
|
137
157
|
when :unmanage
|
data/lib/pdk/module/metadata.rb
CHANGED
@@ -27,7 +27,7 @@ module PDK
|
|
27
27
|
'Debian based Linux' => [
|
28
28
|
{
|
29
29
|
'operatingsystem' => 'Debian',
|
30
|
-
'operatingsystemrelease' => ['
|
30
|
+
'operatingsystemrelease' => ['10'],
|
31
31
|
},
|
32
32
|
{
|
33
33
|
'operatingsystem' => 'Ubuntu',
|
@@ -54,6 +54,10 @@ module PDK
|
|
54
54
|
'operatingsystem' => 'windows',
|
55
55
|
'operatingsystemrelease' => %w[2019 10],
|
56
56
|
},
|
57
|
+
'AIX' => {
|
58
|
+
'operatingsystem' => 'AIX',
|
59
|
+
'operatingsystemrelease' => %w[6.1 7.1 7.2],
|
60
|
+
},
|
57
61
|
}.freeze
|
58
62
|
|
59
63
|
DEFAULT_OPERATING_SYSTEMS = [
|
@@ -77,7 +81,7 @@ module PDK
|
|
77
81
|
OPERATING_SYSTEMS[os_name]
|
78
82
|
}.flatten,
|
79
83
|
'requirements' => [
|
80
|
-
{ 'name' => 'puppet', 'version_requirement' => '>=
|
84
|
+
{ 'name' => 'puppet', 'version_requirement' => '>= 6.21.0 < 8.0.0' },
|
81
85
|
],
|
82
86
|
}.freeze
|
83
87
|
|
data/lib/pdk/module/release.rb
CHANGED
@@ -65,6 +65,12 @@ module PDK
|
|
65
65
|
|
66
66
|
# Update the changelog with the correct version
|
67
67
|
PDK::Util::ChangelogGenerator.generate_changelog unless skip_changelog?
|
68
|
+
|
69
|
+
# Check if the versions match
|
70
|
+
latest_version = PDK::Util::ChangelogGenerator.latest_version
|
71
|
+
unless latest_version
|
72
|
+
raise PDK::CLI::ExitWithError, _('%{new_version} does not match %{latest_version}') % { new_version: new_version, latest_version: latest_version } if new_version != latest_version
|
73
|
+
end
|
68
74
|
end
|
69
75
|
|
70
76
|
run_documentation(options) unless skip_documentation?
|
@@ -111,7 +117,7 @@ module PDK
|
|
111
117
|
|
112
118
|
PDK::Util::Bundler.ensure_bundle!(puppet_env[:gemset])
|
113
119
|
|
114
|
-
validator_exit_code, = PDK::Validate.invoke_validators_by_name(PDK::Validate.validator_names, false, options)
|
120
|
+
validator_exit_code, = PDK::Validate.invoke_validators_by_name(PDK.context, PDK::Validate.validator_names, false, options)
|
115
121
|
raise PDK::CLI::ExitWithError, _('An error occured during validation') unless validator_exit_code.zero?
|
116
122
|
end
|
117
123
|
|
@@ -163,7 +169,7 @@ module PDK
|
|
163
169
|
http.request(request)
|
164
170
|
end
|
165
171
|
|
166
|
-
raise PDK::CLI::ExitWithError, _('Error uploading to Puppet Forge: %{result}') % { result: response } unless response.is_a?(Net::HTTPSuccess)
|
172
|
+
raise PDK::CLI::ExitWithError, _('Error uploading to Puppet Forge: %{result}') % { result: response.body } unless response.is_a?(Net::HTTPSuccess)
|
167
173
|
PDK.logger.info _('Publish to Forge was successful')
|
168
174
|
end
|
169
175
|
|
data/lib/pdk/module/update.rb
CHANGED
@@ -33,19 +33,15 @@ module PDK
|
|
33
33
|
return unless PDK::CLI::Util.prompt_for_yes(message)
|
34
34
|
end
|
35
35
|
|
36
|
-
# Remove these files straight away as these changes are not something
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
end
|
36
|
+
# Remove these files straight away as these changes are not something
|
37
|
+
# that the user needs to review.
|
38
|
+
update_manager.unlink_file('Gemfile.lock')
|
39
|
+
update_manager.unlink_file(File.join('.bundle', 'config'))
|
41
40
|
|
42
41
|
update_manager.sync_changes!
|
43
42
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
PDK::Util::Bundler.ensure_bundle!
|
48
|
-
end
|
43
|
+
require 'pdk/util/bundler'
|
44
|
+
PDK::Util::Bundler.ensure_bundle!
|
49
45
|
|
50
46
|
print_result 'Update completed'
|
51
47
|
end
|
@@ -89,7 +85,7 @@ module PDK
|
|
89
85
|
private
|
90
86
|
|
91
87
|
def latest_template?
|
92
|
-
[PDK::TEMPLATE_REF, 'master'].include?(template_uri.uri_fragment)
|
88
|
+
[PDK::TEMPLATE_REF, 'master', 'main'].include?(template_uri.uri_fragment)
|
93
89
|
end
|
94
90
|
|
95
91
|
def current_template_version
|
@@ -75,6 +75,13 @@ module PDK
|
|
75
75
|
changes[:modified].key?(path)
|
76
76
|
end
|
77
77
|
|
78
|
+
def clear!
|
79
|
+
@modified_files.clear
|
80
|
+
@added_files.clear
|
81
|
+
@removed_files.clear
|
82
|
+
nil
|
83
|
+
end
|
84
|
+
|
78
85
|
# Apply any pending changes stored in the UpdateManager to the module.
|
79
86
|
#
|
80
87
|
# @raise (see #calculate_diffs)
|