sitespec 1.1.0 → 1.2.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: aebce21985d8078df2ad1316e59c50af7875aa0c
4
- data.tar.gz: 6d1876b3790b7a3c23b8494f91a63bd139a92d79
3
+ metadata.gz: 95af9cafe48631ad6f7d042b5be5b80d5cef58e4
4
+ data.tar.gz: f4f2a7962845d247b00cf61126cd81c3e372c55c
5
5
  SHA512:
6
- metadata.gz: 7a89ac98879b869473638475f2b8679e26cf7e2cfb32af84884c5b2edb2ca01f6d79058f06e76267c360a23fec33ba7bfc8c9068ec245516c69cdb5beb9117e5
7
- data.tar.gz: 080a4c535fb11be1325fc8b50df792e72af17ac5eb76c5e1db97a2bb84fd16422db8cbd9f498fc8bb31c4a0841e02450ae02d9810e0b46494fdf09cd8655c018
6
+ metadata.gz: 86a8ccfad5216e8d089ac9a1e4932f2077718e4700e993d6044fe0ef2ae9cd018cfcbbf06427899ad535f1aad283dd09c630657b7d703d5fcb6ca93336913d48
7
+ data.tar.gz: e38379191d7540169a23da8bd35fac7f7ea12dafab2023cc1a4351d6631e24cb22e1e23541b026d6b6031e0a1d3306ad531295c48ff8d05f8d011776d7336dac
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.2.0
2
+ - Allow users to generate index.html by putting trailing slash
3
+
1
4
  ## 1.1.0
2
5
  - Add auto_complete_html_path configuration (default: true)
3
6
 
data/README.md CHANGED
@@ -30,11 +30,8 @@ describe "Sitespec" do
30
30
  end
31
31
 
32
32
  %w[
33
- /2000/01/01/hello.html
34
- /2000/01/02/world.html
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 /2000-01-01-hello.html
53
+ GET /
57
54
  returns 200
58
- GET /index.html
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` - Flag to autocomplete .html (default: `true`)
69
- - `Sitespec.configuration.build_path` - Where to locate files (default: `"build"`)
70
- - `Sitespec.configuration.enabled` - Flag to enable sitespec (default: `true`)
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.
@@ -29,7 +29,7 @@ module Sitespec
29
29
  def save
30
30
  if valid?
31
31
  write
32
- count_up
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"
@@ -1,3 +1,3 @@
1
1
  module Sitespec
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
data/lib/sitespec.rb CHANGED
@@ -4,13 +4,15 @@ require "sitespec/version"
4
4
 
5
5
  module Sitespec
6
6
  class << self
7
- attr_writer :artifacts_count
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.1.0
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-05-15 00:00:00.000000000 Z
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: