Class: Albacore::AppSpec::Defaults
- Inherits:
-
Object
- Object
- Albacore::AppSpec::Defaults
- Includes:
- Logging
- Defined in:
- lib/albacore/app_spec/defaults.rb
Overview
The default is to get the bin/ folder based on the configuration that you have compiled the project with.
Direct Known Subclasses
Instance Method Summary collapse
-
#deploy_dir(app_spec) ⇒ Object
Gets the location fully qualified path that the finished artefact will be installed into.
-
#embedded_resource(relative_path) ⇒ Object
Get the relative resource from ‘albacore/app_spec/.’ as a string.
-
#embedded_resource_path(relative_path) ⇒ Object
Get the relative resource path from ‘albacore/app_spec/.’.
-
#install_script(out, app_spec, &block) ⇒ Object
create a chocolatey install script for a topshelf service on windows.
-
#nuget_contents ⇒ Object
location/folder inside nuget to place everything found in the #relative_dir inside.
-
#source_dir(app_spec, configuration = 'Release') ⇒ Object
Where to copy contents from.
- #write_invocation(app_spec, io) ⇒ Object
Methods included from Logging
#debug, #err, #error, #fatal, #info, #puts, #trace, #warn
Instance Method Details
#deploy_dir(app_spec) ⇒ Object
Gets the location fully qualified path that the finished artefact will be installed into. Defaults to C:\Services{id}.
43 44 45 |
# File 'lib/albacore/app_spec/defaults.rb', line 43 def deploy_dir app_spec app_spec.conf['deploy_dir'] || "C:\\Services\\#{app_spec.id}" end |
#embedded_resource(relative_path) ⇒ Object
Get the relative resource from ‘albacore/app_spec/.’ as a string.
48 49 50 |
# File 'lib/albacore/app_spec/defaults.rb', line 48 def relative_path File.open((relative_path), 'r') { |io| io.read } end |
#embedded_resource_path(relative_path) ⇒ Object
Get the relative resource path from ‘albacore/app_spec/.’
53 54 55 |
# File 'lib/albacore/app_spec/defaults.rb', line 53 def relative_path File.join(File.dirname(File.(__FILE__)), relative_path) end |
#install_script(out, app_spec, &block) ⇒ Object
create a chocolatey install script for a topshelf service on windows
write tools/chocolateyInstall.ps1
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/albacore/app_spec/defaults.rb', line 28 def install_script out, app_spec, &block debug { "installing into '#{out}' [app_spec/defaults#install_script]" } tools = "#{out}/#{app_spec.id}/tools" FileUtils.mkdir tools unless Dir.exists? tools File.open(File.join(tools, 'chocolateyInstall.ps1'), 'w+') do |io| contents = '../../../resources/chocolateyInstall.ps1' io.write contents write_invocation app_spec, io end end |
#nuget_contents ⇒ Object
location/folder inside nuget to place everything found in the #relative_dir inside
14 15 16 |
# File 'lib/albacore/app_spec/defaults.rb', line 14 def nuget_contents 'bin' end |
#source_dir(app_spec, configuration = 'Release') ⇒ Object
Where to copy contents from
19 20 21 22 23 |
# File 'lib/albacore/app_spec/defaults.rb', line 19 def source_dir app_spec, configuration = 'Release' Paths.normalise_slashes( File.join(app_spec.proj.proj_path_base, app_spec.bin_folder(configuration), '.')) end |
#write_invocation(app_spec, io) ⇒ Object
57 58 59 60 61 62 63 64 65 |
# File 'lib/albacore/app_spec/defaults.rb', line 57 def write_invocation app_spec, io debug { 'writing default powershell invocation [app_spec/defaults#write_invocation]' } io.write %{ Install-Service ` -ServiceExeName "#{app_spec.exe}" -ServiceDir "#{deploy_dir app_spec}" ` -CurrentPath (Split-Path $MyInvocation.MyCommand.Path) } end |