Class: MSDeploy
- Inherits:
-
Object
- Object
- MSDeploy
- Includes:
- Albacore::RunCommand, Albacore::Task
- Defined in:
- lib/albacore/msdeploy.rb
Instance Attribute Summary collapse
-
#additional_parameters ⇒ Object
Returns the value of attribute additional_parameters.
-
#deploy_package ⇒ Object
Returns the value of attribute deploy_package.
-
#noop ⇒ Object
Returns the value of attribute noop.
-
#parameters_file ⇒ Object
Returns the value of attribute parameters_file.
-
#password ⇒ Object
Returns the value of attribute password.
-
#server ⇒ Object
Returns the value of attribute server.
-
#username ⇒ Object
Returns the value of attribute username.
Attributes included from Albacore::RunCommand
Attributes included from Logging
Instance Method Summary collapse
- #execute ⇒ Object
- #get_constant_parameters ⇒ Object
- #get_destination ⇒ Object
- #get_msdeploy_path ⇒ Object
- #get_package ⇒ Object
- #get_parameters ⇒ Object
- #get_whatif ⇒ Object
-
#initialize ⇒ MSDeploy
constructor
A new instance of MSDeploy.
Methods included from Albacore::RunCommand
Methods included from AttrMethods
Methods included from Albacore::Task
clean_dirname, create_rake_task, include_config, included
Methods included from UpdateAttributes
Methods included from YAMLConfig
#configure, #load_config_by_task_name
Methods included from Logging
#create_logger, #log_device=, #log_level, #log_level=
Methods included from Failure
Constructor Details
#initialize ⇒ MSDeploy
Returns a new instance of MSDeploy.
13 14 15 16 17 18 |
# File 'lib/albacore/msdeploy.rb', line 13 def initialize @deploy_package = Dir.pwd @noop = false super() update_attributes Albacore.configuration.msdeploy.to_hash end |
Instance Attribute Details
#additional_parameters ⇒ Object
Returns the value of attribute additional_parameters.
11 12 13 |
# File 'lib/albacore/msdeploy.rb', line 11 def additional_parameters @additional_parameters end |
#deploy_package ⇒ Object
Returns the value of attribute deploy_package.
11 12 13 |
# File 'lib/albacore/msdeploy.rb', line 11 def deploy_package @deploy_package end |
#noop ⇒ Object
Returns the value of attribute noop.
11 12 13 |
# File 'lib/albacore/msdeploy.rb', line 11 def noop @noop end |
#parameters_file ⇒ Object
Returns the value of attribute parameters_file.
11 12 13 |
# File 'lib/albacore/msdeploy.rb', line 11 def parameters_file @parameters_file end |
#password ⇒ Object
Returns the value of attribute password.
11 12 13 |
# File 'lib/albacore/msdeploy.rb', line 11 def password @password end |
#server ⇒ Object
Returns the value of attribute server.
11 12 13 |
# File 'lib/albacore/msdeploy.rb', line 11 def server @server end |
#username ⇒ Object
Returns the value of attribute username.
11 12 13 |
# File 'lib/albacore/msdeploy.rb', line 11 def username @username end |
Instance Method Details
#execute ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/albacore/msdeploy.rb', line 20 def execute if(@command.nil?) @command = get_msdeploy_path end cmd_params = [] cmd_params << get_package cmd_params << get_destination cmd_params << get_parameters cmd_params << get_constant_parameters if(!@additional_parameters.nil?) cmd_params << @additional_parameters end cmd_params << get_whatif result = run_command "MSDeploy Command", "#{cmd_params.join(" ")}" failure_msg = 'MSDeploy Failed. See build log for details' failure_msg if !result end |
#get_constant_parameters ⇒ Object
119 120 121 |
# File 'lib/albacore/msdeploy.rb', line 119 def get_constant_parameters return "-verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension " end |
#get_destination ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/albacore/msdeploy.rb', line 84 def get_destination if(@server.nil?) #no server so use auto return "-dest:auto,includeAcls='False'" end destination_string = "-dest:auto,computerName='#{@server}'" if(!@username.nil?) destination_string << ",userName='#{@username}'" end if(!@password.nil?) destination_string << ",password='#{@password}'" end return destination_string << ",includeAcls='False'" end |
#get_msdeploy_path ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/albacore/msdeploy.rb', line 42 def get_msdeploy_path #check the environment paths ENV['PATH'].split(';').each do |path| msdeploy_path = File.join(path, 'msdeploy.exe') return msdeploy_path if File.exists?(msdeploy_path) end #check the environment variables if ENV['MSDeployPath'] msdeploy_path = File.join(ENV['MSDeployPath'], 'msdeploy.exe') return msdeploy_path if File.exists?(msdeploy_path) end #check if it's in registry Win32::Registry::HKEY_LOCAL_MACHINE.open('SOFTWARE\Microsoft\IIS Extensions\MSDeploy\2') do |reg| reg_typ, reg_val = reg.read('InstallPath') # no checking for x86 here. msdeploy_path = reg_val return msdeploy_path if File.exists?(msdeploy_path) end 'MSDeploy could not be found is it installed?' end |
#get_package ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/albacore/msdeploy.rb', line 65 def get_package #is it a direct file if(File.file?(@deploy_package)) return "-source:package='#{File.(@deploy_package)}'" end #try directory with zip in it Dir.glob("#{@deploy_package}/**.zip") do |zip| puts File.(zip) return "-source:package='#{File.(zip)}'" end # must be an archive directory package_location = "#{@deploy_package}/archive" if(File.exists?(package_location)) return "-source:archiveDir='#{File.(package_location)}'" end "Could not find the MSDeploy package to deploy." end |
#get_parameters ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/albacore/msdeploy.rb', line 99 def get_parameters if (!@parameters_file.nil?) Dir.glob("#{@parameters_file}") do |parameters| return "-setParamFile:\"#{File.(parameters)}\"" end 'Could not find parameter file specified.' else Dir.glob("#{@deploy_package}/**.SetParameters.xml") do |parameters| return "-setParamFile:\"#{File.(parameters)}\"" end end return nil end |
#get_whatif ⇒ Object
113 114 115 116 117 |
# File 'lib/albacore/msdeploy.rb', line 113 def get_whatif if(@noop) return "-whatif" end end |