pre_push 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. data/.gitignore +21 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE.txt +22 -0
  4. data/README.md +29 -0
  5. data/Rakefile +5 -0
  6. data/bin/pre-push +15 -0
  7. data/bin/prepush +19 -0
  8. data/lib/pre_push/version.rb +3 -0
  9. data/lib/pre_push.rb +53 -0
  10. data/lib/prepush_validator.rb +23 -0
  11. data/lib/runners/mspec/CommandLine.dll +0 -0
  12. data/lib/runners/mspec/CommandLine.xml +504 -0
  13. data/lib/runners/mspec/InstallDotCoverRunner.2.0.bat +7 -0
  14. data/lib/runners/mspec/InstallDotCoverRunner.2.1.bat +7 -0
  15. data/lib/runners/mspec/InstallDotCoverRunner.2.2.bat +7 -0
  16. data/lib/runners/mspec/InstallResharperRunner.6.1.bat +10 -0
  17. data/lib/runners/mspec/InstallResharperRunner.7.0.bat +10 -0
  18. data/lib/runners/mspec/InstallResharperRunner.7.1.bat +10 -0
  19. data/lib/runners/mspec/InstallTDNetRunner.bat +16 -0
  20. data/lib/runners/mspec/InstallTDNetRunnerSilent.bat +16 -0
  21. data/lib/runners/mspec/JetBrains.dotCover.Resources.dll +0 -0
  22. data/lib/runners/mspec/License.txt +54 -0
  23. data/lib/runners/mspec/Machine.Specifications.Clr4.dll +0 -0
  24. data/lib/runners/mspec/Machine.Specifications.GallioAdapter.dll +0 -0
  25. data/lib/runners/mspec/Machine.Specifications.GallioAdapter.plugin +43 -0
  26. data/lib/runners/mspec/Machine.Specifications.ReSharperRunner.6.0.dll +0 -0
  27. data/lib/runners/mspec/Machine.Specifications.ReSharperRunner.6.1.dll +0 -0
  28. data/lib/runners/mspec/Machine.Specifications.ReSharperRunner.7.0.dll +0 -0
  29. data/lib/runners/mspec/Machine.Specifications.ReSharperRunner.7.1.dll +0 -0
  30. data/lib/runners/mspec/Machine.Specifications.Reporting.Templates.dll +0 -0
  31. data/lib/runners/mspec/Machine.Specifications.Reporting.dll +0 -0
  32. data/lib/runners/mspec/Machine.Specifications.SeleniumSupport.dll +0 -0
  33. data/lib/runners/mspec/Machine.Specifications.TDNetRunner.dll +0 -0
  34. data/lib/runners/mspec/Machine.Specifications.WatinSupport.dll +0 -0
  35. data/lib/runners/mspec/Machine.Specifications.WebDriverSupport.dll +0 -0
  36. data/lib/runners/mspec/Machine.Specifications.dll +0 -0
  37. data/lib/runners/mspec/Machine.Specifications.dll.tdnet +5 -0
  38. data/lib/runners/mspec/Machine.Specifications.dotCoverRunner.2.0.dll +0 -0
  39. data/lib/runners/mspec/Machine.Specifications.dotCoverRunner.2.1.dll +0 -0
  40. data/lib/runners/mspec/Machine.Specifications.dotCoverRunner.2.2.dll +0 -0
  41. data/lib/runners/mspec/Spark.dll +0 -0
  42. data/lib/runners/mspec/TestDriven.Framework.dll +0 -0
  43. data/lib/runners/mspec/install.ps1 +6 -0
  44. data/lib/runners/mspec/mspec-clr4.exe +0 -0
  45. data/lib/runners/mspec/mspec-clr4.exe.config +9 -0
  46. data/lib/runners/mspec/mspec-x86-clr4.exe +0 -0
  47. data/lib/runners/mspec/mspec-x86-clr4.exe.config +9 -0
  48. data/lib/runners/mspec/mspec-x86.exe +0 -0
  49. data/lib/runners/mspec/mspec.exe +0 -0
  50. data/lib/runners/nunit262/framework/nunit.framework.dll +0 -0
  51. data/lib/runners/nunit262/framework/nunit.framework.xml +10899 -0
  52. data/lib/runners/nunit262/framework/nunit.mocks.dll +0 -0
  53. data/lib/runners/nunit262/lib/NSubstitute.dll +0 -0
  54. data/lib/runners/nunit262/lib/nunit-console-runner.dll +0 -0
  55. data/lib/runners/nunit262/lib/nunit-gui-runner.dll +0 -0
  56. data/lib/runners/nunit262/lib/nunit.core.dll +0 -0
  57. data/lib/runners/nunit262/lib/nunit.core.interfaces.dll +0 -0
  58. data/lib/runners/nunit262/lib/nunit.uiexception.dll +0 -0
  59. data/lib/runners/nunit262/lib/nunit.uikit.dll +0 -0
  60. data/lib/runners/nunit262/lib/nunit.util.dll +0 -0
  61. data/lib/runners/nunit262/nunit-agent.exe +0 -0
  62. data/lib/runners/nunit262/nunit-agent.exe.config +37 -0
  63. data/lib/runners/nunit262/nunit-console.exe +0 -0
  64. data/lib/runners/nunit262/nunit-console.exe.config +24 -0
  65. data/lib/runners/nunit262/nunit-editor.exe +0 -0
  66. data/lib/runners/nunit262/nunit.exe +0 -0
  67. data/lib/runners/nunit262/nunit.exe.config +23 -0
  68. data/lib/runners/nunit262/nunit.framework.dll +0 -0
  69. data/lib/runners/xunit191/xunit.console.exe +0 -0
  70. data/lib/runners/xunit191/xunit.console.exe.config +21 -0
  71. data/lib/runners/xunit191/xunit.dll +0 -0
  72. data/lib/runners/xunit191/xunit.dll.tdnet +5 -0
  73. data/lib/runners/xunit191/xunit.extensions.dll +0 -0
  74. data/lib/runners/xunit191/xunit.runner.msbuild.dll +0 -0
  75. data/lib/runners/xunit191/xunit.runner.tdnet.dll +0 -0
  76. data/lib/runners/xunit191/xunit.runner.utility.dll +0 -0
  77. data/lib/runners/xunit191/xunit.runner.utility.xml +1212 -0
  78. data/lib/runners/xunit191/xunit.xml +2611 -0
  79. data/lib/spec_helper.rb +4 -0
  80. data/pre_push.gemspec +23 -0
  81. data/spec/TestProj/TestProj/AllTests.cs +31 -0
  82. data/spec/TestProj/TestProj/Properties/AssemblyInfo.cs +36 -0
  83. data/spec/TestProj/TestProj/TestProj.csproj +71 -0
  84. data/spec/TestProj/TestProj/TestProj.csproj.user +6 -0
  85. data/spec/TestProj/TestProj/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache +0 -0
  86. data/spec/TestProj/TestProj/packages.config +6 -0
  87. data/spec/TestProj/TestProj.5.1.ReSharper.user +59 -0
  88. data/spec/TestProj/TestProj.sln +20 -0
  89. data/spec/TestProj/TestProj.suo +0 -0
  90. data/spec/TestProj/packages/Machine.Specifications.0.5.12/Machine.Specifications.0.5.12.nupkg +0 -0
  91. data/spec/TestProj/packages/Machine.Specifications.0.5.12/lib/net20/Machine.Specifications.TDNetRunner.dll +0 -0
  92. data/spec/TestProj/packages/Machine.Specifications.0.5.12/lib/net20/Machine.Specifications.dll +0 -0
  93. data/spec/TestProj/packages/Machine.Specifications.0.5.12/lib/net20/Machine.Specifications.dll.tdnet +5 -0
  94. data/spec/TestProj/packages/Machine.Specifications.0.5.12/lib/net40/Machine.Specifications.Clr4.dll +0 -0
  95. data/spec/TestProj/packages/Machine.Specifications.0.5.12/lib/net40/Machine.Specifications.TDNetRunner.dll +0 -0
  96. data/spec/TestProj/packages/Machine.Specifications.0.5.12/lib/net40/Machine.Specifications.dll +0 -0
  97. data/spec/TestProj/packages/Machine.Specifications.0.5.12/lib/net40/Machine.Specifications.dll.tdnet +5 -0
  98. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/CommandLine.dll +0 -0
  99. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/CommandLine.xml +504 -0
  100. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/InstallDotCoverRunner.2.0.bat +7 -0
  101. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/InstallDotCoverRunner.2.1.bat +7 -0
  102. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/InstallDotCoverRunner.2.2.bat +7 -0
  103. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/InstallResharperRunner.6.1.bat +10 -0
  104. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/InstallResharperRunner.7.0.bat +10 -0
  105. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/InstallResharperRunner.7.1.bat +10 -0
  106. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/InstallTDNetRunner.bat +16 -0
  107. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/InstallTDNetRunnerSilent.bat +16 -0
  108. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/JetBrains.dotCover.Resources.dll +0 -0
  109. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/License.txt +54 -0
  110. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.Clr4.dll +0 -0
  111. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.GallioAdapter.dll +0 -0
  112. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.GallioAdapter.plugin +43 -0
  113. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.ReSharperRunner.6.1.dll +0 -0
  114. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.ReSharperRunner.7.0.dll +0 -0
  115. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.ReSharperRunner.7.1.dll +0 -0
  116. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.Reporting.Templates.dll +0 -0
  117. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.Reporting.dll +0 -0
  118. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.SeleniumSupport.dll +0 -0
  119. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.TDNetRunner.dll +0 -0
  120. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.WatinSupport.dll +0 -0
  121. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.WebDriverSupport.dll +0 -0
  122. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.dll +0 -0
  123. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.dll.tdnet +5 -0
  124. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.dotCoverRunner.2.0.dll +0 -0
  125. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.dotCoverRunner.2.1.dll +0 -0
  126. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Machine.Specifications.dotCoverRunner.2.2.dll +0 -0
  127. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/Spark.dll +0 -0
  128. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/TestDriven.Framework.dll +0 -0
  129. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/install.ps1 +6 -0
  130. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/mspec-clr4.exe +0 -0
  131. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/mspec-clr4.exe.config +9 -0
  132. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/mspec-x86-clr4.exe +0 -0
  133. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/mspec-x86-clr4.exe.config +9 -0
  134. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/mspec-x86.exe +0 -0
  135. data/spec/TestProj/packages/Machine.Specifications.0.5.12/tools/mspec.exe +0 -0
  136. data/spec/TestProj/packages/NUnit.2.6.2/NUnit.2.6.2.nupkg +0 -0
  137. data/spec/TestProj/packages/NUnit.2.6.2/lib/nunit.framework.dll +0 -0
  138. data/spec/TestProj/packages/NUnit.2.6.2/lib/nunit.framework.xml +10899 -0
  139. data/spec/TestProj/packages/NUnit.2.6.2/license.txt +15 -0
  140. data/spec/TestProj/packages/repositories.config +4 -0
  141. data/spec/TestProj/packages/xunit.1.9.1/lib/net20/xunit.dll +0 -0
  142. data/spec/TestProj/packages/xunit.1.9.1/lib/net20/xunit.dll.tdnet +5 -0
  143. data/spec/TestProj/packages/xunit.1.9.1/lib/net20/xunit.runner.msbuild.dll +0 -0
  144. data/spec/TestProj/packages/xunit.1.9.1/lib/net20/xunit.runner.tdnet.dll +0 -0
  145. data/spec/TestProj/packages/xunit.1.9.1/lib/net20/xunit.runner.utility.dll +0 -0
  146. data/spec/TestProj/packages/xunit.1.9.1/lib/net20/xunit.xml +2611 -0
  147. data/spec/TestProj/packages/xunit.1.9.1/xunit.1.9.1.nupkg +0 -0
  148. data/spec/mspec_integration_spec.rb +13 -0
  149. data/spec/nunit_integration_spec.rb +14 -0
  150. data/spec/pre_push_spec.rb +36 -0
  151. 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
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in pre_push.gemspec
4
+ gemspec
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
@@ -0,0 +1,5 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake'
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
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
@@ -0,0 +1,3 @@
1
+ module PrePush
2
+ VERSION = "0.0.1"
3
+ 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