nesta 0.13.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +1 -1
- data/.gitignore +1 -0
- data/CHANGES +73 -0
- data/Gemfile.lock +24 -22
- data/README.md +4 -2
- data/bin/nesta +4 -1
- data/lib/nesta/app.rb +1 -2
- data/lib/nesta/commands/build.rb +38 -0
- data/lib/nesta/commands/new.rb +2 -1
- data/lib/nesta/commands.rb +1 -0
- data/lib/nesta/config.rb +49 -75
- data/lib/nesta/config_file.rb +5 -1
- data/lib/nesta/helpers.rb +0 -5
- data/lib/nesta/models.rb +33 -34
- data/lib/nesta/navigation.rb +0 -5
- data/lib/nesta/overrides.rb +32 -43
- data/lib/nesta/plugin.rb +0 -16
- data/lib/nesta/static/assets.rb +50 -0
- data/lib/nesta/static/html_file.rb +26 -0
- data/lib/nesta/static/site.rb +104 -0
- data/lib/nesta/version.rb +1 -1
- data/lib/nesta.rb +1 -3
- data/nesta.gemspec +4 -4
- data/templates/config/config.yml +28 -2
- data/templates/themes/README.md +1 -1
- data/templates/themes/views/master.sass +1 -1
- data/test/integration/atom_feed_test.rb +1 -1
- data/test/integration/commands/build_test.rb +53 -0
- data/test/integration/overrides_test.rb +1 -1
- data/test/integration/sitemap_test.rb +1 -1
- data/test/support/temporary_files.rb +1 -1
- data/test/support/test_configuration.rb +2 -4
- data/test/unit/config_test.rb +25 -94
- data/test/unit/static/assets_test.rb +56 -0
- data/test/unit/static/html_file_test.rb +41 -0
- data/test/unit/static/site_test.rb +104 -0
- data/views/atom.haml +2 -2
- data/views/comments.haml +2 -2
- data/views/footer.haml +1 -1
- data/views/header.haml +2 -3
- data/views/layout.haml +2 -2
- data/views/master.sass +1 -1
- data/views/mixins.sass +2 -2
- data/views/normalize.scss +0 -1
- data/views/sitemap.haml +1 -1
- metadata +33 -25
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
require_relative '../../../lib/nesta/static/assets'
|
4
|
+
|
5
|
+
describe 'Assets' do
|
6
|
+
include TestConfiguration
|
7
|
+
|
8
|
+
after do
|
9
|
+
remove_temp_directory
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'is happy if attachments directory not present' do
|
13
|
+
in_temporary_project do |project_root|
|
14
|
+
stub_config('content' => File.join(project_root, 'content')) do
|
15
|
+
Nesta::Static::Assets.new('dist').copy_attachments
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'copies attachments into build directory' do
|
21
|
+
build_dir = 'dist'
|
22
|
+
attachment = 'image.jpeg'
|
23
|
+
|
24
|
+
in_temporary_project do |project_root|
|
25
|
+
stub_config('content' => File.join(project_root, 'content')) do
|
26
|
+
FileUtils.mkdir_p(Nesta::Config.attachment_path)
|
27
|
+
open(File.join(Nesta::Config.attachment_path, attachment), 'w')
|
28
|
+
|
29
|
+
Nesta::Static::Assets.new(build_dir).copy_attachments
|
30
|
+
|
31
|
+
assert_exists_in_project File.join(build_dir, 'attachments', attachment)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'is happy if public directory not present' do
|
37
|
+
in_temporary_project do |project_root|
|
38
|
+
Nesta::Static::Assets.new('dist').copy_public_folder
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'copies contents of public directory into build directory' do
|
43
|
+
build_dir = 'dist'
|
44
|
+
asset_path = File.join('css', 'third-party.css')
|
45
|
+
|
46
|
+
in_temporary_project do |project_root|
|
47
|
+
public_path = File.join(project_root, 'public')
|
48
|
+
FileUtils.mkdir_p(File.dirname(File.join(public_path, asset_path)))
|
49
|
+
open(File.join(public_path, asset_path), 'w')
|
50
|
+
|
51
|
+
Nesta::Static::Assets.new(build_dir).copy_public_folder
|
52
|
+
|
53
|
+
assert_exists_in_project File.join(build_dir, asset_path)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
require_relative '../../../lib/nesta/static/html_file'
|
4
|
+
|
5
|
+
describe 'HtmlFile' do
|
6
|
+
include ModelFactory
|
7
|
+
include TestConfiguration
|
8
|
+
|
9
|
+
after do
|
10
|
+
remove_temp_directory
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'determines HTML filename from build dir and page filename' do
|
14
|
+
build_dir = "dist"
|
15
|
+
|
16
|
+
with_temp_content_directory do
|
17
|
+
page = create(:page)
|
18
|
+
|
19
|
+
html_file = Nesta::Static::HtmlFile.new(build_dir, page)
|
20
|
+
|
21
|
+
expected = File.join(build_dir, "page-1.html")
|
22
|
+
assert_equal expected, html_file.filename
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'creates index.html in directory if page shares path with directory' do
|
27
|
+
build_dir = "dist"
|
28
|
+
|
29
|
+
with_temp_content_directory do
|
30
|
+
page = create(:page)
|
31
|
+
ext = File.extname(page.filename)
|
32
|
+
directory_path = page.filename.sub(/#{ext}$/, '')
|
33
|
+
FileUtils.mkdir(directory_path)
|
34
|
+
|
35
|
+
html_file = Nesta::Static::HtmlFile.new(build_dir, page)
|
36
|
+
|
37
|
+
expected = File.join(build_dir, "page-1", "index.html")
|
38
|
+
assert_equal expected, html_file.filename
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
require_relative '../../../lib/nesta/static/site'
|
4
|
+
|
5
|
+
describe 'Site' do
|
6
|
+
include ModelFactory
|
7
|
+
include TestConfiguration
|
8
|
+
|
9
|
+
after do
|
10
|
+
remove_temp_directory
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'converts Markdown to HTML' do
|
14
|
+
build_dir = 'dist'
|
15
|
+
domain = 'localhost'
|
16
|
+
|
17
|
+
in_temporary_project do
|
18
|
+
with_temp_content_directory do
|
19
|
+
page = create(:page)
|
20
|
+
|
21
|
+
Nesta::Static::Site.new(build_dir, domain).render_pages
|
22
|
+
|
23
|
+
html_file = File.join(build_dir, page.abspath + '.html')
|
24
|
+
markup = open(html_file).read
|
25
|
+
|
26
|
+
assert markup.include?("<title>#{page.title}</title>")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'renders a 404 not found page' do
|
32
|
+
build_dir = 'dist'
|
33
|
+
domain = 'localhost'
|
34
|
+
|
35
|
+
in_temporary_project do
|
36
|
+
with_temp_content_directory do
|
37
|
+
Nesta::Static::Site.new(build_dir, domain).render_not_found
|
38
|
+
|
39
|
+
html_file = File.join(build_dir, '404.html')
|
40
|
+
markup = open(html_file).read
|
41
|
+
|
42
|
+
assert markup.include?("<h1>Page not found</h1>")
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'renders Atom feed' do
|
48
|
+
build_dir = 'dist'
|
49
|
+
domain = 'mysite.com'
|
50
|
+
|
51
|
+
in_temporary_project do
|
52
|
+
with_temp_content_directory do
|
53
|
+
article = create(:article)
|
54
|
+
Nesta::Static::Site.new(build_dir, domain).render_atom_feed
|
55
|
+
|
56
|
+
xml_file = File.join(build_dir, 'articles.xml')
|
57
|
+
xml = open(xml_file).read
|
58
|
+
|
59
|
+
assert xml.include?("<link href='https://#{domain + article.abspath}'")
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'includes domain name in sitemap' do
|
65
|
+
build_dir = 'dist'
|
66
|
+
domain = 'mysite.com'
|
67
|
+
|
68
|
+
in_temporary_project do
|
69
|
+
with_temp_content_directory do
|
70
|
+
page = create(:page)
|
71
|
+
Nesta::Static::Site.new(build_dir, domain).render_sitemap
|
72
|
+
|
73
|
+
xml_file = File.join(build_dir, 'sitemap.xml')
|
74
|
+
xml = open(xml_file).read
|
75
|
+
|
76
|
+
assert xml.include?(domain + page.abspath)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
it "renders the user's list of templated assets" do
|
82
|
+
build_dir = 'dist'
|
83
|
+
css_path = '/css/styles.css'
|
84
|
+
build_config = {}
|
85
|
+
|
86
|
+
in_temporary_project do
|
87
|
+
stub_config('build' => { 'templated_assets' => [css_path] }) do
|
88
|
+
views = File.join(project_root, 'views')
|
89
|
+
FileUtils.mkdir_p(views)
|
90
|
+
open(File.join(views, 'styles.sass'), 'w') do |sass|
|
91
|
+
sass.write("p\n font-size: 1em\n")
|
92
|
+
end
|
93
|
+
|
94
|
+
site = Nesta::Static::Site.new(build_dir, 'mysite.com')
|
95
|
+
site.render_templated_assets
|
96
|
+
|
97
|
+
css_file = File.join(build_dir, css_path)
|
98
|
+
assert_exists_in_project(css_file)
|
99
|
+
|
100
|
+
assert_equal open(css_file).read, "p {\n font-size: 1em;\n}"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
data/views/atom.haml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
!!! XML
|
2
|
-
%feed(xmlns='
|
2
|
+
%feed(xmlns='https://www.w3.org/2005/Atom')
|
3
3
|
%title(type='text')= @title
|
4
|
-
%generator(uri='
|
4
|
+
%generator(uri='https://nestacms.com') Nesta
|
5
5
|
%id= atom_id
|
6
6
|
%link(href="#{path_to('/articles.xml', :uri => true)}" rel='self')
|
7
7
|
%link(href="#{path_to('/', :uri => true)}" rel='alternate')
|
data/views/comments.haml
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
- if Sinatra::Application.environment == :development
|
4
4
|
:javascript
|
5
5
|
var disqus_developer = true;
|
6
|
-
%script{:type => 'text/javascript', :src => "
|
6
|
+
%script{:type => 'text/javascript', :src => "https://#{short_name}.disqus.com/embed.js", :async => true}
|
7
7
|
|
8
8
|
%noscript
|
9
|
-
%a(href="
|
9
|
+
%a(href="https://#{short_name}.disqus.com/embed.js?url=ref") View comments.
|
data/views/footer.haml
CHANGED
data/views/header.haml
CHANGED
data/views/layout.haml
CHANGED
@@ -8,13 +8,13 @@
|
|
8
8
|
- if @keywords
|
9
9
|
%meta(name="keywords" content=@keywords)
|
10
10
|
%title= @title
|
11
|
-
%link(href='
|
11
|
+
%link(href='//fonts.googleapis.com/css?family=Roboto+Slab:400,700' rel='stylesheet' type='text/css')
|
12
12
|
<!--[if ! lte IE 6]><!-->
|
13
13
|
%link(href="#{path_to('/css/master.css')}" media="screen" rel="stylesheet")
|
14
14
|
- local_stylesheet_link_tag('local')
|
15
15
|
<!--<![endif]-->
|
16
16
|
/[if lte IE 6]
|
17
|
-
%link(rel="stylesheet" href="
|
17
|
+
%link(rel="stylesheet" href="//universal-ie6-css.googlecode.com/files/ie6.1.1.css" media="screen, projection")
|
18
18
|
/[if lt IE 9]
|
19
19
|
%script(src="//html5shim.googlecode.com/svn/trunk/html5.js")
|
20
20
|
%script(src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.1.0/respond.min.js")
|
data/views/master.sass
CHANGED
data/views/mixins.sass
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
// Default ratios between font sizes; used to maintain the type hierarchy.
|
2
|
-
//
|
2
|
+
// https://www.markboulton.co.uk/journal/comments/five-simple-steps-to-better-typography-part-4
|
3
3
|
|
4
4
|
$size5: 2.18em
|
5
5
|
$size4: 1.64em
|
@@ -23,7 +23,7 @@ $nav-link-color: desaturate(lighten($link-color, 10%), 25%)
|
|
23
23
|
$meta-color: #87877D
|
24
24
|
|
25
25
|
@function empx($em, $base: 16px)
|
26
|
-
@return ($em / 1em) * $base
|
26
|
+
@return calc($em / 1em) * $base
|
27
27
|
|
28
28
|
// Layout settings
|
29
29
|
|
data/views/normalize.scss
CHANGED
data/views/sitemap.haml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nesta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Graham Ashton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: haml
|
@@ -50,14 +50,28 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '2
|
53
|
+
version: '2'
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: '2
|
60
|
+
version: '2'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rake
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
61
75
|
- !ruby/object:Gem::Dependency
|
62
76
|
name: rdiscount
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -87,19 +101,19 @@ dependencies:
|
|
87
101
|
- !ruby/object:Gem::Version
|
88
102
|
version: '4.2'
|
89
103
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
104
|
+
name: sass-embedded
|
91
105
|
requirement: !ruby/object:Gem::Requirement
|
92
106
|
requirements:
|
93
|
-
- - "
|
107
|
+
- - "~>"
|
94
108
|
- !ruby/object:Gem::Version
|
95
|
-
version: '
|
109
|
+
version: '1.58'
|
96
110
|
type: :runtime
|
97
111
|
prerelease: false
|
98
112
|
version_requirements: !ruby/object:Gem::Requirement
|
99
113
|
requirements:
|
100
|
-
- - "
|
114
|
+
- - "~>"
|
101
115
|
- !ruby/object:Gem::Version
|
102
|
-
version: '
|
116
|
+
version: '1.58'
|
103
117
|
- !ruby/object:Gem::Dependency
|
104
118
|
name: sinatra
|
105
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,20 +212,6 @@ dependencies:
|
|
198
212
|
- - ">="
|
199
213
|
- !ruby/object:Gem::Version
|
200
214
|
version: '0'
|
201
|
-
- !ruby/object:Gem::Dependency
|
202
|
-
name: rake
|
203
|
-
requirement: !ruby/object:Gem::Requirement
|
204
|
-
requirements:
|
205
|
-
- - ">="
|
206
|
-
- !ruby/object:Gem::Version
|
207
|
-
version: '0'
|
208
|
-
type: :development
|
209
|
-
prerelease: false
|
210
|
-
version_requirements: !ruby/object:Gem::Requirement
|
211
|
-
requirements:
|
212
|
-
- - ">="
|
213
|
-
- !ruby/object:Gem::Version
|
214
|
-
version: '0'
|
215
215
|
description: |
|
216
216
|
Nesta is a lightweight Content Management System, written in Ruby using
|
217
217
|
the Sinatra web framework. Nesta has the simplicity of a static site
|
@@ -248,6 +248,7 @@ files:
|
|
248
248
|
- lib/nesta.rb
|
249
249
|
- lib/nesta/app.rb
|
250
250
|
- lib/nesta/commands.rb
|
251
|
+
- lib/nesta/commands/build.rb
|
251
252
|
- lib/nesta/commands/demo.rb
|
252
253
|
- lib/nesta/commands/demo/content.rb
|
253
254
|
- lib/nesta/commands/edit.rb
|
@@ -268,6 +269,9 @@ files:
|
|
268
269
|
- lib/nesta/overrides.rb
|
269
270
|
- lib/nesta/path.rb
|
270
271
|
- lib/nesta/plugin.rb
|
272
|
+
- lib/nesta/static/assets.rb
|
273
|
+
- lib/nesta/static/html_file.rb
|
274
|
+
- lib/nesta/static/site.rb
|
271
275
|
- lib/nesta/system_command.rb
|
272
276
|
- lib/nesta/version.rb
|
273
277
|
- nesta.gemspec
|
@@ -298,6 +302,7 @@ files:
|
|
298
302
|
- test/fixtures/nesta-plugin-test/lib/nesta-plugin-test/version.rb
|
299
303
|
- test/fixtures/nesta-plugin-test/nesta-plugin-test.gemspec
|
300
304
|
- test/integration/atom_feed_test.rb
|
305
|
+
- test/integration/commands/build_test.rb
|
301
306
|
- test/integration/commands/demo/content_test.rb
|
302
307
|
- test/integration/commands/edit_test.rb
|
303
308
|
- test/integration/commands/new_test.rb
|
@@ -320,6 +325,9 @@ files:
|
|
320
325
|
- test/unit/page_test.rb
|
321
326
|
- test/unit/path_test.rb
|
322
327
|
- test/unit/plugin_test.rb
|
328
|
+
- test/unit/static/assets_test.rb
|
329
|
+
- test/unit/static/html_file_test.rb
|
330
|
+
- test/unit/static/site_test.rb
|
323
331
|
- test/unit/system_command_test.rb
|
324
332
|
- views/analytics.haml
|
325
333
|
- views/atom.haml
|
@@ -340,7 +348,7 @@ files:
|
|
340
348
|
- views/sidebar.haml
|
341
349
|
- views/sitemap.haml
|
342
350
|
- views/summaries.haml
|
343
|
-
homepage:
|
351
|
+
homepage: https://nestacms.com
|
344
352
|
licenses: []
|
345
353
|
metadata: {}
|
346
354
|
post_install_message:
|
@@ -358,7 +366,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
358
366
|
- !ruby/object:Gem::Version
|
359
367
|
version: '0'
|
360
368
|
requirements: []
|
361
|
-
rubygems_version: 3.
|
369
|
+
rubygems_version: 3.4.6
|
362
370
|
signing_key:
|
363
371
|
specification_version: 4
|
364
372
|
summary: Ruby CMS, written in Sinatra
|