nesta 0.11.1 → 0.13.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 +5 -5
- data/.github/workflows/tests.yml +21 -0
- data/.gitmodules +0 -0
- data/CHANGES +44 -2
- data/Gemfile +1 -1
- data/Gemfile.lock +73 -55
- data/LICENSE +1 -1
- data/README.md +7 -14
- data/RELEASING.md +10 -9
- data/Rakefile +20 -3
- data/bin/nesta +1 -1
- data/config/deploy.rb.sample +1 -1
- data/lib/nesta/app.rb +4 -8
- data/lib/nesta/commands/demo/content.rb +28 -12
- data/lib/nesta/commands/edit.rb +2 -6
- data/lib/nesta/commands/new.rb +9 -11
- 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 +12 -14
- data/lib/nesta/commands.rb +8 -0
- data/lib/nesta/config_file.rb +25 -0
- data/lib/nesta/helpers.rb +14 -0
- data/lib/nesta/models.rb +26 -22
- data/lib/nesta/navigation.rb +1 -1
- data/lib/nesta/system_command.rb +15 -0
- data/lib/nesta/version.rb +1 -1
- data/lib/nesta.rb +6 -1
- data/nesta.gemspec +11 -12
- data/templates/config/config.yml +1 -1
- data/{spec → test}/fixtures/nesta-plugin-test/Gemfile +0 -0
- data/{spec → test}/fixtures/nesta-plugin-test/Rakefile +0 -0
- data/{spec → test}/fixtures/nesta-plugin-test/lib/nesta-plugin-test/init.rb +0 -0
- data/{spec → test}/fixtures/nesta-plugin-test/lib/nesta-plugin-test/version.rb +0 -0
- data/{spec → test}/fixtures/nesta-plugin-test/lib/nesta-plugin-test.rb +0 -0
- data/{spec → test}/fixtures/nesta-plugin-test/nesta-plugin-test.gemspec +0 -0
- data/test/integration/atom_feed_test.rb +178 -0
- data/test/integration/commands/demo/content_test.rb +33 -0
- data/test/integration/commands/edit_test.rb +21 -0
- data/test/integration/commands/new_test.rb +91 -0
- data/test/integration/commands/plugin/create_test.rb +131 -0
- data/test/integration/commands/theme/create_test.rb +41 -0
- data/test/integration/commands/theme/enable_test.rb +28 -0
- data/test/integration/commands/theme/install_test.rb +66 -0
- data/test/integration/default_theme_test.rb +220 -0
- data/test/integration/overrides_test.rb +118 -0
- data/test/integration/route_handlers_test.rb +96 -0
- data/test/integration/sitemap_test.rb +85 -0
- data/test/integration_test_helper.rb +61 -0
- data/test/support/model_factory.rb +169 -0
- data/test/support/temporary_files.rb +33 -0
- data/test/support/test_configuration.rb +19 -0
- data/test/test_helper.rb +26 -0
- data/test/unit/config_test.rb +138 -0
- data/test/unit/file_model_test.rb +71 -0
- data/test/unit/menu_test.rb +82 -0
- data/test/unit/page_test.rb +571 -0
- data/test/unit/path_test.rb +41 -0
- data/test/unit/plugin_test.rb +47 -0
- data/test/unit/system_command_test.rb +20 -0
- data/views/master.sass +1 -1
- metadata +90 -89
- data/.hound.yml +0 -2
- data/.rspec +0 -1
- data/.travis.yml +0 -6
- data/lib/nesta/commands/command.rb +0 -58
- data/smoke-test.sh +0 -107
- data/spec/atom_spec.rb +0 -141
- data/spec/commands/demo/content_spec.rb +0 -65
- data/spec/commands/edit_spec.rb +0 -27
- data/spec/commands/new_spec.rb +0 -88
- data/spec/commands/plugin/create_spec.rb +0 -97
- data/spec/commands/system_spec.rb +0 -25
- data/spec/commands/theme/create_spec.rb +0 -41
- data/spec/commands/theme/enable_spec.rb +0 -44
- data/spec/commands/theme/install_spec.rb +0 -56
- data/spec/config_spec.rb +0 -127
- data/spec/model_factory.rb +0 -92
- data/spec/models_spec.rb +0 -700
- data/spec/overrides_spec.rb +0 -132
- data/spec/page_spec.rb +0 -560
- data/spec/path_spec.rb +0 -28
- data/spec/plugin_spec.rb +0 -51
- data/spec/sitemap_spec.rb +0 -105
- data/spec/spec_helper.rb +0 -114
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e80fef7e8fe518a674eb7527d91410d162fca8288985971e641a3329ae192eef
|
4
|
+
data.tar.gz: bc6f671dc4f0ae10b403fa53b489f06c74ae8e9c6560ae49e08dc2518185dc22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 857872073a0ea318df15323bd0f9a64de0104106b45c0c749a2261e266866abc0dd38f475fa98de07fb9cb09ee41411b837ec91a1e7d581bb1924f697557184d
|
7
|
+
data.tar.gz: 828a24e35350cfae15ff093f42a67a6ee33faf48435b0e0d9ff831e3e5a1592b2e22db2910442eb39adc7642f5b3f451224dcf8f49fcc11d7a062e7a48f4b47c
|
@@ -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", "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/.gitmodules
ADDED
File without changes
|
data/CHANGES
CHANGED
@@ -1,3 +1,45 @@
|
|
1
|
+
= 0.13.0 / (28 September 2022)
|
2
|
+
|
3
|
+
* Update dependencies in order to support Ruby 3.0 and above.
|
4
|
+
(Graham Ashton)
|
5
|
+
|
6
|
+
* Upgrade multiple dependencies to fix security vulnerabilities.
|
7
|
+
(Graham Ashton)
|
8
|
+
|
9
|
+
* Switch Git repository URLs to HTTPS (fixes the demo:content command).
|
10
|
+
(Graham Ashton)
|
11
|
+
|
12
|
+
* Update dependency on Haml; Nesta currently requires a version lower
|
13
|
+
than 6.0. (Graham Ashton)
|
14
|
+
|
15
|
+
* Refactor: Extracted logic for running external processes into
|
16
|
+
a new `Nesta::SystemCommand` class. (Graham Ashton)
|
17
|
+
|
18
|
+
* Refactor: Created a new `Nesta::Commands::Template` class for
|
19
|
+
commands that create files from templates. (Graham Ashton)
|
20
|
+
|
21
|
+
* Refactor: Move logic for editing the config file from within Nesta's
|
22
|
+
commands into new `Nesta::ConfigFile` class. (Graham Ashton)
|
23
|
+
|
24
|
+
* Stopped the test suite from executing external commands during tests.
|
25
|
+
(Graham Ashton)
|
26
|
+
|
27
|
+
= 0.12.0 / (30 June 2020)
|
28
|
+
|
29
|
+
* Upgrade to Sinatra 2 and Rack 2. (Graham Ashton)
|
30
|
+
|
31
|
+
* Upgrade from tilt 1.4 to 2.0. (Graham Ashton)
|
32
|
+
|
33
|
+
* Replace the deprecated sass gem with sassc. (Brad Weslake)
|
34
|
+
|
35
|
+
* Port the test suite from RSpec and Webrat to Minitest and Capybara.
|
36
|
+
(Graham Ashton)
|
37
|
+
|
38
|
+
* Silence deprecation warnings produced under Ruby 2.7. (Graham Ashton)
|
39
|
+
|
40
|
+
* Stop running the test suite under Ruby 2.3 and 2.4, both of which
|
41
|
+
have reached end-of-life. (Graham Ashton)
|
42
|
+
|
1
43
|
= 0.11.1 / (26 March 2015)
|
2
44
|
|
3
45
|
* Tighten dependency on Tilt, as version 2.x is incompatible.
|
@@ -288,7 +330,7 @@
|
|
288
330
|
* Bug fix: The Sinatra app's root directory wasn't set which meant
|
289
331
|
that Nesta couldn't always find the ./public directory (such as when
|
290
332
|
running on Heroku).
|
291
|
-
|
333
|
+
|
292
334
|
The modifications made in 0.9.6 to make Nesta easier to mount inside
|
293
335
|
another Rack application moved Nesta::App.root to the (new)
|
294
336
|
Nesta::Env class. In 0.9.6 I forgot to actually set Nesta::App.root
|
@@ -360,7 +402,7 @@
|
|
360
402
|
|
361
403
|
= 0.9.3 / 18 January 2011
|
362
404
|
|
363
|
-
* The route and view for serving the home page (/) has been removed,
|
405
|
+
* The route and view for serving the home page (/) has been removed,
|
364
406
|
and the home page must now be created as an index page in
|
365
407
|
content/pages.
|
366
408
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,86 +1,104 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nesta (0.
|
4
|
+
nesta (0.13.0)
|
5
5
|
RedCloth (~> 4.2)
|
6
|
-
haml (>= 3.1)
|
6
|
+
haml (>= 3.1, < 6.0)
|
7
7
|
haml-contrib (>= 1.0)
|
8
|
-
rack (
|
8
|
+
rack (~> 2.0)
|
9
9
|
rdiscount (~> 2.1)
|
10
|
-
|
11
|
-
sinatra (~>
|
12
|
-
tilt (~>
|
10
|
+
sassc (>= 2.2)
|
11
|
+
sinatra (~> 2.0)
|
12
|
+
tilt (~> 2.0)
|
13
13
|
|
14
14
|
GEM
|
15
|
-
remote:
|
15
|
+
remote: https://rubygems.org/
|
16
16
|
specs:
|
17
|
-
RedCloth (4.2
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
RedCloth (4.3.2)
|
18
|
+
addressable (2.8.1)
|
19
|
+
public_suffix (>= 2.0.2, < 6.0)
|
20
|
+
ansi (1.5.0)
|
21
|
+
builder (3.2.4)
|
22
|
+
byebug (11.1.3)
|
23
|
+
capybara (2.18.0)
|
24
|
+
addressable
|
25
|
+
mini_mime (>= 0.1.3)
|
26
|
+
nokogiri (>= 1.3.3)
|
27
|
+
rack (>= 1.0.0)
|
28
|
+
rack-test (>= 0.5.4)
|
29
|
+
xpath (>= 2.0, < 4.0)
|
30
|
+
ffi (1.15.5)
|
31
|
+
haml (5.2.2)
|
32
|
+
temple (>= 0.8.0)
|
21
33
|
tilt
|
22
34
|
haml-contrib (1.0.0.1)
|
23
35
|
haml (>= 3.2.0.alpha.13)
|
24
|
-
|
25
|
-
rake (>= 0.8, < 11.0)
|
26
|
-
kgio (2.9.3)
|
36
|
+
kgio (2.11.4)
|
27
37
|
listen (1.3.1)
|
28
38
|
rb-fsevent (>= 0.9.3)
|
29
39
|
rb-inotify (>= 0.9)
|
30
40
|
rb-kqueue (>= 0.2)
|
31
|
-
|
41
|
+
mini_mime (1.1.2)
|
42
|
+
mini_portile2 (2.8.0)
|
43
|
+
minitest (5.16.3)
|
44
|
+
minitest-reporters (1.5.0)
|
45
|
+
ansi
|
46
|
+
builder
|
47
|
+
minitest (>= 5.0)
|
48
|
+
ruby-progressbar
|
32
49
|
mr-sparkle (0.3.0)
|
33
50
|
listen (~> 1.0)
|
34
51
|
rb-fsevent (>= 0.9)
|
35
52
|
rb-inotify (>= 0.8)
|
36
53
|
unicorn (>= 4.5)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
54
|
+
mustermann (2.0.2)
|
55
|
+
ruby2_keywords (~> 0.0.1)
|
56
|
+
nokogiri (1.13.8)
|
57
|
+
mini_portile2 (~> 2.8.0)
|
58
|
+
racc (~> 1.4)
|
59
|
+
public_suffix (5.0.0)
|
60
|
+
racc (1.6.0)
|
61
|
+
rack (2.2.4)
|
62
|
+
rack-protection (2.2.2)
|
41
63
|
rack
|
42
|
-
rack-test (0.
|
43
|
-
rack (>= 1.
|
44
|
-
raindrops (0.
|
45
|
-
rake (
|
46
|
-
rb-fsevent (0.
|
47
|
-
rb-inotify (0.
|
48
|
-
ffi (
|
49
|
-
rb-kqueue (0.2.
|
64
|
+
rack-test (2.0.2)
|
65
|
+
rack (>= 1.3)
|
66
|
+
raindrops (0.20.0)
|
67
|
+
rake (13.0.6)
|
68
|
+
rb-fsevent (0.11.2)
|
69
|
+
rb-inotify (0.10.1)
|
70
|
+
ffi (~> 1.0)
|
71
|
+
rb-kqueue (0.2.8)
|
50
72
|
ffi (>= 0.5.0)
|
51
|
-
rdiscount (2.
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
tilt (>= 1.3, < 3)
|
65
|
-
test-unit (1.2.3)
|
66
|
-
hoe (>= 1.5.1)
|
67
|
-
tilt (1.4.1)
|
68
|
-
unicorn (4.8.3)
|
73
|
+
rdiscount (2.2.0.2)
|
74
|
+
ruby-progressbar (1.11.0)
|
75
|
+
ruby2_keywords (0.0.5)
|
76
|
+
sassc (2.4.0)
|
77
|
+
ffi (~> 1.9)
|
78
|
+
sinatra (2.2.2)
|
79
|
+
mustermann (~> 2.0)
|
80
|
+
rack (~> 2.2)
|
81
|
+
rack-protection (= 2.2.2)
|
82
|
+
tilt (~> 2.0)
|
83
|
+
temple (0.8.2)
|
84
|
+
tilt (2.0.11)
|
85
|
+
unicorn (6.1.0)
|
69
86
|
kgio (~> 2.6)
|
70
|
-
rack
|
71
87
|
raindrops (~> 0.7)
|
72
|
-
|
73
|
-
nokogiri (
|
74
|
-
rack (>= 1.0)
|
75
|
-
rack-test (>= 0.5.3)
|
88
|
+
xpath (3.2.0)
|
89
|
+
nokogiri (~> 1.8)
|
76
90
|
|
77
91
|
PLATFORMS
|
78
92
|
ruby
|
79
93
|
|
80
94
|
DEPENDENCIES
|
81
|
-
|
95
|
+
byebug
|
96
|
+
capybara (~> 2.0)
|
97
|
+
minitest (~> 5.0)
|
98
|
+
minitest-reporters
|
99
|
+
mr-sparkle
|
82
100
|
nesta!
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
101
|
+
rake
|
102
|
+
|
103
|
+
BUNDLED WITH
|
104
|
+
2.3.14
|
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 (@grahamashton)
|
48
|
+
on Twitter.
|
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][].
|
@@ -56,19 +55,13 @@ on Twitter, and on [the blog][].
|
|
56
55
|
|
57
56
|
## Contributing
|
58
57
|
|
59
|
-
If you want to add a new feature, I recommend that you
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
good approach before you start.
|
58
|
+
If you want to add a new feature, I recommend that you file an issue to discuss
|
59
|
+
it before you start coding. I'm likely to suggest that we implement it as a
|
60
|
+
[plugin][] (to keep Nesta itself lean and simple), so you might save yourself
|
61
|
+
some time if we chat about a good approach before you start.
|
64
62
|
|
65
63
|
[plugin]: http://nestacms.com/docs/plugins
|
66
64
|
|
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
65
|
-- Graham ([@grahamashton][] on Twitter).
|
73
66
|
|
74
67
|
[@grahamashton]: http://twitter.com/grahamashton
|
data/RELEASING.md
CHANGED
@@ -3,20 +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
|
-
`smoke-test.sh`. If not, commit and push. Verify that all relevant
|
15
|
-
versions of Ruby have been installed locally, with `chruby`.
|
16
|
+
4. Commit these changes with a commit message of 'Bump version to <version>'
|
16
17
|
|
17
|
-
|
18
|
+
5. Generate a new site with the `nesta` command, install the demo content,
|
19
|
+
check that it runs okay locally.
|
18
20
|
|
19
|
-
|
20
|
-
previous step, run `rake release`.
|
21
|
+
6. If everything seems fine, run `rake release`.
|
21
22
|
|
22
|
-
|
23
|
+
7. Publish an announcement blog post and email the list.
|
data/Rakefile
CHANGED
@@ -5,7 +5,24 @@ Bundler.require(:default, :test)
|
|
5
5
|
|
6
6
|
Bundler::GemHelper.install_tasks
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
namespace :test do
|
9
|
+
task :set_load_path do
|
10
|
+
$LOAD_PATH.unshift File.expand_path('test')
|
11
|
+
end
|
10
12
|
|
11
|
-
|
13
|
+
def load_tests(directory)
|
14
|
+
Rake::FileList["test/#{directory}/*_test.rb"].each { |f| require_relative f }
|
15
|
+
end
|
16
|
+
|
17
|
+
task units: :set_load_path do
|
18
|
+
load_tests('unit/**')
|
19
|
+
end
|
20
|
+
|
21
|
+
task integrations: :set_load_path do
|
22
|
+
load_tests('integration/**')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
task test: 'test:set_load_path' do
|
27
|
+
load_tests('**')
|
28
|
+
end
|
data/bin/nesta
CHANGED
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,6 @@
|
|
1
1
|
require 'sinatra/base'
|
2
2
|
require 'haml'
|
3
|
-
require '
|
3
|
+
require 'sassc'
|
4
4
|
|
5
5
|
require File.expand_path('../nesta', File.dirname(__FILE__))
|
6
6
|
require File.expand_path('env', File.dirname(__FILE__))
|
@@ -55,13 +55,9 @@ module Nesta
|
|
55
55
|
stylesheet(params[:sheet].to_sym)
|
56
56
|
end
|
57
57
|
|
58
|
-
get
|
59
|
-
|
60
|
-
|
61
|
-
not_found
|
62
|
-
else
|
63
|
-
send_file(file, disposition: nil)
|
64
|
-
end
|
58
|
+
get '/attachments/*' do |path|
|
59
|
+
filename = File.join(Nesta::Config.attachment_path, path)
|
60
|
+
send_file(filename, disposition: nil)
|
65
61
|
end
|
66
62
|
|
67
63
|
get '/articles.xml' do
|
@@ -1,36 +1,52 @@
|
|
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
|
-
|
7
|
+
@demo_repository = 'https://github.com/gma/nesta-demo-content.git'
|
8
|
+
class << self
|
9
|
+
attr_accessor :demo_repository
|
10
|
+
end
|
8
11
|
|
9
12
|
def initialize(*args)
|
10
13
|
@dir = 'content-demo'
|
11
14
|
end
|
12
15
|
|
13
|
-
def clone_or_update_repository
|
14
|
-
repository = 'git://github.com/gma/nesta-demo-content.git'
|
16
|
+
def clone_or_update_repository(process)
|
15
17
|
path = Nesta::Path.local(@dir)
|
16
18
|
if File.exist?(path)
|
17
|
-
FileUtils.cd(path) {
|
19
|
+
FileUtils.cd(path) { process.run('git', 'pull', 'origin', 'master') }
|
18
20
|
else
|
19
|
-
|
21
|
+
process.run('git', 'clone', self.class.demo_repository, path)
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
25
|
+
def exclude_path
|
26
|
+
Nesta::Path.local('.git/info/exclude')
|
27
|
+
end
|
28
|
+
|
29
|
+
def in_git_repo?
|
30
|
+
File.directory?(Nesta::Path.local('.git'))
|
31
|
+
end
|
32
|
+
|
33
|
+
def demo_repo_ignored?
|
34
|
+
File.read(exclude_path).split.any? { |line| line == @dir }
|
35
|
+
rescue Errno::ENOENT
|
36
|
+
false
|
37
|
+
end
|
38
|
+
|
23
39
|
def configure_git_to_ignore_repo
|
24
|
-
|
25
|
-
|
26
|
-
File.open(
|
40
|
+
if in_git_repo? && ! demo_repo_ignored?
|
41
|
+
FileUtils.mkdir_p(File.dirname(exclude_path))
|
42
|
+
File.open(exclude_path, 'a') { |file| file.puts @dir }
|
27
43
|
end
|
28
44
|
end
|
29
45
|
|
30
|
-
def execute
|
31
|
-
clone_or_update_repository
|
46
|
+
def execute(process)
|
47
|
+
clone_or_update_repository(process)
|
32
48
|
configure_git_to_ignore_repo
|
33
|
-
|
49
|
+
Nesta::ConfigFile.new.set_value('content', @dir)
|
34
50
|
end
|
35
51
|
end
|
36
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,18 @@ 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
|
file.puts %w[._* .*.swp .bundle .DS_Store .sass-cache].join("\n")
|
33
29
|
end
|
34
|
-
|
35
|
-
|
36
|
-
|
30
|
+
process.run('git', 'init')
|
31
|
+
process.run('git', 'add', '.')
|
32
|
+
process.run('git', 'commit', '-m', 'Initial commit')
|
37
33
|
end
|
38
34
|
end
|
39
35
|
|
40
|
-
def execute
|
36
|
+
def execute(process)
|
41
37
|
make_directories
|
42
38
|
templates = {
|
43
39
|
'config.ru' => "#{@path}/config.ru",
|
@@ -49,8 +45,10 @@ module Nesta
|
|
49
45
|
if @options['vlad']
|
50
46
|
templates['config/deploy.rb'] = "#{@path}/config/deploy.rb"
|
51
47
|
end
|
52
|
-
|
53
|
-
|
48
|
+
templates.each do |src, dest|
|
49
|
+
Nesta::Commands::Template.new(src).copy_to(dest, binding)
|
50
|
+
end
|
51
|
+
create_repository(process) if @options['git']
|
54
52
|
end
|
55
53
|
end
|
56
54
|
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
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Nesta
|
2
|
+
module Commands
|
3
|
+
class Template
|
4
|
+
def initialize(filename)
|
5
|
+
@filename = filename
|
6
|
+
end
|
7
|
+
|
8
|
+
def template_path
|
9
|
+
dir = File.expand_path('../../../templates', File.dirname(__FILE__))
|
10
|
+
File.join(dir, @filename)
|
11
|
+
end
|
12
|
+
|
13
|
+
def copy_to(dest, context)
|
14
|
+
FileUtils.mkdir_p(File.dirname(dest))
|
15
|
+
template = ERB.new(File.read(template_path), trim_mode: "-")
|
16
|
+
File.open(dest, 'w') { |file| file.puts template.result(context) }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -1,18 +1,16 @@
|
|
1
|
-
require File.expand_path('../command', File.dirname(__FILE__))
|
2
|
-
|
3
1
|
module Nesta
|
4
2
|
module Commands
|
5
3
|
module Theme
|
6
4
|
class Create
|
7
|
-
include Command
|
8
|
-
|
9
5
|
def initialize(*args)
|
10
6
|
name = args.shift
|
11
7
|
options = args.shift || {}
|
12
8
|
name.nil? && (raise UsageError.new('name not specified'))
|
13
9
|
@name = name
|
14
10
|
@theme_path = Nesta::Path.themes(@name)
|
15
|
-
|
11
|
+
if File.exist?(@theme_path)
|
12
|
+
Nesta.fail_with("#{@theme_path} already exists")
|
13
|
+
end
|
16
14
|
end
|
17
15
|
|
18
16
|
def make_directories
|
@@ -20,15 +18,17 @@ module Nesta
|
|
20
18
|
FileUtils.mkdir_p(File.join(@theme_path, 'views'))
|
21
19
|
end
|
22
20
|
|
23
|
-
def execute
|
21
|
+
def execute(process)
|
24
22
|
make_directories
|
25
|
-
|
23
|
+
{
|
26
24
|
'themes/README.md' => "#{@theme_path}/README.md",
|
27
25
|
'themes/app.rb' => "#{@theme_path}/app.rb",
|
28
26
|
'themes/views/layout.haml' => "#{@theme_path}/views/layout.haml",
|
29
27
|
'themes/views/page.haml' => "#{@theme_path}/views/page.haml",
|
30
28
|
'themes/views/master.sass' => "#{@theme_path}/views/master.sass"
|
31
|
-
|
29
|
+
}.each do |src, dest|
|
30
|
+
Nesta::Commands::Template.new(src).copy_to(dest, binding)
|
31
|
+
end
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|