utopia 2.16.0 → 2.18.0

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
  SHA256:
3
- metadata.gz: ddb5cc8a1bb593d344e0d2f2c8bf315704f297ae1e8063b4d7c0e5f3d71f4014
4
- data.tar.gz: '09ff4febe6dd06945a3725e0c1354402e23bf837026c5aa09b6c2106b482e00d'
3
+ metadata.gz: a8851f81c898bf14616952ae21c9c5379bff340c112e84c422f652ceeff26a2f
4
+ data.tar.gz: e1abf3e367e371b83edfb2089371367952d6f4d23ffae441074abe3dd3daff66
5
5
  SHA512:
6
- metadata.gz: 6a5a89b6bf438d72007dd8617085125aae4a038ee8267716361810e149f9488166323c299aea04baf69ebd54e630e20093c32ec8e016553b11ad46bfa54fe22c
7
- data.tar.gz: bf6fcfe77a7423b39fabd019b40309c52db7a15284661243119d32c279d32d51d2467e4bff409cf6d53924baca9cc60d7788b00bbaf4f9986b65e2b0522e5dbd
6
+ metadata.gz: e191685798e34a85a19c06828987938efc4876b50691add9dd923ab6b53d38c6a5e578cc3b94fa5fc3129dba368106dcf621f02d1a6cf0e8243238d79fac83e9
7
+ data.tar.gz: fc79ea764f46e0352ed1fa000a049d32c7c2c3ea8511ef12fd2e5270d4465873fac12468bb93fe576eeea496297dd23826bff342216493b98b54b2b36f7e0dc5
@@ -68,7 +68,8 @@ module Utopia
68
68
  system("git", "config", "receive.denyCurrentBranch", "ignore") or fail "could not set configuration"
69
69
  system("git", "config", "core.worktree", destination_root) or fail "could not set configuration"
70
70
 
71
- system("bundle", "config", "set", "--local", "deployment", "true")
71
+ # Doing this invokes a lot of behaviour that isn't always ideal...
72
+ # system("bundle", "config", "set", "--local", "deployment", "true")
72
73
  system("bundle", "config", "set", "--local", "without", "development")
73
74
 
74
75
  # In theory, to convert from non-shared to shared:
@@ -33,7 +33,7 @@ module Utopia
33
33
  # Local site setup commands.
34
34
  class Site < Samovar::Command
35
35
  # Configuration files which should be installed/updated:
36
- CONFIGURATION_FILES = ['.gitignore', 'config.ru', 'config/environment.rb', 'falcon.rb', 'Gemfile', 'Guardfile', 'bake.rb', 'spec/spec_helper.rb', 'spec/website_context.rb', 'spec/website_spec.rb']
36
+ CONFIGURATION_FILES = ['.gitignore', 'config.ru', 'config/environment.rb', 'falcon.rb', 'gems.rb', 'Guardfile', 'bake.rb', 'spec/spec_helper.rb', 'spec/website_context.rb', 'spec/website_spec.rb']
37
37
 
38
38
  # Directories that should exist:
39
39
  DIRECTORIES = ["config", "lib", "pages", "public", "tasks", "spec"]
@@ -142,6 +142,15 @@ module Utopia
142
142
  end
143
143
  end
144
144
 
145
+ # Move `Gemfile` to `gems.rb`.
146
+ def update_gemfile!
147
+ # If `Gemfile` doens't exist, we are done:
148
+ return unless File.exist?('Gemfile')
149
+
150
+ system("git", "mv", "Gemfile", "gems.rb")
151
+ system("git", "mv", "Gemfile.lock", "gems.locked")
152
+ end
153
+
145
154
  def call
146
155
  destination_root = parent.root
147
156
  branch_name = "utopia-upgrade-#{Utopia::VERSION}"
@@ -184,6 +193,7 @@ module Utopia
184
193
  system("git", "add", *Site::CONFIGURATION_FILES) or fail "could not add files"
185
194
 
186
195
  move_static!
196
+ update_gemfile!
187
197
 
188
198
  # Commit all changes:
189
199
  system("git", "commit", "-m", "Upgrade to utopia #{Utopia::VERSION}.") or fail "could not commit changes"
@@ -177,17 +177,19 @@ module Utopia
177
177
  end
178
178
 
179
179
  def content_tag(name, node)
