Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #133 from adaburrows/verbose_plugin_install
Browse files Browse the repository at this point in the history
Verbosity++ for puppet:plugin:install rake task
  • Loading branch information
haus committed Nov 21, 2012
2 parents 6fecc7d + 4ca7363 commit 72d4dd6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/tasks/plugins.rake
Expand Up @@ -8,9 +8,13 @@ namespace :puppet do
target_file = Pathname.new(target_dir + source_file.basename)

if source_file.directory?
target_file.mkdir unless target_file.exist?
unless target_file.exist?
puts "Creating directory #{target_file}."
target_file.mkdir
end
link_contents(source_file, target_file)
else
puts "Copying '#{source_file}' to '#{target_file}'."
target_file.unlink if target_file.exist?
File.copy(source_file, target_file)
end
Expand All @@ -27,6 +31,7 @@ namespace :puppet do
raise "Plugin #{plugin_name} not found in vendor/plugins."
end

puts "Copying database migrations."
Dir.glob(File.join(plugin_dir, 'db', 'migrate', '*.rb')) do |source_file|
base_file_name = File.basename(source_file)

Expand All @@ -35,9 +40,11 @@ namespace :puppet do
"Migrations for this plugin must be named in the form: YYYYMMDDHHMMSS_plugin_#{plugin_name}_*.rb"
end

puts "Copying #{base_file_name}."
FileUtils.cp source_file, "db/migrate/#{base_file_name}"
end

puts "Copying public files from '#{plugin_dir}/public/' to '#{Rails.root}/public/'."
source_dir = Pathname.new(File.join(plugin_dir, 'public'))
dest_dir = Pathname.new(File.join(Rails.root, 'public'))
link_contents(source_dir, dest_dir) if source_dir.directory?
Expand Down

0 comments on commit 72d4dd6

Please sign in to comment.