Class: Dpl::Providers::Pages::Api

Inherits:
Dpl::Providers::Pages show all
Defined in:
lib/dpl/providers/pages/api.rb

Constant Summary collapse

PAGES_PREVIEW_MEDIA_TYPE =
'application/vnd.github.mister-fantastic-preview+json'
TIMEOUTS =
{
  timeout: 180,
  open_timeout: 180
}

Constants inherited from Dpl::Provider

Dpl::Provider::FOLDS, Dpl::Provider::STAGES

Instance Attribute Summary

Attributes inherited from Dpl::Provider

#key_name, #repo_name

Instance Method Summary collapse

Methods inherited from Dpl::Provider

#before_finish, #before_init, #before_install, #before_prepare, #before_setup, #chmod, #cleanup, #cmd, #compact, #err, #error, #escape, examples, #expand, #file?, #finish?, #fold, #fold?, #info, #initialize, install_deps, install_deps?, #mkdir_p, move_files, #msg, #mv, #only, #open, #opt_for, #opt_key, #opts_for, #print, #quote, #read, #remove_dpl_dir, #rm_rf, #run, #run_cmd, #run_cmds, #run_stage, #run_stage?, #script, #setup_dpl_dir, #setup_git_config, #setup_git_http_user_agent, #setup_git_ssh, #setup_ssh_key, #shell, #sq, #ssh_keygen, #symbolize, #try_ssh_access, #uncleanup, unmove_files, validate_runtimes, #wait_for_ssh_access, #warn

Methods included from Dpl::Provider::Dsl

#apt, #apt?, #cmds, #description, #env, #errs, #full_name, #gem, #gem?, #keep, #move, #msgs, #needs, #needs?, #node_js, #npm, #npm?, #opt, #path, #pip, #pip?, #python, #ruby_pre?, #ruby_version, #runtimes, #status, #strs, #summary, #user_agent, #vars

Methods included from Squiggle

#sq

Methods included from Assets

#asset

Methods included from Env

included, #opts

Methods included from ConfigFile

included, #opts

Methods included from Interpolate

#interpolate, #obfuscate, #vars

Methods included from Memoize

included

Constructor Details

This class inherits a constructor from Dpl::Provider

Instance Method Details

#deployObject



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/dpl/providers/pages/api.rb', line 51

def deploy
  info :deploy

  api.request_page_build slug

  response = api.pages slug
  logger.debug response

  Timeout::timeout(30) do
    until response.status == 'built'
      response = api.pages slug
      logger.debug response
      sleep 1
    end
  end

  latest_pages_build = api.latest_pages_build slug
  if msg = latest_pages_build.error.message
    error "Build failed: #{msg}"
  end

  info "Pages deployed to #{response.html_url}, using commit #{latest_pages_build.commit}"
  logger.debug latest_pages_build

rescue Octokit::Forbidden => fb
  error fb.message
rescue Timeout::Error => to
  error :timeout
end

#validateObject



47
48
49
# File 'lib/dpl/providers/pages/api.rb', line 47

def validate
  error :not_found unless pages_enabled?
end