Sha256: 9728feac1fba0a44183e3c417325c65eea6be895249edb33d96ee765f348a14f

Contents?: true

Size: 658 Bytes

Versions: 5

Compression:

Stored size: 658 Bytes

Contents

# frozen_string_literal: true

namespace :invoke do
  # Defalut to :app roles
  rake_roles = fetch(:rake_roles, :app)

  desc 'Execute a rake task on a remote server (cap invoke:rake TASK=db:migrate)'
  task :rake do
    task_name = ENV['TASK']
    unless task_name
      puts "\n\nFailed! You need to specify the 'TASK' parameter!",
           'Usage: cap <stage> invoke:rake TASK=your:task',
           'Example: cap production invoke:rake TASK=db:migrate'
      exit 1
    end

    on roles(rake_roles) do
      within current_path do
        with rails_env: fetch(:rails_env) do
          execute :rake, task_name
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
capistrano-ops-1.0.4 lib/capistrano/ops/invoke/tasks/invoke.rake
capistrano-ops-1.0.3 lib/capistrano/ops/invoke/tasks/invoke.rake
capistrano-ops-1.0.2 lib/capistrano/ops/invoke/tasks/invoke.rake
capistrano-ops-1.0.1 lib/capistrano/ops/invoke/tasks/invoke.rake
capistrano-ops-1.0.0 lib/capistrano/ops/invoke/tasks/invoke.rake