module NugetHelper
Constants
- VERSION
Public Class Methods
command_path(library, exe)
click to toggle source
# File lib/nuget_helper.rb, line 15 def self.command_path(library, exe) cmd = self.first_command_path(library, exe) if cmd.nil? raise "Could not find #{exe} at the packages/#{library}*/tools/ path!" end return cmd end
exec(parameters)
click to toggle source
# File lib/nuget_helper.rb, line 9 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
last_version(files)
click to toggle source
# File lib/nuget_helper.rb, line 71 def self.last_version(files) files.max_by do |l| self.version_of(l) end end
mspec_clr4_path()
click to toggle source
# File lib/nuget_helper.rb, line 43 def self.mspec_clr4_path self.command_path('Machine.Specifications', 'mspec-clr4.exe') end
mspec_path()
click to toggle source
# File lib/nuget_helper.rb, line 39 def self.mspec_path self.command_path('Machine.Specifications', 'mspec.exe') end
nspec_path()
click to toggle source
# File lib/nuget_helper.rb, line 47 def self.nspec_path self.command_path('nspec', 'NSpecRunner.exe') end
nunit_path()
click to toggle source
# File lib/nuget_helper.rb, line 23 def self.nunit_path self.command_path('NUnit.Runners', 'nunit-console.exe') end
run_tool(command, parameters=nil)
click to toggle source
# File lib/nuget_helper.rb, line 55 def self.run_tool(command, parameters=nil) system( to_shell_string( command, parameters)) end
run_tool_with_result(command, parameters=nil)
click to toggle source
# File lib/nuget_helper.rb, line 59 def self.run_tool_with_result(command, parameters=nil) stdout_str, stderr_str, status= Open3.capture3( to_shell_string( command, parameters)) if ! status.success? raise stderr_str end stdout_str end
semver_fromassembly_path()
click to toggle source
# File lib/nuget_helper.rb, line 51 def self.semver_fromassembly_path self.command_path('SemVer.FromAssembly', 'SemVer.FromAssembly.exe') end
version_of(file)
click to toggle source
# File lib/nuget_helper.rb, line 67 def self.version_of(file) SemVer.parse(file.gsub(/\.nupkg$/, '')) end
xunit2_path()
click to toggle source
# File lib/nuget_helper.rb, line 35 def self.xunit2_path self.command_path('xunit.runner.console', 'xunit.console.exe') end
xunit_clr4_path()
click to toggle source
# File lib/nuget_helper.rb, line 27 def self.xunit_clr4_path self.command_path('xunit.runners', 'xunit.console.clr4.exe') end
xunit_path()
click to toggle source
# File lib/nuget_helper.rb, line 31 def self.xunit_path self.command_path('xunit.runners', 'xunit.console.exe') end
Private Class Methods
first_command_path(library, exe)
click to toggle source
# File lib/nuget_helper.rb, line 86 def self.first_command_path(library, exe) cmds = Dir.glob(File.join("**","packages","#{library}*","tools",exe)) if cmds.any? command = File.expand_path cmds.first return command else return nil end end
to_shell_string(command, parameters)
click to toggle source
# File lib/nuget_helper.rb, line 78 def self.to_shell_string(command, parameters) parameters = '' if parameters.nil? if Gem.win_platform? "#{command} #{parameters}" else "mono --runtime=v4.0 #{command} #{parameters} " end end