Class: RakeDotNet::Cli
- Inherits:
-
Object
- Object
- RakeDotNet::Cli
- Defined in:
- lib/rake_dotnet.rb
Instance Attribute Summary collapse
-
#bin ⇒ Object
Returns the value of attribute bin.
-
#search_paths ⇒ Object
Returns the value of attribute search_paths.
Instance Method Summary collapse
- #cmd ⇒ Object
- #exe ⇒ Object
-
#initialize(params = {}) ⇒ Cli
constructor
A new instance of Cli.
- #search_for_exe ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Cli
Returns a new instance of Cli.
100 101 102 103 104 105 106 107 |
# File 'lib/rake_dotnet.rb', line 100 def initialize(params={}) @bin = params[:exe] || nil @exe_name = params[:exe_name] #required for inferring path # guessable / defaultable @search_paths = params[:search_paths] || [] @search_paths << nil # use the one that will be found in %PATH% end |
Instance Attribute Details
#bin ⇒ Object
Returns the value of attribute bin.
98 99 100 |
# File 'lib/rake_dotnet.rb', line 98 def bin @bin end |
#search_paths ⇒ Object
Returns the value of attribute search_paths.
98 99 100 |
# File 'lib/rake_dotnet.rb', line 98 def search_paths @search_paths end |
Instance Method Details
#cmd ⇒ Object
117 118 119 |
# File 'lib/rake_dotnet.rb', line 117 def cmd return "\"#{exe}\"" end |
#exe ⇒ Object
109 110 111 112 113 114 115 |
# File 'lib/rake_dotnet.rb', line 109 def exe return @bin unless @bin.nil? @bin = "#{search_for_exe}" return @bin end |
#search_for_exe ⇒ Object
121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/rake_dotnet.rb', line 121 def search_for_exe @search_paths.each do |sp| if sp.nil? return @exe_name #because we add bare exe as last element in array else path = File.join(sp, @exe_name) return File.(path) if File.exist? path end end raise(ArgumentError, "No executable found in search-paths or system-PATH", caller) end |