Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge [5395] from trunk.

git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/1-2-pre-release@5396 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 9f26164d37995545f00f1dd3f5262d8a5257da85 1 parent c7f28e0
@jeremy jeremy authored
Showing with 22 additions and 6 deletions.
  1. +2 −0  railties/CHANGELOG
  2. +20 −6 railties/lib/rails_generator/commands.rb
View
2  railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Generated directories are recursively svn added, like mkdir -p. #6416 [NeilW]
+
* resource and scaffold_resource generators add a restful route to config/routes.rb [Jeremy Kemper]
* Revert environment changes for autoload_paths. [Koz]
View
26 railties/lib/rails_generator/commands.rb
@@ -299,12 +299,26 @@ def directory(relative_path)
logger.exists relative_path
else
logger.create relative_path
- FileUtils.mkdir_p(path) unless options[:pretend]
-
- # Optionally add file to subversion
- system("svn add #{path}") if options[:svn]
- end
- end
+ unless options[:pretend]
+ FileUtils.mkdir_p(path)
+
+ # Subversion doesn't do path adds, so we need to add
+ # each directory individually.
+ # So stack up the directory tree and add the paths to
+ # subversion in order without recursion.
+ if options[:svn]
+ stack=[relative_path]
+ until File.dirname(stack.last) == stack.last # dirname('.') == '.'
+ stack.push File.dirname(stack.last)
+ end
+ stack.reverse_each do |rel_path|
+ svn_path = destination_path(rel_path)
+ system("svn add -N #{svn_path}") unless File.directory?(File.join(svn_path, '.svn'))
+ end
+ end
+ end
+ end
+ end
# Display a README.
def readme(*relative_sources)
Please sign in to comment.
Something went wrong with that request. Please try again.