utopia 1.8.2 → 1.8.3
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 +4 -4
- data/README.md +15 -1
- data/lib/utopia/setup.rb +9 -4
- data/lib/utopia/version.rb +1 -1
- data/setup/site/.rspec +4 -0
- data/setup/site/.simplecov +9 -0
- data/setup/site/Gemfile +4 -0
- data/setup/site/spec/website_context.rb +11 -0
- data/setup/site/spec/website_spec.rb +15 -0
- data/setup/site/tasks/test.rake +10 -0
- data/spec/utopia/setup_spec.rb +6 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5095d35222a513f2daa3c4b93e1a03490fa89654
|
4
|
+
data.tar.gz: 6d71788ce9d2d1cd24e65ccb1314946e3d2c692f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ba7fadd9730016d29fdefb2ff26ca2911867daa811290bd40a76f7cd640af4ea534e3ab8f040f97fc75b1f445bb81cf133295a77d9bf4a5c519014c077299a4
|
7
|
+
data.tar.gz: cc97dcf681d73a609e2adfd1d6422403340a2708e0763f1229ec34d4bc7ddd67e1491932da42c9df801f719ada966432068092a5437a8c0a51eca122847dcd4b
|
data/README.md
CHANGED
@@ -253,11 +253,25 @@ This template would typically be designed with supporting `_page.xnode` and `_he
|
|
253
253
|
The session management uses symmetric private key encryption to store data on the client and avoid tampering.
|
254
254
|
|
255
255
|
use Utopia::Session,
|
256
|
-
:
|
256
|
+
:expires_after => 3600,
|
257
257
|
:secret => '40 or more random characters for your secret key'
|
258
258
|
|
259
259
|
All session data is stored on the client, but it's encrypted with a salt and the secret key. It would be hard for the client to decrypt the data without the secret.
|
260
260
|
|
261
|
+
### Testing
|
262
|
+
|
263
|
+
Utopia websites include a default set of tests, and associated `rake test` tasks. These specs can test against the actual running website. By default, `simplecov` is included for coverage testing.
|
264
|
+
|
265
|
+
$ rake coverage test
|
266
|
+
|
267
|
+
my website
|
268
|
+
should have an accessible front page
|
269
|
+
|
270
|
+
Finished in 0.44849 seconds (files took 0.15547 seconds to load)
|
271
|
+
1 example, 0 failures
|
272
|
+
|
273
|
+
Coverage report generated for RSpec. 5 / 5 LOC (100.0%) covered.
|
274
|
+
|
261
275
|
## Contributing
|
262
276
|
|
263
277
|
1. Fork it
|
data/lib/utopia/setup.rb
CHANGED
@@ -20,8 +20,10 @@
|
|
20
20
|
|
21
21
|
module Utopia
|
22
22
|
class Bootstrap
|
23
|
-
def initialize(config_root)
|
23
|
+
def initialize(config_root, external_encoding: Encoding::UTF_8)
|
24
24
|
@config_root = config_root
|
25
|
+
|
26
|
+
@external_encoding = external_encoding
|
25
27
|
end
|
26
28
|
|
27
29
|
def setup
|
@@ -38,10 +40,13 @@ module Utopia
|
|
38
40
|
File.expand_path('environment.yaml', @config_root)
|
39
41
|
end
|
40
42
|
|
43
|
+
# If you don't specify these, it's possible to have issues when encodings mismatch on the server.
|
41
44
|
def setup_encoding
|
42
|
-
#
|
43
|
-
Encoding.default_external
|
44
|
-
|
45
|
+
# TODO: Deprecate and remove this setup - it should be the responsibility of the server to set this correctly.
|
46
|
+
if @external_encoding and Encoding.default_external != @external_encoding
|
47
|
+
warn "Updating Encoding.default_external from #{Encoding.default_external} to #{@external_encoding}"
|
48
|
+
Encoding.default_external = @external_encoding
|
49
|
+
end
|
45
50
|
end
|
46
51
|
|
47
52
|
def setup_environment
|
data/lib/utopia/version.rb
CHANGED
data/setup/site/.rspec
ADDED
data/setup/site/Gemfile
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
|
2
|
+
require 'rack/test'
|
3
|
+
|
4
|
+
RSpec.shared_context "website" do
|
5
|
+
include Rack::Test::Methods
|
6
|
+
|
7
|
+
let(:rackup_path) {File.expand_path('../config.ru', __dir__)}
|
8
|
+
let(:rackup_directory) {File.dirname(rackup_path)}
|
9
|
+
|
10
|
+
let(:app) {Rack::Builder.parse_file(rackup_path).first}
|
11
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
require_relative 'website_context'
|
3
|
+
|
4
|
+
# Learn about best practice specs from http://betterspecs.org
|
5
|
+
RSpec.describe "my website" do
|
6
|
+
include_context "website"
|
7
|
+
|
8
|
+
it "should have an accessible front page" do
|
9
|
+
get "/"
|
10
|
+
|
11
|
+
follow_redirect!
|
12
|
+
|
13
|
+
expect(last_response.status).to be == 200
|
14
|
+
end
|
15
|
+
end
|
data/spec/utopia/setup_spec.rb
CHANGED
@@ -56,7 +56,12 @@ RSpec.describe "utopia executable" do
|
|
56
56
|
result = sh(utopia, "--in", dir, "site", "create")
|
57
57
|
expect(result).to be == 0
|
58
58
|
|
59
|
-
expect(Dir.entries(dir)).to include(".bowerrc", ".git", "Gemfile", "Gemfile.lock", "README.md", "Rakefile", "config.ru", "lib", "pages", "public", "tmp")
|
59
|
+
expect(Dir.entries(dir)).to include(".bowerrc", ".git", "Gemfile", "Gemfile.lock", "README.md", "Rakefile", "config.ru", "lib", "pages", "public", "tmp", "spec")
|
60
|
+
|
61
|
+
Dir.chdir(dir) do
|
62
|
+
result = sh("rake", "test")
|
63
|
+
expect(result).to be == 0
|
64
|
+
end
|
60
65
|
end
|
61
66
|
end
|
62
67
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utopia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: trenni
|
@@ -236,6 +236,8 @@ files:
|
|
236
236
|
- setup/server/config/environment.yaml
|
237
237
|
- setup/server/git/hooks/post-receive
|
238
238
|
- setup/site/.bowerrc
|
239
|
+
- setup/site/.rspec
|
240
|
+
- setup/site/.simplecov
|
239
241
|
- setup/site/Gemfile
|
240
242
|
- setup/site/README.md
|
241
243
|
- setup/site/Rakefile
|
@@ -254,6 +256,9 @@ files:
|
|
254
256
|
- setup/site/public/_static/utopia-background.svg
|
255
257
|
- setup/site/public/_static/utopia.svg
|
256
258
|
- setup/site/public/readme.txt
|
259
|
+
- setup/site/spec/website_context.rb
|
260
|
+
- setup/site/spec/website_spec.rb
|
261
|
+
- setup/site/tasks/test.rake
|
257
262
|
- setup/site/tasks/utopia.rake
|
258
263
|
- setup/site/tmp/readme.txt
|
259
264
|
- spec/utopia/content/link_spec.rb
|