module Capistrano::Jenkins::DefaultStrategy

The Capistrano default strategy for git. You should want to use this.

Public Instance Methods

check() click to toggle source
# File lib/capistrano/jenkins.rb, line 102
def check
  res          = jenkins_api_res
  build_status = res['result'].downcase

  if allowed_statuses.include? build_status
    if artifact_is_zip?
      unless test! 'hash unzip 2>/dev/null'
        abort 'unzip required, but not found'
      end
    end

    true
  else
    abort 'Latest build status isn\'t green!'
  end
end
clone() click to toggle source
# File lib/capistrano/jenkins.rb, line 119
def clone
  # Left unimplemented, as Jenkins has no analog to `git clone`
  context.execute :mkdir, '-p', repo_path

  true
end
fetch_revision() click to toggle source
# File lib/capistrano/jenkins.rb, line 145
def fetch_revision
  "build-#{artifact_build_number}"
end
release() click to toggle source
# File lib/capistrano/jenkins.rb, line 133
def release
  if artifact_is_zip?
    # is an archive - unpack and deploy
    context.execute :rm, '-rf', 'out'
    context.execute :unzip, fetch(:deployed_artifact_filename, artifact_filename), '-d', 'out/'
    context.execute :bash, "-c 'shopt -s dotglob; mv out/#{fetch(:jenkins_artifact_path, '*')} #{release_path}'"
    context.execute :rm, '-rf', 'out'
  else
    context.execute :cp, fetch(:deployed_artifact_filename, artifact_filename), release_path
  end
end
test() click to toggle source
# File lib/capistrano/jenkins.rb, line 98
def test
  test! " [ -d #{repo_path} ] "
end
update() click to toggle source
# File lib/capistrano/jenkins.rb, line 126
def update
  # grab the newest artifact
  context.execute :curl, "--silent --fail --show-error #{curl_auth} " \
    "#{artifact_url} -o #{fetch(:deployed_artifact_filename, artifact_filename)} " \
    "#{'--insecure' if fetch(:jenkins_insecure)}"
end