Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improve script/plugin on Windows. Closes #2646.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2821 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 08acb95a3fea6b8c29133528c7e0166c7b87a0f4 1 parent 54a4e50
@jeremy jeremy authored
Showing with 29 additions and 3 deletions.
  1. +2 −0  railties/CHANGELOG
  2. +27 −3 railties/lib/commands/plugin.rb
View
2  railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Improve script/plugin on Windows. #2646 [Chad Fowler]
+
* The *_plugindoc Rake tasks look deeper into the plugins' lib directories. #2652 [bellis@deepthought.org]
* The PostgreSQL :db_structure_dump Rake task limits its dump to the schema search path in database.yml. [Anatol Pomozov <anatol.pomozov@gmail.com>]
View
30 railties/lib/commands/plugin.rb
@@ -46,6 +46,12 @@
# Send patches to rtomayko@gmail.com
$verbose = false
+`svn --version`
+unless $?.success?
+ $stderr.puts "ERROR: Must have subversion (svn) available in the PATH to use plugin manager"
+ exit 1
+end
+
require 'fileutils'
require 'tempfile'
@@ -193,7 +199,7 @@ def rails_env
class Repositories
include Enumerable
- def initialize(cache_file="~/.rails-plugin-sources")
+ def initialize(cache_file = File.join(find_home, ".rails-plugin-sources"))
@cache_file = File.expand_path(cache_file)
load!
end
@@ -252,7 +258,25 @@ def defaults
http://svn.aviditybytes.com/rails/plugins/
REPOSITORIES
end
-
+
+ def find_home
+ ['HOME', 'USERPROFILE'].each do |homekey|
+ return ENV[homekey] if ENV[homekey]
+ end
+ if ENV['HOMEDRIVE'] && ENV['HOMEPATH']
+ return "#{ENV['HOMEDRIVE']}:#{ENV['HOMEPATH']}"
+ end
+ begin
+ File.expand_path("~")
+ rescue StandardError => ex
+ if File::ALT_SEPARATOR
+ "C:/"
@chad
chad added a note

This is really thrilling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ else
+ "/"
+ end
+ end
+ end
+
def self.instance
@instance ||= Repositories.new
end
@@ -740,4 +764,4 @@ def parse!(args)
end
-Commands::Plugin.parse!
@chad

This is really thrilling

Please sign in to comment.
Something went wrong with that request. Please try again.