Class: Dependency

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

Constant Summary collapse

DESCRIPTION_TYPE_WIDTH =
8

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Dependency

Returns a new instance of Dependency.



11
12
13
# File 'lib/dependency.rb', line 11

def initialize(name)
	@name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



9
10
11
# File 'lib/dependency.rb', line 9

def name
  @name
end

Instance Method Details

#always_act?Boolean

if true, this type of resource must always have ‘meet` and `unmeet` called; useful for resources that can’t easily be checked to see if they’re met

Returns:

  • (Boolean)


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

def always_act?
	false
end

#exit_codeObject



53
54
55
# File 'lib/dependency.rb', line 53

def exit_code
	@executor&.exit_code
end

#meetObject

Raises:

  • (NotImplementedError)


19
20
21
# File 'lib/dependency.rb', line 19

def meet
	raise NotImplementedError
end

#met?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


15
16
17
# File 'lib/dependency.rb', line 15

def met?
	raise NotImplementedError
end

#outputObject



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

def output
	@executor&.output
end

#should_meet?Boolean

should_meet? can be used to implement dependencies that should only be met on some platforms, e.g. brew on Macs and apt on Linux it can be used to base a decision on anything else that can be read from the environment at runtime

Returns:

  • (Boolean)


31
32
33
# File 'lib/dependency.rb', line 31

def should_meet?
	true
end

#success?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/dependency.rb', line 45

def success?
	@executor.nil? ? true : @executor.success?
end

#typeObject



41
42
43
# File 'lib/dependency.rb', line 41

def type
	self.class.name.split('::').last
end

#unmeetObject

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/dependency.rb', line 23

def unmeet
	raise NotImplementedError
end