Class: DtcRake::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/dtc_rake/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



15
16
17
18
19
20
21
22
23
24
# File 'lib/dtc_rake/config.rb', line 15

def initialize
  self.root_dir   = Dir.pwd
  self.output_dir = "target"
  self.colorize   = true
  self.upload_readme = false
  self.appbox_meta_artifact_code = "UU.OS/RUNTIME/APP_BOX"
  self.upload_uucloud_descriptor = false
  self.version_files = []
  guess_vendor_and_app
end

Instance Attribute Details

#appObject

Code of application. Guessed from root_dir name if not set.



27
28
29
# File 'lib/dtc_rake/config.rb', line 27

def app
  @app
end

#appbox_artifact_codeObject

Code of appbox artifact. Guessed from product_code and appbox_version if not set.



31
32
33
# File 'lib/dtc_rake/config.rb', line 31

def appbox_artifact_code
  @appbox_artifact_code
end

#appbox_location_codeObject

Code of appbox location (folder or organization unit). Required.



34
35
36
# File 'lib/dtc_rake/config.rb', line 34

def appbox_location_code
  @appbox_location_code
end

#appbox_meta_artifact_codeObject

Code of appbox meta artifact. Default value: UU.OS/RUNTIME/APP_BOX.



37
38
39
# File 'lib/dtc_rake/config.rb', line 37

def appbox_meta_artifact_code
  @appbox_meta_artifact_code
end

#appbox_territory_codeObject

Code of territory where the appbox artifact is / should be. Required.



40
41
42
# File 'lib/dtc_rake/config.rb', line 40

def appbox_territory_code
  @appbox_territory_code
end

#appbox_uarchiveObject

Path to uarchive with contents of appbox artifact. Default value: nil. If not set, appbox is created with empty content. Relative path is relative to root_dir.



45
46
47
# File 'lib/dtc_rake/config.rb', line 45

def appbox_uarchive
  @appbox_uarchive
end

#appbox_versionObject

Appbox version. Read from VERSION file located in the same directory as Rakefile if not set.



49
50
51
# File 'lib/dtc_rake/config.rb', line 49

def appbox_version
  @appbox_version
end

#colorizeObject

Print messages in colors. Default value: true.



52
53
54
# File 'lib/dtc_rake/config.rb', line 52

def colorize
  @colorize
end

#output_dirObject

Name of folder with build products. Default value: target. Relative path is relative to root_dir.



56
57
58
# File 'lib/dtc_rake/config.rb', line 56

def output_dir
  @output_dir
end

#product_codeObject

Code of product the appbox belongs to. Required.



59
60
61
# File 'lib/dtc_rake/config.rb', line 59

def product_code
  @product_code
end

#product_nameObject

Name of product the appbox belongs to. Required.



62
63
64
# File 'lib/dtc_rake/config.rb', line 62

def product_name
  @product_name
end

#root_dirObject

Appbox project root folder. Default value: current working directory.



65
66
67
# File 'lib/dtc_rake/config.rb', line 65

def root_dir
  @root_dir
end

#upload_readmeObject

Upload README.md or README.txt to appbox artifact. Default value: false.



68
69
70
# File 'lib/dtc_rake/config.rb', line 68

def upload_readme
  @upload_readme
end

#upload_uucloud_descriptorObject

Upload uuApp deployment descriptor to appbox artifact. Default value: false.



71
72
73
# File 'lib/dtc_rake/config.rb', line 71

def upload_uucloud_descriptor
  @upload_uucloud_descriptor
end

#uucloud_descriptor_pathObject

Path to uuApp deployment descriptor. Default value: uucloud_descriptor.json.



74
75
76
# File 'lib/dtc_rake/config.rb', line 74

def uucloud_descriptor_path
  @uucloud_descriptor_path
end

#vendorObject

Code of vendor. Guessed from root_dir name if not set.



77
78
79
# File 'lib/dtc_rake/config.rb', line 77

def vendor
  @vendor
end

#version_filesObject

List of files (or glob patterns) determining which files get updated by version:* tasks. Default: none.



81
82
83
# File 'lib/dtc_rake/config.rb', line 81

def version_files
  @version_files
end

Instance Method Details

#validate!Object



83
84
85
86
87
88
89
# File 'lib/dtc_rake/config.rb', line 83

def validate!
  %w(appbox_location_code appbox_territory_code product_code product_name).each do |param|
    if instance_variable_get("@#{param}").nil?
      _error "Required parameter #{param} is not set. Set it within DtcRake.configure in your Rakefile."
    end
  end
end