utopia 2.22.1 → 2.22.2
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 +2 -3
- data/bake/utopia/environment.rb +11 -9
- data/bake/utopia/site.rb +45 -43
- data/lib/utopia/version.rb +1 -1
- data/setup/site/Guardfile +0 -19
- data/setup/site/config.ru +3 -3
- data.tar.gz.sig +0 -0
- metadata +1 -1
- 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: bad66abbb1a3bfd34ad266594c8f79b713f6289e1e2e572280459bdf3fe3ac9b
|
4
|
+
data.tar.gz: 04b1e9a3831cbbfe5551838725fd58ae71e5b218eeaa6ff708450e3a82c5007a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acee0556abc970a44077e739b344cd25f962b559d7238ae11535154e500bb3a529220970a031f437a5d37debc44edd1a279131680ae6cab012d1a404680d4628
|
7
|
+
data.tar.gz: d6056af6f2a3b59b5539444d3e7be38f82528dee5ec33e71d1dd8076eeb750f7e7fb388b8d574462b86d216f87653bd0b4663ee5dbf5a0d2e882f14ae5d459b8
|
checksums.yaml.gz.sig
CHANGED
@@ -1,3 +1,2 @@
|
|
1
|
-
n
|
2
|
-
|
3
|
-
��c�a���f���*L���z~̄��R����T�֊�:K��vt�9�3��P;���l�&��gs�R�� ?��+�&�>U�b�-��+��NXa�٠��@����t�CZ"*���)&�{bGr$��m�8X��:�{\�_�b��#�Y�{=��~�}J�
|
1
|
+
hV�n�h�N���!#�aFۮ��\c^.h�Y��>w%1[m*����#܌#&c)[��Z��Q,@(/gD녊���Bћ�ch\t��ŧ�A�0�e����"ut�[�W7�%R������ ����5���Ֆ?j��i�)G8�˺�{�r�Q���%*�M0���[�d��U}�
|
2
|
+
A?���uz&j�m��>�B�3[�������gV<�73�E_���WϞ@��tɣ�]%FR�j&&Y�F�̹pM��[k����6V���Gjuwm����Q1le�]�<*���k�¦�;����.�[F�����v��bg�N
|
data/bake/utopia/environment.rb
CHANGED
@@ -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/site.rb
CHANGED
@@ -20,7 +20,7 @@ SETUP_ROOT = File.expand_path("../../setup", __dir__)
|
|
20
20
|
CONFIGURATION_FILES = ['.gitignore', 'config.ru', 'config/environment.rb', 'falcon.rb', 'gems.rb', 'Guardfile', 'bake.rb', 'test/website.rb', 'fixtures/website.rb']
|
21
21
|
|
22
22
|
# Directories that should exist:
|
23
|
-
DIRECTORIES = ["config", "lib", "pages", "public", "bake", "test"]
|
23
|
+
DIRECTORIES = ["config", "lib", "pages", "public", "bake", "fixtures", "test"]
|
24
24
|
|
25
25
|
# Directories that should be removed during upgrade process:
|
26
26
|
OLD_PATHS = ["access_log", "cache", "tmp", "Rakefile", "tasks", ".bowerrc"]
|
@@ -64,6 +64,8 @@ def create(root: context.root)
|
|
64
64
|
|
65
65
|
system("bundle", "install", chdir: root) or warn "could not install bundled gems"
|
66
66
|
|
67
|
+
context.lookup('utopia:environment:setup').call(root: root)
|
68
|
+
|
67
69
|
if !File.exist?('.git')
|
68
70
|
Console.logger.info(self) {"Setting up git repository..."}
|
69
71
|
|
@@ -72,8 +74,6 @@ def create(root: context.root)
|
|
72
74
|
system("git", "commit", "-q", "-m", "Initial Utopia v#{Utopia::VERSION} site.", chdir: root) or warn "could not commit files"
|
73
75
|
end
|
74
76
|
|
75
|
-
context.lookup('utopia:environment:defaults').call(root)
|
76
|
-
|
77
77
|
name = `git config user.name || whoami`.chomp
|
78
78
|
|
79
79
|
puts
|
@@ -92,36 +92,37 @@ end
|
|
92
92
|
|
93
93
|
# Upgrade an existing site to use the latest configuration files from the template.
|
94
94
|
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
|
95
|
+
message = "Upgrade to utopia v#{Utopia::VERSION}."
|
104
96
|
|
105
|
-
|
106
|
-
path = File.join(root, path)
|
107
|
-
Console.logger.info(self) {"Removing #{path}..."}
|
108
|
-
FileUtils.rm_rf(path)
|
109
|
-
end
|
97
|
+
Console.logger.info(self) {"Upgrading #{root}..."}
|
110
98
|
|
111
|
-
|
112
|
-
|
113
|
-
|
99
|
+
commit_changes(root, message) do
|
100
|
+
DIRECTORIES.each do |directory|
|
101
|
+
FileUtils.mkdir_p(File.join(root, directory))
|
102
|
+
end
|
114
103
|
|
115
|
-
|
104
|
+
OLD_PATHS.each do |path|
|
105
|
+
path = File.join(root, path)
|
106
|
+
|
107
|
+
if File.exist?(path)
|
108
|
+
Console.logger.info(self) {"Removing #{path}..."}
|
109
|
+
FileUtils.rm_rf(path)
|
110
|
+
end
|
111
|
+
end
|
116
112
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
113
|
+
CONFIGURATION_FILES.each do |configuration_file|
|
114
|
+
source_path = File.join(SITE_ROOT, configuration_file)
|
115
|
+
destination_path = File.join(root, configuration_file)
|
116
|
+
|
117
|
+
Console.logger.info(self) {"Updating #{destination_path}..."}
|
118
|
+
|
119
|
+
FileUtils.copy_entry(source_path, destination_path)
|
120
|
+
buffer = File.read(destination_path).gsub('$UTOPIA_VERSION', Utopia::VERSION)
|
121
|
+
File.open(destination_path, "w") { |file| file.write(buffer) }
|
122
|
+
end
|
123
|
+
|
124
|
+
context.lookup('utopia:environment:setup').call(root: root)
|
123
125
|
|
124
|
-
begin
|
125
126
|
# Stage any files that have been changed or removed:
|
126
127
|
system("git", "add", "-u", chdir: root) or fail "could not add files"
|
127
128
|
|
@@ -130,26 +131,27 @@ def upgrade(root: context.root)
|
|
130
131
|
|
131
132
|
move_static!(root)
|
132
133
|
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
134
|
end
|
149
135
|
end
|
150
136
|
|
151
137
|
private
|
152
138
|
|
139
|
+
def commit_changes(root, message)
|
140
|
+
# Ensure the current branch is clean:
|
141
|
+
system("git", "diff-index", "--quiet", "HEAD", chdir: root) or fail "current branch is not clean"
|
142
|
+
|
143
|
+
begin
|
144
|
+
yield
|
145
|
+
rescue
|
146
|
+
# Clear out the changes:
|
147
|
+
system("git", "reset", "--hard", "HEAD", chdir: root) or fail "could not reset changes"
|
148
|
+
raise
|
149
|
+
end
|
150
|
+
|
151
|
+
# Commit all changes:
|
152
|
+
system("git", "commit", "-m", message, chdir: root) or fail "could not commit changes"
|
153
|
+
end
|
154
|
+
|
153
155
|
# Move legacy `pages/_static` to `public/_static`.
|
154
156
|
def move_static!(root)
|
155
157
|
old_static_path = File.expand_path('pages/_static', root)
|
data/lib/utopia/version.rb
CHANGED
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
metadata.gz.sig
CHANGED
Binary file
|