Class: DeployGate::Deploy

Inherits:
Object
  • Object
show all
Defined in:
lib/deploygate/deploy.rb

Defined Under Namespace

Classes: NotFileExistError, NotLoginError, UploadError

Class Method Summary collapse

Class Method Details

.push(command, file_path, target_user, message, distribution_key, disable_notify = false) { ... } ⇒ Hash

Parameters:

  • command (String)
  • file_path (String)
  • target_user (String)
  • message (String)
  • distribution_key (String)
  • disable_notify (Boolean) (defaults to: false)

Yields:

  • Upload process block

Returns:

  • (Hash)

Raises:



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/deploygate/deploy.rb', line 20

def push(command, file_path, target_user, message, distribution_key, disable_notify = false, &process_block)
  raise NotFileExistError, 'Target file is not found' if file_path.nil? || !File.exist?(file_path)

  session = DeployGate::Session.new()
  raise NotLoginError, 'Must login user' unless session.login?
  token = session.token

  data = API::V1::Push.upload(command, file_path, target_user, token, message, distribution_key || '', disable_notify) { process_block.call unless process_block.nil? }
  raise UploadError, data[:message] if data[:error]

  data
end