180
- parent_path = node.parent_path
180
+ full_path = node.parent_path + name
181
+
182
+ name = full_path.pop
181
183
 
182
184
  # If the current node is called 'foo', we can't lookup 'foo' in the current directory or we will have infinite recursion.
183
- if name == node.name
184
- parent_path = parent_path.dirname
185
+ while full_path.last == name
186
+ full_path.pop
185
187
  end
186
188
 
187
- cache_key = parent_path + name
189
+ cache_key = full_path + name
188
190
 
189
191
  @node_cache.fetch_or_store(cache_key) do
190
- lookup_content(name, parent_path)
192
+ lookup_content(name, full_path)
191
193
  end
192
194
  end
193
195
  end
@@ -52,7 +52,9 @@ module Utopia
52
52
 
53
53
  def href
54
54
  @href ||= @info.fetch(:uri) do
55
- (@path.dirname + @path.basename).to_s if @path
55
+ @info.fetch(:href) do
56
+ (@path.dirname + @path.basename).to_s if @path
57
+ end
56
58
  end
57
59
  end
58
60
 
@@ -234,7 +234,7 @@ module Utopia
234
234
  end
235
235
 
236
236
  def load_index(name, locale, info)
237
- info ||= {}
237
+ info ||= {}
238
238
 
239
239
  if locale and defaults = @metadata[name]
240
240
  info = defaults.merge(info)
@@ -245,17 +245,20 @@ module Utopia
245
245
  yield Link.new(:index, name, locale, path, info, path[-2])
246
246
  end
247
247
 
248
+ DEFAULT_INDEX_INFO = {href: nil}.freeze
249
+
250
+ # The default index for a directory which has no contents.
248
251
  def load_default_index(name = INDEX, info = {})
249
252
  path = @top + name
250
253
 
251
254
  if info
252
- info = {uri: nil}.merge(info)
255
+ info = DEFAULT_INDEX_INFO.merge(info)
253
256
  else
254
- info = {uri: nil}
257
+ info = DEFAULT_INDEX_INFO
255
258
  end
256
259
 
257
260
  # Specify a nil uri if no index could be found for the directory:
258
- yield Link.new(:index, name, nil, @top, info, path[-2])
261
+ yield Link.new(:index, name, nil, @top.to_directory, info, path[-2])
259
262
  end
260
263
 
261
264
  def load_file(name, locale, info)
@@ -28,6 +28,10 @@ module Utopia
28
28
 
29
29
  # The base implementation of a controller class.
30
30
  class Base
31
+ URI_PATH = nil
32
+ BASE_PATH = nil
33
+ CONTROLLER = nil
34
+
31
35
  # A string which is the full path to the directory which contains the controller.
32
36
  def self.base_path
33
37
  self.const_get(:BASE_PATH)
@@ -44,7 +48,7 @@ module Utopia
44
48
  end
45
49
 
46
50
  def self.inspect
47
- "Controller#{self.uri_path}"
51
+ "#{super}#{self.uri_path}"
48
52
  end
49
53
 
50
54
  def self.to_s
@@ -25,7 +25,7 @@ module Utopia
25
25
  class Path
26
26
  include Comparable
27
27
 
28
- SEPARATOR = '/'.freeze
28
+ SEPARATOR = '/'
29
29
 
30
30
  def initialize(components = [])
31
31
  @components = components
@@ -34,6 +34,8 @@ module Utopia
34
34
  attr_accessor :components
35
35
 
36
36
  def freeze
37
+ return self if frozen?
38
+
37
39
  @components.freeze
38
40
 
39
41
  super
@@ -235,6 +237,30 @@ module Utopia
235
237
  return self.class.new(result)
236
238
  end
237
239
 
240
+ # Returns the first path component.
241
+ def first
242
+ if absolute?
243
+ @components[1]
244
+ else
245
+ @components[0]
246
+ end
247
+ end
248
+
249
+ # Returns the last path component.
250
+ def last
251
+ if @components != ['']
252
+ @components.last
253
+ end
254
+ end
255
+
256
+ # Pops the last path component.
257
+ def pop
258
+ # We don't want to convert an absolute path to a relative path.
259
+ if @components != ['']
260
+ @components.pop
261
+ end
262
+ end
263
+
238
264
  # @return [String] the last path component without any file extension.
