-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(PDK-668) Templatedir now reads .sync.yml for config when rendering t… #354
Conversation
2cd9a3a
to
97e1005
Compare
97e1005
to
9305903
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good! Just some minor nits.
lib/pdk/module/templatedir.rb
Outdated
@config = {} | ||
end | ||
if @config.nil? | ||
confdefaults = read_config(config_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tiny nitpick here, but just for consistency sake, confdefaults
and syncconfig
should be underscore separated like the other variables are.
lib/pdk/module/templatedir.rb
Outdated
file_config = @config.fetch(:global, {}) | ||
file_config['module_metadata'] = @module_metadata | ||
file_config.merge!(@config.fetch(dest_path, {})) unless dest_path.nil? | ||
file_config.merge!(@config) | ||
file_config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is no longer needed since the last line is no longer conditional.
YAML.load(config_defaults) # rubocop:disable Security/YAMLLoad | ||
end | ||
|
||
before(:each) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The config_defaults
related allows should be moved up to the top level before
block for maintenance purposes since they are required to be mocked with or without a sync.yml
file.
lib/pdk/module/templatedir.rb
Outdated
@@ -236,26 +232,44 @@ def self.files_in_template(dirs) | |||
# | |||
# @api private | |||
def config_for(dest_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be cool if the path to sync.yml
could be passed in as an optional parameter here, and if it is nil, then the code below can default the path to the <dest_path>/sync.yml
. This will allow us to potentially add support for externally provided sync.yml
config in the future.
lib/pdk/module/templatedir.rb
Outdated
@@ -236,26 +232,44 @@ def self.files_in_template(dirs) | |||
# | |||
# @api private | |||
def config_for(dest_path) | |||
if @config.nil? | |||
config_path = File.join(@path, 'config_defaults.yml') | |||
sync_config_path = File.join(@path, '/.sync.yml') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The /
isn't necessary on a File.join. It will actually cause problems on Windows.
9305903
to
13f2414
Compare
@bmjen Updated with your changes! |
…emplates.