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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a969d31ec8e0bcf1c77d5e833a0c26c64d64943
4
- data.tar.gz: 74eb10c9644a5dd2fbcfe0850bdfa535cb669ed8
3
+ metadata.gz: 13ac19a35a839e89433534afd9ad62d50043423a
4
+ data.tar.gz: 850cef298bfd22ed9a9890473b1397da86a15e23
5
5
  SHA512:
6
- metadata.gz: aa5e1e84f305381673abfbb14796d040306910af540af05439eee4a21d85dd75afaa8c6e549ef9457043f67b1d2bfe579394714676196f3f852d68d05ce9ce7c
7
- data.tar.gz: 7a312c1e095626a8a984cac7503340c0e46376656bb4a3e92b12bd44522c6ca76ac3d6f8ec83930460a24d568110e72693a8736ce4936e6bfe696a7e4f1a1ec6
6
+ metadata.gz: eebbea76d8eae56c606b4e78eb48603a3b7a7ead4ed2a7720b91bc325ff9e11f7279bd7c2f0e5782638e1a8f235d3056987fa11f654e316d87a7886bd5945a1c
7
+ data.tar.gz: 3d157c408778103392fc5d50062e607cf1a330e3b8181edf2d2c24d1cdfb0b72d39b1983e0656ddf5a5f2b026122af862ed8a76f07708d6216048a32c5ecbf1f
data/.gitignore CHANGED
@@ -20,3 +20,5 @@ tmp
20
20
  *.o
21
21
  *.a
22
22
  mkmf.log
