utopia 2.22.1 → 2.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/bake/utopia/environment.rb +12 -10
- data/bake/utopia/server.rb +1 -1
- data/bake/utopia/site.rb +46 -45
- data/lib/utopia/content.rb +2 -2
- data/lib/utopia/static.rb +2 -2
- data/lib/utopia/version.rb +2 -2
- data/readme.md +9 -1
- data/setup/site/Guardfile +0 -19
- data/setup/site/config.ru +3 -3
- data/setup/site/fixtures/website.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +8 -8
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe8b55483bdf9ce333c4edc86df63f44089079c03ba671d8c0dfe889751733c0
|
4
|
+
data.tar.gz: cd2642132d31ac3a4e46e688daf3ff9d1e1f706f7eff89ea5f8ed25af9e0f337
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef6f7c5e487e5df0edcaa341b6b699b2ad0f41879c8b36a8dd00b7006f65d62a99f908bf158ef7dd3a67406ba08f31d94dc7fdb952177633b9d3206abacae029
|
7
|
+
data.tar.gz: 637c10fca8f1e1e6ff8b1f6e252ed71ad41ed80f196b6198416a2b452664e518c34544f756d2e3aaf911c3fbe454b5545eaa724f7b4ab6ed65a9492422b2d7f1
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/bake/utopia/environment.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2018-
|
4
|
+
# Copyright, 2018-2023, by Samuel Williams.
|
5
5
|
|
6
6
|
# Update environment variables in config/environment.yaml
|
7
7
|
def initialize(...)
|
@@ -15,8 +15,8 @@ end
|
|
15
15
|
# Setup default environemnts "testing" and "development".
|
16
16
|
# @parameter root [String] The root directory of the project.
|
17
17
|
def setup(root: context.root)
|
18
|
-
defaults(
|
19
|
-
defaults(
|
18
|
+
defaults("testing", root: root)
|
19
|
+
defaults("development", root: root)
|
20
20
|
end
|
21
21
|
|
22
22
|
# Setup the defaults for a specific environment.
|
@@ -24,6 +24,7 @@ end
|
|
24
24
|
# @parameter root [String] The root directory of the project.
|
25
25
|
def defaults(name, root: context.root)
|
26
26
|
update_environment(root, name) do |store|
|
27
|
+
Console.logger.info(self) {"Setting up defaults for environment #{name}..."}
|
27
28
|
# Set some useful defaults for the environment.
|
28
29
|
store['UTOPIA_SESSION_SECRET'] ||= SecureRandom.hex(40)
|
29
30
|
end
|
@@ -33,22 +34,23 @@ end
|
|
33
34
|
# @parameter name [String] The name of the environment to update.
|
34
35
|
# @parameter variables [Hash(String, String)] A list of environment KEY=VALUE pairs to set.
|
35
36
|
def update(name, root: context.root, **variables)
|
36
|
-
update_environment(root, name) do |store|
|
37
|
-
variables&.each do |
|
38
|
-
key
|
37
|
+
update_environment(root, name) do |store, _, path|
|
38
|
+
variables&.each do |key, value|
|
39
|
+
# Ensure the key is a string...
|
40
|
+
key = key.to_s
|
39
41
|
|
40
|
-
if value
|
41
|
-
|
42
|
+
if value && !value.empty?
|
43
|
+
Console.logger.info(self) {"ENV[#{key.inspect}] will default to #{value.inspect} unless otherwise specified."}
|
42
44
|
store[key] = value
|
43
45
|
else
|
44
|
-
|
46
|
+
Console.logger.info(self) {"ENV[#{key.inspect}] will be unset unless otherwise specified."}
|
45
47
|
store.delete(key)
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
49
51
|
yield store if block_given?
|
50
52
|
|
51
|
-
Console.logger.
|
53
|
+
Console.logger.info(self) do |buffer|
|
52
54
|
buffer.puts "Environment #{name} (#{path}):"
|
53
55
|
store.roots.each do |key|
|
54
56
|
value = store[key]
|
data/bake/utopia/server.rb
CHANGED
data/bake/utopia/site.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright,
|
5
|
-
# Copyright, 2020, by Michael Adams.
|
4
|
+
# Copyright, 2023, by Samuel Williams.
|
6
5
|
|
7
6
|
def initialize(...)
|
8
7
|
super
|
@@ -20,7 +19,7 @@ SETUP_ROOT = File.expand_path("../../setup", __dir__)
|
|
20
19
|
CONFIGURATION_FILES = ['.gitignore', 'config.ru', 'config/environment.rb', 'falcon.rb', 'gems.rb', 'Guardfile', 'bake.rb', 'test/website.rb', 'fixtures/website.rb']
|
21
20
|
|
22
21
|
# Directories that should exist:
|
23
|
-
DIRECTORIES = ["config", "lib", "pages", "public", "bake", "test"]
|
22
|
+
DIRECTORIES = ["config", "lib", "pages", "public", "bake", "fixtures", "test"]
|
24
23
|
|
25
24
|
# Directories that should be removed during upgrade process:
|
26
25
|
OLD_PATHS = ["access_log", "cache", "tmp", "Rakefile", "tasks", ".bowerrc"]
|
@@ -64,6 +63,8 @@ def create(root: context.root)
|
|
64
63
|
|
65
64
|
system("bundle", "install", chdir: root) or warn "could not install bundled gems"
|
66
65
|
|
66
|
+
context.lookup('utopia:environment:setup').call(root: root)
|
67
|
+
|
67
68
|
if !File.exist?('.git')
|
68
69
|
Console.logger.info(self) {"Setting up git repository..."}
|
69
70
|
|
@@ -72,8 +73,6 @@ def create(root: context.root)
|
|
72
73
|
system("git", "commit", "-q", "-m", "Initial Utopia v#{Utopia::VERSION} site.", chdir: root) or warn "could not commit files"
|
73
74
|
end
|
74
75
|
|
75
|
-
context.lookup('utopia:environment:defaults').call(root)
|
76
|
-
|
77
76
|
name = `git config user.name || whoami`.chomp
|
78
77
|
|
79
78
|
puts
|
@@ -92,36 +91,37 @@ end
|
|
92
91
|
|
93
92
|
# Upgrade an existing site to use the latest configuration files from the template.
|
94
93
|
def upgrade(root: context.root)
|
95
|
-
|
96
|
-
|
97
|
-
$stderr.puts "Upgrading #{destination_root}..."
|
98
|
-
|
99
|
-
system('git', 'checkout', '-b', branch_name, chdir: root) or fail "could not change branch"
|
100
|
-
|
101
|
-
DIRECTORIES.each do |directory|
|
102
|
-
FileUtils.mkdir_p(File.join(root, directory))
|
103
|
-
end
|
94
|
+
message = "Upgrade to utopia v#{Utopia::VERSION}."
|
104
95
|
|
105
|
-
|
106
|
-
path = File.join(root, path)
|
107
|
-
Console.logger.info(self) {"Removing #{path}..."}
|
108
|
-
FileUtils.rm_rf(path)
|
109
|
-
end
|
96
|
+
Console.logger.info(self) {"Upgrading #{root}..."}
|
110
97
|
|
111
|
-
|
112
|
-
|
113
|
-
|
98
|
+
commit_changes(root, message) do
|
99
|
+
DIRECTORIES.each do |directory|
|
100
|
+
FileUtils.mkdir_p(File.join(root, directory))
|
101
|
+
end
|
114
102
|
|
115
|
-
|
103
|
+
OLD_PATHS.each do |path|
|
104
|
+
path = File.join(root, path)
|
105
|
+
|
106
|
+
if File.exist?(path)
|
107
|
+
Console.logger.info(self) {"Removing #{path}..."}
|
108
|
+
FileUtils.rm_rf(path)
|
109
|
+
end
|
110
|
+
end
|
116
111
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
112
|
+
CONFIGURATION_FILES.each do |configuration_file|
|
113
|
+
source_path = File.join(SITE_ROOT, configuration_file)
|
114
|
+
destination_path = File.join(root, configuration_file)
|
115
|
+
|
116
|
+
Console.logger.info(self) {"Updating #{destination_path}..."}
|
117
|
+
|
118
|
+
FileUtils.copy_entry(source_path, destination_path)
|
119
|
+
buffer = File.read(destination_path).gsub('$UTOPIA_VERSION', Utopia::VERSION)
|
120
|
+
File.open(destination_path, "w") { |file| file.write(buffer) }
|
121
|
+
end
|
122
|
+
|
123
|
+
context.lookup('utopia:environment:setup').call(root: root)
|
123
124
|
|
124
|
-
begin
|
125
125
|
# Stage any files that have been changed or removed:
|
126
126
|
system("git", "add", "-u", chdir: root) or fail "could not add files"
|
127
127
|
|
@@ -130,26 +130,27 @@ def upgrade(root: context.root)
|
|
130
130
|
|
131
131
|
move_static!(root)
|
132
132
|
update_gemfile!(root)
|
133
|
-
|
134
|
-
# Commit all changes:
|
135
|
-
system("git", "commit", "-m", "Upgrade to utopia #{Utopia::VERSION}.", chdir: root) or fail "could not commit changes"
|
136
|
-
|
137
|
-
# Checkout main..
|
138
|
-
system("git", "checkout", "main", chdir: root) or fail "could not checkout main"
|
139
|
-
|
140
|
-
# and merge:
|
141
|
-
system("git", "merge", "--squash", "--no-commit", branch_name, chdir: root) or fail "could not merge changes"
|
142
|
-
rescue => error
|
143
|
-
Console.logger.error(self, error) {"Upgrade failed."}
|
144
|
-
|
145
|
-
system("git", "checkout", "master", chdir: root)
|
146
|
-
ensure
|
147
|
-
system("git", "branch", "-D", branch_name, chdir: root)
|
148
133
|
end
|
149
134
|
end
|
150
135
|
|
151
136
|
private
|
152
137
|
|
138
|
+
def commit_changes(root, message)
|
139
|
+
# Ensure the current branch is clean:
|
140
|
+
system("git", "diff-index", "--quiet", "HEAD", chdir: root) or fail "current branch is not clean"
|
141
|
+
|
142
|
+
begin
|
143
|
+
yield
|
144
|
+
rescue
|
145
|
+
# Clear out the changes:
|
146
|
+
system("git", "reset", "--hard", "HEAD", chdir: root) or fail "could not reset changes"
|
147
|
+
raise
|
148
|
+
end
|
149
|
+
|
150
|
+
# Commit all changes:
|
151
|
+
system("git", "commit", "-m", message, chdir: root) or fail "could not commit changes"
|
152
|
+
end
|
153
|
+
|
153
154
|
# Move legacy `pages/_static` to `public/_static`.
|
154
155
|
def move_static!(root)
|
155
156
|
old_static_path = File.expand_path('pages/_static', root)
|
data/lib/utopia/content.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2009-
|
4
|
+
# Copyright, 2009-2023, by Samuel Williams.
|
5
5
|
|
6
6
|
require_relative 'middleware'
|
7
7
|
require_relative 'localization'
|
@@ -190,7 +190,7 @@ module Utopia
|
|
190
190
|
'link.href' => link.href
|
191
191
|
}
|
192
192
|
|
193
|
-
trace("utopia.content.respond", attributes: attributes) {super}
|
193
|
+
Traces.trace("utopia.content.respond", attributes: attributes) {super}
|
194
194
|
end
|
195
195
|
end
|
196
196
|
end
|
data/lib/utopia/static.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2009-
|
4
|
+
# Copyright, 2009-2023, by Samuel Williams.
|
5
5
|
|
6
6
|
require_relative 'middleware'
|
7
7
|
require_relative 'localization'
|
@@ -102,7 +102,7 @@ module Utopia
|
|
102
102
|
path_info: path_info,
|
103
103
|
}
|
104
104
|
|
105
|
-
trace("utopia.static.respond", attributes: attributes) {super}
|
105
|
+
Traces.trace("utopia.static.respond", attributes: attributes) {super}
|
106
106
|
end
|
107
107
|
end
|
108
108
|
end
|
data/lib/utopia/version.rb
CHANGED
data/readme.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Utopia is a website generation framework which provides a robust set of tools to build highly complex dynamic websites. It uses the filesystem heavily for content and provides functions for interacting with files and directories as structure representing the website.
|
4
4
|
|
5
|
-
[![Development Status](https://github.com/
|
5
|
+
[![Development Status](https://github.com/socketry/utopia/workflows/Test/badge.svg)](https://github.com/socketry/utopia/actions?workflow=Test)
|
6
6
|
|
7
7
|
## Features
|
8
8
|
|
@@ -25,6 +25,14 @@ We welcome contributions to this project.
|
|
25
25
|
4. Push to the branch (`git push origin my-new-feature`).
|
26
26
|
5. Create new Pull Request.
|
27
27
|
|
28
|
+
### Developer Certificate of Origin
|
29
|
+
|
30
|
+
This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.
|
31
|
+
|
32
|
+
### Contributor Covenant
|
33
|
+
|
34
|
+
This project is governed by [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
|
35
|
+
|
28
36
|
## See Also
|
29
37
|
|
30
38
|
- [Trenni](https://github.com/ioquatix/trenni) — Template and markup parsers, markup generation.
|
data/setup/site/Guardfile
CHANGED
@@ -8,22 +8,3 @@ group :development do
|
|
8
8
|
notification :off
|
9
9
|
end
|
10
10
|
end
|
11
|
-
|
12
|
-
group :test do
|
13
|
-
# guard :rspec, cmd: 'rspec' do
|
14
|
-
# # Notifications can get a bit tedious:
|
15
|
-
# # notification :off
|
16
|
-
|
17
|
-
# # Re-run specs if they are changed:
|
18
|
-
# watch(%r{^spec/.+_spec\.rb$})
|
19
|
-
# watch('spec/spec_helper.rb') {'spec'}
|
20
|
-
|
21
|
-
# # Run relevent specs if files in `lib/` or `pages/` are changed:
|
22
|
-
# watch(%r{^lib/(.+)\.rb$}) {|match| "spec/lib/#{match[1]}_spec.rb" }
|
23
|
-
# watch(%r{^pages/(.+)\.(rb|xnode)$}) {|match| "spec/pages/#{match[1]}_spec.rb"}
|
24
|
-
# watch(%r{^pages/(.+)controller\.rb$}) {|match| Dir.glob("spec/pages/#{match[1]}*_spec.rb")}
|
25
|
-
|
26
|
-
# # If any files in pages changes, ensure the website still works:
|
27
|
-
# watch(%r{^pages/.*}) {'spec/website_spec.rb'}
|
28
|
-
# end
|
29
|
-
end
|
data/setup/site/config.ru
CHANGED
@@ -14,7 +14,7 @@ else
|
|
14
14
|
use Rack::ShowExceptions unless UTOPIA.testing?
|
15
15
|
end
|
16
16
|
|
17
|
-
#
|
17
|
+
# Serve static files from "public" directory:
|
18
18
|
use Utopia::Static, root: 'public'
|
19
19
|
|
20
20
|
use Utopia::Redirection::Rewrite, {
|
@@ -40,10 +40,10 @@ use Utopia::Session,
|
|
40
40
|
|
41
41
|
use Utopia::Controller
|
42
42
|
|
43
|
-
#
|
43
|
+
# Serve static files from "pages" directory:
|
44
44
|
use Utopia::Static
|
45
45
|
|
46
|
-
# Serve dynamic content
|
46
|
+
# Serve dynamic content:
|
47
47
|
use Utopia::Content
|
48
48
|
|
49
49
|
run lambda { |env| [404, {}, []] }
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utopia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -41,7 +41,7 @@ cert_chain:
|
|
41
41
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
42
42
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
43
43
|
-----END CERTIFICATE-----
|
44
|
-
date: 2023-
|
44
|
+
date: 2023-06-26 00:00:00.000000000 Z
|
45
45
|
dependencies:
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: concurrent-ruby
|
@@ -173,16 +173,16 @@ dependencies:
|
|
173
173
|
name: traces
|
174
174
|
requirement: !ruby/object:Gem::Requirement
|
175
175
|
requirements:
|
176
|
-
- - "
|
176
|
+
- - "~>"
|
177
177
|
- !ruby/object:Gem::Version
|
178
|
-
version: '0'
|
178
|
+
version: '0.10'
|
179
179
|
type: :runtime
|
180
180
|
prerelease: false
|
181
181
|
version_requirements: !ruby/object:Gem::Requirement
|
182
182
|
requirements:
|
183
|
-
- - "
|
183
|
+
- - "~>"
|
184
184
|
- !ruby/object:Gem::Version
|
185
|
-
version: '0'
|
185
|
+
version: '0.10'
|
186
186
|
- !ruby/object:Gem::Dependency
|
187
187
|
name: trenni
|
188
188
|
requirement: !ruby/object:Gem::Requirement
|
@@ -404,14 +404,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
404
404
|
requirements:
|
405
405
|
- - ">="
|
406
406
|
- !ruby/object:Gem::Version
|
407
|
-
version: '
|
407
|
+
version: '3.0'
|
408
408
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
409
409
|
requirements:
|
410
410
|
- - ">="
|
411
411
|
- !ruby/object:Gem::Version
|
412
412
|
version: '0'
|
413
413
|
requirements: []
|
414
|
-
rubygems_version: 3.4.
|
414
|
+
rubygems_version: 3.4.7
|
415
415
|
signing_key:
|
416
416
|
specification_version: 4
|
417
417
|
summary: Utopia is a framework for building dynamic content-driven websites.
|
metadata.gz.sig
CHANGED
Binary file
|