sitespec 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +9 -10
- data/lib/sitespec/artifact.rb +6 -6
- data/lib/sitespec/version.rb +1 -1
- data/lib/sitespec.rb +12 -2
- 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: 95af9cafe48631ad6f7d042b5be5b80d5cef58e4
|
4
|
+
data.tar.gz: f4f2a7962845d247b00cf61126cd81c3e372c55c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86a8ccfad5216e8d089ac9a1e4932f2077718e4700e993d6044fe0ef2ae9cd018cfcbbf06427899ad535f1aad283dd09c630657b7d703d5fcb6ca93336913d48
|
7
|
+
data.tar.gz: e38379191d7540169a23da8bd35fac7f7ea12dafab2023cc1a4351d6631e24cb22e1e23541b026d6b6031e0a1d3306ad531295c48ff8d05f8d011776d7336dac
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -30,11 +30,8 @@ describe "Sitespec" do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
%w[
|
33
|
-
/
|
34
|
-
/2000/01/
|
35
|
-
/feed.xml
|
36
|
-
/images/favicon.ico
|
37
|
-
/index.html
|
33
|
+
/
|
34
|
+
/2000/01/01/hello
|
38
35
|
/stylesheets/all.css
|
39
36
|
].each do |path|
|
40
37
|
describe "GET #{path}", :sitespec do
|
@@ -53,21 +50,23 @@ Note: only successful examples generate static files.
|
|
53
50
|
$ bundle exec rspec
|
54
51
|
|
55
52
|
Example application
|
56
|
-
GET /
|
53
|
+
GET /
|
57
54
|
returns 200
|
58
|
-
GET /
|
55
|
+
GET /2000/01/01/hello
|
59
56
|
returns 200
|
60
57
|
GET /stylesheets/all.css
|
61
58
|
returns 200
|
62
59
|
|
60
|
+
Sitespec generated 3 files into build directory.
|
61
|
+
|
63
62
|
Finished in 0.08302 seconds (files took 0.79161 seconds to load)
|
64
63
|
3 examples, 0 failures
|
65
64
|
```
|
66
65
|
|
67
66
|
## Configuration
|
68
|
-
- `Sitespec.configuration.auto_complete_html_path` -
|
69
|
-
- `Sitespec.configuration.build_path` - Where to locate files (default:
|
70
|
-
- `Sitespec.configuration.enabled` -
|
67
|
+
- `Sitespec.configuration.auto_complete_html_path` - Autocomplete .html (default: true)
|
68
|
+
- `Sitespec.configuration.build_path` - Where to locate files (default: build)
|
69
|
+
- `Sitespec.configuration.enabled` - Enable sitespec (default: true)
|
71
70
|
|
72
71
|
## Advanced topics
|
73
72
|
Sitespec is excellent with GitHub Pages.
|
data/lib/sitespec/artifact.rb
CHANGED
@@ -29,7 +29,7 @@ module Sitespec
|
|
29
29
|
def save
|
30
30
|
if valid?
|
31
31
|
write
|
32
|
-
|
32
|
+
increment
|
33
33
|
true
|
34
34
|
else
|
35
35
|
false
|
@@ -38,10 +38,6 @@ module Sitespec
|
|
38
38
|
|
39
39
|
private
|
40
40
|
|
41
|
-
def count_up
|
42
|
-
Sitespec.artifacts_count += 1
|
43
|
-
end
|
44
|
-
|
45
41
|
# Utility method to access to `@example`
|
46
42
|
def example
|
47
43
|
@example
|
@@ -56,6 +52,10 @@ module Sitespec
|
|
56
52
|
pathname.write(response.body)
|
57
53
|
end
|
58
54
|
|
55
|
+
def increment
|
56
|
+
Sitespec.increment_artifacts_count
|
57
|
+
end
|
58
|
+
|
59
59
|
def make_parent_directory
|
60
60
|
pathname.parent.mkpath
|
61
61
|
end
|
@@ -72,7 +72,7 @@ module Sitespec
|
|
72
72
|
""
|
73
73
|
when response.content_type.nil? || !response.content_type.include?("text/html") || request.path.end_with?(".html")
|
74
74
|
""
|
75
|
-
when request.path
|
75
|
+
when request.path.end_with?("/")
|
76
76
|
"index.html"
|
77
77
|
else
|
78
78
|
".html"
|
data/lib/sitespec/version.rb
CHANGED
data/lib/sitespec.rb
CHANGED
@@ -4,13 +4,15 @@ require "sitespec/version"
|
|
4
4
|
|
5
5
|
module Sitespec
|
6
6
|
class << self
|
7
|
-
|
8
|
-
|
7
|
+
# Return how many artifacts (files) generated on this process.
|
8
|
+
# This count is to be shown after all examples are finished.
|
9
|
+
# @return [Integer]
|
9
10
|
def artifacts_count
|
10
11
|
@artifacts_count || 0
|
11
12
|
end
|
12
13
|
|
13
14
|
# Provide singleton configuration object shared with the current process.
|
15
|
+
# All of user-configuration should be stored in this singleton object.
|
14
16
|
# @example
|
15
17
|
# Sitespec.configuration.build_path = "artifacts"
|
16
18
|
def configuration
|
@@ -18,6 +20,8 @@ module Sitespec
|
|
18
20
|
end
|
19
21
|
|
20
22
|
# Provide friendly interface to access to Sitespec.configuration.
|
23
|
+
# The configuration object passed to given block is same with
|
24
|
+
# `Sitespec.configuration`.
|
21
25
|
# @example
|
22
26
|
# Sitespec.configure do |configuration|
|
23
27
|
# configuration.build_path = "artifacts"
|
@@ -25,5 +29,11 @@ module Sitespec
|
|
25
29
|
def configure(&block)
|
26
30
|
block.call(configuration)
|
27
31
|
end
|
32
|
+
|
33
|
+
# Use this method when a new artifact is generated.
|
34
|
+
# In almost cases, it's called from Sitespec::Artifact class.
|
35
|
+
def increment_artifacts_count
|
36
|
+
@artifacts_count = artifacts_count + 1
|
37
|
+
end
|
28
38
|
end
|
29
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sitespec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack-test
|
@@ -198,3 +198,4 @@ test_files:
|
|
198
198
|
- spec/support/application/views/index.slim
|
199
199
|
- spec/support/application/views/layouts/application.slim
|
200
200
|
- spec/support/application/views/show.slim
|
201
|
+
has_rdoc:
|