Sha256: 4bf570e6cb48df078df2100e1105777aa0695eeed12db1f62e0a367733007caa

Contents?: true

Size: 1.51 KB

Versions: 1

Compression:

Stored size: 1.51 KB

Contents

set_default :releases_path, "releases"
set_default :shared_path, "shared"
set_default :current_path, "current"
set_default :lock_file, "deploy.lock"

namespace :deploy do
  desc "Forces a deploy unlock."
  task :force_unlock do
    queue %{echo "-----> Unlocking"}
    queue echo_cmd %{rm -f "#{deploy_to}/#{lock_file}"}
  end

  desc "Links paths set in :shared_paths."
  task :link_shared_paths do
    dirs = settings.shared_paths!.map { |file| File.dirname("./#{file}") }.uniq

    cmds = dirs.map do |dir|
      echo_cmd %{mkdir -p "#{dir}"}
    end

    cmds += shared_paths.map do |file|
      echo_cmd %{ln -s "#{shared_path}/#{file}" "./#{file}"}
    end

    queue %{
      echo "-----> Symlinking shared paths"
      #{cmds.join(" &&\n")}
    }
  end
end

desc "Sets up a site."
task :setup do
  settings.deploy_to!

  queue %{echo "-----> Setting up #{deploy_to}"}
  queue echo_cmd %{mkdir -p "#{deploy_to}"}
  queue echo_cmd %{chown -R `whoami` "#{deploy_to}"}
  queue echo_cmd %{chmod g+rx,u+rwx "#{deploy_to}"}
  queue echo_cmd %{cd "#{deploy_to}"}
  queue echo_cmd %{mkdir -p "#{releases_path}"}
  queue echo_cmd %{chmod g+rx,u+rwx "#{releases_path}"}
  queue echo_cmd %{mkdir -p "#{shared_path}"}
  queue echo_cmd %{chmod g+rx,u+rwx "#{shared_path}"}
  queue %{echo "-----> Done"}
end

desc "Runs a command in the server."
task :run, :command do |t, args|
  command = args[:command]
  unless command
    puts %[You need to provide a command. Try: mina "run[ls -la]"]
    exit 1
  end

  queue %[cd #{deploy_to!} && #{command}]
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mina-0.1.0 lib/mina/deploy.rb