Class: Serverspec::Type::OctopusDeployProjectGroup

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

Instance Method Summary collapse

Constructor Details

#initialize(serverUrl, apiKey, projectgroup_name, space_name = nil) ⇒ OctopusDeployProjectGroup

Returns a new instance of OctopusDeployProjectGroup.



14
15
16
17
18
19
20
21
22
23
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/octopus_serverspec_extensions/type/octopus_deploy_project_group.rb', line 14

def initialize(serverUrl, apiKey, projectgroup_name, space_name = nil)
  @name = "Octopus Deploy Project Group #{projectgroup_name}"
  @runner = Specinfra::Runner
  @serverUrl = serverUrl
  @apiKey = apiKey


  if serverUrl.nil?
    raise "'serverUrl' was not provided. Unable to connect to Octopus server to validate configuration."
  end
  if apiKey.nil?
    raise "'apiKey' was not provided. Unable to connect to Octopus server to validate configuration."
  end
  if projectgroup_name.nil?
    raise "'projectgroup_name' was not provided. Unable to connect to Octopus server to validate configuration."
  end

  @serverSupportsSpaces = check_supports_spaces(serverUrl)

  if @serverSupportsSpaces
    # set the spaceId correctly


    if space_name.nil?
      @spaceId = 'Spaces-1' # default to Spaces-1

    else
      @spaceId = get_space_id?(space_name)
    end

    @spaceFragment = "#{@spaceId}/"
  end

  @projectgroup = get_projectgroup_via_api(serverUrl, apiKey, projectgroup_name)
end

Instance Method Details

#exists?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_project_group.rb', line 48

def exists?
  (!@projectgroup.nil?) && (@projectgroup != [])
end

#has_description?(projectgroup_description) ⇒ Boolean

Returns:

  • (Boolean)


52
53
54
55
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_project_group.rb', line 52

def has_description?(projectgroup_description)
  return false if @projectgroup.nil?
  @projectgroup["Description"] == projectgroup_description
end