Class: Chef::Taste::Dependency

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/taste/dependency.rb

Overview

The class that contains information about a dependent cookbook

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, requirement) ⇒ Dependency

Constructor

Parameters:

  • name (String)

    the name of the dependent cookbook

  • requirement (String)

    the version requirement for dependent cookbook



61
62
63
64
65
66
67
68
69
# File 'lib/chef/taste/dependency.rb', line 61

def initialize(name, requirement)
  @name = name
  @requirement = requirement
  @version_used = nil
  @latest = nil
  @status = nil
  @source_url = nil
  @changelog = nil
end

Instance Attribute Details

#changelogObject

The changelog link for the dependency if available



52
53
54
# File 'lib/chef/taste/dependency.rb', line 52

def changelog
  @changelog
end

#latestObject

The latest version available for the dependency



43
44
45
# File 'lib/chef/taste/dependency.rb', line 43

def latest
  @latest
end

#nameObject (readonly)

The name of the dependency



34
35
36
# File 'lib/chef/taste/dependency.rb', line 34

def name
  @name
end

#requirementObject (readonly)

The requirement for the dependency



37
38
39
# File 'lib/chef/taste/dependency.rb', line 37

def requirement
  @requirement
end

#source_urlObject

The source URL for a cookbook



49
50
51
# File 'lib/chef/taste/dependency.rb', line 49

def source_url
  @source_url
end

#statusObject

The status of the dependency



46
47
48
# File 'lib/chef/taste/dependency.rb', line 46

def status
  @status
end

#version_usedObject

The version of cookbook used after applying the version constraint



40
41
42
# File 'lib/chef/taste/dependency.rb', line 40

def version_used
  @version_used
end

Instance Method Details

#to_hashHash

Converts the dependency option to a hash

Returns:

  • (Hash)

    the hash representation of the dependency object



75
76
77
78
79
80
81
82
83
# File 'lib/chef/taste/dependency.rb', line 75

def to_hash
  {}.tap do |hash|
    hash[:requirement] = requirement
    hash[:used] = version_used
    hash[:latest] = latest
    hash[:status] = status
    hash[:changelog] = changelog
  end
end