239
265
  def basename
240
266
  basename, _ = @components.last.split('.', 2)
@@ -284,7 +310,7 @@ module Utopia
284
310
  end
285
311
 
286
312
  def split(at)
287
- if at.kind_of? String
313
+ if at.kind_of?(String)
288
314
  at = @components.index(at)
289
315
  end
290
316
 
@@ -342,22 +368,6 @@ module Utopia
342
368
  @components.delete_at(component_offset(index))
343
369
  end
344
370
 
345
- def first
346
- if absolute?
347
- @components[1]
348
- else
349
- @components[0]
350
- end
351
- end
352
-
353
- def last
354
- if directory?
355
- @components[-2]
356
- else
357
- @components[-1]
358
- end
359
- end
360
-
361
371
  private
362
372
 
363
373
  # We adjust the index slightly so that indices reference path components rather than the directory markers at the start and end of the path components array.
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module Utopia
24
- VERSION = "2.16.0"
24
+ VERSION = "2.18.0"
25
25
  end
@@ -62,7 +62,7 @@ Dir.chdir(GIT_WORK_TREE) do
62
62
  sudo %W{git checkout -f}
63
63
  sudo %W{git submodule update -i}
64
64
 
65
- if File.exist? 'Gemfile'
65
+ if File.exist? 'gems.rb'
66
66
  sudo %W{bundle install}
67
67
  end
68
68
 
File without changes
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: 2.16.0
4
+ version: 2.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-29 00:00:00.000000000 Z
11
+ date: 2020-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -192,34 +192,6 @@ dependencies:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
- - !ruby/object:Gem::Dependency
196
- name: bake-bundler
197
- requirement: !ruby/object:Gem::Requirement
198
- requirements:
199
- - - ">="
200
- - !ruby/object:Gem::Version
201
- version: '0'
202
- type: :development
203
- prerelease: false
204
- version_requirements: !ruby/object:Gem::Requirement
205
- requirements:
206
- - - ">="
207
- - !ruby/object:Gem::Version
208
- version: '0'
209
- - !ruby/object:Gem::Dependency
210
- name: bake-modernize
211
- requirement: !ruby/object:Gem::Requirement
212
- requirements:
213
- - - ">="
214
- - !ruby/object:Gem::Version
215
- version: '0'
216
- type: :development
217
- prerelease: false
218
- version_requirements: !ruby/object:Gem::Requirement
219
- requirements:
220
- - - ">="
221
- - !ruby/object:Gem::Version
222
- version: '0'
223
195
  - !ruby/object:Gem::Dependency
224
196
  name: bundler
225
197
  requirement: !ruby/object:Gem::Requirement
@@ -290,8 +262,8 @@ dependencies:
290
262
  - - ">="
291
263
  - !ruby/object:Gem::Version
292
264
  version: '0'
293
- description:
294
- email:
265
+ description:
266
+ email:
295
267
  executables:
296
268
  - utopia
297
269
  extensions: []
@@ -350,7 +322,6 @@ files:
350
322
  - setup/server/git/hooks/post-receive
351
323
  - setup/site/.gitignore
352
324
  - setup/site/.rspec
353
- - setup/site/Gemfile
354
325
  - setup/site/Guardfile
355
326
  - setup/site/README.md
356
327
  - setup/site/bake.rb
@@ -358,6 +329,7 @@ files:
358
329
  - setup/site/config/README.md
359
330
  - setup/site/config/environment.rb
360
331
  - setup/site/falcon.rb
332
+ - setup/site/gems.rb
361
333
  - setup/site/lib/readme.txt
362
334
  - setup/site/pages/_heading.xnode
363
335
  - setup/site/pages/_page.xnode
@@ -378,7 +350,7 @@ licenses:
378
350
  - MIT
379
351
  metadata:
380
352
  funding_uri: https://github.com/sponsors/ioquatix/
381
- post_install_message:
353
+ post_install_message:
382
354
  rdoc_options: []
383
355
  require_paths:
384
356
  - lib
@@ -394,7 +366,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
394
366
  version: '0'
395
367
  requirements: []
396
368
  rubygems_version: 3.1.2
397
- signing_key:
369
+ signing_key:
398
370
  specification_version: 4
399
371
  summary: Utopia is a framework for building dynamic content-driven websites.
400
372
  test_files: []