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



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/utopia/command.rb', line 78

def invoke(parent)
	destination_root = parent.root
	
	FileUtils.mkdir_p File.join(destination_root, "public")
	
	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)
	end
	
	# Copy git hooks:
	system("cp", "-r", File.join(Setup::Server::ROOT, 'git', 'hooks'), File.join(destination_root, '.git'))
	
	Setup::Server.update_default_environment(destination_root)
	
	# Print out helpful git remote add message:
	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