clash 0.0.2 → 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.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +5 -0
- data/README.md +4 -0
- data/bin/clash +35 -87
- data/clash.gemspec +1 -0
- data/lib/clash.rb +1 -1
- data/lib/clash/diff.rb +19 -12
- data/lib/clash/helpers.rb +18 -2
- data/lib/clash/test.rb +16 -10
- data/lib/clash/tests.rb +60 -28
- data/lib/clash/version.rb +1 -1
- data/test/.clash.yml +47 -9
- data/test/.test.yml +1 -0
- data/test/Gemfile +1 -0
- data/test/_c/1.txt +16 -0
- data/test/{b/2.txt → _c/3.txt} +0 -0
- data/test/_config.yml +4 -0
- data/test/_expected/alternate.html +1 -0
- data/test/_expected/default.html +1 -0
- data/test/_expected_output/1 +11 -0
- data/test/_expected_output/10 +15 -0
- data/test/_expected_output/2 +12 -0
- data/test/_expected_output/3 +9 -0
- data/test/_expected_output/4 +9 -0
- data/test/_expected_output/5 +6 -0
- data/test/_expected_output/6 +46 -0
- data/test/_expected_output/7 +6 -0
- data/test/_expected_output/8 +35 -0
- data/test/_expected_output/9 +6 -0
- data/test/_octopress.yml +1 -0
- data/test/_plugins/feed/config.yml +1 -1
- data/test/_test1.yml +1 -0
- data/test/a/1.txt +14 -15
- data/test/a/2.txt +17 -2
- data/test/index.html +3 -0
- data/test/test.rb +22 -0
- metadata +56 -17
- data/test/_test.yml +0 -1
- data/test/a.txt +0 -5
- data/test/b.txt +0 -5
- data/test/b/1.txt +0 -17
- data/test/c.txt +0 -4
- data/test/c/1.txt +0 -17
- data/test/c/2.txt +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13ac19a35a839e89433534afd9ad62d50043423a
|
4
|
+
data.tar.gz: 850cef298bfd22ed9a9890473b1397da86a15e23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eebbea76d8eae56c606b4e78eb48603a3b7a7ead4ed2a7720b91bc325ff9e11f7279bd7c2f0e5782638e1a8f235d3056987fa11f654e316d87a7886bd5945a1c
|
7
|
+
data.tar.gz: 3d157c408778103392fc5d50062e607cf1a330e3b8181edf2d2c24d1cdfb0b72d39b1983e0656ddf5a5f2b026122af862ed8a76f07708d6216048a32c5ecbf1f
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
Clash is a diff based testing framework for static sites.
|
4
4
|
|
5
|
+
[](https://travis-ci.org/imathis/clash)
|
6
|
+
[](https://rubygems.org/gems/clash)
|
7
|
+
[](http://imathis.mit-license.org)
|
8
|
+
|
5
9
|
## Installation
|
6
10
|
|
7
11
|
Add this line to your application's Gemfile:
|
data/bin/clash
CHANGED
@@ -7,111 +7,59 @@ require 'optparse'
|
|
7
7
|
|
8
8
|
options = {}
|
9
9
|
|
10
|
-
|
11
|
-
opts.banner = "Usage: clash [options]"
|
12
|
-
|
13
|
-
opts.on("-f FILE", "--file FILE", "Set test file (default: .clash.yml).") do |f|
|
14
|
-
options[:file] = f
|
15
|
-
end
|
16
|
-
|
17
|
-
opts.on("-c", "--context NUMBER", Integer, "Number of lines of context on a diff") do |context|
|
18
|
-
options[:context] = context
|
19
|
-
end
|
20
|
-
|
21
|
-
opts.on("-h", "--help", "Show help message") do |h|
|
22
|
-
options[:help] = h
|
23
|
-
end
|
24
|
-
|
25
|
-
end.parse!
|
26
|
-
|
27
|
-
if !ARGV.empty?
|
28
|
-
# Parse input `clash 1 2 3` and `clash 1,2,3` the same
|
29
|
-
#
|
30
|
-
options[:only] = ARGV.join(',').split(',').map{ |n| n.to_i }
|
31
|
-
end
|
32
|
-
|
33
|
-
if options[:help]
|
34
|
-
puts <<-HELP
|
10
|
+
banner = <<-BANNER
|
35
11
|
clash #{Clash::VERSION} -- Clash is a diff based testing suite for static sites.
|
36
12
|
|
37
13
|
Usage:
|
38
14
|
|
39
|
-
clash [
|
15
|
+
clash [tests] [options]
|
40
16
|
|
41
17
|
To run only specific tests, pass test numbers separated by commas.
|
42
18
|
|
43
|
-
|
44
|
-
|
19
|
+
$ clash 1 # run only the first test
|
20
|
+
$ clash 2,3 # run the second and third tests
|
45
21
|
|
46
22
|
Options:
|
47
|
-
|
48
|
-
-f, --file FILE Use a specific test file (default: .clash.yml)
|
49
|
-
-c, --context NUMBER On diff errors, show NUMBER of lines of surrounding context (default: 2)
|
50
|
-
-h, --help show this message
|
51
|
-
|
52
|
-
Configuration:
|
53
|
-
|
54
|
-
Clash reads its configuration from a .clash.yml file in the root of your project. Use the --file
|
55
|
-
option to choose a different configuration file.
|
56
|
-
|
57
|
-
Simple configuration:
|
58
|
-
Clash will build the site with Jekyll, and compare the contents of _site/ to expected/.
|
59
|
-
|
60
|
-
build: true
|
61
|
-
compare: _site, expected
|
62
|
-
|
63
|
-
Full configuration:
|
64
|
-
|
65
|
-
| Option | Type | Description |
|
66
|
-
|:-----------------|:---------------|:---------------------------------------------------------|
|
67
|
-
| before | String/Array | Run system command(s) before running tests. |
|
68
|
-
| build | Boolean | Build the site with Jekyll. |
|
69
|
-
| config | Hash | Configure Jekyll, Octopress or Ink plugins. (Info below) |
|
70
|
-
| compare | String/Array | Compare files or directories. e.g. "a.md, b.md" |
|
71
|
-
| enforce_missing | String/Array | Ensure that these files are not found. |
|
72
|
-
| after | String/Array | Run system command(s) after running tests. |
|
73
|
-
|
74
|
-
Note: in the table above, String/Array means a single argument can be a string, but mutliples
|
75
|
-
can be passed as an array. For example:
|
76
23
|
|
77
|
-
|
78
|
-
compare: # Compare mutiple items
|
79
|
-
- _site/index.html, expected/index.html
|
80
|
-
- _site/atom.xml, expected/atom.xml
|
81
|
-
- _site/posts, expected/posts
|
24
|
+
BANNER
|
82
25
|
|
26
|
+
config_info = <<-CONFIG
|
83
27
|
|
84
|
-
|
28
|
+
Configuration:
|
85
29
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
-
|
91
|
-
name: Check asset compression
|
92
|
-
compare: _cdn_build, _cdn_expected
|
30
|
+
Clash reads its configuration from a .clash.yml file in the root of your project. Use the --file
|
31
|
+
option to choose a different configuration file.
|
32
|
+
|
33
|
+
View the README or visit https://github.com/imathis/clash for configuration info.
|
93
34
|
|
94
|
-
|
35
|
+
CONFIG
|
95
36
|
|
37
|
+
OptionParser.new do |opts|
|
38
|
+
opts.banner = banner
|
96
39
|
|
97
|
-
|
40
|
+
opts.on("-f FILE", "--file FILE", "Use a specific test file (default: .clash.yml)") do |f|
|
41
|
+
options[:file] = f
|
42
|
+
end
|
98
43
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
44
|
+
opts.on("-c", "--context NUMBER", Integer, "On diff errors, show NUMBER of lines of surrounding context (default: 2)") do |context|
|
45
|
+
options[:context] = context
|
46
|
+
end
|
47
|
+
|
48
|
+
opts.on("-h", "--help", "Show this message") do |h|
|
49
|
+
puts opts
|
50
|
+
puts config_info
|
51
|
+
options[:help] = h
|
52
|
+
end
|
106
53
|
|
107
|
-
|
54
|
+
end.parse!
|
108
55
|
|
109
|
-
|
110
|
-
|
111
|
-
|
56
|
+
unless ARGV.empty?
|
57
|
+
# Parse input `clash 1 2 3` and `clash 1,2,3` the same
|
58
|
+
#
|
59
|
+
options[:only] = ARGV.join(',').split(',').map{ |n| n.to_i }
|
60
|
+
end
|
112
61
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
Clash::Tests.new(options).run
|
62
|
+
unless options[:help]
|
63
|
+
tests = Clash::Tests.new(options)
|
64
|
+
tests.run
|
117
65
|
end
|
data/clash.gemspec
CHANGED
data/lib/clash.rb
CHANGED
data/lib/clash/diff.rb
CHANGED
@@ -2,11 +2,14 @@ module Clash
|
|
2
2
|
class Diff
|
3
3
|
include Helpers
|
4
4
|
|
5
|
+
attr_accessor :test_failures
|
6
|
+
|
5
7
|
def initialize(a, b, options={})
|
6
8
|
@diffs = {}
|
7
9
|
@a = a
|
8
10
|
@b = b
|
9
11
|
@context = options[:context] || 2
|
12
|
+
@test_failures = []
|
10
13
|
end
|
11
14
|
|
12
15
|
def diff
|
@@ -26,7 +29,7 @@ module Clash
|
|
26
29
|
|
27
30
|
if !file_diff.empty?
|
28
31
|
file_diff = format_diff(file_diff)
|
29
|
-
@diffs["
|
32
|
+
@diffs[yellowit("\nCompared #{a} to #{b}:\n")] = file_diff
|
30
33
|
end
|
31
34
|
end
|
32
35
|
end
|
@@ -44,13 +47,13 @@ module Clash
|
|
44
47
|
# Return files that exist in both directories (without dir names)
|
45
48
|
#
|
46
49
|
def mattching_dir_files(dir1, dir2)
|
47
|
-
dir1_files = dir_files(dir1).map {|f| f.sub(dir1,'') }
|
48
|
-
dir2_files = dir_files(dir2).map {|f| f.sub(dir2,'') }
|
50
|
+
dir1_files = dir_files(dir1).map {|f| f.sub("#{dir1}/",'') }
|
51
|
+
dir2_files = dir_files(dir2).map {|f| f.sub("#{dir2}/",'') }
|
49
52
|
|
50
53
|
matches = dir1_files & dir2_files
|
51
54
|
|
52
|
-
unique_files(dir1,
|
53
|
-
unique_files(dir2,
|
55
|
+
unique_files(dir1, dir2_files, matches)
|
56
|
+
unique_files(dir2, dir1_files, matches)
|
54
57
|
|
55
58
|
matches
|
56
59
|
end
|
@@ -66,8 +69,12 @@ module Clash
|
|
66
69
|
def unique_files(dir, dir_files, common_files)
|
67
70
|
unique = dir_files - common_files
|
68
71
|
if !unique.empty?
|
69
|
-
@test_failures <<
|
70
|
-
unique.each
|
72
|
+
@test_failures << yellowit("\nMissing from directory #{dir}:\n")
|
73
|
+
unique.each do |f|
|
74
|
+
failure = " - #{f}"
|
75
|
+
failure << "\n" if unique.last == f
|
76
|
+
@test_failures << failure
|
77
|
+
end
|
71
78
|
end
|
72
79
|
end
|
73
80
|
|
@@ -75,7 +82,7 @@ module Clash
|
|
75
82
|
file_exists = File.exists?(f)
|
76
83
|
|
77
84
|
if !file_exists
|
78
|
-
@test_failures << "#{
|
85
|
+
@test_failures << "#{redit('File not found:')} #{f}"
|
79
86
|
end
|
80
87
|
|
81
88
|
file_exists
|
@@ -89,17 +96,17 @@ module Clash
|
|
89
96
|
case line
|
90
97
|
when /^\+/ then
|
91
98
|
count = 0
|
92
|
-
|
99
|
+
" #{greenit(line)}"
|
93
100
|
when /^-/ then
|
94
101
|
count = 0
|
95
|
-
|
102
|
+
" #{redit(line)}"
|
96
103
|
else
|
97
104
|
if count == @context
|
98
105
|
count = 0
|
99
|
-
"...\n#{line}"
|
106
|
+
"...\n #{line}"
|
100
107
|
else
|
101
108
|
count += 1
|
102
|
-
line
|
109
|
+
" #{line}"
|
103
110
|
end
|
104
111
|
end
|
105
112
|
}
|
data/lib/clash/helpers.rb
CHANGED
@@ -23,12 +23,28 @@ module Clash
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
def greenit(str)
|
27
|
+
colorize(str, 'green')
|
28
|
+
end
|
29
|
+
|
30
|
+
def yellowit(str)
|
31
|
+
colorize(str, 'yellow')
|
32
|
+
end
|
33
|
+
|
34
|
+
def redit(str)
|
35
|
+
colorize(str, 'red')
|
36
|
+
end
|
37
|
+
|
38
|
+
def boldit(str)
|
39
|
+
colorize(str, 'bold')
|
40
|
+
end
|
41
|
+
|
26
42
|
def print_fail
|
27
|
-
pout
|
43
|
+
pout redit('F')
|
28
44
|
end
|
29
45
|
|
30
46
|
def print_pass
|
31
|
-
pout
|
47
|
+
pout greenit('.')
|
32
48
|
end
|
33
49
|
end
|
34
50
|
end
|
data/lib/clash/test.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module Clash
|
2
2
|
class Test
|
3
|
-
attr_accessor :title
|
4
|
-
|
5
3
|
include Helpers
|
6
4
|
|
5
|
+
attr_accessor :title
|
6
|
+
|
7
7
|
def initialize(options={})
|
8
8
|
@test_failures = []
|
9
9
|
@options = options
|
@@ -15,11 +15,11 @@ module Clash
|
|
15
15
|
system_cmd(@options['before'])
|
16
16
|
config
|
17
17
|
build if @options['build']
|
18
|
-
cleanup_config
|
19
18
|
compare
|
20
19
|
enforce_missing
|
21
|
-
print_result
|
22
20
|
system_cmd(@options['after'])
|
21
|
+
cleanup_config
|
22
|
+
print_result
|
23
23
|
results
|
24
24
|
end
|
25
25
|
|
@@ -86,7 +86,12 @@ module Clash
|
|
86
86
|
def compare
|
87
87
|
default_array(@options['compare']).each do |files|
|
88
88
|
f = files.split(',')
|
89
|
-
|
89
|
+
|
90
|
+
differ = Diff.new(f[0].strip, f[1].strip, context: @options['context'])
|
91
|
+
diff = differ.diff
|
92
|
+
|
93
|
+
@test_failures.concat differ.test_failures
|
94
|
+
|
90
95
|
diff.each do |title, diff|
|
91
96
|
@test_failures << "#{title}\n#{diff}\n"
|
92
97
|
end
|
@@ -94,9 +99,10 @@ module Clash
|
|
94
99
|
end
|
95
100
|
|
96
101
|
def enforce_missing
|
97
|
-
default_array(@options['enforce_missing']).each do |
|
102
|
+
default_array(@options['enforce_missing']).each do |file|
|
98
103
|
if File.exists?(file)
|
99
|
-
|
104
|
+
message = yellowit("\nFile #{file} shouldn't exist.") + "\n But it does!"
|
105
|
+
@test_failures << message
|
100
106
|
end
|
101
107
|
end
|
102
108
|
end
|
@@ -117,10 +123,10 @@ module Clash
|
|
117
123
|
end
|
118
124
|
|
119
125
|
def test_title
|
120
|
-
title =
|
121
|
-
title << "
|
126
|
+
title = boldit("#{@options['index']})")
|
127
|
+
title << " #{@options['title']}" unless @options['title'].nil?
|
122
128
|
<<-HERE
|
123
|
-
|
129
|
+
#{title}
|
124
130
|
========================================================
|
125
131
|
HERE
|
126
132
|
end
|
data/lib/clash/tests.rb
CHANGED
@@ -1,57 +1,89 @@
|
|
1
1
|
module Clash
|
2
2
|
class Tests
|
3
3
|
include Helpers
|
4
|
+
|
5
|
+
attr_accessor :tests
|
4
6
|
|
5
7
|
def initialize(options={})
|
6
8
|
@options = options
|
9
|
+
@results = []
|
10
|
+
@passed = []
|
11
|
+
@failed = []
|
7
12
|
|
8
13
|
@options[:file] ||= '.clash.yml'
|
9
|
-
@options[:
|
10
|
-
@options[:
|
14
|
+
@options[:only] ||= []
|
15
|
+
@options[:exit] ||= true
|
11
16
|
|
12
|
-
@tests =
|
17
|
+
@tests = read_tests
|
13
18
|
end
|
14
19
|
|
15
20
|
def run
|
16
|
-
@results = {}
|
17
|
-
@passed = []
|
18
|
-
@failed = []
|
19
21
|
@tests.each_with_index do |options, index|
|
20
|
-
|
21
22
|
# If tests are limited, only run specified tests
|
22
23
|
#
|
23
|
-
next if
|
24
|
+
next if options.nil?
|
25
|
+
run_test(options, index)
|
26
|
+
end
|
24
27
|
|
25
|
-
|
26
|
-
|
28
|
+
print_results
|
29
|
+
end
|
30
|
+
|
31
|
+
def run_test(options, index)
|
32
|
+
|
33
|
+
options['index'] = index + 1
|
34
|
+
options['context'] = @options[:context]
|
27
35
|
|
28
|
-
|
36
|
+
results = Test.new(options).run
|
29
37
|
|
30
|
-
|
31
|
-
|
38
|
+
if results.nil?
|
39
|
+
@passed << index + 1
|
40
|
+
else
|
41
|
+
@failed << index + 1
|
42
|
+
@results << results
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def read_tests
|
47
|
+
tests = SafeYAML.load_file(@options[:file])
|
48
|
+
index = 0
|
49
|
+
|
50
|
+
default_array(tests).map do |test|
|
51
|
+
index += 1
|
52
|
+
|
53
|
+
# Admit all tests if no tests are excluded
|
54
|
+
if @options[:only].empty?
|
55
|
+
test
|
56
|
+
# Only admit selected tests
|
57
|
+
elsif @options[:only].include?(index)
|
58
|
+
test
|
59
|
+
# Remove tests not selected
|
32
60
|
else
|
33
|
-
|
34
|
-
@results[index + 1] = results
|
61
|
+
nil
|
35
62
|
end
|
36
63
|
end
|
37
|
-
|
38
|
-
print_results
|
39
64
|
end
|
40
65
|
|
41
66
|
def print_results
|
42
|
-
puts "" # newline
|
43
67
|
|
44
|
-
if @results.empty?
|
45
|
-
puts colorize("Passed #{@passed.size} of #{@passed.size} tests", "green")
|
46
|
-
else
|
47
|
-
@results.each do |test, results|
|
48
|
-
if !results.empty?
|
49
|
-
puts "\n#{results.join('')}"
|
50
|
-
end
|
51
|
-
end
|
52
68
|
|
53
|
-
|
54
|
-
|
69
|
+
puts boldit("\n\nFailures:") unless @results.empty?
|
70
|
+
@results.each do |results|
|
71
|
+
puts "\n#{results.join('')}"
|
72
|
+
end
|
73
|
+
|
74
|
+
puts boldit("\n\nTest summary:")
|
75
|
+
puts yellowit(" Tests run: #{@passed.dup.concat(@failed).size}")
|
76
|
+
puts "#{greenit(" Passed #{@passed.size}")} #{list_tests(@passed)}"
|
77
|
+
puts "#{redit(" Failed #{@failed.size}")} #{list_tests(@failed)}"
|
78
|
+
|
79
|
+
exit 1 if @options[:exit] && !@results.empty?
|
80
|
+
end
|
81
|
+
|
82
|
+
def list_tests(tests)
|
83
|
+
if tests.empty?
|
84
|
+
''
|
85
|
+
else
|
86
|
+
"- Tests: #{tests.join(',')}"
|
55
87
|
end
|
56
88
|
end
|
57
89
|
end
|
data/lib/clash/version.rb
CHANGED
data/test/.clash.yml
CHANGED
@@ -1,14 +1,52 @@
|
|
1
1
|
-
|
2
|
-
title:
|
3
|
-
|
2
|
+
title: Standard build
|
3
|
+
build: true
|
4
|
+
compare: _site/index.html, _expected/default.html
|
4
5
|
-
|
5
|
-
title:
|
6
|
-
|
6
|
+
title: Build Jekyll with alternate configuration
|
7
|
+
build: true
|
7
8
|
config:
|
8
|
-
|
9
|
+
jekyll:
|
10
|
+
- _config.yml
|
11
|
+
- _test1.yml
|
12
|
+
compare: _site/index.html, _expected/alternate.html
|
9
13
|
-
|
10
|
-
title:
|
11
|
-
|
14
|
+
title: Test Octopress configuration
|
15
|
+
config:
|
16
|
+
octopress: _test1.yml
|
17
|
+
before: cat _octopress.yml
|
18
|
+
after:
|
19
|
+
- cat _octopress.yml
|
20
|
+
- cat _octopress.yml.bak
|
21
|
+
-
|
22
|
+
title: Test Octopress Ink configuration
|
23
|
+
config:
|
24
|
+
feed: _test1.yml
|
25
|
+
before: cat _plugins/feed/config.yml
|
26
|
+
after:
|
27
|
+
- cat _plugins/feed/config.yml
|
28
|
+
- cat _plugins/feed/config.yml.bak
|
29
|
+
-
|
30
|
+
title: Compare matching files
|
31
|
+
compare:
|
32
|
+
- a/1.txt, _site/a/1.txt
|
33
|
+
- a/2.txt, _site/a/2.txt
|
34
|
+
-
|
35
|
+
title: (Should fail) Compare files with differences
|
36
|
+
compare:
|
37
|
+
- a/1.txt, _c/1.txt
|
38
|
+
- _site/a/1.txt, _c/1.txt
|
39
|
+
-
|
40
|
+
title: Compare two matching dirs
|
41
|
+
compare: a, _site/a
|
42
|
+
-
|
43
|
+
title: (Should fail) Compare two dirs with differences
|
44
|
+
compare: a, _c
|
45
|
+
-
|
46
|
+
title: File shouldn't exist.
|
47
|
+
enforce_missing:
|
48
|
+
- unicorns.txt
|
49
|
+
- dragons.txt
|
12
50
|
-
|
13
|
-
title:
|
14
|
-
|
51
|
+
title: (Should fail) File shouldn't exist (and does)
|
52
|
+
enforce_missing: a/1.txt
|
data/test/.test.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
compare: _output, _expected_output
|
data/test/Gemfile
CHANGED
data/test/_c/1.txt
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
Bacon ipsum dolor sit amet shank landjaeger duis, eu laboris beef fugiat meatball
|
2
|
+
short loin ribeye occaecat cow. Eiusmod swine hamburger biltong qui pork belly fu
|
3
|
+
giat. Duis corned beef hamburger eu short loin. Nisi spare ribs sed quis eu salam
|
4
|
+
i. Non strip steak pork t-bone fatback, commodo ball tip capicola anim. Biltong p
|
5
|
+
ork loin quis corned beef, in landjaeger esse bacon short loin brisket andouille.
|
6
|
+
|
7
|
+
Biltong magna excepteur pork dolore, turducken laboris veniam eiusmod shank. Cons
|
8
|
+
ectetur consequat exercitation pork belly tri-tip in. Biltong meatball velit, rep
|
9
|
+
rehenderit turkey tempor deserunt. Pork belly andouille sirloin ham hock co
|
10
|
+
nsequat ground round ham beef ribs bresaola et tail hamburger commodo bacon. Eius
|
11
|
+
mod capicola pancetta ham nisi turkey tempor qui hamburger.
|
12
|
+
|
13
|
+
Ribeye kevin irure, consectetur jowl tenderloin nulla. Nulla chuck ground round o
|
14
|
+
fficia, kevin shankle corned beef anim salami spare ribs. Landjaeger p
|
15
|
+
astrami aliquip andouille. Proident in venison bresaola drumstick landjaeger occa
|
16
|
+
ecat. Pork spare ribs consectetur sint flank veniam.
|
data/test/{b/2.txt → _c/3.txt}
RENAMED
File without changes
|
data/test/_config.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Site name is: Clashing
|
@@ -0,0 +1 @@
|
|
1
|
+
Site name is: Clash test
|
@@ -0,0 +1,15 @@
|
|
1
|
+
F
|
2
|
+
|
3
|
+
Failures:
|
4
|
+
|
5
|
+
10) (Should fail) File shouldn't exist (and does)
|
6
|
+
========================================================
|
7
|
+
|
8
|
+
File a/1.txt shouldn't exist.
|
9
|
+
But it does!
|
10
|
+
|
11
|
+
|
12
|
+
Test summary:
|
13
|
+
Tests run: 1
|
14
|
+
Passed 0
|
15
|
+
Failed 1 - Tests: 10
|
@@ -0,0 +1,46 @@
|
|
1
|
+
F
|
2
|
+
|
3
|
+
Failures:
|
4
|
+
|
5
|
+
6) (Should fail) Compare files with differences
|
6
|
+
========================================================
|
7
|
+
|
8
|
+
Compared a/1.txt to _c/1.txt:
|
9
|
+
|
10
|
+
Biltong magna excepteur pork dolore, turducken laboris veniam eiusmod shank. Cons
|
11
|
+
ectetur consequat exercitation pork belly tri-tip in. Biltong meatball velit, rep
|
12
|
+
-rehenderit culpa turkey tempor deserunt. Pork belly andouille sirloin ham hock co
|
13
|
+
+rehenderit turkey tempor deserunt. Pork belly andouille sirloin ham hock co
|
14
|
+
nsequat ground round ham beef ribs bresaola et tail hamburger commodo bacon. Eius
|
15
|
+
mod capicola pancetta ham nisi turkey tempor qui hamburger.
|
16
|
+
...
|
17
|
+
|
18
|
+
Ribeye kevin irure, consectetur jowl tenderloin nulla. Nulla chuck ground round o
|
19
|
+
-fficia, prosciutto kevin shankle corned beef anim salami spare ribs. Landjaeger p
|
20
|
+
+fficia, kevin shankle corned beef anim salami spare ribs. Landjaeger p
|
21
|
+
astrami aliquip andouille. Proident in venison bresaola drumstick landjaeger occa
|
22
|
+
ecat. Pork spare ribs consectetur sint flank veniam.
|
23
|
+
|
24
|
+
|
25
|
+
Compared _site/a/1.txt to _c/1.txt:
|
26
|
+
|
27
|
+
Biltong magna excepteur pork dolore, turducken laboris veniam eiusmod shank. Cons
|
28
|
+
ectetur consequat exercitation pork belly tri-tip in. Biltong meatball velit, rep
|
29
|
+
-rehenderit culpa turkey tempor deserunt. Pork belly andouille sirloin ham hock co
|
30
|
+
+rehenderit turkey tempor deserunt. Pork belly andouille sirloin ham hock co
|
31
|
+
nsequat ground round ham beef ribs bresaola et tail hamburger commodo bacon. Eius
|
32
|
+
mod capicola pancetta ham nisi turkey tempor qui hamburger.
|
33
|
+
...
|
34
|
+
|
35
|
+
Ribeye kevin irure, consectetur jowl tenderloin nulla. Nulla chuck ground round o
|
36
|
+
-fficia, prosciutto kevin shankle corned beef anim salami spare ribs. Landjaeger p
|
37
|
+
+fficia, kevin shankle corned beef anim salami spare ribs. Landjaeger p
|
38
|
+
astrami aliquip andouille. Proident in venison bresaola drumstick landjaeger occa
|
39
|
+
ecat. Pork spare ribs consectetur sint flank veniam.
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
Test summary:
|
44
|
+
Tests run: 1
|
45
|
+
Passed 0
|
46
|
+
Failed 1 - Tests: 6
|
@@ -0,0 +1,35 @@
|
|
1
|
+
F
|
2
|
+
|
3
|
+
Failures:
|
4
|
+
|
5
|
+
8) (Should fail) Compare two dirs with differences
|
6
|
+
========================================================
|
7
|
+
|
8
|
+
Missing from directory a:
|
9
|
+
- 3.txt
|
10
|
+
|
11
|
+
Missing from directory _c:
|
12
|
+
- 2.txt
|
13
|
+
|
14
|
+
Compared a/1.txt to _c/1.txt:
|
15
|
+
|
16
|
+
Biltong magna excepteur pork dolore, turducken laboris veniam eiusmod shank. Cons
|
17
|
+
ectetur consequat exercitation pork belly tri-tip in. Biltong meatball velit, rep
|
18
|
+
-rehenderit culpa turkey tempor deserunt. Pork belly andouille sirloin ham hock co
|
19
|
+
+rehenderit turkey tempor deserunt. Pork belly andouille sirloin ham hock co
|
20
|
+
nsequat ground round ham beef ribs bresaola et tail hamburger commodo bacon. Eius
|
21
|
+
mod capicola pancetta ham nisi turkey tempor qui hamburger.
|
22
|
+
...
|
23
|
+
|
24
|
+
Ribeye kevin irure, consectetur jowl tenderloin nulla. Nulla chuck ground round o
|
25
|
+
-fficia, prosciutto kevin shankle corned beef anim salami spare ribs. Landjaeger p
|
26
|
+
+fficia, kevin shankle corned beef anim salami spare ribs. Landjaeger p
|
27
|
+
astrami aliquip andouille. Proident in venison bresaola drumstick landjaeger occa
|
28
|
+
ecat. Pork spare ribs consectetur sint flank veniam.
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
Test summary:
|
33
|
+
Tests run: 1
|
34
|
+
Passed 0
|
35
|
+
Failed 1 - Tests: 8
|
data/test/_octopress.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
name: Octopress clashing
|
@@ -1 +1 @@
|
|
1
|
-
name: Clashing
|
1
|
+
name: Feed Clashing
|
data/test/_test1.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
name: Clashing
|
data/test/a/1.txt
CHANGED
@@ -1,17 +1,16 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
Bacon ipsum dolor sit amet shank landjaeger duis, eu laboris beef fugiat meatball
|
2
|
+
short loin ribeye occaecat cow. Eiusmod swine hamburger biltong qui pork belly fu
|
3
|
+
giat. Duis corned beef hamburger eu short loin. Nisi spare ribs sed quis eu salam
|
4
|
+
i. Non strip steak pork t-bone fatback, commodo ball tip capicola anim. Biltong p
|
5
|
+
ork loin quis corned beef, in landjaeger esse bacon short loin brisket andouille.
|
4
6
|
|
7
|
+
Biltong magna excepteur pork dolore, turducken laboris veniam eiusmod shank. Cons
|
8
|
+
ectetur consequat exercitation pork belly tri-tip in. Biltong meatball velit, rep
|
9
|
+
rehenderit culpa turkey tempor deserunt. Pork belly andouille sirloin ham hock co
|
10
|
+
nsequat ground round ham beef ribs bresaola et tail hamburger commodo bacon. Eius
|
11
|
+
mod capicola pancetta ham nisi turkey tempor qui hamburger.
|
5
12
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
asdf
|
11
|
-
asdf
|
12
|
-
awesome
|
13
|
-
|
14
|
-
asdfa
|
15
|
-
dsfa
|
16
|
-
sdfasdf
|
17
|
-
adsf
|
13
|
+
Ribeye kevin irure, consectetur jowl tenderloin nulla. Nulla chuck ground round o
|
14
|
+
fficia, prosciutto kevin shankle corned beef anim salami spare ribs. Landjaeger p
|
15
|
+
astrami aliquip andouille. Proident in venison bresaola drumstick landjaeger occa
|
16
|
+
ecat. Pork spare ribs consectetur sint flank veniam.
|
data/test/a/2.txt
CHANGED
@@ -1,2 +1,17 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
Ribeye kevin irure, consectetur jowl tenderloin nulla. Nulla chuck ground round o
|
2
|
+
fficia, prosciutto kevin shankle corned beef anim salami spare ribs. Landjaeger p
|
3
|
+
astrami aliquip andouille. Proident in venison bresaola drumstick landjaeger occa
|
4
|
+
ecat. Pork spare ribs consectetur sint flank veniam.
|
5
|
+
|
6
|
+
Turkey cillum short loin nisi non. Jerky irure quis, occaecat venison nisi ball t
|
7
|
+
ip ex do kevin ribeye. Mollit turkey cillum eu boudin in ham andouille. Biltong n
|
8
|
+
isi cow, nostrud prosciutto shank t-bone minim deserunt. Rump chuck occaecat dolo
|
9
|
+
re.
|
10
|
+
|
11
|
+
Short loin corned beef eu, exercitation consectetur do pork chop ullamco adipisic
|
12
|
+
ing nisi spare ribs. Shankle id cillum consequat aliquip, jerky qui beef ribs str
|
13
|
+
ip steak eu frankfurter brisket in ribeye filet mignon. Brisket voluptate bresaol
|
14
|
+
a filet mignon short ribs. Kielbasa in dolore ex ribeye officia. Ground round ess
|
15
|
+
e capicola, rump sausage in id filet mignon bresaola t-bone eiusmod sunt meatloaf
|
16
|
+
. Swine drumstick kevin turkey pork loin short ribs commodo culpa flank salami po
|
17
|
+
rchetta. Shank tail aliqua shankle ut, landjaeger kevin proident.
|
data/test/index.html
ADDED
data/test/test.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'clash'
|
2
|
+
|
3
|
+
count = Clash::Tests.new().tests.size
|
4
|
+
FileUtils.mkdir_p('_output')
|
5
|
+
|
6
|
+
(1..count).each do |t|
|
7
|
+
system("clash #{t} > _output/#{t}")
|
8
|
+
end
|
9
|
+
|
10
|
+
# substitute paths output from Jekyll
|
11
|
+
%w{1 2}.each do |f|
|
12
|
+
content = File.open("_output/#{f}").read
|
13
|
+
content = content.gsub(/Configuration file: .+\//, 'Configuration file: ')
|
14
|
+
.gsub(/Source: .+\//, 'Source: ')
|
15
|
+
.gsub(/Destination: .+\//, 'Destination: ')
|
16
|
+
|
17
|
+
File.open("_output/#{f}", 'w') { |f| f.write(content) }
|
18
|
+
end
|
19
|
+
|
20
|
+
test = Clash::Tests.new(file: ".test.yml")
|
21
|
+
test.run
|
22
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: jekyll
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: pry-debugger
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,6 +117,7 @@ extensions: []
|
|
103
117
|
extra_rdoc_files: []
|
104
118
|
files:
|
105
119
|
- ".gitignore"
|
120
|
+
- ".travis.yml"
|
106
121
|
- Gemfile
|
107
122
|
- LICENSE.txt
|
108
123
|
- README.md
|
@@ -116,18 +131,30 @@ files:
|
|
116
131
|
- lib/clash/tests.rb
|
117
132
|
- lib/clash/version.rb
|
118
133
|
- test/.clash.yml
|
134
|
+
- test/.test.yml
|
119
135
|
- test/Gemfile
|
136
|
+
- test/_c/1.txt
|
137
|
+
- test/_c/3.txt
|
138
|
+
- test/_config.yml
|
139
|
+
- test/_expected/alternate.html
|
140
|
+
- test/_expected/default.html
|
141
|
+
- test/_expected_output/1
|
142
|
+
- test/_expected_output/10
|
143
|
+
- test/_expected_output/2
|
144
|
+
- test/_expected_output/3
|
145
|
+
- test/_expected_output/4
|
146
|
+
- test/_expected_output/5
|
147
|
+
- test/_expected_output/6
|
148
|
+
- test/_expected_output/7
|
149
|
+
- test/_expected_output/8
|
150
|
+
- test/_expected_output/9
|
151
|
+
- test/_octopress.yml
|
120
152
|
- test/_plugins/feed/config.yml
|
121
|
-
- test/
|
122
|
-
- test/a.txt
|
153
|
+
- test/_test1.yml
|
123
154
|
- test/a/1.txt
|
124
155
|
- test/a/2.txt
|
125
|
-
- test/
|
126
|
-
- test/
|
127
|
-
- test/b/2.txt
|
128
|
-
- test/c.txt
|
129
|
-
- test/c/1.txt
|
130
|
-
- test/c/2.txt
|
156
|
+
- test/index.html
|
157
|
+
- test/test.rb
|
131
158
|
homepage: https://github.com/imathis/clash
|
132
159
|
licenses:
|
133
160
|
- MIT
|
@@ -154,15 +181,27 @@ specification_version: 4
|
|
154
181
|
summary: A diff based testing framework for static sites.
|
155
182
|
test_files:
|
156
183
|
- test/.clash.yml
|
184
|
+
- test/.test.yml
|
157
185
|
- test/Gemfile
|
186
|
+
- test/_c/1.txt
|
187
|
+
- test/_c/3.txt
|
188
|
+
- test/_config.yml
|
189
|
+
- test/_expected/alternate.html
|
190
|
+
- test/_expected/default.html
|
191
|
+
- test/_expected_output/1
|
192
|
+
- test/_expected_output/10
|
193
|
+
- test/_expected_output/2
|
194
|
+
- test/_expected_output/3
|
195
|
+
- test/_expected_output/4
|
196
|
+
- test/_expected_output/5
|
197
|
+
- test/_expected_output/6
|
198
|
+
- test/_expected_output/7
|
199
|
+
- test/_expected_output/8
|
200
|
+
- test/_expected_output/9
|
201
|
+
- test/_octopress.yml
|
158
202
|
- test/_plugins/feed/config.yml
|
159
|
-
- test/
|
160
|
-
- test/a.txt
|
203
|
+
- test/_test1.yml
|
161
204
|
- test/a/1.txt
|
162
205
|
- test/a/2.txt
|
163
|
-
- test/
|
164
|
-
- test/
|
165
|
-
- test/b/2.txt
|
166
|
-
- test/c.txt
|
167
|
-
- test/c/1.txt
|
168
|
-
- test/c/2.txt
|
206
|
+
- test/index.html
|
207
|
+
- test/test.rb
|
data/test/_test.yml
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
name: Clash
|
data/test/a.txt
DELETED
data/test/b.txt
DELETED
data/test/b/1.txt
DELETED
data/test/c.txt
DELETED
data/test/c/1.txt
DELETED
data/test/c/2.txt
DELETED