Class: Nbuild::VisualStudioCmd

Inherits:
Cmd
  • Object
show all
Defined in:
lib/nbuild/visual_studio_cmd.rb

Instance Method Summary collapse

Methods inherited from Cmd

#execute, #execute_in

Constructor Details

#initialize(params = {}) ⇒ VisualStudioCmd

Returns a new instance of VisualStudioCmd.



6
7
8
9
10
11
12
# File 'lib/nbuild/visual_studio_cmd.rb', line 6

def initialize params={}
  @params = params
  version = params.delete(:version)
  version ||= '9.0'
  @path = ENV['DEVENV_HOME'] || ENV['ProgramFiles'] +"\\Microsoft Visual Studio #{version}"
  @path += "\\Common7\\IDE"
end

Instance Method Details

#commandObject



14
15
16
17
18
19
20
# File 'lib/nbuild/visual_studio_cmd.rb', line 14

def command
  solution = @params[:solution]
  build = "/Build \"#{@params[:build]}\"" if @params[:build]
  project = "/Project \"#{@params[:project]}\"" if @params[:project]

  "\"#{@path}\\devenv.exe\" \"#{solution}\" #{build} #{project}"
end

#execute_internalObject



22
23
24
25
26
27
28
# File 'lib/nbuild/visual_studio_cmd.rb', line 22

def execute_internal
  the_command = self.command
  puts "executing #{the_command}"
  process = Process.create(:command_line => the_command)
  puts "waiting for pid #{process.process_id}"
  Process.waitpid process.process_id
end