utopia 2.20.1 → 2.22.0
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
- checksums.yaml.gz.sig +0 -0
- data/bake/utopia/environment.rb +90 -0
- data/bake/utopia/node.rb +3 -1
- data/bake/utopia/server.rb +61 -0
- data/bake/utopia/shell.rb +3 -1
- data/bake/utopia/site.rb +188 -0
- data/bake/utopia/static.rb +3 -2
- data/bake/utopia.rb +3 -1
- data/lib/utopia/content/document.rb +2 -19
- data/lib/utopia/content/link.rb +4 -19
- data/lib/utopia/content/links.rb +2 -19
- data/lib/utopia/content/markup.rb +2 -19
- data/lib/utopia/content/namespace.rb +2 -19
- data/lib/utopia/content/node.rb +4 -20
- data/lib/utopia/content/response.rb +2 -19
- data/lib/utopia/content/tags.rb +2 -19
- data/lib/utopia/content.rb +2 -19
- data/lib/utopia/content_length.rb +2 -19
- data/lib/utopia/controller/actions.rb +2 -19
- data/lib/utopia/controller/base.rb +2 -19
- data/lib/utopia/controller/respond.rb +2 -19
- data/lib/utopia/controller/rewrite.rb +2 -19
- data/lib/utopia/controller/variables.rb +2 -19
- data/lib/utopia/controller.rb +2 -19
- data/lib/utopia/exceptions/handler.rb +2 -19
- data/lib/utopia/exceptions/mailer.rb +2 -19
- data/lib/utopia/exceptions.rb +2 -19
- data/lib/utopia/extensions/array_split.rb +3 -20
- data/lib/utopia/extensions/date_comparisons.rb +3 -20
- data/lib/utopia/http.rb +2 -19
- data/lib/utopia/locale.rb +2 -19
- data/lib/utopia/localization.rb +2 -19
- data/lib/utopia/logger.rb +2 -19
- data/lib/utopia/middleware.rb +2 -19
- data/lib/utopia/path/matcher.rb +2 -19
- data/lib/utopia/path.rb +2 -19
- data/lib/utopia/redirection.rb +2 -19
- data/lib/utopia/responder.rb +2 -19
- data/lib/utopia/session/lazy_hash.rb +2 -19
- data/lib/utopia/session/serialization.rb +2 -19
- data/lib/utopia/session.rb +3 -19
- data/lib/utopia/setup.rb +2 -19
- data/lib/utopia/shell.rb +2 -19
- data/lib/utopia/static/local_file.rb +2 -19
- data/lib/utopia/static/mime_types.rb +2 -19
- data/lib/utopia/static.rb +2 -19
- data/lib/utopia/version.rb +3 -20
- data/lib/utopia.rb +3 -20
- data/license.md +25 -0
- data/readme.md +44 -0
- data/setup/site/.gitignore +0 -1
- data/setup/site/Guardfile +13 -13
- data/setup/site/bake.rb +3 -1
- data/setup/site/config/environment.rb +3 -0
- data/setup/site/config/{README.md → readme.md} +0 -0
- data/setup/site/config/sus.rb +10 -0
- data/setup/site/falcon.rb +3 -0
- data/setup/site/fixtures/website.rb +39 -0
- data/setup/site/gems.rb +8 -7
- data/setup/site/{README.md → readme.md} +0 -0
- data/setup/site/test/website.rb +28 -0
- data.tar.gz.sig +0 -0
- metadata +59 -62
- metadata.gz.sig +0 -0
- data/bake/utopia/test.rb +0 -10
- data/bin/utopia +0 -25
- data/lib/utopia/command/environment.rb +0 -93
- data/lib/utopia/command/server.rb +0 -113
- data/lib/utopia/command/site.rb +0 -233
- data/lib/utopia/command.rb +0 -67
- data/setup/site/.rspec +0 -4
- data/setup/site/spec/spec_helper.rb +0 -16
- data/setup/site/spec/website_context.rb +0 -54
- data/setup/site/spec/website_spec.rb +0 -25
metadata
CHANGED
@@ -1,47 +1,47 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: utopia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
- Huba Nagy
|
9
9
|
- Michael Adams
|
10
10
|
- Olle Jonsson
|
11
|
-
-
|
12
|
-
- k1tsu
|
11
|
+
- Pierre Montelle
|
13
12
|
autorequire:
|
14
13
|
bindir: bin
|
15
14
|
cert_chain:
|
16
15
|
- |
|
17
16
|
-----BEGIN CERTIFICATE-----
|
18
|
-
|
19
|
-
|
20
|
-
|
21
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 00:00:00.000000000 Z
|
45
45
|
dependencies:
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: concurrent-ruby
|
@@ -49,14 +49,14 @@ dependencies:
|
|
49
49
|
requirements:
|
50
50
|
- - "~>"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '1.
|
52
|
+
version: '1.2'
|
53
53
|
type: :runtime
|
54
54
|
prerelease: false
|
55
55
|
version_requirements: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
57
|
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '1.
|
59
|
+
version: '1.2'
|
60
60
|
- !ruby/object:Gem::Dependency
|
61
61
|
name: console
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
@@ -145,16 +145,16 @@ dependencies:
|
|
145
145
|
name: rack
|
146
146
|
requirement: !ruby/object:Gem::Requirement
|
147
147
|
requirements:
|
148
|
-
- - "
|
148
|
+
- - "~>"
|
149
149
|
- !ruby/object:Gem::Version
|
150
|
-
version: '
|
150
|
+
version: '3.0'
|
151
151
|
type: :runtime
|
152
152
|
prerelease: false
|
153
153
|
version_requirements: !ruby/object:Gem::Requirement
|
154
154
|
requirements:
|
155
|
-
- - "
|
155
|
+
- - "~>"
|
156
156
|
- !ruby/object:Gem::Version
|
157
|
-
version: '
|
157
|
+
version: '3.0'
|
158
158
|
- !ruby/object:Gem::Dependency
|
159
159
|
name: samovar
|
160
160
|
requirement: !ruby/object:Gem::Requirement
|
@@ -212,7 +212,7 @@ dependencies:
|
|
212
212
|
- !ruby/object:Gem::Version
|
213
213
|
version: '0.1'
|
214
214
|
- !ruby/object:Gem::Dependency
|
215
|
-
name: async-
|
215
|
+
name: async-websocket
|
216
216
|
requirement: !ruby/object:Gem::Requirement
|
217
217
|
requirements:
|
218
218
|
- - ">="
|
@@ -226,7 +226,7 @@ dependencies:
|
|
226
226
|
- !ruby/object:Gem::Version
|
227
227
|
version: '0'
|
228
228
|
- !ruby/object:Gem::Dependency
|
229
|
-
name:
|
229
|
+
name: bake
|
230
230
|
requirement: !ruby/object:Gem::Requirement
|
231
231
|
requirements:
|
232
232
|
- - ">="
|
@@ -240,7 +240,7 @@ dependencies:
|
|
240
240
|
- !ruby/object:Gem::Version
|
241
241
|
version: '0'
|
242
242
|
- !ruby/object:Gem::Dependency
|
243
|
-
name:
|
243
|
+
name: bundler
|
244
244
|
requirement: !ruby/object:Gem::Requirement
|
245
245
|
requirements:
|
246
246
|
- - ">="
|
@@ -254,7 +254,7 @@ dependencies:
|
|
254
254
|
- !ruby/object:Gem::Version
|
255
255
|
version: '0'
|
256
256
|
- !ruby/object:Gem::Dependency
|
257
|
-
name:
|
257
|
+
name: covered
|
258
258
|
requirement: !ruby/object:Gem::Requirement
|
259
259
|
requirements:
|
260
260
|
- - ">="
|
@@ -268,7 +268,7 @@ dependencies:
|
|
268
268
|
- !ruby/object:Gem::Version
|
269
269
|
version: '0'
|
270
270
|
- !ruby/object:Gem::Dependency
|
271
|
-
name:
|
271
|
+
name: falcon
|
272
272
|
requirement: !ruby/object:Gem::Requirement
|
273
273
|
requirements:
|
274
274
|
- - ">="
|
@@ -282,7 +282,7 @@ dependencies:
|
|
282
282
|
- !ruby/object:Gem::Version
|
283
283
|
version: '0'
|
284
284
|
- !ruby/object:Gem::Dependency
|
285
|
-
name:
|
285
|
+
name: sus
|
286
286
|
requirement: !ruby/object:Gem::Requirement
|
287
287
|
requirements:
|
288
288
|
- - ">="
|
@@ -296,37 +296,33 @@ dependencies:
|
|
296
296
|
- !ruby/object:Gem::Version
|
297
297
|
version: '0'
|
298
298
|
- !ruby/object:Gem::Dependency
|
299
|
-
name:
|
299
|
+
name: sus-fixtures-async-http
|
300
300
|
requirement: !ruby/object:Gem::Requirement
|
301
301
|
requirements:
|
302
|
-
- - "
|
302
|
+
- - ">="
|
303
303
|
- !ruby/object:Gem::Version
|
304
|
-
version: '
|
304
|
+
version: '0'
|
305
305
|
type: :development
|
306
306
|
prerelease: false
|
307
307
|
version_requirements: !ruby/object:Gem::Requirement
|
308
308
|
requirements:
|
309
|
-
- - "
|
309
|
+
- - ">="
|
310
310
|
- !ruby/object:Gem::Version
|
311
|
-
version: '
|
311
|
+
version: '0'
|
312
312
|
description:
|
313
313
|
email:
|
314
|
-
executables:
|
315
|
-
- utopia
|
314
|
+
executables: []
|
316
315
|
extensions: []
|
317
316
|
extra_rdoc_files: []
|
318
317
|
files:
|
319
318
|
- bake/utopia.rb
|
319
|
+
- bake/utopia/environment.rb
|
320
320
|
- bake/utopia/node.rb
|
321
|
+
- bake/utopia/server.rb
|
321
322
|
- bake/utopia/shell.rb
|
323
|
+
- bake/utopia/site.rb
|
322
324
|
- bake/utopia/static.rb
|
323
|
-
- bake/utopia/test.rb
|
324
|
-
- bin/utopia
|
325
325
|
- lib/utopia.rb
|
326
|
-
- lib/utopia/command.rb
|
327
|
-
- lib/utopia/command/environment.rb
|
328
|
-
- lib/utopia/command/server.rb
|
329
|
-
- lib/utopia/command/site.rb
|
330
326
|
- lib/utopia/content.rb
|
331
327
|
- lib/utopia/content/document.rb
|
332
328
|
- lib/utopia/content/link.rb
|
@@ -368,16 +364,18 @@ files:
|
|
368
364
|
- lib/utopia/static/local_file.rb
|
369
365
|
- lib/utopia/static/mime_types.rb
|
370
366
|
- lib/utopia/version.rb
|
367
|
+
- license.md
|
368
|
+
- readme.md
|
371
369
|
- setup/server/git/hooks/post-receive
|
372
370
|
- setup/site/.gitignore
|
373
|
-
- setup/site/.rspec
|
374
371
|
- setup/site/Guardfile
|
375
|
-
- setup/site/README.md
|
376
372
|
- setup/site/bake.rb
|
377
373
|
- setup/site/config.ru
|
378
|
-
- setup/site/config/README.md
|
379
374
|
- setup/site/config/environment.rb
|
375
|
+
- setup/site/config/readme.md
|
376
|
+
- setup/site/config/sus.rb
|
380
377
|
- setup/site/falcon.rb
|
378
|
+
- setup/site/fixtures/website.rb
|
381
379
|
- setup/site/gems.rb
|
382
380
|
- setup/site/lib/readme.txt
|
383
381
|
- setup/site/pages/_heading.xnode
|
@@ -391,9 +389,8 @@ files:
|
|
391
389
|
- setup/site/public/_static/utopia-background.svg
|
392
390
|
- setup/site/public/_static/utopia.svg
|
393
391
|
- setup/site/public/readme.txt
|
394
|
-
- setup/site/
|
395
|
-
- setup/site/
|
396
|
-
- setup/site/spec/website_spec.rb
|
392
|
+
- setup/site/readme.md
|
393
|
+
- setup/site/test/website.rb
|
397
394
|
homepage: https://github.com/ioquatix/utopia
|
398
395
|
licenses:
|
399
396
|
- MIT
|
@@ -407,14 +404,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
407
404
|
requirements:
|
408
405
|
- - ">="
|
409
406
|
- !ruby/object:Gem::Version
|
410
|
-
version: '2.
|
407
|
+
version: '2.7'
|
411
408
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
412
409
|
requirements:
|
413
410
|
- - ">="
|
414
411
|
- !ruby/object:Gem::Version
|
415
412
|
version: '0'
|
416
413
|
requirements: []
|
417
|
-
rubygems_version: 3.
|
414
|
+
rubygems_version: 3.5.0.dev
|
418
415
|
signing_key:
|
419
416
|
specification_version: 4
|
420
417
|
summary: Utopia is a framework for building dynamic content-driven websites.
|
metadata.gz.sig
CHANGED
Binary file
|
data/bake/utopia/test.rb
DELETED
data/bin/utopia
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# Copyright, 2015, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
10
|
-
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
13
|
-
# all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
# THE SOFTWARE.
|
22
|
-
|
23
|
-
require_relative '../lib/utopia/command'
|
24
|
-
|
25
|
-
Utopia::Command.call
|
@@ -1,93 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
10
|
-
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
13
|
-
# all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
# THE SOFTWARE.
|
22
|
-
|
23
|
-
require 'securerandom'
|
24
|
-
require 'yaml/store'
|
25
|
-
require 'console'
|
26
|
-
|
27
|
-
module Utopia
|
28
|
-
module Command
|
29
|
-
# Set environment variables within the server deployment.
|
30
|
-
class Environment < Samovar::Command
|
31
|
-
self.description = "Update environment variables in config/environment.yaml"
|
32
|
-
|
33
|
-
options do
|
34
|
-
option '-e/--environment-name <name>', "The environment file to modify.", default: 'environment'
|
35
|
-
option '-d/--defaults', "Initialize any recommended defaults."
|
36
|
-
end
|
37
|
-
|
38
|
-
many :variables, "A list of environment KEY=VALUE pairs to set."
|
39
|
-
|
40
|
-
def self.defaults(destination_root)
|
41
|
-
# Set some useful defaults for the environment.
|
42
|
-
self["--environment-name", "testing", "--defaults"].call(destination_root)
|
43
|
-
self["--environment-name", "development", "--defaults"].call(destination_root)
|
44
|
-
end
|
45
|
-
|
46
|
-
def environment_name
|
47
|
-
@options[:environment_name]
|
48
|
-
end
|
49
|
-
|
50
|
-
# Setup `config/environment.yaml` according to specified options.
|
51
|
-
def update_environment(root, name = self.environment_name)
|
52
|
-
environment_path = File.join(root, "config", "#{name}.yaml")
|
53
|
-
FileUtils.mkpath File.dirname(environment_path)
|
54
|
-
|
55
|
-
store = YAML::Store.new(environment_path)
|
56
|
-
|
57
|
-
store.transaction do
|
58
|
-
yield store, name, environment_path
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def call(root = parent.root)
|
63
|
-
update_environment(root) do |store, name, path|
|
64
|
-
if @options[:defaults]
|
65
|
-
# Set some useful defaults for the environment.
|
66
|
-
store['UTOPIA_SESSION_SECRET'] ||= SecureRandom.hex(40)
|
67
|
-
end
|
68
|
-
|
69
|
-
variables&.each do |variable|
|
70
|
-
key, value = variable.split('=', 2)
|
71
|
-
|
72
|
-
if value
|
73
|
-
puts "ENV[#{key.inspect}] will default to #{value.inspect} unless otherwise specified."
|
74
|
-
store[key] = value
|
75
|
-
else
|
76
|
-
puts "ENV[#{key.inspect}] will be unset unless otherwise specified."
|
77
|
-
store.delete(key)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
Console.logger.debug(self) do |buffer|
|
82
|
-
buffer.puts "Environment #{name} (#{path}):"
|
83
|
-
store.roots.each do |key|
|
84
|
-
value = store[key]
|
85
|
-
|
86
|
-
buffer.puts "#{key}=#{value.inspect}"
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
@@ -1,113 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
|
-
#
|
5
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
# of this software and associated documentation files (the "Software"), to deal
|
7
|
-
# in the Software without restriction, including without limitation the rights
|
8
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
# copies of the Software, and to permit persons to whom the Software is
|
10
|
-
# furnished to do so, subject to the following conditions:
|
11
|
-
#
|
12
|
-
# The above copyright notice and this permission notice shall be included in
|
13
|
-
# all copies or substantial portions of the Software.
|
14
|
-
#
|
15
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
# THE SOFTWARE.
|
22
|
-
|
23
|
-
require_relative 'site'
|
24
|
-
|
25
|
-
require 'fileutils'
|
26
|
-
|
27
|
-
require 'samovar'
|
28
|
-
|
29
|
-
module Utopia
|
30
|
-
module Command
|
31
|
-
# Server setup commands.
|
32
|
-
class Server < Samovar::Command
|
33
|
-
# Create a server.
|
34
|
-
class Create < Samovar::Command
|
35
|
-
self.description = "Create a remote Utopia website suitable for deployment using git."
|
36
|
-
|
37
|
-
def call
|
38
|
-
destination_root = parent.root
|
39
|
-
|
40
|
-
FileUtils.mkdir_p File.join(destination_root, "public")
|
41
|
-
|
42
|
-
Update[parent: parent].call
|
43
|
-
|
44
|
-
# Print out helpful git remote add message:
|
45
|
-
hostname = `hostname`.chomp
|
46
|
-
puts "Now add the git remote to your local repository:\n\tgit remote add production ssh://#{hostname}#{destination_root}"
|
47
|
-
puts "Then push to it:\n\tgit push --set-upstream production master"
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# Update a server.
|
52
|
-
class Update < Samovar::Command
|
53
|
-
self.description = "Update the git hooks in an existing server repository."
|
54
|
-
|
55
|
-
def template_root
|
56
|
-
# The root directory of the template server deployment:
|
57
|
-
File.join(SETUP_ROOT, 'server')
|
58
|
-
end
|
59
|
-
|
60
|
-
def call
|
61
|
-
destination_root = parent.root
|
62
|
-
|
63
|
-
Dir.chdir(destination_root) do
|
64
|
-
# It's okay to call this on an existing repo, it will only update config as required to enable --shared.
|
65
|
-
# --shared allows multiple users to access the site with the same group.
|
66
|
-
system("git", "init", "--shared") or fail "could not initialize repository"
|
67
|
-
|
68
|
-
system("git", "config", "receive.denyCurrentBranch", "ignore") or fail "could not set configuration"
|
69
|
-
system("git", "config", "core.worktree", destination_root) or fail "could not set configuration"
|
70
|
-
|
71
|
-
# Doing this invokes a lot of behaviour that isn't always ideal...
|
72
|
-
# system("bundle", "config", "set", "--local", "deployment", "true")
|
73
|
-
system("bundle", "config", "set", "--local", "without", "development")
|
74
|
-
|
75
|
-
# In theory, to convert from non-shared to shared:
|
76
|
-
# chgrp -R <group-name> . # Change files and directories' group
|
77
|
-
# chmod -R g+w . # Change permissions
|
78
|
-
# chmod g-w .git/objects/pack/* # Git pack files should be immutable
|
79
|
-
# chmod g+s `find . -type d` # New files get group id of directory
|
80
|
-
end
|
81
|
-
|
82
|
-
# Set some useful defaults for the environment.
|
83
|
-
environment = Environment[]
|
84
|
-
environment.update_environment(destination_root) do |store|
|
85
|
-
store['VARIANT'] ||= 'production'
|
86
|
-
store['UTOPIA_SESSION_SECRET'] ||= SecureRandom.hex(40)
|
87
|
-
end
|
88
|
-
|
89
|
-
# Copy git hooks:
|
90
|
-
system("cp", "-r", File.join(template_root, 'git', 'hooks'), File.join(destination_root, '.git')) or fail "could not copy git hooks"
|
91
|
-
# finally set everything in the .git directory to be group writable
|
92
|
-
# This failed for me and I had to do sudo chown http:http .git -R first.
|
93
|
-
system("chmod", "-Rf", "g+w", File.join(destination_root, '.git')) or fail "could not update permissions of .git directory"
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
self.description = "Manage server deployments."
|
98
|
-
|
99
|
-
nested :command, {
|
100
|
-
'create' => Create,
|
101
|
-
'update' => Update
|
102
|
-
}
|
103
|
-
|
104
|
-
def root
|
105
|
-
@parent.root
|
106
|
-
end
|
107
|
-
|
108
|
-
def call
|
109
|
-
@command.call
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|