class Utopia::Command::Server::Update
Update
a server.
Public Instance Methods
call()
click to toggle source
# File lib/utopia/command/server.rb, line 60 def call destination_root = parent.root Dir.chdir(destination_root) do # It's okay to call this on an existing repo, it will only update config as required to enable --shared. # --shared allows multiple users to access the site with the same group. system("git", "init", "--shared") or fail "could not initialize repository" system("git", "config", "receive.denyCurrentBranch", "ignore") or fail "could not set configuration" system("git", "config", "core.worktree", destination_root) or fail "could not set configuration" # Doing this invokes a lot of behaviour that isn't always ideal... # system("bundle", "config", "set", "--local", "deployment", "true") system("bundle", "config", "set", "--local", "without", "development") # In theory, to convert from non-shared to shared: # chgrp -R <group-name> . # Change files and directories' group # chmod -R g+w . # Change permissions # chmod g-w .git/objects/pack/* # Git pack files should be immutable # chmod g+s `find . -type d` # New files get group id of directory end # Set some useful defaults for the environment. environment = Environment[] environment.update_environment(destination_root) do |store| store['VARIANT'] ||= 'production' store['UTOPIA_SESSION_SECRET'] ||= SecureRandom.hex(40) end # Copy git hooks: system("cp", "-r", File.join(template_root, 'git', 'hooks'), File.join(destination_root, '.git')) or fail "could not copy git hooks" # finally set everything in the .git directory to be group writable # This failed for me and I had to do sudo chown http:http .git -R first. system("chmod", "-Rf", "g+w", File.join(destination_root, '.git')) or fail "could not update permissions of .git directory" end
template_root()
click to toggle source
# File lib/utopia/command/server.rb, line 55 def template_root # The root directory of the template server deployment: File.join(SETUP_ROOT, 'server') end