Class: DC::Project

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(directory: '.', docker_socket: 'tcp://127.0.0.1:2375') ⇒ Project

Returns a new instance of Project.



227
228
229
230
231
232
233
234
235
236
# File 'lib/dc.rb', line 227

def initialize directory: '.', docker_socket: 'tcp://127.0.0.1:2375'
  check_if_docker_is_available_at docker_socket

  @directory = File.expand_path directory

  @images_directory = "#{@directory}/.docker/images"
  @images = prepare_images

  @services_file = "#{@directory}/.docker/services.yml"
end

Instance Attribute Details

#groupObject (readonly)

Returns the value of attribute group.



238
239
240
# File 'lib/dc.rb', line 238

def group
  @group
end

#imagesObject (readonly)

Returns the value of attribute images.



238
239
240
# File 'lib/dc.rb', line 238

def images
  @images
end

Instance Method Details

#containersObject



240
241
242
# File 'lib/dc.rb', line 240

def containers
  group.containers
end

#rebuild_imagesObject



249
250
251
252
253
254
# File 'lib/dc.rb', line 249

def rebuild_images
  images.each do |image|
    image.tag "before_rebuild.#{Time.now.to_i}"
    image.build
  end
end

#runObject



244
245
246
247
# File 'lib/dc.rb', line 244

def run
  build_images
  prepare_services
end