Module: Capistrano::DSL

Includes:
Env, Paths, Stages, TaskEnhancements
Defined in:
lib/capistrano/dsl.rb,
lib/capistrano/dsl/env.rb,
lib/capistrano/dsl/paths.rb,
lib/capistrano/dsl/stages.rb

Defined Under Namespace

Modules: Env, Paths, Stages

Instance Method Summary collapse

Methods included from Stages

#stage_definitions, #stage_set?, #stages

Methods included from Paths

#asset_timestamp, #current_path, #deploy_config_path, #deploy_path, #deploy_to, #join_paths, #linked_dir_parents, #linked_dirs, #linked_file_dirs, #linked_files, #map_dirnames, #now, #release_path, #releases_path, #repo_path, #repo_url, #revision_log, #set_release_path, #shared_path, #stage_config_path

Methods included from Env

#any?, #ask, #asset_timestamp, #configure_backend, #delete, #env, #fetch, #primary, #release_roles, #release_timestamp, #role, #role_properties, #roles, #server, #set, #set_if_empty

Methods included from TaskEnhancements

#after, #before, #default_tasks, #define_remote_file_task, #deploying?, #ensure_stage, #exit_deploy_because_of_exception, #remote_file, #tasks_without_stage_dependency

Instance Method Details

#invoke(task, *args) ⇒ Object



15
16
17
# File 'lib/capistrano/dsl.rb', line 15

def invoke(task, *args)
  Rake::Task[task].invoke(*args)
end

#local_userObject



45
46
47
# File 'lib/capistrano/dsl.rb', line 45

def local_user
  fetch(:local_user)
end

#lock(locked_version) ⇒ Object



49
50
51
# File 'lib/capistrano/dsl.rb', line 49

def lock(locked_version)
  VersionValidator.new(locked_version).verify
end

#on(hosts, options = {}, &block) ⇒ Object



53
54
55
56
# File 'lib/capistrano/dsl.rb', line 53

def on(hosts, options={}, &block)
  subset_copy = Marshal.dump(Configuration.env.filter(hosts))
  SSHKit::Coordinator.new(Marshal.load(subset_copy)).each(options, &block)
end

#revision_log_messageObject



31
32
33
34
35
36
37
38
39
# File 'lib/capistrano/dsl.rb', line 31

def revision_log_message
  fetch(:revision_log_message,
    t(:revision_log_message,
      branch: fetch(:branch),
      user: local_user,
      sha: fetch(:current_revision),
      release: fetch(:release_timestamp))
   )
end

#rollback_log_messageObject



41
42
43
# File 'lib/capistrano/dsl.rb', line 41

def rollback_log_message
  t(:rollback_log_message, user: local_user, release: fetch(:rollback_timestamp))
end

#run_locally(&block) ⇒ Object



58
59
60
# File 'lib/capistrano/dsl.rb', line 58

def run_locally(&block)
  SSHKit::Backend::Local.new(&block).run
end

#scmObject



23
24
25
# File 'lib/capistrano/dsl.rb', line 23

def scm
  fetch(:scm)
end

#sudo(*args) ⇒ Object



27
28
29
# File 'lib/capistrano/dsl.rb', line 27

def sudo(*args)
  execute :sudo, *args
end

#t(key, options = {}) ⇒ Object



19
20
21
# File 'lib/capistrano/dsl.rb', line 19

def t(key, options={})
  I18n.t(key, options.merge(scope: :capistrano))
end