Class: Wooget::Build::BuildInfo
- Inherits:
-
Object
- Object
- Wooget::Build::BuildInfo
- Defined in:
- lib/wooget/build/build_info.rb
Instance Attribute Summary collapse
-
#output_dir ⇒ Object
Returns the value of attribute output_dir.
-
#package_ids ⇒ Object
readonly
Returns the value of attribute package_ids.
-
#project_root ⇒ Object
Returns the value of attribute project_root.
-
#release_notes ⇒ Object
Returns the value of attribute release_notes.
-
#template_files ⇒ Object
Returns the value of attribute template_files.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #build_name ⇒ Object
-
#initialize(template_files = [], output_dir = Dir.pwd, version = "919.919.919", release_notes = "no notes!", project_root = Dir.pwd) ⇒ BuildInfo
constructor
A new instance of BuildInfo.
- #invalid_reason ⇒ Object
- #needs_dll_build? ⇒ Boolean
- #package_names ⇒ Object
- #prerelease? ⇒ Boolean
- #valid? ⇒ Boolean
- #version_name ⇒ Object
Constructor Details
#initialize(template_files = [], output_dir = Dir.pwd, version = "919.919.919", release_notes = "no notes!", project_root = Dir.pwd) ⇒ BuildInfo
Returns a new instance of BuildInfo.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/wooget/build/build_info.rb', line 9 def initialize template_files=[], output_dir=Dir.pwd, version="919.919.919", release_notes="no notes!", project_root=Dir.pwd @template_files = template_files @output_dir = output_dir @version = version @release_notes = release_notes @invalid_reason = [] @project_root = project_root @package_ids = get_ids end |
Instance Attribute Details
#output_dir ⇒ Object
Returns the value of attribute output_dir.
6 7 8 |
# File 'lib/wooget/build/build_info.rb', line 6 def output_dir @output_dir end |
#package_ids ⇒ Object (readonly)
Returns the value of attribute package_ids.
7 8 9 |
# File 'lib/wooget/build/build_info.rb', line 7 def package_ids @package_ids end |
#project_root ⇒ Object
Returns the value of attribute project_root.
6 7 8 |
# File 'lib/wooget/build/build_info.rb', line 6 def project_root @project_root end |
#release_notes ⇒ Object
Returns the value of attribute release_notes.
6 7 8 |
# File 'lib/wooget/build/build_info.rb', line 6 def release_notes @release_notes end |
#template_files ⇒ Object
Returns the value of attribute template_files.
6 7 8 |
# File 'lib/wooget/build/build_info.rb', line 6 def template_files @template_files end |
#version ⇒ Object
Returns the value of attribute version.
6 7 8 |
# File 'lib/wooget/build/build_info.rb', line 6 def version @version end |
Instance Method Details
#build_name ⇒ Object
53 54 55 |
# File 'lib/wooget/build/build_info.rb', line 53 def build_name "#{File.basename(@project_root).downcase}-#{version}".shellescape end |
#invalid_reason ⇒ Object
25 26 27 |
# File 'lib/wooget/build/build_info.rb', line 25 def invalid_reason @invalid_reason.join ", " end |
#needs_dll_build? ⇒ Boolean
57 58 59 |
# File 'lib/wooget/build/build_info.rb', line 57 def needs_dll_build? @template_files.map { |f| Util.file_contains? File.join(project_root, f), "type project" }.any? end |
#package_names ⇒ Object
21 22 23 |
# File 'lib/wooget/build/build_info.rb', line 21 def package_names @package_ids.map { |id| [id, @version, "nupkg"].join "." } end |
#prerelease? ⇒ Boolean
33 34 35 |
# File 'lib/wooget/build/build_info.rb', line 33 def prerelease? !(@version !~ /prerelease/) end |
#valid? ⇒ Boolean
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/wooget/build/build_info.rb', line 37 def valid? valid = true unless Util.valid_version_string? @version @invalid_reason << "Invalid version string #{@version}" valid = false end unless @template_files.length > 0 @invalid_reason << "No template files provided" valid = false end valid end |
#version_name ⇒ Object
29 30 31 |
# File 'lib/wooget/build/build_info.rb', line 29 def version_name @version.split("-").first end |