Module: NugetHelper
- Defined in:
- lib/nuget_helper.rb,
lib/nuget_helper/nuspec.rb,
lib/nuget_helper/version.rb
Defined Under Namespace
Classes: NuSpec
Constant Summary collapse
- VERSION =
"1.0.0"
Class Method Summary collapse
- .command_path(library, exe) ⇒ Object
- .exec(parameters) ⇒ Object
- .last_version(files) ⇒ Object
- .mspec_clr4_path ⇒ Object
- .mspec_path ⇒ Object
- .nspec_path ⇒ Object
- .nunit_path ⇒ Object
- .run_tool(command, parameters = nil) ⇒ Object
- .run_tool_with_result(command, parameters = nil) ⇒ Object
- .version_of(file) ⇒ Object
- .xunit2_path ⇒ Object
- .xunit_clr4_path ⇒ Object
- .xunit_path ⇒ Object
Class Method Details
.command_path(library, exe) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/nuget_helper.rb', line 13 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) ⇒ Object
7 8 9 10 11 |
# File 'lib/nuget_helper.rb', line 7 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) ⇒ Object
65 66 67 68 69 |
# File 'lib/nuget_helper.rb', line 65 def self.last_version(files) files.max_by do |l| self.version_of(l) end end |
.mspec_clr4_path ⇒ Object
41 42 43 |
# File 'lib/nuget_helper.rb', line 41 def self.mspec_clr4_path self.command_path('Machine.Specifications', 'mspec-clr4.exe') end |
.mspec_path ⇒ Object
37 38 39 |
# File 'lib/nuget_helper.rb', line 37 def self.mspec_path self.command_path('Machine.Specifications', 'mspec.exe') end |
.nspec_path ⇒ Object
45 46 47 |
# File 'lib/nuget_helper.rb', line 45 def self.nspec_path self.command_path('nspec', 'NSpecRunner.exe') end |
.nunit_path ⇒ Object
21 22 23 |
# File 'lib/nuget_helper.rb', line 21 def self.nunit_path self.command_path('NUnit.Runners', 'nunit-console.exe') end |
.run_tool(command, parameters = nil) ⇒ Object
49 50 51 |
# File 'lib/nuget_helper.rb', line 49 def self.run_tool(command, parameters=nil) system( to_shell_string( command, parameters)) end |
.run_tool_with_result(command, parameters = nil) ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/nuget_helper.rb', line 53 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 |
.version_of(file) ⇒ Object
61 62 63 |
# File 'lib/nuget_helper.rb', line 61 def self.version_of(file) SemVer.parse(file.gsub(/\.nupkg$/, '')) end |
.xunit2_path ⇒ Object
33 34 35 |
# File 'lib/nuget_helper.rb', line 33 def self.xunit2_path self.command_path('xunit.runner.console', 'xunit.console.exe') end |
.xunit_clr4_path ⇒ Object
25 26 27 |
# File 'lib/nuget_helper.rb', line 25 def self.xunit_clr4_path self.command_path('xunit.runners', 'xunit.console.clr4.exe') end |
.xunit_path ⇒ Object
29 30 31 |
# File 'lib/nuget_helper.rb', line 29 def self.xunit_path self.command_path('xunit.runners', 'xunit.console.exe') end |