Class: DockerFlow::RakeBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/rake/rake-builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(title, repository, tag_prefix = '') ⇒ RakeBuilder

Returns a new instance of RakeBuilder.

Parameters:

  • title (string)

    The title of the Project

  • repository (string)

    the docker repository for the project. e.g. vjftw/homomorphic-encryption

  • tag_prefix (string) (defaults to: '')

    If the repository has different services, this should be used. e.g. api



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 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

Instance Method Details

#branch_container_nameObject



61
62
63
# File 'lib/rake/rake-builder.rb', line 61

def branch_container_name
  @branch_container_name
end

#branch_container_tagObject



69
70
71
# File 'lib/rake/rake-builder.rb', line 69

def branch_container_tag
  @branch_container_tag
end

#build_container_nameObject



57
58
59
# File 'lib/rake/rake-builder.rb', line 57

def build_container_name
  @build_container_name
end

#build_container_tagObject



65
66
67
# File 'lib/rake/rake-builder.rb', line 65

def build_container_tag
  @build_container_tag
end

#current_branchObject



49
50
51
# File 'lib/rake/rake-builder.rb', line 49

def current_branch
  @current_branch
end

#current_versionObject



53
54
55
# File 'lib/rake/rake-builder.rb', line 53

def current_version
  @current_version
end

#is_ciObject



45
46
47
# File 'lib/rake/rake-builder.rb', line 45

def is_ci
  @is_ci
end

#repositoryObject



37
38
39
# File 'lib/rake/rake-builder.rb', line 37

def repository
  @repository
end

#titleObject



41
42
43
# File 'lib/rake/rake-builder.rb', line 41

def title
  @title
end