Class: DPL::Provider::Catalyze

Inherits:
DPL::Provider show all
Defined in:
lib/dpl/provider/catalyze.rb

Instance Attribute Summary

Attributes inherited from DPL::Provider

#context, #options

Instance Method Summary collapse

Methods inherited from DPL::Provider

apt_get, #cleanup, #commit_msg, context, #create_key, #default_text_charset, #default_text_charset?, #deploy, deprecated, #detect_encoding?, #encoding_for, #error, experimental, #initialize, #log, new, npm_g, #option, pip, requires, #run, #setup_git_credentials, #setup_git_ssh, #sha, shell, #uncleanup, #user_agent, #warn

Constructor Details

This class inherits a constructor from DPL::Provider

Instance Method Details

#check_appObject



17
18
# File 'lib/dpl/provider/catalyze.rb', line 17

def check_app
end

#check_authObject



20
21
22
# File 'lib/dpl/provider/catalyze.rb', line 20

def check_auth
  error "Missing Catalyze target" unless config['target']
end

#configObject



4
5
6
7
8
9
10
11
# File 'lib/dpl/provider/catalyze.rb', line 4

def config
  {
      # the git repository to deploy to
      "target" => options[:target] || context.env['CATALYZE_TARGET'],
      # the pathspec for files to add to git for deployment e.g. your build directory. defaults to all files.
      "path" => options[:path] || context.env['CATALYZE_PATH'] || '.'
  }
end

#needs_key?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/dpl/provider/catalyze.rb', line 13

def needs_key?
  false
end

#push_appObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/dpl/provider/catalyze.rb', line 24

def push_app
  log "Deploying to Catalyze '#{config['target']}'"

  if options[:skip_cleanup]
    # create commit message
    build_num = context.env["TRAVIS_BUILD_NUMBER"]
    commit = context.env["TRAVIS_COMMIT"]
    repo_slug = context.env["TRAVIS_REPO_SLUG"]
    branch = context.env["TRAVIS_BRANCH"]
    if build_num && commit && repo_slug && branch
      commit_message = "Build ##{build_num} (#{commit}) of #{repo_slug}@#{branch}"
    else
      commit_message = "Local build"
    end

    log "Using build files for deployment"
    context.shell "git checkout HEAD"
    context.shell "git add #{config["path"]} --all --force"
    context.shell "git commit -m \"#{commit_message}\" --quiet"
  end

  context.shell "git push --force #{config['target']} HEAD:master"
end