Skip to content

Commit

Permalink
add Plugin#path to make things simpler
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Belo committed Dec 15, 2009
1 parent 17484ae commit 9d5cda5
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/heroku/plugin.rb
Expand Up @@ -32,20 +32,23 @@ def to_s
name
end

def path
"#{self.class.directory}/#{name}"
end

def install
FileUtils.mkdir_p(install_path = "#{self.class.directory}/#{name}")
Dir.chdir install_path do
FileUtils.mkdir_p(path)
Dir.chdir(path) do
system("git init > /dev/null 2>&1")
if system("git pull --depth 1 #{uri} > /dev/null 2>&1")
FileUtils.rm_rf %w(.git .gitignore)
else
FileUtils.rm_rf install_path
FileUtils.rm_rf path
end
end
end

def uninstall
path = "#{self.class.directory}/#{name}"
FileUtils.rm_r path if File.directory?(path)
end

Expand Down

0 comments on commit 9d5cda5

Please sign in to comment.