# File lib/rubigen/commands.rb, line 345 def directory(relative_path) path = destination_path(relative_path) if File.exist?(path) logger.exists relative_path else logger.create relative_path unless options[:pretend] FileUtils.mkdir_p(path) # git doesn't require adding the paths, adding the files later will # automatically do a path add. # 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