Module: NugetHelper
- Includes:
- XSemVer
- 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.1"
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
- .semver_fromassembly_path ⇒ Object
- .version_of(file) ⇒ Object
- .xunit2_path ⇒ Object
- .xunit_clr4_path ⇒ Object
- .xunit_path ⇒ Object
Class Method Details
.command_path(library, exe) ⇒ Object
15 16 17 18 19 20 21 |
# 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) ⇒ Object
9 10 11 12 13 |
# 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) ⇒ Object
71 72 73 74 75 |
# 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 ⇒ Object
43 44 45 |
# File 'lib/nuget_helper.rb', line 43 def self.mspec_clr4_path self.command_path('Machine.Specifications', 'mspec-clr4.exe') end |
.mspec_path ⇒ Object
39 40 41 |
# File 'lib/nuget_helper.rb', line 39 def self.mspec_path self.command_path('Machine.Specifications', 'mspec.exe') end |
.nspec_path ⇒ Object
47 48 49 |
# File 'lib/nuget_helper.rb', line 47 def self.nspec_path self.command_path('nspec', 'NSpecRunner.exe') end |
.nunit_path ⇒ Object
23 24 25 |
# 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) ⇒ Object
55 56 57 |
# 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) ⇒ Object
59 60 61 62 63 64 65 |
# 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 ⇒ Object
51 52 53 |
# File 'lib/nuget_helper.rb', line 51 def self.semver_fromassembly_path self.command_path('SemVer.FromAssembly', 'SemVer.FromAssembly.exe') end |
.version_of(file) ⇒ Object
67 68 69 |
# File 'lib/nuget_helper.rb', line 67 def self.version_of(file) SemVer.parse(file.gsub(/\.nupkg$/, '')) end |
.xunit2_path ⇒ Object
35 36 37 |
# File 'lib/nuget_helper.rb', line 35 def self.xunit2_path self.command_path('xunit.runner.console', 'xunit.console.exe') end |
.xunit_clr4_path ⇒ Object
27 28 29 |
# File 'lib/nuget_helper.rb', line 27 def self.xunit_clr4_path self.command_path('xunit.runners', 'xunit.console.clr4.exe') end |
.xunit_path ⇒ Object
31 32 33 |
# File 'lib/nuget_helper.rb', line 31 def self.xunit_path self.command_path('xunit.runners', 'xunit.console.exe') end |