Skip to content

Commit adcade5

Browse files
authored
Merge pull request #91 from SeeClickFix/sawyer/update/tp-198470-update-nanoc-to-v4
[TP-198470] Update to Nanoc v4
2 parents 029357c + 1fb89b4 commit adcade5

8 files changed

Lines changed: 109 additions & 29 deletions

File tree

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4.1
1+
3.1.4

.tool-versions

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ruby 3.1.4

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ gem 'builder'
44
gem 'coderay'
55
gem 'kramdown', '~> 2.3.1'
66
gem 'mime-types', '~> 1.16'
7-
gem 'nanoc', '~> 3.7.3'
7+
gem 'nanoc', '~> 4'
88
gem 'nokogiri'
99
gem 'pygments.rb'
1010
gem 'rake', '~> 12.3.3'
1111
gem 'yajl-ruby'
12+
gem 'webrick'
1213

1314
group :development do
1415
gem 'adsf'

Gemfile.lock

Lines changed: 87 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,96 @@
11
GEM
22
remote: http://rubygems.org/
33
specs:
4-
adsf (1.4.2)
5-
rack (>= 1.0.0, < 3.0.0)
6-
builder (3.2.3)
7-
coderay (1.1.2)
8-
cri (2.15.9)
4+
addressable (2.8.7)
5+
public_suffix (>= 2.0.2, < 7.0)
6+
adsf (1.5.2)
7+
rack (>= 1.0.0, < 4.0.0)
8+
rackup (~> 2.1)
9+
base64 (0.2.0)
10+
builder (3.3.0)
11+
coderay (1.1.3)
12+
colored (1.2)
13+
concurrent-ruby (1.3.5)
14+
cri (2.15.12)
15+
ddmetrics (1.1.0)
16+
ddplugin (1.0.3)
17+
diff-lcs (1.5.1)
918
fssm (0.2.10)
10-
kramdown (2.3.1)
19+
immutable-ruby (0.2.0)
20+
concurrent-ruby (~> 1.1)
21+
sorted_set (~> 1.0)
22+
json_schema (0.21.0)
23+
kramdown (2.3.2)
1124
rexml
25+
memo_wise (1.10.0)
26+
method_source (1.1.0)
1227
mime-types (1.25.1)
13-
mini_portile2 (2.8.0)
14-
multi_json (1.14.1)
15-
nanoc (3.7.5)
16-
cri (~> 2.3)
17-
nokogiri (1.13.6)
18-
mini_portile2 (~> 2.8.0)
28+
mini_portile2 (2.8.8)
29+
nanoc (4.13.3)
30+
addressable (~> 2.5)
31+
colored (~> 1.2)
32+
nanoc-checking (~> 1.0, >= 1.0.2)
33+
nanoc-cli (= 4.13.3)
34+
nanoc-core (= 4.13.3)
35+
nanoc-deploying (~> 1.0)
36+
parallel (~> 1.12)
37+
tty-command (~> 0.8)
38+
tty-which (~> 0.4)
39+
nanoc-checking (1.0.5)
40+
nanoc-cli (~> 4.12, >= 4.12.5)
41+
nanoc-core (~> 4.12, >= 4.12.5)
42+
nanoc-cli (4.13.3)
43+
cri (~> 2.15)
44+
diff-lcs (~> 1.3)
45+
nanoc-core (= 4.13.3)
46+
pry
47+
zeitwerk (~> 2.1)
48+
nanoc-core (4.13.3)
49+
base64 (~> 0.2)
50+
concurrent-ruby (~> 1.1)
51+
ddmetrics (~> 1.0)
52+
ddplugin (~> 1.0)
53+
immutable-ruby (~> 0.1)
54+
json_schema (~> 0.19)
55+
memo_wise (~> 1.5)
56+
slow_enumerator_tools (~> 1.0)
57+
tty-platform (~> 0.2)
58+
zeitwerk (~> 2.1)
59+
nanoc-deploying (1.0.2)
60+
nanoc-checking (~> 1.0)
61+
nanoc-cli (~> 4.11, >= 4.11.15)
62+
nanoc-core (~> 4.11, >= 4.11.15)
63+
nokogiri (1.18.1)
64+
mini_portile2 (~> 2.8.2)
1965
racc (~> 1.4)
20-
pygments.rb (1.2.1)
21-
multi_json (>= 1.0.0)
22-
racc (1.6.0)
23-
rack (2.2.3.1)
66+
parallel (1.26.3)
67+
pastel (0.8.0)
68+
tty-color (~> 0.5)
69+
pry (0.15.2)
70+
coderay (~> 1.1)
71+
method_source (~> 1.0)
72+
public_suffix (6.0.1)
73+
pygments.rb (3.0.0)
74+
racc (1.8.1)
75+
rack (3.1.8)
76+
rackup (2.2.1)
77+
rack (>= 3)
2478
rake (12.3.3)
25-
rexml (3.2.5)
79+
rbtree (0.4.6)
80+
rexml (3.4.0)
81+
set (1.1.1)
82+
slow_enumerator_tools (1.1.0)
83+
sorted_set (1.0.3)
84+
rbtree
85+
set (~> 1.0)
86+
tty-color (0.6.0)
87+
tty-command (0.10.1)
88+
pastel (~> 0.8)
89+
tty-platform (0.3.0)
90+
tty-which (0.5.0)
91+
webrick (1.9.1)
2692
yajl-ruby (1.4.3)
93+
zeitwerk (2.6.18)
2794

2895
PLATFORMS
2996
ruby
@@ -35,11 +102,12 @@ DEPENDENCIES
35102
fssm
36103
kramdown (~> 2.3.1)
37104
mime-types (~> 1.16)
38-
nanoc (~> 3.7.3)
105+
nanoc (~> 4)
39106
nokogiri
40107
pygments.rb
41108
rake (~> 12.3.3)
109+
webrick
42110
yajl-ruby
43111

44112
BUNDLED WITH
45-
1.16.2
113+
2.2.33

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)