Class: Rake::Leaves::VisualStudioTask
- Defined in:
- lib/leaves/vstudio.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#solution ⇒ Object
Returns the value of attribute solution.
Instance Method Summary collapse
- #define ⇒ Object
-
#initialize(name = '') {|_self| ... } ⇒ VisualStudioTask
constructor
A new instance of VisualStudioTask.
Methods inherited from TaskLib
Constructor Details
#initialize(name = '') {|_self| ... } ⇒ VisualStudioTask
Returns a new instance of VisualStudioTask.
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/leaves/vstudio.rb', line 18 def initialize(name = '') @name = (name.to_s.empty? ? nil : name) solution = FileList.new('*.sln').to_a.first @solution = solution if solution @config = name.to_s.camelize yield self if block_given? define end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
16 17 18 |
# File 'lib/leaves/vstudio.rb', line 16 def config @config end |
#solution ⇒ Object
Returns the value of attribute solution.
15 16 17 |
# File 'lib/leaves/vstudio.rb', line 15 def solution @solution end |
Instance Method Details
#define ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/leaves/vstudio.rb', line 29 def define if @name desc "Build using Microsoft Visual Studio." task paste("build_", @name) => [paste("compile_", @name)] task paste("compile_", @name) do sh "devenv \"#{@solution}\" /build \"#{@config}\" 2>&1" end task paste("clean_", @name) do sh "devenv \"#{@solution}\" /clean \"#{@config}\" 2>&1" end else sln = VStudioIDE::Solution.new(@solution) sln.configurations.each do |cfg| name = cfg.underscore config = cfg.dup desc "Build using Microsoft Visual Studio." task paste("build_", name) => [paste("compile_", name)] task paste("compile_", name) do sh "devenv \"#{@solution}\" /build \"#{config}\" 2>&1" end task paste("clean_", name) do sh "devenv \"#{@solution}\" /clean \"#{config}\" 2>&1" end end end self end |