Utopia::Command::Site::Update
Update a local site.
Definitions
def move_static!
Move legacy pages/_static
to public/_static
.
Implementation
def move_static!
# If public/_static doens't exist, we are done.
return unless File.exist? 'pages/_static'
if File.exist? 'public/_static'
if File.lstat("public/_static").symlink?
FileUtils.rm_f "public/_static"
else
warn "Can't move pages/_static to public/_static, destination already exists."
return
end
end
# One more sanity check:
if File.directory? 'pages/_static'
system("git", "mv", "pages/_static", "public/")
end
end
def update_gemfile!
Move Gemfile
to gems.rb
.
Implementation
def update_gemfile!
# If `Gemfile` doens't exist, we are done:
return unless File.exist?('Gemfile')
system("git", "mv", "Gemfile", "gems.rb")
system("git", "mv", "Gemfile.lock", "gems.locked")
end