Class: DPL::Provider::Surge

Inherits:
DPL::Provider show all
Defined in:
lib/dpl/provider/surge.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



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

def check_app
	if ! File.directory?(project) then raise Error, "Please set a valid project folder path in .travis.yml under deploy: project: myPath" end
	if domain.empty? && ! File.exist?("#{project}/CNAME") then raise Error, "Please set domain in .travis.yml under deploy: project: myDomain (or in a CNAME file in the repo project folder)" end
end

#check_authObject



14
15
16
17
# File 'lib/dpl/provider/surge.rb', line 14

def check_auth
  if ! context.env['SURGE_TOKEN'] then raise Error, "Please add SURGE_TOKEN in Travis settings (get your token with 'surge token')" end
  if ! context.env['SURGE_LOGIN'] then raise Error, "Please add SURGE_LOGIN in Travis settings (its your email)" end
end

#domainObject



10
11
12
# File 'lib/dpl/provider/surge.rb', line 10

def domain
  options[:domain] || ''
end

#needs_key?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/dpl/provider/surge.rb', line 24

def needs_key?
  false
end

#projectObject



6
7
8
# File 'lib/dpl/provider/surge.rb', line 6

def project
  File.expand_path( (context.env['TRAVIS_BUILD_DIR'] || '.' ) + "/" + (options[:project] || '') )
end

#push_appObject



28
29
30
# File 'lib/dpl/provider/surge.rb', line 28

def push_app
  context.shell "surge #{project} #{domain}"
end