Module: NugetHelper
- Defined in:
- lib/nuget_helper.rb,
lib/nuget_helper/version.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
- .command_path(library, exe) ⇒ Object
- .exec(parameters) ⇒ Object
- .nunit_path ⇒ Object
- .os ⇒ Object
- .run_tool(command, parameters = nil) ⇒ Object
- .xunit_path ⇒ Object
Class Method Details
.command_path(library, exe) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/nuget_helper.rb', line 28 def self.command_path(library, exe) cmds = Dir.glob(File.join("**","packages","#{library}.*","tools",exe)) if cmds.any? command = cmds.first else raise "Could not find #{exe} at the packages/#{library}.*/tools/ path!" end end |
.exec(parameters) ⇒ Object
22 23 24 25 26 |
# File 'lib/nuget_helper.rb', line 22 def self.exec(parameters) spec = Gem::Specification.find_by_name("nuget") command = File.join(spec.gem_dir, "bin", "nuget.exe") self.run_tool(command, parameters) end |
.nunit_path ⇒ Object
37 38 39 |
# File 'lib/nuget_helper.rb', line 37 def self.nunit_path self.command_path('NUnit.Runners', 'nunit-console.exe') end |
.os ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/nuget_helper.rb', line 4 def self.os @os ||= ( host_os = RbConfig::CONFIG['host_os'] case host_os when /mswin|msys|mingw|cygwin|bccwin|wince|emc/ :windows when /darwin|mac os/ :macosx when /linux/ :linux when /solaris|bsd/ :unix else raise "unknown os: #{host_os.inspect}" end ) end |
.run_tool(command, parameters = nil) ⇒ Object
45 46 47 48 49 50 51 52 |
# File 'lib/nuget_helper.rb', line 45 def self.run_tool(command, parameters=nil) parameters = '' if parameters.nil? if self.os == :windows system "#{command} #{parameters}" else system "mono --runtime=v4.0.30319 #{command} #{parameters} " end end |
.xunit_path ⇒ Object
41 42 43 |
# File 'lib/nuget_helper.rb', line 41 def self.xunit_path self.command_path('xunit.runners', 'xunit.console.clr4.exe') end |