Class: Berkshelf::API::CacheBuilder::Worker::Base

Inherits:
Object
  • Object
show all
Includes:
Logging, Mixin::Services, Celluloid
Defined in:
lib/berkshelf/api/cache_builder/worker.rb

Direct Known Subclasses

ChefServer, FileStore, Github, Supermarket

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mixin::Services

extended, included

Methods included from Logging

init, #logger

Constructor Details

#initialize(options = {}) ⇒ Base

Returns a new instance of Base.



21
22
23
# File 'lib/berkshelf/api/cache_builder/worker.rb', line 21

def initialize(options = {})
  @priority = options[:priority]
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



18
19
20
# File 'lib/berkshelf/api/cache_builder/worker.rb', line 18

def options
  @options
end

#priorityObject (readonly)

Returns the value of attribute priority.



19
20
21
# File 'lib/berkshelf/api/cache_builder/worker.rb', line 19

def priority
  @priority
end

Class Method Details

.worker_type(type = nil) ⇒ Object

Parameters:

  • type (#to_s, nil) (defaults to: nil)


7
8
9
10
11
# File 'lib/berkshelf/api/cache_builder/worker.rb', line 7

def worker_type(type = nil)
  return @worker_type if @worker_type
  @worker_type = type.to_s
  Worker.register(@worker_type, self)
end

Instance Method Details

#cookbooksArray<RemoteCookbook>

This method is abstract.

Returns The list of cookbooks this builder can find.

Returns:

  • (Array<RemoteCookbook>)

    The list of cookbooks this builder can find

Raises:

  • (RuntimeError)


43
44
45
# File 'lib/berkshelf/api/cache_builder/worker.rb', line 43

def cookbooks
  raise RuntimeError, "must be implemented"
end

#metadata(remote) ⇒ Ridley::Chef::Cookbook::Metadata

This method is abstract.

Parameters:

Returns:

  • (Ridley::Chef::Cookbook::Metadata)

Raises:

  • (RuntimeError)


35
36
37
# File 'lib/berkshelf/api/cache_builder/worker.rb', line 35

def (remote)
  raise RuntimeError, "must be implemented"
end

#to_sString

Returns:

  • (String)


26
27
28
# File 'lib/berkshelf/api/cache_builder/worker.rb', line 26

def to_s
  friendly_name
end