Class: VssGet

Inherits:
Object
  • Object
show all
Includes:
Albacore::RunCommand, Albacore::Task
Defined in:
lib/albacore/vssget.rb

Constant Summary collapse

TaskName =
:vssget

Instance Attribute Summary collapse

Attributes included from Albacore::RunCommand

#command, #working_directory

Attributes included from Logging

#current_log_device, #logger

Instance Method Summary collapse

Methods included from Albacore::RunCommand

#get_command, #run_command

Methods included from AttrMethods

#attr_array, #attr_hash

Methods included from Albacore::Task

clean_dirname, create_rake_task, include_config, included

Methods included from UpdateAttributes

#<<, #update_attributes

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

#fail_with_message

Constructor Details

#initialize(command = nil) ⇒ VssGet

Returns a new instance of VssGet.



11
12
13
14
15
16
17
18
19
# File 'lib/albacore/vssget.rb', line 11

def initialize(command=nil)
  @options=[]
	@quite = true
	@readonly = true
	@recursive = true
  super()
	update_attributes Albacore.configuration.vss.to_hash
  @command = command unless command.nil?
end

Instance Attribute Details

#passwordObject

Returns the value of attribute password.



8
9
10
# File 'lib/albacore/vssget.rb', line 8

def password
  @password
end

#pathObject

Returns the value of attribute path.



8
9
10
# File 'lib/albacore/vssget.rb', line 8

def path
  @path
end

#projectObject

Returns the value of attribute project.



8
9
10
# File 'lib/albacore/vssget.rb', line 8

def project
  @project
end

#quiteObject

Returns the value of attribute quite.



8
9
10
# File 'lib/albacore/vssget.rb', line 8

def quite
  @quite
end

#readonlyObject

Returns the value of attribute readonly.



8
9
10
# File 'lib/albacore/vssget.rb', line 8

def readonly
  @readonly
end

#recursiveObject

Returns the value of attribute recursive.



8
9
10
# File 'lib/albacore/vssget.rb', line 8

def recursive
  @recursive
end

#repositoryObject

Returns the value of attribute repository.



8
9
10
# File 'lib/albacore/vssget.rb', line 8

def repository
  @repository
end

#usernameObject

Returns the value of attribute username.



8
9
10
# File 'lib/albacore/vssget.rb', line 8

def username
  @username
end

Instance Method Details

#executeObject



34
35
36
37
38
39
40
41
42
43
# File 'lib/albacore/vssget.rb', line 34

def execute()
  fail_with_message 'Repository should be provided.' if @repository.nil?

  ENV["SSDIR"] = @repository

  result = run_command "VssGet", get_command_parameters

  failure_message = 'Visual SourceSafe Failed. See Build Log For Detail'
  fail_with_message failure_message if !result
end

#get_command_parametersObject



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/albacore/vssget.rb', line 21

def get_command_parameters
  command_params = []	
  command_params << "get"
  command_params << @project || "$/"
  command_params << "-Q" if @quite
  command_params << "-R" if @recursive
  command_params << (@readonly ? "-W-" : "-W")
  command_params << "-Y#{@username},#{@password}" unless @username.nil?
  command_params << "\"-GL#{@path}\"" unless @path.nil?
  command_params << @options.join(" ") unless @options.nil?
  command_params
end