Class: AlpacaBuildTool::ToolPackage

Inherits:
Object
  • Object
show all
Defined in:
lib/alpacabuildtool/package_types/tool_package.rb

Overview

ProjectPackage provides configuration of normal nuget packages created from projects

Constant Summary collapse

WORKSPACE =

Defines workspace where files should be copied for further packaging and where *.nuspec, readme and changelog should be created For now it's ~/.workspace

File.join(File.expand_path('~'), '.workspace/')

Instance Method Summary collapse

Constructor Details

#initialize(package_id, project, debug) ⇒ ToolPackage

Creates an instance

package_id

package id so workspace is not messed up

project

project to be used to create a package

debug

is debug configuration should be used to create a package

*It clean workspace/package_id folder and copy files from project/bin*


22
23
24
25
26
27
28
29
30
31
# File 'lib/alpacabuildtool/package_types/tool_package.rb', line 22

def initialize(package_id, project, debug)
  workspace = File.join(WORKSPACE, package_id)
  FileUtils.rm_rf(workspace)
  FileUtils.makedirs(workspace + '/tools')
  tool_path = File.join(project.dir, 'bin', debug ? 'Debug' : 'Release')
  FileUtils.copy_entry(tool_path, workspace + '/tools')
  @nuspec_file = File.join(workspace, "#{package_id}.nuspec")
  @readme_file = File.join(workspace, 'README.txt')
  @changelog_file = File.join(workspace, 'CHANGES.txt')
end

Instance Method Details

#add_files?Boolean

Returns false so Nuspec file creation process will not store readme and changelog files into <files/> entry

This is required for tools packages as they are created from folder and they will miss tool files if <files/> entry will exist in *.nuspec

Returns:

  • (Boolean)

49
50
51
# File 'lib/alpacabuildtool/package_types/tool_package.rb', line 49

def add_files?
  false
end

#filesObject

Returns array of files: *.nuspec, CHANGELOG.txt, README.txt


35
36
37
# File 'lib/alpacabuildtool/package_types/tool_package.rb', line 35

def files
  [@nuspec_file, @changelog_file, @readme_file]
end

#optionsObject


39
40
41
# File 'lib/alpacabuildtool/package_types/tool_package.rb', line 39

def options
  [@nuspec_file]
end