23
+ _site
24
+ _output
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ script: cd test && bundle exec ruby test.rb
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
+ [![Build Status](https://travis-ci.org/imathis/clash.svg)](https://travis-ci.org/imathis/clash)
6
+ [![Gem Version](http://img.shields.io/gem/v/clash.svg)](https://rubygems.org/gems/clash)
7
+ [![License](http://img.shields.io/:license-mit-blue.svg)](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
- OptionParser.new do |opts|
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 [test(s)] [options]
15
+ clash [tests] [options]
40
16
 
41
17
  To run only specific tests, pass test numbers separated by commas.
42
18
 
43
- `clash 1` # run only the first test
44
- `clash 2,3` # run the second and third tests
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
- compare: _site, expected # Compare two directories
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
- To run multiple tests each test should be an array, for example:
28
+ Configuration:
85
29
 
86
- -
87
- name: Check site build
88
- build: true
89
- compare: _site, _expected
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
- Note: When running multiple tests, adding a name can help the reading of test failures.
35
+ CONFIG
95
36
 
37
+ OptionParser.new do |opts|
38
+ opts.banner = banner
96
39
 
97
- Configuring Jekyll, Octopress and Octopress Ink plugins:
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
- build: true
100
- config:
101
- jekyll:
102
- - _configs/config.yml
103
- - _configs/test1.yml
104
- octopress: _configs/octopress.yml
105
- feed: _configs/feed.yml
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
- In this example:
54
+ end.parse!
108
55
 
109
- - Jekyll will build with `--config _configs/config.yml,_configs/test1.yml`
110
- - _configs/octopress.yml will be copied to ./_octopress.yml (and removed after tests)
111
- - _configs/feed.yml will be copied to ./_plugins/feed/config.yml (and removed after tests)
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
- This will not overwrite existing files as they will be backed up an restored after tests.
114
- HELP
115
- else
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
@@ -24,5 +24,6 @@ Gem::Specification.new do |spec|
24
24
 
25
25
  spec.add_development_dependency "bundler", "~> 1.6"
26
26
  spec.add_development_dependency "rake"
27
+ spec.add_development_dependency "jekyll"
27
28
  spec.add_development_dependency "pry-debugger"
28
29
  end
data/lib/clash.rb CHANGED
@@ -5,9 +5,9 @@ require 'safe_yaml'
5
5
  require 'diffy'
6
6
 
7
7
  module Clash
8
-
9
8
  autoload :Tests, 'clash/tests'
10
9
  autoload :Test, 'clash/test'
11
10
  autoload :Diff, 'clash/diff'
12
11
  autoload :Helpers, 'clash/helpers'
13
12
  end
13
+
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["Compared #{colorize(a, 'yellow')} to #{colorize(b,'yellow')}"] = file_diff
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, dir1_files, matches)
53
- unique_files(dir2, dir2_files, matches)
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 << colorize("Files missing from #{dir}/", 'red')
70
- unique.each {|f| @test_failures << "- #{f}"}
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 << "#{colorize('File not found:', 'red')} #{f}"
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
- colorize(line, 'green')
99
+ " #{greenit(line)}"
93
100
  when /^-/ then
94
101
  count = 0
95
- colorize(line, 'red')
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 colorize('F', 'red')
43
+ pout redit('F')
28
44
  end
29
45
 
30
46
  def print_pass
31
- pout colorize('.', 'green')
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
- diff = Diff.new(f[0].strip, f[1].strip, context: @options['context']).diff
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 |files|
102
+ default_array(@options['enforce_missing']).each do |file|
98
103
  if File.exists?(file)
99
- @test_failures << "File #{file} shouldn't exist."
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 = colorize("Test ##{@options['index']}", 'bold')
121
- title << " - #{@options['title']}" unless @options['title'].nil?
126
+ title = boldit("#{@options['index']})")
127
+ title << " #{@options['title']}" unless @options['title'].nil?
122
128
  <<-HERE
123
- Failed #{title}
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[:context] ||= 2
10
- @options[:only] = default_array(@options[:only])
14
+ @options[:only] ||= []
15
+ @options[:exit] ||= true
11
16
 
12
- @tests = default_array(SafeYAML.load_file(@options[:file]))
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 !@options[:only].empty? && !@options[:only].include?(index + 1)
24
+ next if options.nil?
25
+ run_test(options, index)
26
+ end
24
27
 
25
- options['index'] = index + 1
26
- options['context'] = @options[:context]
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
- results = Test.new(options).run
36
+ results = Test.new(options).run
29
37
 
30
- if results.nil?
31
- @passed << index + 1
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
- @failed << index + 1
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
- puts "#{colorize("Passed #{@passed.size}", "green")}: Tests: #{@passed.join(',')}"
54
- puts "#{colorize("Failed #{@failed.size}", "red")}: Tests: #{@failed.join(',')}"
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
@@ -1,3 +1,3 @@
1
1
  module Clash
2
- VERSION = "0.0.2"
2
+ VERSION = "1.0.0"
3
3
  end
data/test/.clash.yml CHANGED
@@ -1,14 +1,52 @@
1
1
  -
2
- title: Checking a and b
3
- compare: 'a.txt, b.txt'
2
+ title: Standard build
3
+ build: true
4
+ compare: _site/index.html, _expected/default.html
4
5
  -
5
- title: Checking a and c
6
- compare: 'a.txt, c.txt'
6
+ title: Build Jekyll with alternate configuration
7
+ build: true
7
8
  config:
8
- feed: _test.yml
9
+ jekyll:
10
+ - _config.yml
11
+ - _test1.yml
12
+ compare: _site/index.html, _expected/alternate.html
9
13
  -
10
- title: Checking dirs a and b
11
- compare: 'a, b'
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: Checking dirs a and c
14
- compare: 'a, c'
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
@@ -2,3 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  gem "clash", path: "../"
4
4
  gem "pry-debugger"
5
+ gem "jekyll"
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.
File without changes
data/test/_config.yml ADDED
@@ -0,0 +1,4 @@
1
+ name: Clash test
2
+ exclude:
3
+ - Gemfile*
4
+ - test.rb
@@ -0,0 +1 @@
1
+ Site name is: Clashing
@@ -0,0 +1 @@
1
+ Site name is: Clash test
@@ -0,0 +1,11 @@
1
+ Configuration file: _config.yml
2
+ Source: test
3
+ Destination: _site
4
+ Generating...
5
+ done.
6
+ .
7
+
8
+ Test summary:
9
+ Tests run: 1
10
+ Passed 1 - Tests: 1
11
+ Failed 0
@@ -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,12 @@
1
+ Configuration file: _config.yml
2
+ Configuration file: _test1.yml
3
+ Source: test
4
+ Destination: _site
5
+ Generating...
6
+ done.
7
+ .
8
+
9
+ Test summary:
10
+ Tests run: 1
11
+ Passed 1 - Tests: 2
12
+ Failed 0
@@ -0,0 +1,9 @@
1
+ name: Octopress clashing
2
+ name: Clashing
3
+ name: Octopress clashing
4
+ .
5
+
6
+ Test summary:
7
+ Tests run: 1
8
+ Passed 1 - Tests: 3
9
+ Failed 0
@@ -0,0 +1,9 @@
1
+ name: Feed Clashing
2
+ name: Clashing
3
+ name: Feed Clashing
4
+ .
5
+
6
+ Test summary:
7
+ Tests run: 1
8
+ Passed 1 - Tests: 4
9
+ Failed 0
@@ -0,0 +1,6 @@
1
+ .
2
+
3
+ Test summary:
4
+ Tests run: 1
5
+ Passed 1 - Tests: 5
6
+ Failed 0
@@ -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,6 @@
1
+ .
2
+
3
+ Test summary:
4
+ Tests run: 1
5
+ Passed 1 - Tests: 7
6
+ Failed 0
@@ -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
@@ -0,0 +1,6 @@
1
+ .
2
+
3
+ Test summary:
4
+ Tests run: 1
5
+ Passed 1 - Tests: 9
6
+ Failed 0
@@ -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
- This is a file.
2
- There is some content.
3
- It's not particularly imaginative.
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
- asdf
9
- asdf
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
- This file is fantastic.
2
- It has words and everything.
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
@@ -0,0 +1,3 @@
1
+ ---
2
+ ---
3
+ Site name is: {{ site.name }}
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.2
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/_test.yml
122
- - test/a.txt
153
+ - test/_test1.yml
123
154
  - test/a/1.txt
124
155
  - test/a/2.txt
125
- - test/b.txt
126
- - test/b/1.txt
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/_test.yml
160
- - test/a.txt
203
+ - test/_test1.yml
161
204
  - test/a/1.txt
162
205
  - test/a/2.txt
163
- - test/b.txt
164
- - test/b/1.txt
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
@@ -1,5 +0,0 @@
1
- this is awesome
2
- you guys
3
- it's pretty great
4
- you should have
5
- lots of fun
data/test/b.txt DELETED
@@ -1,5 +0,0 @@
1
- this is awesome
2
- you guys
3
- it's pretty great
4
- you should have
5
- lots of fun
data/test/b/1.txt DELETED
@@ -1,17 +0,0 @@
1
- This is a file.
2
- There is some content.
3
- It's not particularly imaginative.
4
-
5
-
6
-
7
-
8
- asdf
9
- asdf
10
- asdf
11
- asdf
12
- awesome
13
-
14
- asdfa
15
- dsfa
16
- sdfasdf
17
- adsf
data/test/c.txt DELETED
@@ -1,4 +0,0 @@
1
- this is awesome
2
- it's pretty great
3
- you should have
4
- lots of fun
data/test/c/1.txt DELETED
@@ -1,17 +0,0 @@
1
- This is a file.
2
- There is content.
3
- It's not particularly imaginative.
4
-
5
-
6
-
7
-
8
- asdf
9
- asdf
10
- asdf
11
- asdf
12
- awesome
13
- sweet
14
- asdfa
15
- dsfa
16
- sdfasdf
17
- adsf
data/test/c/2.txt DELETED
@@ -1,3 +0,0 @@
1
- This file is fantastic.
2
- It has words and things.
3
- Ladies…