pre_push 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -0
- data/bin/prepush +5 -5
- data/lib/args_parser.rb +5 -1
- data/lib/pre_push/version.rb +1 -1
- data/lib/pre_push.rb +6 -2
- data/lib/template/pre-push +2 -1
- data/spec/args_parser_spec.rb +6 -0
- data/spec/pre_push_spec.rb +7 -18
- metadata +6 -6
data/README.md
CHANGED
@@ -34,11 +34,17 @@ The arguments accepted are:
|
|
34
34
|
|
35
35
|
/r={test runner}
|
36
36
|
/td={testable dlls}
|
37
|
+
/msb={path/to/custom/MSBuild.exe}
|
37
38
|
|
38
39
|
If you wish to specify the dlls that your test runner should run/test use:
|
39
40
|
|
40
41
|
$ prepush /td=./path/to/some.dll,./path/to/another.dll
|
41
42
|
|
43
|
+
The default msbuild path used is C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe.
|
44
|
+
If you wish to override it use:
|
45
|
+
|
46
|
+
$ prepush /msb=c:/my/path/to/MSBuild.exe
|
47
|
+
|
42
48
|
You can also modify the solution, dlls & even runner on the dropped pre-push file itself.
|
43
49
|
If you're using mspec, you may need to specify the dlls you wish to test in the @assemblies array variable. Failing to do so may result in the error "Could not load file or assembly 'path/to/your.sln' or one of its dependencies. The module was expected to contain an assembly manifest."
|
44
50
|
|
data/bin/prepush
CHANGED
@@ -10,8 +10,7 @@ require "fileutils"
|
|
10
10
|
parsed_args = PrePush::ArgsParser.execute(ARGV)
|
11
11
|
runner = parsed_args[:runner]
|
12
12
|
test_dlls = parsed_args[:test_dlls]
|
13
|
-
|
14
|
-
commented_assemblies_line = "# @assemblies = ['path/to/first/test.dll','path/to/second/test.dll'] # insert dlls to test if different to the solution."
|
13
|
+
msbuild = parsed_args[:msbuild]
|
15
14
|
|
16
15
|
if PrePush::Validator.validate(runner)
|
17
16
|
bin = File.dirname(__FILE__)
|
@@ -22,9 +21,10 @@ if PrePush::Validator.validate(runner)
|
|
22
21
|
sln_path = PrePush::SlnFinder.find || "path/to/your.sln"
|
23
22
|
content = file_text.gsub(/\{runner\}/, "\"#{runner}\"").gsub(/\{sln_path\}/, "\"#{sln_path}\"")
|
24
23
|
if test_dlls != nil
|
25
|
-
content = content.
|
26
|
-
|
27
|
-
|
24
|
+
content = content.sub("# @assemblies = {test_dlls}", "@assemblies = #{test_dlls}")
|
25
|
+
end
|
26
|
+
if msbuild != nil
|
27
|
+
content = content.sub("# override_msbuild 'path/to/custom/msbuild.exe'","override_msbuild '#{msbuild}'")
|
28
28
|
end
|
29
29
|
File.open(pre_push_hook, "w") {|file| file.puts content}
|
30
30
|
puts "the pre-push hook has been dropped into your hooks dir; please modify it to build your assembly & run your tests."
|
data/lib/args_parser.rb
CHANGED
@@ -2,7 +2,11 @@ module PrePush
|
|
2
2
|
class ArgsParser
|
3
3
|
class << self
|
4
4
|
attr_accessor :args_props
|
5
|
-
ArgsParser.args_props = {
|
5
|
+
ArgsParser.args_props = {
|
6
|
+
'r' => [:runner, :str],
|
7
|
+
'td' => [:test_dlls, :array],
|
8
|
+
'msb' => [:msbuild, :str]
|
9
|
+
}
|
6
10
|
end
|
7
11
|
def self.execute args
|
8
12
|
result = {:runner => 'nunit262'}
|
data/lib/pre_push/version.rb
CHANGED
data/lib/pre_push.rb
CHANGED
@@ -2,7 +2,6 @@ require "pre_push/version"
|
|
2
2
|
|
3
3
|
module PrePush
|
4
4
|
module ClassMethods
|
5
|
-
MSBuildPaths = {:clr4 => 'C:/Windows/Microsoft.NET/Framework/v4.0.30319'}
|
6
5
|
def run
|
7
6
|
success = build
|
8
7
|
if (!success)
|
@@ -36,12 +35,17 @@ module PrePush
|
|
36
35
|
def msbuild
|
37
36
|
'C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe'
|
38
37
|
end
|
38
|
+
def override_msbuild custom_msbuild
|
39
|
+
define_singleton_method :msbuild do
|
40
|
+
custom_msbuild
|
41
|
+
end
|
42
|
+
end
|
39
43
|
def runners_exes
|
40
44
|
{
|
41
45
|
'mspec' => 'mspec-clr4.exe',
|
42
46
|
'nunit262' => 'nunit-console.exe',
|
43
47
|
'xunit191' => 'xunit.console.exe'
|
44
|
-
}
|
48
|
+
}
|
45
49
|
end
|
46
50
|
end
|
47
51
|
|
data/lib/template/pre-push
CHANGED
@@ -9,7 +9,8 @@ class Executor
|
|
9
9
|
###
|
10
10
|
|
11
11
|
@solution = {sln_path} # the path to the solution to build
|
12
|
-
@assemblies = {
|
12
|
+
# @assemblies = {test_dlls} # insert dlls to test if different to the solution.
|
13
|
+
# override_msbuild 'path/to/custom/msbuild.exe'
|
13
14
|
end
|
14
15
|
|
15
16
|
Executor.run
|
data/spec/args_parser_spec.rb
CHANGED
@@ -19,6 +19,12 @@ module PrePush
|
|
19
19
|
result[:runner].should == "mspec"
|
20
20
|
end
|
21
21
|
end
|
22
|
+
describe "when /msb is specfied" do
|
23
|
+
it "should return a result with a string msbuild" do
|
24
|
+
result = PrePush::ArgsParser.execute(["/msb=path/to/custom/msbuild.exe"])
|
25
|
+
result[:msbuild].should == "path/to/custom/msbuild.exe"
|
26
|
+
end
|
27
|
+
end
|
22
28
|
describe "when /td is specified" do
|
23
29
|
it "should parse value as an array" do
|
24
30
|
result = PrePush::ArgsParser.execute(["/td=./path/to/testable.dll"])
|
data/spec/pre_push_spec.rb
CHANGED
@@ -11,23 +11,8 @@ class EmptyDllsDummy
|
|
11
11
|
include PrePush
|
12
12
|
end
|
13
13
|
|
14
|
-
class
|
15
|
-
|
16
|
-
@solution = "solution/path/whammy"
|
17
|
-
include PrePush
|
18
|
-
end
|
19
|
-
|
20
|
-
class SetExeDummy
|
21
|
-
@solution = 'meh'
|
22
|
-
@runner_exe = 'bar.exe'
|
23
|
-
@test_runner = 'nunit262'
|
24
|
-
def self.get_runners_exes
|
25
|
-
@runners_exes
|
26
|
-
end
|
27
|
-
def self.set_exes
|
28
|
-
self.build
|
29
|
-
end
|
30
|
-
include PrePush
|
14
|
+
class DummyCustomMSBuild < Dummy
|
15
|
+
override_msbuild 'path/to/custom/msbuild.exe'
|
31
16
|
end
|
32
17
|
|
33
18
|
class NilClass
|
@@ -42,9 +27,13 @@ describe PrePush do
|
|
42
27
|
Dummy.build
|
43
28
|
end
|
44
29
|
it "should use clr4 msbuild when no clr specified" do
|
45
|
-
Dummy.should_receive("system").with(/^C:\/Windows\/Microsoft.NET\/Framework\/v4.0.30319/)
|
30
|
+
Dummy.should_receive("system").with(/^C:\/Windows\/Microsoft.NET\/Framework\/v4.0.30319\/MSBuild.exe/)
|
46
31
|
Dummy.build
|
47
32
|
end
|
33
|
+
it "should use custom msbuild when specified" do
|
34
|
+
DummyCustomMSBuild.should_receive("system").with(/^path\/to\/custom\/msbuild.exe/)
|
35
|
+
DummyCustomMSBuild.build
|
36
|
+
end
|
48
37
|
end
|
49
38
|
describe 'run_tests' do
|
50
39
|
it 'should call system to run tests on specified assemblies' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pre_push
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
|
-
requirement: &
|
16
|
+
requirement: &23167296 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.3'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *23167296
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &23166732 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *23166732
|
36
36
|
description: adding a pre-push hook for git to compile & run tests
|
37
37
|
email:
|
38
38
|
- nievegoor@gmail.com
|