Permalink
Browse files

Move some per-source manifest details to the source.

  • Loading branch information...
1 parent 0255047 commit 9bd8fbd5e0e11ae1b8d51a6f4f1b4e415eca8afe @yfeldblum yfeldblum committed May 8, 2012
Showing with 19 additions and 8 deletions.
  1. +18 −0 lib/librarian/chef/source/local.rb
  2. +1 −8 lib/librarian/chef/source/local/manifest.rb
@@ -10,6 +10,24 @@ def manifest_class
Manifest
end
+ def install!(manifest)
+ manifest.source == self or raise ArgumentError
+
+ debug { "Installing #{manifest}" }
+
+ name, version = manifest.name, manifest.version
+ found_path = found_path(name)
+
+ install_path = environment.install_path.join(name)
+ if install_path.exist?
+ debug { "Deleting #{relative_path_to(install_path)}" }
+ install_path.rmtree
+ end
+
+ debug { "Copying #{relative_path_to(found_path)} to #{relative_path_to(install_path)}" }
+ FileUtils.cp_r(found_path, install_path)
+ end
+
private
def manifest?(name, path)
@@ -40,14 +40,7 @@ def fetch_dependencies!
end
def install!
- debug { "Installing #{name}-#{version}" }
- install_path = environment.install_path.join(name)
- if install_path.exist?
- debug { "Deleting #{relative_path_to(install_path)}" }
- install_path.rmtree
- end
- debug { "Copying #{relative_path_to(found_path)} to #{relative_path_to(install_path)}" }
- FileUtils.cp_r(found_path, install_path)
+ source.install!(self)
end
private

0 comments on commit 9bd8fbd

Please sign in to comment.