nuget_helper 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nuget_helper/version.rb +1 -1
- data/lib/nuget_helper.rb +18 -6
- data/spec/get_version_of_spec.rb +4 -0
- data/spec/nuget_exec_spec.rb +12 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c093a8f07c3418eb7b726260fc22f151fa2dd8e9
|
4
|
+
data.tar.gz: 6e7d48c45ae169d070165d1654757e162e8b5ba1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5aa74e8192e39cb1b22b07e2f7609f3549e9e2be65b7eb75f425b2af1a74c018336364e18c82faeab0bfde8e9c270e45e23cad6013d8013ccb869ccfbcd603aa
|
7
|
+
data.tar.gz: 15593fb4c59c34c45fa729e67ea1073406b4faf91f3880cf5fa9ca229ced26d56b7ad37b31934ec643a2baa0cdf380e52b9858920efd77ffe428694c1b656866
|
data/lib/nuget_helper/version.rb
CHANGED
data/lib/nuget_helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "nuget_helper/version"
|
2
|
+
require "Open3"
|
2
3
|
|
3
4
|
module NugetHelper
|
4
5
|
def self.exec(parameters)
|
@@ -44,16 +45,19 @@ module NugetHelper
|
|
44
45
|
end
|
45
46
|
|
46
47
|
def self.run_tool(command, parameters=nil)
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
48
|
+
system( to_shell_string( command, parameters))
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.run_tool_with_result(command, parameters=nil)
|
52
|
+
stdout_str, stderr_str, status= Open3.capture3( to_shell_string( command, parameters))
|
53
|
+
if ! status.success?
|
54
|
+
raise stderr_str
|
52
55
|
end
|
56
|
+
stdout_str
|
53
57
|
end
|
54
58
|
|
55
59
|
def self.version_of(file)
|
56
|
-
file.gsub(/[a-zA-Z]\.?/,'').split(/\./).map do |i| i.to_i end
|
60
|
+
file.gsub(/[a-zA-Z]\.?/,'').split(/\./).map do |i| i.to_i end.to_a
|
57
61
|
end
|
58
62
|
|
59
63
|
def self.last_version(files)
|
@@ -63,6 +67,14 @@ module NugetHelper
|
|
63
67
|
end
|
64
68
|
|
65
69
|
private
|
70
|
+
def self.to_shell_string(command, parameters)
|
71
|
+
parameters = '' if parameters.nil?
|
72
|
+
if Gem.win_platform?
|
73
|
+
"#{command} #{parameters}"
|
74
|
+
else
|
75
|
+
"mono --runtime=v4.0 #{command} #{parameters} "
|
76
|
+
end
|
77
|
+
end
|
66
78
|
def self.first_command_path(library, exe)
|
67
79
|
cmds = Dir.glob(File.join("**","packages","#{library}*","tools",exe))
|
68
80
|
if cmds.any?
|
data/spec/get_version_of_spec.rb
CHANGED
@@ -22,5 +22,9 @@ describe "NugetHelper" do
|
|
22
22
|
it "can parse out version" do
|
23
23
|
expect( NugetHelper.version_of 'somelib.something.35.63.7').to eq [35,63,7]
|
24
24
|
end
|
25
|
+
|
26
|
+
it "can determine latest version of" do
|
27
|
+
expect( NugetHelper.last_version ['With.0.4.7.nupkg','With.1.0.2.nupkg','With.1.0.1.nupkg']).to eq 'With.1.0.2.nupkg'
|
28
|
+
end
|
25
29
|
end
|
26
30
|
end
|
data/spec/nuget_exec_spec.rb
CHANGED
@@ -19,6 +19,18 @@ describe "NugetHelper" do
|
|
19
19
|
expect($?.success?).to be true
|
20
20
|
end
|
21
21
|
|
22
|
+
it "can run nunit runner and get result" do
|
23
|
+
cmd = NugetHelper.nunit_path
|
24
|
+
help = Gem.win_platform? ? "/help" : "-help"
|
25
|
+
res= NugetHelper.run_tool_with_result cmd, help
|
26
|
+
expect(res).not_to be_empty
|
27
|
+
end
|
28
|
+
|
29
|
+
it "can run nunit runner and fail" do
|
30
|
+
cmd = NugetHelper.nunit_path
|
31
|
+
expect { NugetHelper.run_tool_with_result "xxxyyy" }.to raise_error
|
32
|
+
end
|
33
|
+
|
22
34
|
it "can run xunit2 runner" do
|
23
35
|
cmd = NugetHelper.xunit2_path
|
24
36
|
c = NugetHelper.run_tool cmd
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nuget_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oskar Gewalli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
114
114
|
version: '0'
|
115
115
|
requirements: []
|
116
116
|
rubyforge_project:
|
117
|
-
rubygems_version: 2.
|
117
|
+
rubygems_version: 2.5.1
|
118
118
|
signing_key:
|
119
119
|
specification_version: 4
|
120
120
|
summary: Helper Gem to simplify work with nuget.
|