Skip to content

Commit 1fb89b4

Browse files
committed
[TP-198470] Minimal changes for nanoc v3 -> v4 migration to get the site up and running.
1 parent 02a9b6b commit 1fb89b4

4 files changed

Lines changed: 18 additions & 8 deletions

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ smart enough not to try to compile unchanged files:
105105
You can setup whatever you want to view the files. If you have the adsf
106106
gem, however (I hope so, it was in the Gemfile), you can start Webrick:
107107

108-
$ nanoc view
108+
$ nanoc view -p [port]
109+
110+
You can provide a port number other than 3000 if you don't want to have to
111+
stop an existing (SCF?) rails instance. eg. "-p 3030" will allow viewing on
112+
port 3030.
109113

110114
Compilation times got you down? Use `autocompile`!
111115

Rules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ compile '*' do
3636
end
3737

3838
route '/static/*' do
39-
item.identifier[7..-2]
39+
item.identifier.to_s.sub(/\A\/static/, '')
4040
end
4141

4242
route '/CNAME/' do

config.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ index_filenames: [ 'index.html' ]
1919
# before and after the last site compilation.
2020
enable_output_diff: false
2121

22+
# Required for Nanoc3->4
23+
string_pattern_type: legacy
24+
2225
# The data sources where nanoc loads its data from. This is an array of
2326
# hashes; each array element represents a single data source. By default,
2427
# there is only a single data source that reads data from the “content/” and
@@ -27,7 +30,8 @@ data_sources:
2730
-
2831
# The type is the identifier of the data source. By default, this will be
2932
# `filesystem_unified`.
30-
type: filesystem_unified
33+
type: filesystem
34+
identifier_type: legacy
3135

3236
# The path where items should be mounted (comparable to mount points in
3337
# Unix-like systems). This is “/” by default, meaning that items will have
@@ -41,5 +45,7 @@ data_sources:
4145
layouts_root: /
4246

4347
-
44-
type: static
48+
type: filesystem
4549
items_root: /static
50+
content_dir: 'static'
51+
layouts_dir: null

lib/static.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
require 'digest/sha1'
22

3-
module Nanoc3::DataSources
3+
module Nanoc::DataSources
44

5-
class Static < Nanoc3::DataSource
5+
class Static < Nanoc::DataSource
66

77
identifier :static
88

@@ -19,12 +19,12 @@ def items
1919
:extension => File.extname(filename)[1..-1],
2020
:filename => filename,
2121
}
22-
identifier = filename[(prefix.length+1)..-1] + '/'
22+
identifier = Nano::Identifier.new(filename[(prefix.length+1)..-1] + '/', type: :legacy)
2323

2424
mtime = File.mtime(filename)
2525
checksum = checksum_for(filename)
2626

27-
Nanoc3::Item.new(
27+
new_item(
2828
filename,
2929
attributes,
3030
identifier,

0 commit comments

Comments
 (0)