From 60c9f6483f1a4988ad893d1c116fc6c7e210a5a8 Mon Sep 17 00:00:00 2001 From: Daniel Schierbeck Date: Thu, 30 Oct 2008 00:35:32 +0100 Subject: [PATCH] Made it possible to install plugins from Bazaar branches. --- railties/lib/commands/plugin.rb | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/railties/lib/commands/plugin.rb b/railties/lib/commands/plugin.rb index 9ff4739..089e315 100644 --- a/railties/lib/commands/plugin.rb +++ b/railties/lib/commands/plugin.rb @@ -175,6 +175,10 @@ class Plugin def git_url? @uri =~ /^git:\/\// || @uri =~ /\.git$/ end + + def bzr_url? + @uri =~ /^bzr(?:\+ssh)?:\/\// + end def installed? File.directory?("#{rails_env.root}/vendor/plugins/#{name}") \ @@ -186,6 +190,7 @@ class Plugin if :http == method method = :export if svn_url? method = :git if git_url? + method = :bzr if bzr_url? end uninstall if installed? and options[:force] @@ -286,6 +291,24 @@ class Plugin end end + def install_using_bzr(options = {}) + root = rails_env.root + mkdir_p "#{root}/vendor/plugins" + Dir.chdir "#{root}/vendor/plugins" do + base_cmd = "bzr branch" + base_cmd += " -q" if options[:quiet] and not $verbose + base_cmd += " -r #{options[:revision]}" if options[:revision] + base_cmd += " #{uri} #{name}" + puts base_cmd if $verbose + if system(base_cmd) + puts "removing: .bzr" if $verbose + rm_rf "#{name}/.bzr" + else + rm_rf name + end + end + end + def svn_command(cmd, options = {}) root = rails_env.root mkdir_p "#{root}/vendor/plugins" -- 1.5.4.3