Class: Utopia::Command::Server::Update
- Inherits:
-
Samovar::Command
- Object
- Samovar::Command
- Utopia::Command::Server::Update
- Defined in:
- lib/utopia/command/server.rb
Overview
Update a server.
Instance Method Summary collapse
Instance Method Details
#invoke(parent) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/utopia/command/server.rb', line 49 def invoke(parent) 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" # 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 Setup::Server.update_default_environment(destination_root) # Copy git hooks: system("cp", "-r", File.join(Setup::Server::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 |