nesta 0.12.0 → 0.14.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
- data/.github/workflows/tests.yml +21 -0
- data/.gitignore +1 -0
- data/.gitmodules +0 -6
- data/CHANGES +99 -0
- data/Gemfile.lock +43 -39
- data/LICENSE +1 -1
- data/README.md +9 -14
- data/RELEASING.md +9 -7
- data/Rakefile +2 -2
- data/bin/nesta +5 -2
- data/config/deploy.rb.sample +1 -1
- data/lib/nesta/app.rb +1 -2
- data/lib/nesta/commands/build.rb +38 -0
- data/lib/nesta/commands/demo/content.rb +8 -10
- data/lib/nesta/commands/edit.rb +2 -6
- data/lib/nesta/commands/new.rb +11 -12
- data/lib/nesta/commands/plugin/create.rb +7 -9
- data/lib/nesta/commands/template.rb +20 -0
- data/lib/nesta/commands/theme/create.rb +8 -8
- data/lib/nesta/commands/theme/enable.rb +3 -5
- data/lib/nesta/commands/theme/install.rb +6 -10
- data/lib/nesta/commands.rb +9 -0
- data/lib/nesta/config.rb +49 -75
- data/lib/nesta/config_file.rb +29 -0
- 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/system_command.rb +15 -0
- data/lib/nesta/version.rb +1 -1
- data/lib/nesta.rb +7 -4
- data/nesta.gemspec +5 -5
- 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/commands/demo/content_test.rb +8 -6
- data/test/integration/commands/edit_test.rb +4 -4
- data/test/integration/commands/new_test.rb +22 -51
- data/test/integration/commands/plugin/create_test.rb +7 -4
- data/test/integration/commands/theme/create_test.rb +8 -2
- data/test/integration/commands/theme/enable_test.rb +7 -1
- data/test/integration/commands/theme/install_test.rb +13 -9
- 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/test/unit/system_command_test.rb +20 -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 +44 -31
- data/.hound.yml +0 -2
- data/.rspec +0 -1
- data/.travis.yml +0 -11
- data/lib/nesta/commands/command.rb +0 -57
- data/test/support/silence_commands_during_tests.rb +0 -5
- data/test/unit/commands_test.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e14e3ed99700277225c068df787864f52f19385f08469d91bf1a8f4073e24568
|
4
|
+
data.tar.gz: 84e9c0fb31ba8b380b0ce86f9edc6f660fd8a8f9474ad28400e7c921fd745c01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e39c4ada00a1ac3b4be18b6887240a670d4f1c050023771dc71fa6703bbb315bac54f959053788dc7018761a5bfc3e1fe387486e856629a785ae3098c8203704
|
7
|
+
data.tar.gz: 4da9e195b6679df8c9f2c9ec3a07b780409b2a68f6cffe66feab9276a0ee90b987b7221a13d5f363c0b700c3d5b8d956e9b6a5753a0aa81058e1e10458ced75f
|
@@ -0,0 +1,21 @@
|
|
1
|
+
---
|
2
|
+
name: run-tests
|
3
|
+
|
4
|
+
on: [push, pull_request]
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
test:
|
8
|
+
strategy:
|
9
|
+
fail-fast: false
|
10
|
+
matrix:
|
11
|
+
ruby: ["2.7", "3.0", "3.1", "3.2", "head"]
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v3
|
15
|
+
- uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: ${{ matrix.ruby }}
|
18
|
+
bundler-cache: true
|
19
|
+
- run: bundle exec rake test
|
20
|
+
env:
|
21
|
+
REPORTER: default
|
data/.gitignore
CHANGED
data/.gitmodules
CHANGED
@@ -1,6 +0,0 @@
|
|
1
|
-
[submodule "test/fixtures/demo-content.git"]
|
2
|
-
path = test/fixtures/demo-content.git
|
3
|
-
url = https://github.com/gma/nesta-demo-content.git
|
4
|
-
[submodule "test/fixtures/nesta-theme-test"]
|
5
|
-
path = test/fixtures/nesta-theme-test.git
|
6
|
-
url = https://github.com/gma/nesta-theme-test.git
|
data/CHANGES
CHANGED
@@ -1,3 +1,102 @@
|
|
1
|
+
= 0.14.0 / (23 March 2023)
|
2
|
+
|
3
|
+
* Nesta can now be used as a Static Site Generator (SSG) with its new
|
4
|
+
`nesta build` command! Server Side Rendering (SSR) is still supported,
|
5
|
+
as is development with a local web server.
|
6
|
+
|
7
|
+
Back in the days when Heroku allowed us to deploy Nesta on their
|
8
|
+
platform for free, there really didn't seem to be any point in
|
9
|
+
converting a site to a bunch of static HTML and CSS files. If you
|
10
|
+
enabled the appropriate HTTP cache-control headers, Heroku would
|
11
|
+
automatically cache an entire site in memory, so there was no real
|
12
|
+
performance benefit. That's why Nesta never had SSG support, even
|
13
|
+
though everybody seemed to think it was cool.
|
14
|
+
|
15
|
+
But Heroku is not free any more. And there's a wide choice of hosting
|
16
|
+
platforms for static site generators. So why not?
|
17
|
+
|
18
|
+
See the docs for full details, but in short:
|
19
|
+
|
20
|
+
- If you run `bundle exec nesta build`, Nesta will generate a static
|
21
|
+
copy of your site in a ./dist directory.
|
22
|
+
|
23
|
+
- You might want to add ./dist to your .gitignore file.
|
24
|
+
|
25
|
+
- There are a couple of new config settings in config.yml.
|
26
|
+
|
27
|
+
- You can configure hosting platforms like Netlify, AWS Amplify,
|
28
|
+
Vercel (and others) to redeploy your site by running the build
|
29
|
+
command when you push changes to your git repository.
|
30
|
+
|
31
|
+
This was fun to implement. (Graham Ashton)
|
32
|
+
|
33
|
+
* Sass and SCSS files are now rendered with Dart Sass (the main implementation
|
34
|
+
of Sass). We had been using the (now deprecated) libsass library.
|
35
|
+
|
36
|
+
Sass has changed a bit since libsass was current, so you may need to make
|
37
|
+
some small changes to your stylesheets. Documentation that should help with
|
38
|
+
those changes can be found here:
|
39
|
+
|
40
|
+
https://sass-lang.com/documentation/breaking-changes
|
41
|
+
|
42
|
+
* Replace Nesta's custom template-locating code with Sinatra's #find_template
|
43
|
+
method. (Graham Ashton, suggested by Lilith River)
|
44
|
+
|
45
|
+
* Update multiple dependencies to fix security vulnerabilities; see commit
|
46
|
+
history for details. (Graham Ashton)
|
47
|
+
|
48
|
+
* Built-in support for configuring Nesta via environment variables has been
|
49
|
+
dropped. (Graham Ashton)
|
50
|
+
|
51
|
+
Should you still want to configure Nesta via the environment you can
|
52
|
+
use Erb in `config.yml`, like this:
|
53
|
+
|
54
|
+
some_value: <%= ENV.fetch('NESTA_VARIABLE') %>
|
55
|
+
|
56
|
+
* During a tidy up of the config file code, the `yaml_conf` attribute on
|
57
|
+
the Nesta::Config class has been renamed to `config`. This is unlikely
|
58
|
+
to affect you, but if it does just change the name. (Graham Ashton)
|
59
|
+
|
60
|
+
* The `yaml_path` attribute on the Nesta::Config class has been moved
|
61
|
+
to `Nesta::ConfigFile.path`. Again, I can't imagine why anybody would
|
62
|
+
have written code that used it, but it's a breaking change so I'm
|
63
|
+
mentioning it. (Graham Ashton)
|
64
|
+
|
65
|
+
* Support for loading plugins from a local directory (which was deprecated
|
66
|
+
in version 0.9.10) has been removed. (Graham Ashton)
|
67
|
+
|
68
|
+
* The local_stylesheet? helper method (deprecated in 0.9.1) has been
|
69
|
+
removed. (Graham Ashton)
|
70
|
+
|
71
|
+
* The breadcrumb_label helper method (deprecated in 0.9.3) has been removed.
|
72
|
+
(Graham Ashton)
|
73
|
+
|
74
|
+
= 0.13.0 / (28 September 2022)
|
75
|
+
|
76
|
+
* Update dependencies in order to support Ruby 3.0 and above.
|
77
|
+
(Graham Ashton)
|
78
|
+
|
79
|
+
* Upgrade multiple dependencies to fix security vulnerabilities.
|
80
|
+
(Graham Ashton)
|
81
|
+
|
82
|
+
* Switch Git repository URLs to HTTPS (fixes the demo:content command).
|
83
|
+
(Graham Ashton)
|
84
|
+
|
85
|
+
* Update dependency on Haml; Nesta currently requires a version lower
|
86
|
+
than 6.0. (Graham Ashton)
|
87
|
+
|
88
|
+
* Refactor: Extracted logic for running external processes into
|
89
|
+
a new `Nesta::SystemCommand` class. (Graham Ashton)
|
90
|
+
|
91
|
+
* Refactor: Created a new `Nesta::Commands::Template` class for
|
92
|
+
commands that create files from templates. (Graham Ashton)
|
93
|
+
|
94
|
+
* Refactor: Move logic for editing the config file from within Nesta's
|
95
|
+
commands into new `Nesta::ConfigFile` class. (Graham Ashton)
|
96
|
+
|
97
|
+
* Stopped the test suite from executing external commands during tests.
|
98
|
+
(Graham Ashton)
|
99
|
+
|
1
100
|
= 0.12.0 / (30 June 2020)
|
2
101
|
|
3
102
|
* Upgrade to Sinatra 2 and Rack 2. (Graham Ashton)
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nesta (0.
|
4
|
+
nesta (0.14.0)
|
5
5
|
RedCloth (~> 4.2)
|
6
|
-
haml (>= 3.1)
|
6
|
+
haml (>= 3.1, < 6.0)
|
7
7
|
haml-contrib (>= 1.0)
|
8
|
-
rack (~> 2
|
8
|
+
rack (~> 2)
|
9
|
+
rake
|
9
10
|
rdiscount (~> 2.1)
|
10
|
-
|
11
|
+
sass-embedded (~> 1.58)
|
11
12
|
sinatra (~> 2.0)
|
12
13
|
tilt (~> 2.0)
|
13
14
|
|
@@ -15,8 +16,8 @@ GEM
|
|
15
16
|
remote: https://rubygems.org/
|
16
17
|
specs:
|
17
18
|
RedCloth (4.3.2)
|
18
|
-
addressable (2.
|
19
|
-
public_suffix (>= 2.0.2, <
|
19
|
+
addressable (2.8.1)
|
20
|
+
public_suffix (>= 2.0.2, < 6.0)
|
20
21
|
ansi (1.5.0)
|
21
22
|
builder (3.2.4)
|
22
23
|
byebug (11.1.3)
|
@@ -27,21 +28,22 @@ GEM
|
|
27
28
|
rack (>= 1.0.0)
|
28
29
|
rack-test (>= 0.5.4)
|
29
30
|
xpath (>= 2.0, < 4.0)
|
30
|
-
ffi (1.
|
31
|
-
|
31
|
+
ffi (1.15.5)
|
32
|
+
google-protobuf (3.22.2)
|
33
|
+
haml (5.2.2)
|
32
34
|
temple (>= 0.8.0)
|
33
35
|
tilt
|
34
36
|
haml-contrib (1.0.0.1)
|
35
37
|
haml (>= 3.2.0.alpha.13)
|
36
|
-
kgio (2.11.
|
38
|
+
kgio (2.11.4)
|
37
39
|
listen (1.3.1)
|
38
40
|
rb-fsevent (>= 0.9.3)
|
39
41
|
rb-inotify (>= 0.9)
|
40
42
|
rb-kqueue (>= 0.2)
|
41
|
-
mini_mime (1.
|
42
|
-
mini_portile2 (2.
|
43
|
-
minitest (5.
|
44
|
-
minitest-reporters (1.
|
43
|
+
mini_mime (1.1.2)
|
44
|
+
mini_portile2 (2.8.1)
|
45
|
+
minitest (5.18.0)
|
46
|
+
minitest-reporters (1.6.0)
|
45
47
|
ansi
|
46
48
|
builder
|
47
49
|
minitest (>= 5.0)
|
@@ -51,36 +53,39 @@ GEM
|
|
51
53
|
rb-fsevent (>= 0.9)
|
52
54
|
rb-inotify (>= 0.8)
|
53
55
|
unicorn (>= 4.5)
|
54
|
-
mustermann (
|
56
|
+
mustermann (2.0.2)
|
55
57
|
ruby2_keywords (~> 0.0.1)
|
56
|
-
nokogiri (1.
|
57
|
-
mini_portile2 (~> 2.
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
nokogiri (1.14.2)
|
59
|
+
mini_portile2 (~> 2.8.0)
|
60
|
+
racc (~> 1.4)
|
61
|
+
public_suffix (5.0.1)
|
62
|
+
racc (1.6.2)
|
63
|
+
rack (2.2.6.4)
|
64
|
+
rack-protection (2.2.4)
|
61
65
|
rack
|
62
|
-
rack-test (
|
63
|
-
rack (>= 1.
|
64
|
-
raindrops (0.
|
65
|
-
rake (13.0.
|
66
|
-
rb-fsevent (0.
|
66
|
+
rack-test (2.0.2)
|
67
|
+
rack (>= 1.3)
|
68
|
+
raindrops (0.20.1)
|
69
|
+
rake (13.0.6)
|
70
|
+
rb-fsevent (0.11.2)
|
67
71
|
rb-inotify (0.10.1)
|
68
72
|
ffi (~> 1.0)
|
69
|
-
rb-kqueue (0.2.
|
73
|
+
rb-kqueue (0.2.8)
|
70
74
|
ffi (>= 0.5.0)
|
71
|
-
rdiscount (2.2.
|
72
|
-
ruby-progressbar (1.
|
73
|
-
ruby2_keywords (0.0.
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
rack
|
75
|
+
rdiscount (2.2.7)
|
76
|
+
ruby-progressbar (1.13.0)
|
77
|
+
ruby2_keywords (0.0.5)
|
78
|
+
sass-embedded (1.58.3)
|
79
|
+
google-protobuf (~> 3.21)
|
80
|
+
rake (>= 10.0.0)
|
81
|
+
sinatra (2.2.4)
|
82
|
+
mustermann (~> 2.0)
|
83
|
+
rack (~> 2.2)
|
84
|
+
rack-protection (= 2.2.4)
|
80
85
|
tilt (~> 2.0)
|
81
|
-
temple (0.
|
82
|
-
tilt (2.0
|
83
|
-
unicorn (
|
86
|
+
temple (0.10.0)
|
87
|
+
tilt (2.1.0)
|
88
|
+
unicorn (6.1.0)
|
84
89
|
kgio (~> 2.6)
|
85
90
|
raindrops (~> 0.7)
|
86
91
|
xpath (3.2.0)
|
@@ -96,7 +101,6 @@ DEPENDENCIES
|
|
96
101
|
minitest-reporters
|
97
102
|
mr-sparkle
|
98
103
|
nesta!
|
99
|
-
rake
|
100
104
|
|
101
105
|
BUNDLED WITH
|
102
|
-
2.
|
106
|
+
2.4.6
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Nesta - a CMS for Ruby Developers
|
2
2
|
|
3
|
-
A CMS for
|
3
|
+
A file-based CMS for web sites and blogs, written in [Sinatra][frank].
|
4
4
|
|
5
5
|
Content can be written in [Markdown][markdown] or [Textile][textile] and
|
6
6
|
stored in text files (though you can also use Haml if you need to add
|
@@ -44,9 +44,8 @@ full instructions).
|
|
44
44
|
## Support
|
45
45
|
|
46
46
|
There's plenty of information on <http://nestacms.com>. If you need some
|
47
|
-
help with anything
|
48
|
-
|
49
|
-
[mailing list]: http://nestacms.com/support
|
47
|
+
help with anything feel free to file an issue, or contact me on Mastodon
|
48
|
+
(@gma@hachyderm.io) or Twitter (@grahamashton).
|
50
49
|
|
51
50
|
If you like Nesta you can keep up with developments by following [@nestacms][]
|
52
51
|
on Twitter, and on [the blog][].
|
@@ -54,21 +53,17 @@ on Twitter, and on [the blog][].
|
|
54
53
|
[@nestacms]: http://twitter.com/nestacms
|
55
54
|
[the blog]: http://nestacms.com/blog
|
56
55
|
|
56
|
+

|
57
|
+
|
57
58
|
## Contributing
|
58
59
|
|
59
|
-
If you want to add a new feature, I recommend that you
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
good approach before you start.
|
60
|
+
If you want to add a new feature, I recommend that you file an issue to discuss
|
61
|
+
it before you start coding. I'm likely to suggest that we implement it as a
|
62
|
+
[plugin][] (to keep Nesta itself lean and simple), so you might save yourself
|
63
|
+
some time if we chat about a good approach before you start.
|
64
64
|
|
65
65
|
[plugin]: http://nestacms.com/docs/plugins
|
66
66
|
|
67
|
-
If you think you've found a bug, please bring that up on the [mailing
|
68
|
-
list][] too, rather than creating an issue on GitHub straight away.
|
69
|
-
You'll probably get a faster response on the mailing list, as I'm the
|
70
|
-
only person who'll see your new issue.
|
71
|
-
|
72
67
|
-- Graham ([@grahamashton][] on Twitter).
|
73
68
|
|
74
69
|
[@grahamashton]: http://twitter.com/grahamashton
|
data/RELEASING.md
CHANGED
@@ -3,19 +3,21 @@
|
|
3
3
|
When it comes time to release a new version of the Nesta gem, these are
|
4
4
|
the steps:
|
5
5
|
|
6
|
-
1.
|
6
|
+
1. Check the versions of Ruby used in `.github/workflows` are up to date. If
|
7
|
+
new Ruby versions need testing, update the config and re-run the build.
|
8
|
+
|
9
|
+
2. Bump the version number in `lib/nesta/version.rb`. This will cause
|
7
10
|
the version number in `Gemfile.lock` to be updated too, so regenerate
|
8
11
|
it now and check them in together.
|
9
12
|
|
10
|
-
|
13
|
+
3. Update the `CHANGES` file with a summary of significant changes since
|
11
14
|
the previous release.
|
12
15
|
|
13
|
-
|
14
|
-
Ruby versions need testing, update the config and re-run the Travis build.
|
16
|
+
4. Commit these changes with a commit message of 'Bump version to <version>'
|
15
17
|
|
16
|
-
|
18
|
+
5. Generate a new site with the `nesta` command, install the demo content,
|
17
19
|
check that it runs okay locally.
|
18
20
|
|
19
|
-
|
21
|
+
6. If everything seems fine, run `rake release`.
|
20
22
|
|
21
|
-
|
23
|
+
7. Publish an announcement blog post and email the list.
|
data/Rakefile
CHANGED
data/bin/nesta
CHANGED
@@ -24,6 +24,7 @@ COMMANDS
|
|
24
24
|
theme:install <url> Install a theme from a git repository.
|
25
25
|
theme:enable <name> Make the theme active, updating config.yml.
|
26
26
|
theme:create <name> Makes a template for a new theme in ./themes.
|
27
|
+
build [path] Build static copy of site (path defaults to ./dist)
|
27
28
|
|
28
29
|
OPTIONS FOR new
|
29
30
|
--git Create a new git repository for the project.
|
@@ -41,6 +42,7 @@ EOF
|
|
41
42
|
def self.parse_command_line
|
42
43
|
opts = GetoptLong.new(
|
43
44
|
['--bash-completion', GetoptLong::NO_ARGUMENT],
|
45
|
+
['--domain', GetoptLong::REQUIRED_ARGUMENT],
|
44
46
|
['--git', GetoptLong::NO_ARGUMENT],
|
45
47
|
['--help', '-h', GetoptLong::NO_ARGUMENT],
|
46
48
|
['--version', '-v', GetoptLong::NO_ARGUMENT],
|
@@ -91,7 +93,7 @@ EOF
|
|
91
93
|
rescue NameError
|
92
94
|
usage
|
93
95
|
else
|
94
|
-
command_cls.new(ARGV[0], options).execute
|
96
|
+
command_cls.new(ARGV[0], options).execute(Nesta::SystemCommand.new)
|
95
97
|
end
|
96
98
|
rescue RuntimeError => e
|
97
99
|
$stderr.puts "ERROR: #{e}"
|
@@ -118,7 +120,7 @@ _nesta() {
|
|
118
120
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
119
121
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
120
122
|
|
121
|
-
opts="new 'demo:content' edit 'plugin:create' 'theme:install' 'theme:enable' 'theme:create'"
|
123
|
+
opts="new 'demo:content' edit 'plugin:create' 'theme:install' 'theme:enable' 'theme:create' build"
|
122
124
|
|
123
125
|
case "${cur}" in
|
124
126
|
theme:*)
|
@@ -172,6 +174,7 @@ _1st_arguments=(
|
|
172
174
|
'theme\:install:Install a theme from a git repository'
|
173
175
|
'theme\:enable:Make the theme active, updating config.yml'
|
174
176
|
'theme\:create:Makes a template for a new theme in ./themes'
|
177
|
+
'build\:Build static copy of site'
|
175
178
|
)
|
176
179
|
|
177
180
|
local expl
|
data/config/deploy.rb.sample
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
set :application, "nesta"
|
2
|
-
set :repository, "
|
2
|
+
set :repository, "https://github.com/gma/nesta.git"
|
3
3
|
|
4
4
|
# Set :user if you want to connect (via ssh) to your server using a
|
5
5
|
# different username. You will also need to include the user in :domain
|
data/lib/nesta/app.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'sinatra/base'
|
2
2
|
require 'haml'
|
3
|
-
require 'sassc'
|
4
3
|
|
5
4
|
require File.expand_path('../nesta', File.dirname(__FILE__))
|
6
5
|
require File.expand_path('env', File.dirname(__FILE__))
|
@@ -18,6 +17,7 @@ module Nesta
|
|
18
17
|
set :root, Nesta::Env.root
|
19
18
|
set :views, File.expand_path('../../views', File.dirname(__FILE__))
|
20
19
|
set :haml, { format: :html5 }
|
20
|
+
set :public_folder, 'public'
|
21
21
|
|
22
22
|
helpers Overrides::Renderers
|
23
23
|
helpers Navigation::Renderers
|
@@ -90,5 +90,4 @@ module Nesta
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
-
Nesta::Plugin.load_local_plugins
|
94
93
|
Nesta::Plugin.initialize_plugins
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
require_relative '../static/assets'
|
4
|
+
require_relative '../static/site'
|
5
|
+
|
6
|
+
module Nesta
|
7
|
+
module Commands
|
8
|
+
class Build
|
9
|
+
DEFAULT_DESTINATION = "dist"
|
10
|
+
|
11
|
+
attr_accessor :domain
|
12
|
+
|
13
|
+
def initialize(build_dir = nil, options = {})
|
14
|
+
@build_dir = build_dir || DEFAULT_DESTINATION
|
15
|
+
if @build_dir == Nesta::App.settings.public_folder
|
16
|
+
raise RuntimeError.new("#{@build_dir} is already used, for assets")
|
17
|
+
end
|
18
|
+
@domain = options['domain'] || configured_domain_name
|
19
|
+
end
|
20
|
+
|
21
|
+
def configured_domain_name
|
22
|
+
Nesta::Config.build.fetch('domain', 'localhost')
|
23
|
+
end
|
24
|
+
|
25
|
+
def execute(process)
|
26
|
+
logger = Proc.new { |message| puts message }
|
27
|
+
site = Nesta::Static::Site.new(@build_dir, @domain, logger)
|
28
|
+
site.render_pages
|
29
|
+
site.render_not_found
|
30
|
+
site.render_atom_feed
|
31
|
+
site.render_sitemap
|
32
|
+
site.render_templated_assets
|
33
|
+
Nesta::Static::Assets.new(@build_dir, logger).copy_attachments
|
34
|
+
Nesta::Static::Assets.new(@build_dir, logger).copy_public_folder
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -1,12 +1,10 @@
|
|
1
|
-
require File.expand_path('
|
1
|
+
require File.expand_path('../../config_file', File.dirname(__FILE__))
|
2
2
|
|
3
3
|
module Nesta
|
4
4
|
module Commands
|
5
5
|
module Demo
|
6
6
|
class Content
|
7
|
-
|
8
|
-
|
9
|
-
@demo_repository = 'git://github.com/gma/nesta-demo-content.git'
|
7
|
+
@demo_repository = 'https://github.com/gma/nesta-demo-content.git'
|
10
8
|
class << self
|
11
9
|
attr_accessor :demo_repository
|
12
10
|
end
|
@@ -15,12 +13,12 @@ module Nesta
|
|
15
13
|
@dir = 'content-demo'
|
16
14
|
end
|
17
15
|
|
18
|
-
def clone_or_update_repository
|
16
|
+
def clone_or_update_repository(process)
|
19
17
|
path = Nesta::Path.local(@dir)
|
20
18
|
if File.exist?(path)
|
21
|
-
FileUtils.cd(path) {
|
19
|
+
FileUtils.cd(path) { process.run('git', 'pull', 'origin', 'master') }
|
22
20
|
else
|
23
|
-
|
21
|
+
process.run('git', 'clone', self.class.demo_repository, path)
|
24
22
|
end
|
25
23
|
end
|
26
24
|
|
@@ -45,10 +43,10 @@ module Nesta
|
|
45
43
|
end
|
46
44
|
end
|
47
45
|
|
48
|
-
def execute
|
49
|
-
clone_or_update_repository
|
46
|
+
def execute(process)
|
47
|
+
clone_or_update_repository(process)
|
50
48
|
configure_git_to_ignore_repo
|
51
|
-
|
49
|
+
Nesta::ConfigFile.new.set_value('content', @dir)
|
52
50
|
end
|
53
51
|
end
|
54
52
|
end
|
data/lib/nesta/commands/edit.rb
CHANGED
@@ -1,20 +1,16 @@
|
|
1
|
-
require File.expand_path('command', File.dirname(__FILE__))
|
2
|
-
|
3
1
|
module Nesta
|
4
2
|
module Commands
|
5
3
|
class Edit
|
6
|
-
include Command
|
7
|
-
|
8
4
|
def initialize(*args)
|
9
5
|
@filename = Nesta::Config.page_path(args.shift)
|
10
6
|
end
|
11
7
|
|
12
|
-
def execute
|
8
|
+
def execute(process)
|
13
9
|
editor = ENV.fetch('EDITOR')
|
14
10
|
rescue IndexError
|
15
11
|
$stderr.puts "No editor: set EDITOR environment variable"
|
16
12
|
else
|
17
|
-
|
13
|
+
process.run(editor, @filename)
|
18
14
|
end
|
19
15
|
end
|
20
16
|
end
|
data/lib/nesta/commands/new.rb
CHANGED
@@ -1,10 +1,6 @@
|
|
1
|
-
require File.expand_path('command', File.dirname(__FILE__))
|
2
|
-
|
3
1
|
module Nesta
|
4
2
|
module Commands
|
5
3
|
class New
|
6
|
-
include Command
|
7
|
-
|
8
4
|
def initialize(*args)
|
9
5
|
path = args.shift
|
10
6
|
options = args.shift || {}
|
@@ -26,18 +22,19 @@ module Nesta
|
|
26
22
|
@options['vlad']
|
27
23
|
end
|
28
24
|
|
29
|
-
def create_repository
|
25
|
+
def create_repository(process)
|
30
26
|
FileUtils.cd(@path) do
|
31
27
|
File.open('.gitignore', 'w') do |file|
|
32
|
-
|
28
|
+
lines = %w[._* .*.swp .bundle .DS_Store .sass-cache dist]
|
29
|
+
file.puts lines.join("\n")
|
33
30
|
end
|
34
|
-
|
35
|
-
|
36
|
-
|
31
|
+
process.run('git', 'init')
|
32
|
+
process.run('git', 'add', '.')
|
33
|
+
process.run('git', 'commit', '-m', 'Initial commit')
|
37
34
|
end
|
38
35
|
end
|
39
36
|
|
40
|
-
def execute
|
37
|
+
def execute(process)
|
41
38
|
make_directories
|
42
39
|
templates = {
|
43
40
|
'config.ru' => "#{@path}/config.ru",
|
@@ -49,8 +46,10 @@ module Nesta
|
|
49
46
|
if @options['vlad']
|
50
47
|
templates['config/deploy.rb'] = "#{@path}/config/deploy.rb"
|
51
48
|
end
|
52
|
-
|
53
|
-
|
49
|
+
templates.each do |src, dest|
|
50
|
+
Nesta::Commands::Template.new(src).copy_to(dest, binding)
|
51
|
+
end
|
52
|
+
create_repository(process) if @options['git']
|
54
53
|
end
|
55
54
|
end
|
56
55
|
end
|
@@ -1,11 +1,7 @@
|
|
1
|
-
require File.expand_path('../command', File.dirname(__FILE__))
|
2
|
-
|
3
1
|
module Nesta
|
4
2
|
module Commands
|
5
3
|
module Plugin
|
6
4
|
class Create
|
7
|
-
include Command
|
8
|
-
|
9
5
|
def initialize(*args)
|
10
6
|
name = args.shift
|
11
7
|
name.nil? && (raise UsageError.new('name not specified'))
|
@@ -54,9 +50,9 @@ module Nesta
|
|
54
50
|
File.join(@gem_name, path)
|
55
51
|
end
|
56
52
|
|
57
|
-
def execute
|
53
|
+
def execute(process)
|
58
54
|
make_directories
|
59
|
-
|
55
|
+
{
|
60
56
|
'plugins/README.md' => gem_path('README.md'),
|
61
57
|
'plugins/gitignore' => gem_path('.gitignore'),
|
62
58
|
'plugins/plugin.gemspec' => gem_path("#{@gem_name}.gemspec"),
|
@@ -65,10 +61,12 @@ module Nesta
|
|
65
61
|
'plugins/lib/version.rb' => gem_path("lib/#{@gem_name}/version.rb"),
|
66
62
|
'plugins/lib/init.rb' => gem_path("lib/#{@gem_name}/init.rb"),
|
67
63
|
'plugins/Rakefile' => gem_path('Rakefile')
|
68
|
-
|
64
|
+
}.each do |src, dest|
|
65
|
+
Nesta::Commands::Template.new(src).copy_to(dest, binding)
|
66
|
+
end
|
69
67
|
Dir.chdir(@gem_name) do
|
70
|
-
|
71
|
-
|
68
|
+
process.run('git', 'init')
|
69
|
+
process.run('git', 'add', '.')
|
72
70
|
end
|
73
71
|
end
|
74
72
|
|