flipping 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.md +23 -0
  3. data/bin/flipping +79 -0
  4. data/lib/version.rb +6 -0
  5. metadata +61 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 82df1a32dd72b8186354022465b82008bc4e68ab
4
+ data.tar.gz: 8176b530c0e018c88155bf0fe7c296afc877f24b
5
+ SHA512:
6
+ metadata.gz: 1d32a568b2407e9f36e4dcf0d3a3d6643061d4465aed438bed2a386ac6dc39bc2cf703bd0d5013dc6bec9e5fceadbed1ee18e7467d977418e17569be3669d27b
7
+ data.tar.gz: 0ccd5f0a3f0fc867b5eaac0435b43e77993676da05eede781c4dc2c9492ced051cf52f5ac009cdd24b555e5ad5b9125e04691919750e3f513e3ac1505a79aa62
@@ -0,0 +1,23 @@
1
+ # FreeBSD License
2
+
3
+ # Copyright 2014 Andrew Pennebaker. All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without modification,
6
+ are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+ 2. Redistributions in binary form must reproduce the above copyright notice,
11
+ this list of conditions and the following disclaimer in the documentation and/or
12
+ other materials provided with the distribution.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED
15
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
17
+ SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
18
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
19
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
22
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
23
+ ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'tempfile'
4
+ require 'optparse'
5
+
6
+ def main
7
+ color = $stdout.isatty
8
+
9
+ maven_command = 'mvn test'
10
+
11
+ option = OptionParser.new do |option|
12
+ option.banner = 'Usage: flipping [options] [mvn-test-command]
13
+ mvn-test-command defaults to "mvn test"'
14
+
15
+ option.on('-c', '--color', 'Enable colors (on by default for tty\'s') do
16
+ color = true
17
+ end
18
+
19
+ option.on('-h', '--help', 'Print usage info') do
20
+ puts option
21
+ exit
22
+ end
23
+ end
24
+
25
+ option.parse!
26
+
27
+ if ARGV.length == 1
28
+ maven_command = ARGV[0]
29
+ end
30
+
31
+ maven_output = `#{maven_command}`
32
+
33
+ # Extract failing test values
34
+
35
+ test_values = maven_output.scan(/\s\s.* expected:\<(.+)\> but was:\<(.+)\>\n/)
36
+
37
+ if test_values == nil || test_values.length < 1
38
+ exit 0
39
+ end
40
+
41
+ # Extract expected vs actual values
42
+
43
+ expected = []
44
+ actual = []
45
+
46
+ test_values.each do |test_case|
47
+ e, a = test_case
48
+
49
+ expected << e
50
+ actual << a
51
+ end
52
+
53
+ f1 = Tempfile.new 'expected'
54
+ f2 = Tempfile.new 'actual'
55
+
56
+ expected.each do |e|
57
+ f1.write "Actual: #{e}\n"
58
+ end
59
+
60
+ actual.each do |a|
61
+ f2.write "Expected: #{a}\n"
62
+ end
63
+
64
+ f1.close
65
+ f2.close
66
+
67
+ output = `moss #{ if color then "-c" else "" end } #{f1.path} #{f2.path}`
68
+
69
+ f1.delete
70
+ f2.delete
71
+
72
+ puts output
73
+ end
74
+
75
+ begin
76
+ main
77
+ rescue Interrupt
78
+ nil
79
+ end
@@ -0,0 +1,6 @@
1
+ #
2
+ # Flipping
3
+ #
4
+ module Flipping
5
+ VERSION = '0.1'
6
+ end
metadata ADDED
@@ -0,0 +1,61 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: flipping
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Pennebaker
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: moss
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: '0.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: '0.4'
27
+ description: See README.md for example usage
28
+ email: andrew.pennebaker@gmail.com
29
+ executables:
30
+ - flipping
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - lib/version.rb
35
+ - LICENSE.md
36
+ - bin/flipping
37
+ homepage: https://github.com/mcandre/flipping
38
+ licenses:
39
+ - FreeBSD
40
+ metadata: {}
41
+ post_install_message:
42
+ rdoc_options: []
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - '>='
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ requirements: []
56
+ rubyforge_project:
57
+ rubygems_version: 2.1.10
58
+ signing_key:
59
+ specification_version: 4
60
+ summary: highlight differences in complex Maven test expected/actual values
61
+ test_files: []