sitespec 1.0.0 → 1.1.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 +6 -5
- data/lib/sitespec/artifact.rb +21 -2
- data/lib/sitespec/configuration.rb +6 -1
- data/lib/sitespec/version.rb +1 -1
- data/sitespec.gemspec +1 -1
- data/spec/sitespec_spec.rb +2 -2
- data/spec/support/application/example_application.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aebce21985d8078df2ad1316e59c50af7875aa0c
|
4
|
+
data.tar.gz: 6d1876b3790b7a3c23b8494f91a63bd139a92d79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a89ac98879b869473638475f2b8679e26cf7e2cfb32af84884c5b2edb2ca01f6d79058f06e76267c360a23fec33ba7bfc8c9068ec245516c69cdb5beb9117e5
|
7
|
+
data.tar.gz: 080a4c535fb11be1325fc8b50df792e72af17ac5eb76c5e1db97a2bb84fd16422db8cbd9f498fc8bb31c4a0841e02450ae02d9810e0b46494fdf09cd8655c018
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
# Sitespec
|
2
|
-
Generate static site from your rack application &
|
2
|
+
Generate static site from your rack application & test files.
|
3
3
|
|
4
4
|
* Provides the same way to create both dynamic & static website
|
5
5
|
* Generates static website from your existing dynamic website
|
6
6
|
* Sitespec can be executable specification, good documentation, and well-tested implementation
|
7
7
|
|
8
8
|
## Usage
|
9
|
-
### Add sitespec into your Gemfile
|
9
|
+
### 1. Add sitespec into your Gemfile
|
10
10
|
```rb
|
11
11
|
# Gemfile
|
12
12
|
gem "sitespec"
|
13
13
|
```
|
14
14
|
|
15
|
-
### Require sitespec/rspec in your specs
|
15
|
+
### 2. Require sitespec/rspec in your specs
|
16
16
|
```rb
|
17
17
|
# spec/spec_helper.rb
|
18
18
|
require "sitespec/rspec"
|
19
19
|
```
|
20
20
|
|
21
|
-
### Write request-specs with `:sitespec` metadata
|
21
|
+
### 3. Write request-specs with `:sitespec` metadata
|
22
22
|
Note: [rack/test](https://github.com/brynary/rack-test) is automatically enabled
|
23
23
|
in the example groups that have `:sitespec`.
|
24
24
|
|
@@ -46,7 +46,7 @@ describe "Sitespec" do
|
|
46
46
|
end
|
47
47
|
```
|
48
48
|
|
49
|
-
### Run rspec to build static files
|
49
|
+
### 4. Run rspec to build static files
|
50
50
|
Note: only successful examples generate static files.
|
51
51
|
|
52
52
|
```
|
@@ -65,6 +65,7 @@ Finished in 0.08302 seconds (files took 0.79161 seconds to load)
|
|
65
65
|
```
|
66
66
|
|
67
67
|
## Configuration
|
68
|
+
- `Sitespec.configuration.auto_complete_html_path` - Flag to autocomplete .html (default: `true`)
|
68
69
|
- `Sitespec.configuration.build_path` - Where to locate files (default: `"build"`)
|
69
70
|
- `Sitespec.configuration.enabled` - Flag to enable sitespec (default: `true`)
|
70
71
|
|
data/lib/sitespec/artifact.rb
CHANGED
@@ -60,9 +60,28 @@ module Sitespec
|
|
60
60
|
pathname.parent.mkpath
|
61
61
|
end
|
62
62
|
|
63
|
-
# @return [
|
63
|
+
# @return [String] Where to an artifact file is located
|
64
|
+
def path
|
65
|
+
File.join(Sitespec.configuration.build_pathname, request.path) + path_suffix
|
66
|
+
end
|
67
|
+
|
68
|
+
# @return [String]
|
69
|
+
def path_suffix
|
70
|
+
case
|
71
|
+
when !Sitespec.configuration.auto_complete_html_path
|
72
|
+
""
|
73
|
+
when response.content_type.nil? || !response.content_type.include?("text/html") || request.path.end_with?(".html")
|
74
|
+
""
|
75
|
+
when request.path == "/"
|
76
|
+
"index.html"
|
77
|
+
else
|
78
|
+
".html"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# @return [Pathname]
|
64
83
|
def pathname
|
65
|
-
Pathname.new(
|
84
|
+
Pathname.new(path)
|
66
85
|
end
|
67
86
|
|
68
87
|
# @note We expect `request` is provided via rack-test
|
@@ -4,10 +4,15 @@ module Sitespec
|
|
4
4
|
class Configuration
|
5
5
|
DEFAULT_BUILD_PATH = "build"
|
6
6
|
|
7
|
-
attr_writer :build_path
|
7
|
+
attr_writer :auto_complete_html_path, :build_path
|
8
8
|
|
9
9
|
def initialize
|
10
10
|
@enabled = true
|
11
|
+
@auto_complete_html_path = true
|
12
|
+
end
|
13
|
+
|
14
|
+
def auto_complete_html_path
|
15
|
+
!!@auto_complete_html_path
|
11
16
|
end
|
12
17
|
|
13
18
|
def build_path
|
data/lib/sitespec/version.rb
CHANGED
data/sitespec.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.version = Sitespec::VERSION
|
8
8
|
spec.authors = ["Ryo Nakamura"]
|
9
9
|
spec.email = ["r7kamura@gmail.com"]
|
10
|
-
spec.summary = "Generate static site from your rack application &
|
10
|
+
spec.summary = "Generate static site from your rack application & test files"
|
11
11
|
spec.homepage = "https://github.com/r7kamura/sitespec"
|
12
12
|
spec.license = "MIT"
|
13
13
|
spec.files = `git ls-files`.split($/)
|
data/spec/sitespec_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sitespec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
@@ -187,7 +187,7 @@ rubyforge_project:
|
|
187
187
|
rubygems_version: 2.4.5
|
188
188
|
signing_key:
|
189
189
|
specification_version: 4
|
190
|
-
summary: Generate static site from your rack application &
|
190
|
+
summary: Generate static site from your rack application & test files
|
191
191
|
test_files:
|
192
192
|
- spec/sitespec_spec.rb
|
193
193
|
- spec/spec_helper.rb
|