Class: Serverspec::Type::OctopusDeploySpace

Inherits:
Base
  • Object
show all
Defined in:
lib/octopus_serverspec_extensions/type/octopus_deploy_space.rb

Instance Method Summary collapse

Constructor Details

#initialize(*url_and_api_key, space_name) ⇒ OctopusDeploySpace

Returns a new instance of OctopusDeploySpace.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_space.rb', line 12

def initialize(*url_and_api_key, space_name)
  serverUrl, apiKey = get_octopus_creds(url_and_api_key)

  @name = "Octopus Deploy Space #{space_name}"
  @runner = Specinfra::Runner
  @serverUrl = serverUrl
  @apiKey = apiKey

  if space_name.nil?
    raise "'space_name' was not included. Cannot contact server to validate space."
  end

  @spaceName = space_name
end

Instance Method Details

#default?Boolean

Returns:

  • (Boolean)


32
33
34
35
36
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_space.rb', line 32

def default?
  load_resource_if_nil
  false if @space.nil?
  @space['IsDefault'] == true
end

#exists?Boolean

Returns:

  • (Boolean)


27
28
29
30
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_space.rb', line 27

def exists?
  load_resource_if_nil
  @space.nil? == false
end

#has_description?(description) ⇒ Boolean

Returns:

  • (Boolean)


44
45
46
47
48
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_space.rb', line 44

def has_description?(description)
  load_resource_if_nil
  false if @space.nil?
  @space['Description'] == description
end

#has_running_task_queue?Boolean

Returns:

  • (Boolean)


38
39
40
41
42
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_space.rb', line 38

def has_running_task_queue?
  load_resource_if_nil
  false if @space.nil?
  @space['TaskQueueStopped'] == false
end

#load_resource_if_nilObject



50
51
52
53
54
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_space.rb', line 50

def load_resource_if_nil
  if @space.nil?
    @space = get_space_via_api
  end
end