Class: Utopia::Command::Server::Create

Inherits:
Samovar::Command
  • Object
show all
Defined in:
lib/utopia/command.rb

Instance Method Summary collapse

Instance Method Details

#invoke(parent) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/utopia/command.rb', line 55

def invoke(parent)
	destination_root = parent.root
	
	FileUtils.mkdir_p File.join(destination_root, "public")
	FileUtils.mkdir_p File.join(destination_root, "tmp")
	
	Dir.chdir(destination_root) do
		# Shared allows multiple users to access the site with the same group:
		system("git", "init", "--shared")
		system("git", "config", "receive.denyCurrentBranch", "ignore")
		system("git", "config", "core.worktree", destination_root)
		
		system("cp", "-r", File.join(Setup::Server::ROOT, 'git', 'hooks'), File.join(destination_root, '.git'))
	end
	
	hostname = `hostname`.chomp
	puts "Now add the git remote to your local repository:\n\tgit remote add production ssh://#{hostname}#{destination_root}"
	puts "Then push to it:\n\tgit push --set-upstream production master"
end