Class: DtcRake::Product

Inherits:
Object
  • Object
show all
Includes:
UI, Singleton
Defined in:
lib/dtc_rake/product.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from UI

announce, colorize?, error, info, success, warning

Constructor Details

#initializeProduct

Returns a new instance of Product.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/dtc_rake/product.rb', line 25

def initialize
  config = Config.instance
  root_dir = config.root_dir
  sibling_dir_path = File.expand_path(File.join(root_dir, "../#{config.vendor}_#{config.app}"))

  @gem_project = sibling_dir_path
  @has_gem = File.directory?(@gem_project)

  @cmd_project = "#{sibling_dir_path}-cmd"
  @has_cmd = File.directory?(@cmd_project)

  @vuc_project = "#{sibling_dir_path}-vuc"
  @has_vuc = File.directory?(@vuc_project)

  @dockerfiles_project = File.expand_path(File.join(root_dir, "../docker"))
  @has_dockerfiles = File.directory?(@dockerfiles_project)
end

Instance Attribute Details

#appbox_uriObject (readonly)

UESURI of the appbox artifact.



16
17
18
# File 'lib/dtc_rake/product.rb', line 16

def appbox_uri
  @appbox_uri
end

#cmd_attachment_codeObject (readonly)

Returns the value of attribute cmd_attachment_code.



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

def cmd_attachment_code
  @cmd_attachment_code
end

#cmd_file_nameObject (readonly)

Returns the value of attribute cmd_file_name.



22
23
24
# File 'lib/dtc_rake/product.rb', line 22

def cmd_file_name
  @cmd_file_name
end

#cmd_projectObject (readonly)

Returns the value of attribute cmd_project.



18
19
20
# File 'lib/dtc_rake/product.rb', line 18

def cmd_project
  @cmd_project
end

#dockerfiles_attachment_codeObject (readonly)

Returns the value of attribute dockerfiles_attachment_code.



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

def dockerfiles_attachment_code
  @dockerfiles_attachment_code
end

#dockerfiles_file_nameObject (readonly)

Returns the value of attribute dockerfiles_file_name.



22
23
24
# File 'lib/dtc_rake/product.rb', line 22

def dockerfiles_file_name
  @dockerfiles_file_name
end

#dockerfiles_projectObject (readonly)

Returns the value of attribute dockerfiles_project.



18
19
20
# File 'lib/dtc_rake/product.rb', line 18

def dockerfiles_project
  @dockerfiles_project
end

#gem_attachment_codeObject (readonly)

Returns the value of attribute gem_attachment_code.



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

def gem_attachment_code
  @gem_attachment_code
end

#gem_file_nameObject (readonly)

Returns the value of attribute gem_file_name.



22
23
24
# File 'lib/dtc_rake/product.rb', line 22

def gem_file_name
  @gem_file_name
end

#gem_projectObject (readonly)

Returns the value of attribute gem_project.



18
19
20
# File 'lib/dtc_rake/product.rb', line 18

def gem_project
  @gem_project
end

#has_cmdObject (readonly)

Returns the value of attribute has_cmd.



20
21
22
# File 'lib/dtc_rake/product.rb', line 20

def has_cmd
  @has_cmd
end

#has_dockerfilesObject (readonly)

Returns the value of attribute has_dockerfiles.



20
21
22
# File 'lib/dtc_rake/product.rb', line 20

def has_dockerfiles
  @has_dockerfiles
end

#has_gemObject (readonly)

Returns the value of attribute has_gem.



20
21
22
# File 'lib/dtc_rake/product.rb', line 20

def has_gem
  @has_gem
end

#has_vucObject (readonly)

Returns the value of attribute has_vuc.



20
21
22
# File 'lib/dtc_rake/product.rb', line 20

def has_vuc
  @has_vuc
end

#versionObject (readonly)

Appbox version specified in deployment descriptor.



13
14
15
# File 'lib/dtc_rake/product.rb', line 13

def version
  @version
end

#vuc_attachment_codeObject (readonly)

Returns the value of attribute vuc_attachment_code.



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

def vuc_attachment_code
  @vuc_attachment_code
end

#vuc_file_nameObject (readonly)

Returns the value of attribute vuc_file_name.



22
23
24
# File 'lib/dtc_rake/product.rb', line 22

def vuc_file_name
  @vuc_file_name
end

#vuc_projectObject (readonly)

Returns the value of attribute vuc_project.



18
19
20
# File 'lib/dtc_rake/product.rb', line 18

def vuc_project
  @vuc_project
end

#yardoc_attachment_codeObject (readonly)

Returns the value of attribute yardoc_attachment_code.



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

def yardoc_attachment_code
  @yardoc_attachment_code
end

#yardoc_file_nameObject (readonly)

Returns the value of attribute yardoc_file_name.



22
23
24
# File 'lib/dtc_rake/product.rb', line 22

def yardoc_file_name
  @yardoc_file_name
end

Instance Method Details

#readme_attachment_codeObject



133
134
135
136
137
# File 'lib/dtc_rake/product.rb', line 133

def readme_attachment_code
  return @readme_attachment_code if defined? @readme_attachment_code
  config = Config.instance
  @readme_attachment_code = "#{config.vendor.upcase}.#{config.app.upcase}/README"
end

#uucloud_descriptorObject



43
44
45
46
47
48
49
50
# File 'lib/dtc_rake/product.rb', line 43

def uucloud_descriptor
  return @uucloud_descriptor if @uucloud_descriptor

  # TODO: Use app.json instead of uucloud_descriptor.json for appbox metadata
  File.open(Config.instance.uucloud_descriptor_path, "r") do |f|
    @uucloud_descriptor = JSON.parse(f.read, symbolize_names: true)
  end
end

#uucloud_descriptor_attachment_codeObject



127
128
129
130
131
# File 'lib/dtc_rake/product.rb', line 127

def uucloud_descriptor_attachment_code
  return @uucloud_descriptor_attachment_code if defined? @uucloud_descriptor_attachment_code
  config = Config.instance
  @uucloud_descriptor_attachment_code = "#{config.vendor.upcase}.#{config.app.upcase}/UUAPP-DEPLOY"
end