pre_push 0.0.7 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/prepush +0 -1
- data/bin/prepush-config +12 -0
- data/lib/msbuild.rb +1 -0
- data/lib/pre_push/version.rb +1 -1
- data/lib/pre_push.rb +12 -4
- data/lib/template/pre-push +1 -0
- data/pre_push.gemspec +1 -0
- data/spec/pre_push_spec.rb +8 -0
- metadata +14 -7
data/bin/prepush
CHANGED
data/bin/prepush-config
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
arg = ARGV[0]
|
4
|
+
bin = File.dirname(__FILE__)
|
5
|
+
puts "This will make sure all of your prepush hooks will use '#{arg}' to build your solutions. \nDo you want to continue? [y|else for no]"
|
6
|
+
input = STDIN.gets.chomp
|
7
|
+
if input.empty? || input.downcase == 'y'
|
8
|
+
File.open("#{bin}/../lib/msbuild.rb", "w") {|file| file.puts "MSBuild = '#{arg}'"}
|
9
|
+
puts 'success- modification has taken place.'
|
10
|
+
else
|
11
|
+
puts 'aborted.'
|
12
|
+
end
|
data/lib/msbuild.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
MSBuild = 'C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe'
|
data/lib/pre_push/version.rb
CHANGED
data/lib/pre_push.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "pre_push/version"
|
2
|
+
require "msbuild"
|
2
3
|
|
3
4
|
module PrePush
|
4
5
|
module ClassMethods
|
@@ -19,13 +20,12 @@ module PrePush
|
|
19
20
|
$?.success?
|
20
21
|
end
|
21
22
|
def run_tests assemblies
|
22
|
-
gem_lib = File.dirname(__FILE__)
|
23
23
|
assemblies = assemblies || [@solution]
|
24
24
|
assemblies = assemblies.empty? ? [@solution] : assemblies
|
25
25
|
success = true
|
26
|
+
gem_lib = File.dirname(__FILE__)
|
26
27
|
assemblies.each do |assembly|
|
27
|
-
|
28
|
-
system "\"#{gem_lib}/runners/#{@test_runner}/#{exe}\" \"#{assembly}\""
|
28
|
+
system "#{test_runner_path(gem_lib)} \"#{assembly}\""
|
29
29
|
success &= $?.success?
|
30
30
|
end
|
31
31
|
success
|
@@ -33,13 +33,21 @@ module PrePush
|
|
33
33
|
|
34
34
|
private
|
35
35
|
def msbuild
|
36
|
-
|
36
|
+
MSBuild
|
37
|
+
end
|
38
|
+
def test_runner_path gem_lib
|
39
|
+
"\"#{gem_lib}/runners/#{@test_runner}/#{runners_exes[@test_runner]}\""
|
37
40
|
end
|
38
41
|
def override_msbuild custom_msbuild
|
39
42
|
define_singleton_method :msbuild do
|
40
43
|
custom_msbuild
|
41
44
|
end
|
42
45
|
end
|
46
|
+
def force_test_runner runner_path
|
47
|
+
define_singleton_method :test_runner_path do |gem_lib|
|
48
|
+
runner_path
|
49
|
+
end
|
50
|
+
end
|
43
51
|
def runners_exes
|
44
52
|
{
|
45
53
|
'mspec' => 'mspec-clr4.exe',
|
data/lib/template/pre-push
CHANGED
@@ -11,6 +11,7 @@ class Executor
|
|
11
11
|
@solution = {sln_path} # the path to the solution to build
|
12
12
|
# @assemblies = {test_dlls} # insert dlls to test if different to the solution.
|
13
13
|
# override_msbuild 'path/to/custom/msbuild.exe'
|
14
|
+
# force_test_runner 'path/to/my/custom/test_runner.exe' # uncomment to use a custom test runner
|
14
15
|
end
|
15
16
|
|
16
17
|
Executor.run
|
data/pre_push.gemspec
CHANGED
@@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake"
|
23
|
+
spec.post_install_message = "cd to your git repository (containing the .git directory) and from there type 'prepush' to drop the prush hook into .git/hooks. \nBy default the hook will use 'C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe' to build your solutions. Use 'prepush-config path/to/your/msbuild.exe' to modify this. \nFor more information please see https://github.com/nieve/prepush"
|
23
24
|
end
|
data/spec/pre_push_spec.rb
CHANGED
@@ -15,6 +15,10 @@ class DummyCustomMSBuild < Dummy
|
|
15
15
|
override_msbuild 'path/to/custom/msbuild.exe'
|
16
16
|
end
|
17
17
|
|
18
|
+
class DummyCustomTestRunner < Dummy
|
19
|
+
force_test_runner 'path/to/my/custom/test_runner.exe'
|
20
|
+
end
|
21
|
+
|
18
22
|
class NilClass
|
19
23
|
def success?
|
20
24
|
end
|
@@ -40,6 +44,10 @@ describe PrePush do
|
|
40
44
|
Dummy.should_receive("system").with(/some_test_proj.csproj/)
|
41
45
|
Dummy.run_tests(['some_test_proj.csproj'])
|
42
46
|
end
|
47
|
+
it "should use custom test runner when specified" do
|
48
|
+
DummyCustomTestRunner.should_receive("system").with(/^path\/to\/my\/custom\/test_runner.exe/)
|
49
|
+
DummyCustomTestRunner.run_tests(['some_test_proj.csproj'])
|
50
|
+
end
|
43
51
|
describe 'when assemblies are left empty' do
|
44
52
|
it 'should call system to run tests on solution' do
|
45
53
|
EmptyDllsDummy.should_receive("system").with(/\.\/path\/to\/some.sln"$/)
|
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: 1.0.0
|
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-07-
|
12
|
+
date: 2013-07-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
|
-
requirement: &
|
16
|
+
requirement: &21331896 !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: *21331896
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &21331548 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,12 +32,13 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *21331548
|
36
36
|
description: adding a pre-push hook for git to compile & run tests
|
37
37
|
email:
|
38
38
|
- nievegoor@gmail.com
|
39
39
|
executables:
|
40
40
|
- prepush
|
41
|
+
- prepush-config
|
41
42
|
extensions: []
|
42
43
|
extra_rdoc_files: []
|
43
44
|
files:
|
@@ -47,7 +48,9 @@ files:
|
|
47
48
|
- README.md
|
48
49
|
- Rakefile
|
49
50
|
- bin/prepush
|
51
|
+
- bin/prepush-config
|
50
52
|
- lib/args_parser.rb
|
53
|
+
- lib/msbuild.rb
|
51
54
|
- lib/pre_push.rb
|
52
55
|
- lib/pre_push/version.rb
|
53
56
|
- lib/prepush_validator.rb
|
@@ -190,7 +193,11 @@ files:
|
|
190
193
|
homepage: https://github.com/nieve/prepush
|
191
194
|
licenses:
|
192
195
|
- MIT
|
193
|
-
post_install_message:
|
196
|
+
post_install_message: ! "cd to your git repository (containing the .git directory)
|
197
|
+
and from there type 'prepush' to drop the prush hook into .git/hooks. \nBy default
|
198
|
+
the hook will use 'C:/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe' to
|
199
|
+
build your solutions. Use 'prepush-config path/to/your/msbuild.exe' to modify this.
|
200
|
+
\nFor more information please see https://github.com/nieve/prepush"
|
194
201
|
rdoc_options: []
|
195
202
|
require_paths:
|
196
203
|
- lib
|