Class: Kitchen::Driver::VmpoolStores::GitlabCommitStore

Inherits:
GitlabBaseStore show all
Defined in:
lib/kitchen/driver/vmpool_stores/gitlab_commit_store.rb

Instance Attribute Summary collapse

Attributes inherited from FileBaseStore

#pool_data

Instance Method Summary collapse

Methods inherited from FileBaseStore

#cleanup, #read, #reread, #take_pool_member

Methods inherited from BaseStore

#cleanup, #take_pool_member

Constructor Details

#initialize(options = nil) ⇒ GitlabCommitStore

Returns a new instance of GitlabCommitStore.

Parameters:

  • project_id (Hash)

    a customizable set of options

  • commit_id (Hash)

    a customizable set of options

  • pool_file (Hash)

    a customizable set of options

Raises:

  • (ArgumentError)


14
15
16
17
18
19
20
21
22
# File 'lib/kitchen/driver/vmpool_stores/gitlab_commit_store.rb', line 14

def initialize(options = nil)
  # there is currently some sort of weird bug in gitlab that prevents us from creating files with a yaml extension
  # thus we have ranmed the default pool file to vmpool
  options ||= { "project_id" => nil, "pool_file" => 'vmpool'}
  raise ArgumentError.new("You must pass the project_id option") unless options['project_id'].to_i > 0
  @project_id = options['project_id']  #ie. 89
  @pool_file = options['pool_file'] || 'vmpool'
  @branch = 'master'
end

Instance Attribute Details

#branchObject (readonly)

Returns the value of attribute branch.



9
10
11
# File 'lib/kitchen/driver/vmpool_stores/gitlab_commit_store.rb', line 9

def branch
  @branch
end

#pool_fileObject (readonly)

Returns the value of attribute pool_file.



9
10
11
# File 'lib/kitchen/driver/vmpool_stores/gitlab_commit_store.rb', line 9

def pool_file
  @pool_file
end

#project_idObject

Returns the value of attribute project_id.



8
9
10
# File 'lib/kitchen/driver/vmpool_stores/gitlab_commit_store.rb', line 8

def project_id
  @project_id
end

Instance Method Details

#createObject



30
31
32
33
34
# File 'lib/kitchen/driver/vmpool_stores/gitlab_commit_store.rb', line 30

def create
  #info("Creating new vmpool data commit")
  create_file unless file_exists?
  read
end

#saveObject



36
37
38
39
40
# File 'lib/kitchen/driver/vmpool_stores/gitlab_commit_store.rb', line 36

def save
  # info("Saving vmpool data")
  update_file
  read
end

#update(content = nil) ⇒ Object



24
25
26
27
28
# File 'lib/kitchen/driver/vmpool_stores/gitlab_commit_store.rb', line 24

def update(content = nil)
  #info("Updating vmpool data")
  update_file
  read
end