-
Notifications
You must be signed in to change notification settings - Fork 34
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
replacing 'ForemanPluginTemplate' in rename.rb is not applied #63
Comments
We're talking about these lines: foreman_plugin_template/rename.rb Lines 38 to 43 in d9ca190
This was added in 65e6437. I don't really see the problem. Note that it's |
for example: foreman_plugin_template/lib/foreman_plugin_template/engine.rb Lines 1 to 4 in d9ca190
And path rename logic has another problem. I modified the code as follows for my case: Find.find('.') do |path|
next unless File.file?(path)
next if path =~ /\.git/
next if path == './rename.rb'
# Change content on all files
tmp_file_1 = "#{path}.1.tmp"
tmp_file_2 = "#{path}.2.tmp"
system(%(sed 's/foreman_plugin_template/#{snake}/g' #{path} > #{tmp_file_1}))
system(%(sed 's/ForemanPluginTemplate/#{camel}/g' #{tmp_file_1} > #{tmp_file_2}))
system(%(sed 's/foremanPluginTemplate/#{camel_lower}/g' #{tmp_file_2} > #{path}))
system(%(rm #{tmp_file_1}))
system(%(rm #{tmp_file_2}))
end
old_dirs = []
Find.find('.') do |path|
next unless File.directory?(path)
next if path =~ /\.git/
if path =~ /foreman_plugin_template$/i
new = path.gsub('foreman_plugin_template', snake)
FileUtils.cp_r(path, new)
old_dirs << path
end
end
FileUtils.rm_rf(old_dirs)
Find.find('.') do |path|
next unless File.file?(path)
next if path =~ /\.git/
if path =~ /foreman_plugin_template/i
new = path.gsub('foreman_plugin_template', snake)
FileUtils.mv(path, new)
end
end
FileUtils.mv('README.plugin.md', 'README.md') |
Oh, now I see it! I wonder why it's not using sed -i to avoid temporary files. And a single sed statement could alsobe implemented |
third changes replace second changes.
The text was updated successfully, but these errors were encountered: