bin/derpy in derpy-2.0.4 vs bin/derpy in derpy-2.0.5
- old
+ new
@@ -16,18 +16,19 @@
abort "Too many arguments; please specify only the target directory."
end
# set the target directory
site_target_dir = ARGV[1]
+ sitename = File.basename(File.expand_path(site_target_dir))
# check if the target directory exists
if File.directory?(site_target_dir)
abort "Error: The target directory already exists."
end
# make remote repos
- system('ssh git@git.3sign.com "cd git; mkdir [sitename] [sitename]/[sitename].git; cd [sitename]/[sitename].git; git --bare init;"'.gsub('[sitename]',site_target_dir))
+ system('ssh git@git.3sign.com "cd git; mkdir [sitename] [sitename]/[sitename].git; cd [sitename]/[sitename].git; git --bare init;"'.gsub('[sitename]',sitename))
# fetch and execute the drush make file
system('git clone git@github.com:3sign/threesign-standard-makefile.git')
system('drush make threesign-standard-makefile/threesign.make ' + site_target_dir)
@@ -43,13 +44,13 @@
FileUtils.mkdir('sites/all/drush')
# copy the aliases file to the drush dir
source = File.expand_path(File.dirname(__FILE__)) + "/../templates/aliases.drushrc.php"
FileUtils.cp(source, 'sites/all/drush')
- # replace [sitename] with site_target_dir
+ # replace [sitename] with sitename
text = File.read('sites/all/drush/aliases.drushrc.php')
- puts = text.gsub('[sitename]',site_target_dir)
+ puts = text.gsub('[sitename]',sitename)
File.open('sites/all/drush/aliases.drushrc.php', "w") {|file| file << puts}
# create local .htaccess
FileUtils.cp('.htaccess', '.htaccess.local')
# alter local .htaccess to use VirtualDocumentRoot
@@ -57,11 +58,11 @@
puts = text.gsub('# RewriteBase /','RewriteBase /')
File.open('.htaccess.local', "w") {|file| file << puts}
# set up the core repo
system('git init')
- system('git remote add origin git@git.3sign.com:git/[sitename]/[sitename].git'.gsub('[sitename]',site_target_dir))
+ system('git remote add origin git@git.3sign.com:git/[sitename]/[sitename].git'.gsub('[sitename]',sitename))
File.open('.gitignore', 'a') { |file|
file.puts "# Ignore local .htaccess."
file.puts ".htaccess.local"
file.puts "# Ignore Capistrano config paths."
file.puts "Capfile"
@@ -71,10 +72,10 @@
# initial push
system('git add .')
system('git commit -am "initial commit"')
system('git push origin master')
- puts "Derpy finished installing " + site_target_dir + ", YO!"
+ puts "Derpy finished installing " + sitename + ", YO!"
end
end
if ARGV.empty?
abort "Use 'derpy -T' to display Capistrano tasks.
\ No newline at end of file