utopia 1.8.2 → 1.8.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ca9a6f28fcec98323ae67b683f903e44fb68eea
4
- data.tar.gz: 1b86bb5bb7a36448df329b2aeda819feb2c66fa2
3
+ metadata.gz: 5095d35222a513f2daa3c4b93e1a03490fa89654
4
+ data.tar.gz: 6d71788ce9d2d1cd24e65ccb1314946e3d2c692f
5
5
  SHA512:
6
- metadata.gz: 7279e0472f9c4e1760368ee5c138f1338e2426dd2c194e5014a318b5faf2e0227c04bd09f556c32bc3abeca899270bbbd92208c7aaf454cac2100d4116a2b4c8
7
- data.tar.gz: 5be21037ad98e014ece09d98ceef3812256aaa9239eb7ea770f68df6aa636f245fe9a5168ef545944e0206954a11ed0d7388c0083f3ff7237e35f62a4cbb80d9
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
- :expire_after => 3600,
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
- # If you don't specify these, it's possible to have issues when encodings mismatch on the server.
43
- Encoding.default_external = Encoding::UTF_8
44
- Encoding.default_internal = Encoding::UTF_8
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
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Utopia
22
- VERSION = "1.8.2"
22
+ VERSION = "1.8.3"
23
23
  end
data/setup/site/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --format documentation
3
+ --backtrace
4
+ --warnings
@@ -0,0 +1,9 @@
1
+
2
+ SimpleCov.start do
3
+ add_filter "/spec/"
4
+ end
5
+
6
+ # if ENV['TRAVIS']
7
+ # require 'coveralls'
8
+ # Coveralls.wear!
9
+ # end
data/setup/site/Gemfile CHANGED
@@ -15,6 +15,10 @@ group :development do
15
15
  # For `rake console`:
16
16
  gem "pry"
17
17
  gem "rack-test"
18
+
19
+ # For `rspec` testing:
20
+ gem "rspec"
21
+ gem "simplecov"
18
22
  end
19
23
 
20
24
  group :production do
@@ -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
@@ -0,0 +1,10 @@
1
+
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:test) do |task|
5
+ task.rspec_opts = %w{--require simplecov} if ENV['COVERAGE']
6
+ end
7
+
8
+ task :coverage do
9
+ ENV['COVERAGE'] = 'y'
10
+ end
@@ -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.2
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-03 00:00:00.000000000 Z
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