class DockerFlow::RakeBuilder

Public Class Methods

new(title, repository, tag_prefix='') click to toggle source

@param title [string] The title of the Project @param repository [string] the docker repository for the project. e.g. vjftw/homomorphic-encryption @param tag_prefix [string] If the repository has different services, this should be used. e.g. api

# File lib/rake/rake-builder.rb, line 7
def initialize(title, repository, tag_prefix='')
  @title = title
  @repository = repository
  @is_ci = DockerFlow::Utils.is_ci
  @current_branch = DockerFlow::Utils.get_branch
  @current_version = DockerFlow::Utils.get_commit_version

  @branch_container_tag = @current_branch

  @build_container_tag = "#{@current_branch}-#{@current_version}"
  if tag_prefix.length > 0
    @build_container_tag = "#{tag_prefix}-#{@build_container_tag}"
    @branch_container_tag = "#{tag_prefix}-#{@branch_container_tag}"
  end

  @build_container_name = "#{repository}:#{@build_container_tag}"
  @branch_container_name = "#{repository}:#{@branch_container_tag}"

  @info = {
      :host_type => @is_ci? 'Continuous Integration': 'Development',
      :branch => @current_branch,
      :commit_version => @current_version,
      :repository => @repository,
      :build_container_tag => @build_container_tag,
      :branch_container_tag => @branch_container_tag
  }

  init_print
end

Public Instance Methods

branch_container_name() click to toggle source
# File lib/rake/rake-builder.rb, line 61
def branch_container_name
  @branch_container_name
end
branch_container_tag() click to toggle source
# File lib/rake/rake-builder.rb, line 69
def branch_container_tag
  @branch_container_tag
end
build_container_name() click to toggle source
# File lib/rake/rake-builder.rb, line 57
def build_container_name
  @build_container_name
end
build_container_tag() click to toggle source
# File lib/rake/rake-builder.rb, line 65
def build_container_tag
  @build_container_tag
end
current_branch() click to toggle source
# File lib/rake/rake-builder.rb, line 49
def current_branch
  @current_branch
end
current_version() click to toggle source
# File lib/rake/rake-builder.rb, line 53
def current_version
  @current_version
end
is_ci() click to toggle source
# File lib/rake/rake-builder.rb, line 45
def is_ci
  @is_ci
end
repository() click to toggle source
# File lib/rake/rake-builder.rb, line 37
def repository
  @repository
end
title() click to toggle source
# File lib/rake/rake-builder.rb, line 41
def title
  @title
end

Private Instance Methods

init_print() click to toggle source
# File lib/rake/rake-builder.rb, line 74
def init_print
  DockerFlow::Utils.print_br
  DockerFlow::Utils.put_project_title @title
  DockerFlow::Utils.print_br
  DockerFlow::Utils.put_build_information @info
  DockerFlow::Utils.print_br
  DockerFlow::Utils.put_system_info
  puts "\n\n"
end