Class: Wooget::Build::BuildInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/wooget/build/build_info.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_dirObject

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_idsObject (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_rootObject

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_notesObject

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_filesObject

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

#versionObject

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_nameObject



53
54
55
# File 'lib/wooget/build/build_info.rb', line 53

def build_name
  "#{File.basename(@project_root).downcase}-#{version}".shellescape
end

#invalid_reasonObject



25
26
27
# File 'lib/wooget/build/build_info.rb', line 25

def invalid_reason
  @invalid_reason.join ", "
end

#needs_dll_build?Boolean

Returns:

  • (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_namesObject



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

Returns:

  • (Boolean)


33
34
35
# File 'lib/wooget/build/build_info.rb', line 33

def prerelease?
  !(@version !~ /prerelease/)
end

#valid?Boolean

Returns:

  • (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_nameObject



29
30
31
# File 'lib/wooget/build/build_info.rb', line 29

def version_name
  @version.split("-").first
end