Class: RightScale::DevRepositories

Inherits:
Object
  • Object
show all
Includes:
Serializable
Defined in:
lib/right_agent/core_payload_types/dev_repositories.rb

Overview

Sequence of cookbooks to be checked out on the instance.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Serializable

included

Constructor Details

#initialize(*args) ⇒ DevRepositories

Initialize fields from given arguments



34
35
36
# File 'lib/right_agent/core_payload_types/dev_repositories.rb', line 34

def initialize(*args)
  @repositories = args[0] || {}
end

Instance Attribute Details

#repositoriesObject

Returns the value of attribute repositories.



31
32
33
# File 'lib/right_agent/core_payload_types/dev_repositories.rb', line 31

def repositories
  @repositories
end

Instance Method Details

#add_repo(repo_sha, repo_detail, cookbook_positions) ⇒ Object

Add a repository…

Parameters

(Hash)

collection of repos to be checked out on the instance

:repo_sha (String)

the hash id (SHA) of the repository

:repo_detail (Hash)

info needed to checkout this repo

 {
   <Symbol> Type of repository: one of :git, :svn, :download or :local
     * :git denotes a 'git' repository that should be retrieved via 'git clone'
     * :svn denotes a 'svn' repository that should be retrieved via 'svn checkout'
     * :download denotes a tar ball that should be retrieved via HTTP GET (HTTPS if uri starts with https://)
     * :local denotes cookbook that is already local and doesn't need to be retrieved
   :repo_type => <Symbol>,
   <String> URL to repository (e.g. git://github.com/opscode/chef-repo.git)
   :url => <String>,
   <String> git commit or svn branch that should be used to retrieve repository
     Optional, use 'master' for git and 'trunk' for svn if tag is nil.
     Not used for raw repositories.
   :tag => <String>,
   <Array> Path to cookbooks inside repostory
     Optional (use location of repository as cookbook path if nil)
   :cookbooks_path => <Array>,
   <String> Private SSH key used to retrieve git repositories
     Optional, not used for svn and raw repositories.
   :ssh_key => <String>,
   <String> Username used to retrieve svn and raw repositories
     Optional, not used for git repositories.
   :username => <String>,
   <String> Password used to retrieve svn and raw repositories
     Optional, not used for git repositories.
   :password => <String>
}
:cookbook_positions (Array)

List of CookbookPositions to be developed. Represents the subset of cookbooks identified as the “dev cookbooks”

Return

result(Hash)

The entry added to the collection of repositories



79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/right_agent/core_payload_types/dev_repositories.rb', line 79

def add_repo(repo_sha, repo_detail, cookbook_positions)
  @repositories ||= {}
  @repositories[repo_sha] = DevRepository.new(repo_detail[:repo_type],
                                              repo_detail[:url],
                                              repo_detail[:tag],
                                              repo_detail[:cookboooks_path],
                                              repo_detail[:ssh_key],
                                              repo_detail[:username],
                                              repo_detail[:password],
                                              repo_sha,
                                              cookbook_positions)
end

#empty?Boolean

Return

(Boolean)

true if there are no repositories, false otherwise

Returns:

  • (Boolean)


95
96
97
# File 'lib/right_agent/core_payload_types/dev_repositories.rb', line 95

def empty?
  @repositories.count == 0
end

#serialized_membersObject

Array of serialized fields given to constructor



39
40
41
# File 'lib/right_agent/core_payload_types/dev_repositories.rb', line 39

def serialized_members
  [ @repositories ]
end