clash 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +28 -15
- data/lib/clash/test.rb +2 -2
- data/lib/clash/version.rb +1 -1
- data/test/.clash.yml +8 -8
- data/test/.test.yml +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23f6c62c10e72f88582594bf9a1251839898862a
|
4
|
+
data.tar.gz: d6819aa56879e5288583f7034b8bf6a21a24cc2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a3763cc4049da6ceccd8b26b35dda08d712367fd6220ee1f7dd2df4ddf736f4f3cca0cbb1ffde0db48832f741899e9c3f08bdcbb5f78b722f95ae7f8bd39b1d
|
7
|
+
data.tar.gz: 0a669aecd5bfc7f0519dff40f35eb129276ca7d4a3a1063ad8f93f40c0f93ca6432b3d03f9c190a8a4bacdea194c4e1788570d8738bb2562a9807474578deb6d
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -23,12 +23,13 @@ Or install it yourself as:
|
|
23
23
|
## Usage
|
24
24
|
|
25
25
|
```
|
26
|
-
clash [test
|
26
|
+
clash [test] [options]
|
27
27
|
```
|
28
28
|
|
29
29
|
To run only specific tests, pass test numbers separated by commas.
|
30
30
|
|
31
31
|
```
|
32
|
+
$ clash # run all tests
|
32
33
|
$ clash 1 # run only the first test
|
33
34
|
$ clash 2,3 # run the second and third tests
|
34
35
|
```
|
@@ -41,20 +42,32 @@ $ clash 2,3 # run the second and third tests
|
|
41
42
|
-h, --help show this message
|
42
43
|
```
|
43
44
|
|
44
|
-
## Configuration
|
45
|
-
|
46
45
|
Clash reads its configuration from a .clash.yml file in the root of your project. Use the --file
|
47
46
|
option to choose a different configuration file.
|
48
47
|
|
49
|
-
|
50
|
-
|
48
|
+
### Example usage:
|
49
|
+
|
50
|
+
If you have a simple liquid tag you want to test:
|
51
|
+
|
52
|
+
1. Create a simple Jekyll site with tags.
|
53
|
+
2. Create one or more pages which test the tags features.
|
54
|
+
3. Manually check that the compiled site looks right.
|
55
|
+
4. Copy `_site` to `_expected`.
|
56
|
+
5. Create a test file like the one below.
|
57
|
+
6. **Code with confidence!**
|
58
|
+
|
59
|
+
### Simple configuration:
|
60
|
+
|
61
|
+
Clash will build your site with Jekyll, and compare the contents of _site/ to _expected/.
|
51
62
|
|
52
63
|
```
|
53
64
|
build: true
|
54
|
-
compare: _site
|
65
|
+
compare: _site _expected
|
55
66
|
```
|
56
67
|
|
57
|
-
|
68
|
+
Of course, there is a lot more you can do.
|
69
|
+
|
70
|
+
## Configuration
|
58
71
|
|
59
72
|
| Option | Type | Description |
|
60
73
|
|:-----------------|:---------------|:---------------------------------------------------------|
|
@@ -62,7 +75,7 @@ compare: _site, expected
|
|
62
75
|
| before | String/Array | Run system command(s) before running tests. |
|
63
76
|
| build | Boolean | Build the site with Jekyll. |
|
64
77
|
| config | Hash | Configure Jekyll, Octopress or Ink plugins. (Info below) |
|
65
|
-
| compare | String/Array | Compare files or directories. e.g. "a.md
|
78
|
+
| compare | String/Array | Compare files or directories. e.g. "a.md b.md" |
|
66
79
|
| enforce_missing | String/Array | Ensure that these files are not found. |
|
67
80
|
| after | String/Array | Run system command(s) after running tests. |
|
68
81
|
|
@@ -70,11 +83,11 @@ Note: in the table above, String/Array means a single argument can be a string,
|
|
70
83
|
can be passed as an array. For example:
|
71
84
|
|
72
85
|
```yaml
|
73
|
-
compare: _site
|
74
|
-
compare:
|
75
|
-
- _site/index.html
|
76
|
-
- _site/atom.xml
|
77
|
-
- _site/posts
|
86
|
+
compare: _site _expected # Compare two directories
|
87
|
+
compare: # Compare mutiple items
|
88
|
+
- _site/index.html _expected/index.html
|
89
|
+
- _site/atom.xml _expected/atom.xml
|
90
|
+
- _site/posts _expected/posts
|
78
91
|
```
|
79
92
|
|
80
93
|
To run multiple tests each test should be an array, for example:
|
@@ -83,10 +96,10 @@ To run multiple tests each test should be an array, for example:
|
|
83
96
|
-
|
84
97
|
name: Check site build
|
85
98
|
build: true
|
86
|
-
compare: _site
|
99
|
+
compare: _site _expected
|
87
100
|
-
|
88
101
|
name: Check asset compression
|
89
|
-
compare: _cdn_build
|
102
|
+
compare: _cdn_build _cdn_expected
|
90
103
|
```
|
91
104
|
|
92
105
|
Note: When running multiple tests, adding a name can help the reading of test failures.
|
data/lib/clash/test.rb
CHANGED
@@ -85,9 +85,9 @@ module Clash
|
|
85
85
|
|
86
86
|
def compare
|
87
87
|
default_array(@options['compare']).each do |files|
|
88
|
-
f = files.
|
88
|
+
f = files.gsub(',',' ').split
|
89
89
|
|
90
|
-
differ = Diff.new(f
|
90
|
+
differ = Diff.new(f.first, f.last, context: @options['context'])
|
91
91
|
diff = differ.diff
|
92
92
|
|
93
93
|
@test_failures.concat differ.test_failures
|
data/lib/clash/version.rb
CHANGED
data/test/.clash.yml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
-
|
2
2
|
title: Standard build
|
3
3
|
build: true
|
4
|
-
compare: _site/index.html
|
4
|
+
compare: _site/index.html _expected/default.html
|
5
5
|
-
|
6
6
|
title: Build Jekyll with alternate configuration
|
7
7
|
build: true
|
@@ -9,7 +9,7 @@
|
|
9
9
|
jekyll:
|
10
10
|
- _config.yml
|
11
11
|
- _test1.yml
|
12
|
-
compare: _site/index.html
|
12
|
+
compare: _site/index.html _expected/alternate.html
|
13
13
|
-
|
14
14
|
title: Test Octopress configuration
|
15
15
|
config:
|
@@ -29,19 +29,19 @@
|
|
29
29
|
-
|
30
30
|
title: Compare matching files
|
31
31
|
compare:
|
32
|
-
- a/1.txt
|
33
|
-
- a/2.txt
|
32
|
+
- a/1.txt _site/a/1.txt
|
33
|
+
- a/2.txt _site/a/2.txt
|
34
34
|
-
|
35
35
|
title: (Should fail) Compare files with differences
|
36
36
|
compare:
|
37
|
-
- a/1.txt
|
38
|
-
- _site/a/1.txt
|
37
|
+
- a/1.txt _c/1.txt
|
38
|
+
- _site/a/1.txt _c/1.txt
|
39
39
|
-
|
40
40
|
title: Compare two matching dirs
|
41
|
-
compare: a
|
41
|
+
compare: a _site/a
|
42
42
|
-
|
43
43
|
title: (Should fail) Compare two dirs with differences
|
44
|
-
compare: a
|
44
|
+
compare: a _c
|
45
45
|
-
|
46
46
|
title: File shouldn't exist.
|
47
47
|
enforce_missing:
|
data/test/.test.yml
CHANGED
@@ -1 +1 @@
|
|
1
|
-
compare: _output
|
1
|
+
compare: _output _expected_output
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clash
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diffy
|
@@ -118,6 +118,7 @@ extra_rdoc_files: []
|
|
118
118
|
files:
|
119
119
|
- ".gitignore"
|
120
120
|
- ".travis.yml"
|
121
|
+
- CHANGELOG.md
|
121
122
|
- Gemfile
|
122
123
|
- LICENSE.txt
|
123
124
|
- README.md
|