pre_push 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +21 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +5 -0
- data/bin/pre-push +15 -0
- data/bin/prepush +19 -0
- data/lib/pre_push/version.rb +3 -0
- data/lib/pre_push.rb +53 -0
- data/lib/prepush_validator.rb +23 -0
- data/lib/runners/mspec/CommandLine.dll +0 -0
- data/lib/runners/mspec/CommandLine.xml +504 -0
- data/lib/runners/mspec/InstallDotCoverRunner.2.0.bat +7 -0
- data/lib/runners/mspec/InstallDotCoverRunner.2.1.bat +7 -0
- data/lib/runners/mspec/InstallDotCoverRunner.2.2.bat +7 -0
- data/lib/runners/mspec/InstallResharperRunner.6.1.bat +10 -0
- data/lib/runners/mspec/InstallResharperRunner.7.0.bat +10 -0
- data/lib/runners/mspec/InstallResharperRunner.7.1.bat +10 -0
- data/lib/runners/mspec/InstallTDNetRunner.bat +16 -0
- data/lib/runners/mspec/InstallTDNetRunnerSilent.bat +16 -0
- data/lib/runners/mspec/JetBrains.dotCover.Resources.dll +0 -0
- data/lib/runners/mspec/License.txt +54 -0
- data/lib/runners/mspec/Machine.Specifications.Clr4.dll +0 -0
- data/lib/runners/mspec/Machine.Specifications.GallioAdapter.dll +0 -0
- data/lib/runners/mspec/Machine.Specifications.GallioAdapter.plugin +43 -0
- data/lib/runners/mspec/Machine.Specifications.ReSharperRunner.6.0.dll +0 -0
- data/lib/runners/mspec/Machine.Specifications.ReSharperRunner.6.1.dll +0 -0
- data/lib/runners/mspec/Machine.Specifications.ReSharperRunner.7.0.dll +0 -0
- data/lib/runners/mspec/Machine.Specifications.ReSharperRunner.7.1.dll +0 -0
- data/lib/runners/mspec/Machine.Specifications.Reporting.Templates.dll +0 -0
- data/lib/runners/mspec/Machine.Specifications.Reporting.dll +0 -0
- data/lib/runners/mspec/Machine.Specifications.SeleniumSupport.dll +0 -0
- data/lib/runners/mspec/Machine.Specifications.TDNetRunner.dll +0 -0
- data/lib/runners/mspec/Machine.Specifications.WatinSupport.dll +0 -0
- data/lib/runners/mspec/Machine.Specifications.WebDriverSupport.dll +0 -0
- data/lib/runners/mspec/Machine.Specifications.dll +0 -0
- data/lib/runners/mspec/Machine.Specifications.dll.tdnet +5 -0
- data/lib/runners/mspec/Machine.Specifications.dotCoverRunner.2.0.dll +0 -0
- data/lib/runners/mspec/Machine.Specifications.dotCoverRunner.2.1.dll +0 -0
- data/lib/runners/mspec/Machine.Specifications.dotCoverRunner.2.2.dll +0 -0
- data/lib/runners/mspec/Spark.dll +0 -0
- data/lib/runners/mspec/TestDriven.Framework.dll +0 -0
- data/lib/runners/mspec/install.ps1 +6 -0
- data/lib/runners/mspec/mspec-clr4.exe +0 -0
- data/lib/runners/mspec/mspec-clr4.exe.config +9 -0
- data/lib/runners/mspec/mspec-x86-clr4.exe +0 -0
- data/lib/runners/mspec/mspec-x86-clr4.exe.config +9 -0
- data/lib/runners/mspec/mspec-x86.exe +0 -0
- data/lib/runners/mspec/mspec.exe +0 -0
- data/lib/runners/nunit262/framework/nunit.framework.dll +0 -0
- data/lib/runners/nunit262/framework/nunit.framework.xml +10899 -0
- data/lib/runners/nunit262/framework/nunit.mocks.dll +0 -0
- data/lib/runners/nunit262/lib/NSubstitute.dll +0 -0
- data/lib/runners/nunit262/lib/nunit-console-runner.dll +0 -0
- data/lib/runners/nunit262/lib/nunit-gui-runner.dll +0 -0
- data/lib/runners/nunit262/lib/nunit.core.dll +0 -0
- data/lib/runners/nunit262/lib/nunit.core.interfaces.dll +0 -0
- data/lib/runners/nunit262/lib/nunit.uiexception.dll +0 -0
- data/lib/runners/nunit262/lib/nunit.uikit.dll +0 -0
- data/lib/runners/nunit262/lib/nunit.util.dll +0 -0
- data/lib/runners/nunit262/nunit-agent.exe +0 -0
- data/lib/runners/nunit262/nunit-agent.exe.config +37 -0
- data/lib/runners/nunit262/nunit-console.exe +0 -0
- data/lib/runners/nunit262/nunit-console.exe.config +24 -0
- data/lib/runners/nunit262/nunit-editor.exe +0 -0
- data/lib/runners/nunit262/nunit.exe +0 -0
- data/lib/runners/nunit262/nunit.exe.config +23 -0
- data/lib/runners/nunit262/nunit.framework.dll +0 -0
- data/lib/runners/xunit191/xunit.console.exe +0 -0
- data/lib/runners/xunit191/xunit.console.exe.config +21 -0
- data/lib/runners/xunit191/xunit.dll +0 -0
- data/lib/runners/xunit191/xunit.dll.tdnet +5 -0
- data/lib/runners/xunit191/xunit.extensions.dll +0 -0
- data/lib/runners/xunit191/xunit.runner.msbuild.dll +0 -0
- data/lib/runners/xunit191/xunit.runner.tdnet.dll +0 -0
- data/lib/runners/xunit191/xunit.runner.utility.dll +0 -0
- data/lib/runners/xunit191/xunit.runner.utility.xml +1212 -0
- data/lib/runners/xunit191/xunit.xml +2611 -0
- data/lib/spec_helper.rb +4 -0
- data/pre_push.gemspec +23 -0
- data/spec/TestProj/TestProj/AllTests.cs +31 -0
- data/spec/TestProj/TestProj/Properties/AssemblyInfo.cs +36 -0
- data/spec/TestProj/TestProj/TestProj.csproj +71 -0
- data/spec/TestProj/TestProj/TestProj.csproj.user +6 -0
- data/spec/TestProj/TestProj/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache +0 -0
- data/spec/TestProj/TestProj/packages.config +6 -0
- data/spec/TestProj/TestProj.5.1.ReSharper.user +59 -0
- data/spec/TestProj/TestProj.sln +20 -0
- data/spec/TestProj/TestProj.suo +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/Machine.Specifications.0.5.12.nupkg +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/lib/net20/Machine.Specifications.TDNetRunner.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/lib/net20/Machine.Specifications.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/lib/net20/Machine.Specifications.dll.tdnet +5 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/lib/net40/Machine.Specifications.Clr4.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/lib/net40/Machine.Specifications.TDNetRunner.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/lib/net40/Machine.Specifications.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/lib/net40/Machine.Specifications.dll.tdnet +5 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/CommandLine.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/CommandLine.xml +504 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/InstallDotCoverRunner.2.0.bat +7 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/InstallDotCoverRunner.2.1.bat +7 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/InstallDotCoverRunner.2.2.bat +7 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/InstallResharperRunner.6.1.bat +10 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/InstallResharperRunner.7.0.bat +10 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/InstallResharperRunner.7.1.bat +10 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/InstallTDNetRunner.bat +16 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/InstallTDNetRunnerSilent.bat +16 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/JetBrains.dotCover.Resources.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/License.txt +54 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.Clr4.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.GallioAdapter.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.GallioAdapter.plugin +43 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.ReSharperRunner.6.1.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.ReSharperRunner.7.0.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.ReSharperRunner.7.1.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.Reporting.Templates.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.Reporting.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.SeleniumSupport.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.TDNetRunner.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.WatinSupport.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.WebDriverSupport.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.dll.tdnet +5 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.dotCoverRunner.2.0.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.dotCoverRunner.2.1.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.dotCoverRunner.2.2.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Spark.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/TestDriven.Framework.dll +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/install.ps1 +6 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/mspec-clr4.exe +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/mspec-clr4.exe.config +9 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/mspec-x86-clr4.exe +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/mspec-x86-clr4.exe.config +9 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/mspec-x86.exe +0 -0
- data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/mspec.exe +0 -0
- data/spec/TestProj/packages/NUnit.2.6.2/NUnit.2.6.2.nupkg +0 -0
- data/spec/TestProj/packages/NUnit.2.6.2/lib/nunit.framework.dll +0 -0
- data/spec/TestProj/packages/NUnit.2.6.2/lib/nunit.framework.xml +10899 -0
- data/spec/TestProj/packages/NUnit.2.6.2/license.txt +15 -0
- data/spec/TestProj/packages/repositories.config +4 -0
- data/spec/TestProj/packages/xunit.1.9.1/lib/net20/xunit.dll +0 -0
- data/spec/TestProj/packages/xunit.1.9.1/lib/net20/xunit.dll.tdnet +5 -0
- data/spec/TestProj/packages/xunit.1.9.1/lib/net20/xunit.runner.msbuild.dll +0 -0
- data/spec/TestProj/packages/xunit.1.9.1/lib/net20/xunit.runner.tdnet.dll +0 -0
- data/spec/TestProj/packages/xunit.1.9.1/lib/net20/xunit.runner.utility.dll +0 -0
- data/spec/TestProj/packages/xunit.1.9.1/lib/net20/xunit.xml +2611 -0
- data/spec/TestProj/packages/xunit.1.9.1/xunit.1.9.1.nupkg +0 -0
- data/spec/mspec_integration_spec.rb +13 -0
- data/spec/nunit_integration_spec.rb +14 -0
- data/spec/pre_push_spec.rb +36 -0
- metadata +290 -0
data/.gitignore
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*TestResult.xml
|
19
|
+
bin/
|
20
|
+
obj/
|
21
|
+
_ReSharper*
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 nieve
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# PrePush
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'pre_push'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install pre_push
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/pre-push
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "pre_push"
|
4
|
+
|
5
|
+
class Executor
|
6
|
+
### change only if you change your test runner
|
7
|
+
@test_runner = {runner}
|
8
|
+
###
|
9
|
+
|
10
|
+
@solution = "path/to/your.sln"
|
11
|
+
# @assemblies = ['path/to/first/test.dll','path/to/second/test.dll'] #uncomment & insert if different to the solution.
|
12
|
+
include PrePush
|
13
|
+
end
|
14
|
+
|
15
|
+
Executor.run
|
data/bin/prepush
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "pre_push"
|
4
|
+
require "prepush_validator"
|
5
|
+
require "fileutils"
|
6
|
+
|
7
|
+
|
8
|
+
runner = ARGV[0] || 'nunit262'
|
9
|
+
|
10
|
+
if PrePush::Validator.validate(runner)
|
11
|
+
bin = File.dirname(__FILE__)
|
12
|
+
FileUtils.cp("#{bin}/pre-push", ".git/hooks")
|
13
|
+
|
14
|
+
pre_push_hook = ".git/hooks/pre-push"
|
15
|
+
file_text = File.read(pre_push_hook)
|
16
|
+
content = file_text.gsub(/\{runner\}/, "\"#{runner}\"")
|
17
|
+
File.open(pre_push_hook, "w") {|file| file.puts content}
|
18
|
+
puts "the pre-push hook has been dropped into your hooks dir; please modify it to build your assembly & run your tests."
|
19
|
+
end
|
data/lib/pre_push.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require "pre_push/version"
|
2
|
+
|
3
|
+
module PrePush
|
4
|
+
module ClassMethods
|
5
|
+
def run
|
6
|
+
success = build
|
7
|
+
if (!success)
|
8
|
+
puts 'build has failed'
|
9
|
+
exit(1)
|
10
|
+
end
|
11
|
+
success = run_tests(@assemblies)
|
12
|
+
if (!success)
|
13
|
+
puts 'Tests have failed'
|
14
|
+
exit(1)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
def build
|
18
|
+
set_exes_cache
|
19
|
+
msbuild = 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe'
|
20
|
+
system "#{msbuild} #{@solution}"
|
21
|
+
$?.success?
|
22
|
+
end
|
23
|
+
def run_tests assemblies
|
24
|
+
set_exes_cache
|
25
|
+
gem_lib = File.dirname(__FILE__)
|
26
|
+
assemblies = assemblies || [@solution]
|
27
|
+
success = true
|
28
|
+
assemblies.each do |assembly|
|
29
|
+
exe = @runners_exes[@test_runner]
|
30
|
+
puts "\"#{gem_lib}/runners/#{@test_runner}/#{exe}\" \"#{assembly}\""
|
31
|
+
system "\"#{gem_lib}/runners/#{@test_runner}/#{exe}\" \"#{assembly}\""
|
32
|
+
success &= $?.success?
|
33
|
+
end
|
34
|
+
success
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
def set_exes_cache
|
39
|
+
if (@runners_exes == nil || @runners_exes.empty?) then
|
40
|
+
@runners_exes = {}
|
41
|
+
bin = File.dirname(__FILE__)
|
42
|
+
runners_dir = "#{bin}/../lib/runners"
|
43
|
+
Dir.entries(runners_dir).each {|file| @runners_exes[file] = Dir.entries("#{runners_dir}/#{file}").detect{|f| f.end_with?('.exe')}}
|
44
|
+
@runners_exes['nunit262'] = 'nunit-console.exe'
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.included(receiver)
|
50
|
+
receiver.extend ClassMethods
|
51
|
+
#receiver.send :include, InstanceMethods
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module PrePush
|
2
|
+
class Validator
|
3
|
+
def self.validate runner
|
4
|
+
if !Dir.exists?('.git')
|
5
|
+
puts "Couldn't find a git repository"
|
6
|
+
return false
|
7
|
+
end
|
8
|
+
if !Dir.exists?('.git/hooks')
|
9
|
+
puts "Couldn't find the git hooks dir"
|
10
|
+
return false
|
11
|
+
end
|
12
|
+
bin = File.dirname(__FILE__)
|
13
|
+
runners_dir = "#{bin}/../lib/runners"
|
14
|
+
found = false
|
15
|
+
Dir.entries(runners_dir).each {|file| found = true if file == runner}
|
16
|
+
unless found
|
17
|
+
puts "Couldn't find test runner #{runner}"
|
18
|
+
return false
|
19
|
+
end
|
20
|
+
return true
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
Binary file
|