nesta 0.11.1 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitmodules +6 -0
- data/.travis.yml +9 -4
- data/CHANGES +18 -2
- data/Gemfile +1 -1
- data/Gemfile.lock +70 -54
- data/LICENSE +1 -1
- data/RELEASING.md +5 -6
- data/Rakefile +20 -3
- data/lib/nesta/app.rb +4 -8
- data/lib/nesta/commands/command.rb +1 -2
- data/lib/nesta/commands/demo/content.rb +23 -5
- data/lib/nesta/commands/theme/install.rb +9 -7
- data/lib/nesta/helpers.rb +14 -0
- data/lib/nesta/models.rb +26 -22
- data/lib/nesta/navigation.rb +1 -1
- data/lib/nesta/version.rb +1 -1
- data/nesta.gemspec +10 -11
- 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.rb +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/nesta-plugin-test.gemspec +0 -0
- data/test/integration/atom_feed_test.rb +178 -0
- data/test/integration/commands/demo/content_test.rb +31 -0
- data/test/integration/commands/edit_test.rb +21 -0
- data/test/integration/commands/new_test.rb +120 -0
- data/test/integration/commands/plugin/create_test.rb +128 -0
- data/test/integration/commands/theme/create_test.rb +35 -0
- data/test/integration/commands/theme/enable_test.rb +22 -0
- data/test/integration/commands/theme/install_test.rb +62 -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/silence_commands_during_tests.rb +5 -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/commands_test.rb +23 -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/views/master.sass +1 -1
- metadata +81 -85
- 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: a79722f3a6494862b4365151dd2300b0eccece20b6cb711298c753763926d9ea
|
4
|
+
data.tar.gz: 4eca7c5b41e3103500237791960658ca8a3b0d1bf50e83860d74d531dd40fb17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36a89f709fa69d85e340a93ef44ca6fa43a31f54585d0da3c7ca359ed40dddd1003374a75feb0350bd53403595df0f71e513255a16e13dce0568c434fca62d9e
|
7
|
+
data.tar.gz: b3c443a50646d62b70247743c6157433a946d98566b72631284217458e218908720c2ce3bf01534630458cb35cd4c3045d187861385ad3ada43256f74e55f054
|
data/.gitmodules
ADDED
@@ -0,0 +1,6 @@
|
|
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/.travis.yml
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
-
|
4
|
-
- 2.
|
5
|
-
- 2.
|
6
|
-
|
3
|
+
- 2.5
|
4
|
+
- 2.6
|
5
|
+
- 2.7
|
6
|
+
before_script:
|
7
|
+
- git config --global user.email "continuous-integration@nestacms.com"
|
8
|
+
- git config --global user.name "Nesta CI"
|
9
|
+
script: bundle exec rake test
|
10
|
+
env:
|
11
|
+
- REPORTER=default
|
data/CHANGES
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
= 0.12.0 / (30 June 2020)
|
2
|
+
|
3
|
+
* Upgrade to Sinatra 2 and Rack 2. (Graham Ashton)
|
4
|
+
|
5
|
+
* Upgrade from tilt 1.4 to 2.0. (Graham Ashton)
|
6
|
+
|
7
|
+
* Replace the deprecated sass gem with sassc. (Brad Weslake)
|
8
|
+
|
9
|
+
* Port the test suite from RSpec and Webrat to Minitest and Capybara.
|
10
|
+
(Graham Ashton)
|
11
|
+
|
12
|
+
* Silence deprecation warnings produced under Ruby 2.7. (Graham Ashton)
|
13
|
+
|
14
|
+
* Stop running the test suite under Ruby 2.3 and 2.4, both of which
|
15
|
+
have reached end-of-life. (Graham Ashton)
|
16
|
+
|
1
17
|
= 0.11.1 / (26 March 2015)
|
2
18
|
|
3
19
|
* Tighten dependency on Tilt, as version 2.x is incompatible.
|
@@ -288,7 +304,7 @@
|
|
288
304
|
* Bug fix: The Sinatra app's root directory wasn't set which meant
|
289
305
|
that Nesta couldn't always find the ./public directory (such as when
|
290
306
|
running on Heroku).
|
291
|
-
|
307
|
+
|
292
308
|
The modifications made in 0.9.6 to make Nesta easier to mount inside
|
293
309
|
another Rack application moved Nesta::App.root to the (new)
|
294
310
|
Nesta::Env class. In 0.9.6 I forgot to actually set Nesta::App.root
|
@@ -360,7 +376,7 @@
|
|
360
376
|
|
361
377
|
= 0.9.3 / 18 January 2011
|
362
378
|
|
363
|
-
* The route and view for serving the home page (/) has been removed,
|
379
|
+
* The route and view for serving the home page (/) has been removed,
|
364
380
|
and the home page must now be created as an index page in
|
365
381
|
content/pages.
|
366
382
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,86 +1,102 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nesta (0.
|
4
|
+
nesta (0.12.0)
|
5
5
|
RedCloth (~> 4.2)
|
6
6
|
haml (>= 3.1)
|
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.7.0)
|
19
|
+
public_suffix (>= 2.0.2, < 5.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.13.1)
|
31
|
+
haml (5.1.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.3)
|
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.0.2)
|
42
|
+
mini_portile2 (2.4.0)
|
43
|
+
minitest (5.14.1)
|
44
|
+
minitest-reporters (1.4.2)
|
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 (1.1.1)
|
55
|
+
ruby2_keywords (~> 0.0.1)
|
56
|
+
nokogiri (1.10.9)
|
57
|
+
mini_portile2 (~> 2.4.0)
|
58
|
+
public_suffix (4.0.5)
|
59
|
+
rack (2.2.3)
|
60
|
+
rack-protection (2.0.8.1)
|
41
61
|
rack
|
42
|
-
rack-test (
|
43
|
-
rack (>= 1.0)
|
44
|
-
raindrops (0.
|
45
|
-
rake (
|
46
|
-
rb-fsevent (0.
|
47
|
-
rb-inotify (0.
|
62
|
+
rack-test (1.1.0)
|
63
|
+
rack (>= 1.0, < 3)
|
64
|
+
raindrops (0.19.1)
|
65
|
+
rake (13.0.1)
|
66
|
+
rb-fsevent (0.10.4)
|
67
|
+
rb-inotify (0.10.1)
|
68
|
+
ffi (~> 1.0)
|
69
|
+
rb-kqueue (0.2.5)
|
48
70
|
ffi (>= 0.5.0)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
rack (~> 1.4)
|
63
|
-
rack-protection (~> 1.4)
|
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)
|
71
|
+
rdiscount (2.2.0.1)
|
72
|
+
ruby-progressbar (1.10.1)
|
73
|
+
ruby2_keywords (0.0.2)
|
74
|
+
sassc (2.4.0)
|
75
|
+
ffi (~> 1.9)
|
76
|
+
sinatra (2.0.8.1)
|
77
|
+
mustermann (~> 1.0)
|
78
|
+
rack (~> 2.0)
|
79
|
+
rack-protection (= 2.0.8.1)
|
80
|
+
tilt (~> 2.0)
|
81
|
+
temple (0.8.2)
|
82
|
+
tilt (2.0.10)
|
83
|
+
unicorn (5.5.5)
|
69
84
|
kgio (~> 2.6)
|
70
|
-
rack
|
71
85
|
raindrops (~> 0.7)
|
72
|
-
|
73
|
-
nokogiri (
|
74
|
-
rack (>= 1.0)
|
75
|
-
rack-test (>= 0.5.3)
|
86
|
+
xpath (3.2.0)
|
87
|
+
nokogiri (~> 1.8)
|
76
88
|
|
77
89
|
PLATFORMS
|
78
90
|
ruby
|
79
91
|
|
80
92
|
DEPENDENCIES
|
81
|
-
|
93
|
+
byebug
|
94
|
+
capybara (~> 2.0)
|
95
|
+
minitest (~> 5.0)
|
96
|
+
minitest-reporters
|
97
|
+
mr-sparkle
|
82
98
|
nesta!
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
99
|
+
rake
|
100
|
+
|
101
|
+
BUNDLED WITH
|
102
|
+
2.1.4
|
data/LICENSE
CHANGED
data/RELEASING.md
CHANGED
@@ -10,13 +10,12 @@ the steps:
|
|
10
10
|
2. Update the `CHANGES` file with a summary of significant changes since
|
11
11
|
the previous release.
|
12
12
|
|
13
|
-
3.
|
14
|
-
|
15
|
-
versions of Ruby have been installed locally, with `chruby`.
|
13
|
+
3. Check the versions of Ruby used in `.travis.yml` are up to date. If new
|
14
|
+
Ruby versions need testing, update the config and re-run the Travis build.
|
16
15
|
|
17
|
-
4.
|
16
|
+
4. Generate a new site with the `nesta` command, install the demo content,
|
17
|
+
check that it runs okay locally.
|
18
18
|
|
19
|
-
5.
|
20
|
-
previous step, run `rake release`.
|
19
|
+
5. If everything seems fine, run `rake release`.
|
21
20
|
|
22
21
|
6. 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/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
|
@@ -6,24 +6,42 @@ module Nesta
|
|
6
6
|
class Content
|
7
7
|
include Command
|
8
8
|
|
9
|
+
@demo_repository = 'git://github.com/gma/nesta-demo-content.git'
|
10
|
+
class << self
|
11
|
+
attr_accessor :demo_repository
|
12
|
+
end
|
13
|
+
|
9
14
|
def initialize(*args)
|
10
15
|
@dir = 'content-demo'
|
11
16
|
end
|
12
17
|
|
13
18
|
def clone_or_update_repository
|
14
|
-
repository = 'git://github.com/gma/nesta-demo-content.git'
|
15
19
|
path = Nesta::Path.local(@dir)
|
16
20
|
if File.exist?(path)
|
17
21
|
FileUtils.cd(path) { run_process('git', 'pull', 'origin', 'master') }
|
18
22
|
else
|
19
|
-
run_process('git', 'clone',
|
23
|
+
run_process('git', 'clone', self.class.demo_repository, path)
|
20
24
|
end
|
21
25
|
end
|
22
26
|
|
27
|
+
def exclude_path
|
28
|
+
Nesta::Path.local('.git/info/exclude')
|
29
|
+
end
|
30
|
+
|
31
|
+
def in_git_repo?
|
32
|
+
File.directory?(Nesta::Path.local('.git'))
|
33
|
+
end
|
34
|
+
|
35
|
+
def demo_repo_ignored?
|
36
|
+
File.read(exclude_path).split.any? { |line| line == @dir }
|
37
|
+
rescue Errno::ENOENT
|
38
|
+
false
|
39
|
+
end
|
40
|
+
|
23
41
|
def configure_git_to_ignore_repo
|
24
|
-
|
25
|
-
|
26
|
-
File.open(
|
42
|
+
if in_git_repo? && ! demo_repo_ignored?
|
43
|
+
FileUtils.mkdir_p(File.dirname(exclude_path))
|
44
|
+
File.open(exclude_path, 'a') { |file| file.puts @dir }
|
27
45
|
end
|
28
46
|
end
|
29
47
|
|
@@ -7,21 +7,23 @@ module Nesta
|
|
7
7
|
include Command
|
8
8
|
|
9
9
|
def initialize(*args)
|
10
|
-
url = args.shift
|
10
|
+
@url = args.shift
|
11
|
+
@url.nil? && (raise UsageError.new('URL not specified'))
|
11
12
|
options = args.shift || {}
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
end
|
14
|
+
|
15
|
+
def theme_name
|
16
|
+
File.basename(@url, '.git').sub(/nesta-theme-/, '')
|
15
17
|
end
|
16
18
|
|
17
19
|
def execute
|
18
|
-
run_process('git', 'clone', @url, "themes/#{
|
19
|
-
FileUtils.rm_r(File.join("themes/#{
|
20
|
+
run_process('git', 'clone', @url, "themes/#{theme_name}")
|
21
|
+
FileUtils.rm_r(File.join("themes/#{theme_name}", '.git'))
|
20
22
|
enable
|
21
23
|
end
|
22
24
|
|
23
25
|
def enable
|
24
|
-
Enable.new(
|
26
|
+
Enable.new(theme_name).execute
|
25
27
|
end
|
26
28
|
end
|
27
29
|
end
|
data/lib/nesta/helpers.rb
CHANGED
@@ -42,6 +42,20 @@ module Nesta
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
# Returns the current page's heading or the site's title, if we
|
46
|
+
# don't have a current page, or the page doesn't have a heading
|
47
|
+
# defined.
|
48
|
+
#
|
49
|
+
# Useful in templates that generate links to social sharing sites,
|
50
|
+
# which need a suitable description for the page being shared or
|
51
|
+
# bookmarked.
|
52
|
+
#
|
53
|
+
def heading_or_site_title
|
54
|
+
@page && @page.heading
|
55
|
+
rescue Nesta::HeadingNotSet
|
56
|
+
@title
|
57
|
+
end
|
58
|
+
|
45
59
|
def format_date(date)
|
46
60
|
date.strftime("%d %B %Y")
|
47
61
|
end
|
data/lib/nesta/models.rb
CHANGED
@@ -1,10 +1,19 @@
|
|
1
1
|
require 'time'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
Tilt.register Tilt
|
7
|
-
|
3
|
+
require 'rdiscount'
|
4
|
+
|
5
|
+
def register_template_handler(class_name, *extensions)
|
6
|
+
Tilt.register Tilt.const_get(class_name), *extensions
|
7
|
+
rescue LoadError
|
8
|
+
# Only one of the Markdown processors needs to be available, so we can
|
9
|
+
# safely ignore these load errors.
|
10
|
+
end
|
11
|
+
|
12
|
+
register_template_handler :MarukuTemplate, 'mdown', 'md'
|
13
|
+
register_template_handler :KramdownTemplate, 'mdown', 'md'
|
14
|
+
register_template_handler :BlueClothTemplate, 'mdown', 'md'
|
15
|
+
register_template_handler :RDiscountTemplate, 'mdown', 'md'
|
16
|
+
register_template_handler :RedcarpetTemplate, 'mdown', 'md'
|
8
17
|
|
9
18
|
module Nesta
|
10
19
|
class HeadingNotSet < RuntimeError; end
|
@@ -13,7 +22,7 @@ module Nesta
|
|
13
22
|
|
14
23
|
class FileModel
|
15
24
|
FORMATS = [:mdown, :md, :haml, :textile]
|
16
|
-
@@
|
25
|
+
@@model_cache = {}
|
17
26
|
@@filename_cache = {}
|
18
27
|
|
19
28
|
attr_reader :filename, :mtime
|
@@ -52,26 +61,21 @@ module Nesta
|
|
52
61
|
end
|
53
62
|
|
54
63
|
def self.needs_loading?(path, filename)
|
55
|
-
@@
|
64
|
+
@@model_cache[path].nil? || File.mtime(filename) > @@model_cache[path].mtime
|
56
65
|
end
|
57
66
|
|
58
67
|
def self.load(path)
|
59
68
|
if (filename = find_file_for_path(path)) && needs_loading?(path, filename)
|
60
|
-
@@
|
69
|
+
@@model_cache[path] = self.new(filename)
|
61
70
|
end
|
62
|
-
@@
|
71
|
+
@@model_cache[path]
|
63
72
|
end
|
64
73
|
|
65
74
|
def self.purge_cache
|
66
|
-
@@
|
75
|
+
@@model_cache = {}
|
67
76
|
@@filename_cache = {}
|
68
77
|
end
|
69
78
|
|
70
|
-
def self.menu_items
|
71
|
-
Nesta.deprecated('Page.menu_items', 'see Menu.top_level and Menu.for_path')
|
72
|
-
Menu.top_level
|
73
|
-
end
|
74
|
-
|
75
79
|
def initialize(filename)
|
76
80
|
@filename = filename
|
77
81
|
@format = filename.split('.').last.to_sym
|
@@ -84,16 +88,20 @@ module Nesta
|
|
84
88
|
@mtime = File.mtime(filename)
|
85
89
|
end
|
86
90
|
|
91
|
+
def ==(other)
|
92
|
+
other.respond_to?(:path) && (self.path == other.path)
|
93
|
+
end
|
94
|
+
|
87
95
|
def index_page?
|
88
96
|
@filename =~ /\/?index\.\w+$/
|
89
97
|
end
|
90
98
|
|
91
99
|
def abspath
|
92
|
-
|
100
|
+
file_path = @filename.sub(self.class.model_path, '')
|
93
101
|
if index_page?
|
94
|
-
File.dirname(
|
102
|
+
File.dirname(file_path)
|
95
103
|
else
|
96
|
-
File.join(File.dirname(
|
104
|
+
File.join(File.dirname(file_path), File.basename(file_path, '.*'))
|
97
105
|
end
|
98
106
|
end
|
99
107
|
|
@@ -206,10 +214,6 @@ module Nesta
|
|
206
214
|
end.sort { |x, y| y.date <=> x.date }
|
207
215
|
end
|
208
216
|
|
209
|
-
def ==(other)
|
210
|
-
other.respond_to?(:path) && (self.path == other.path)
|
211
|
-
end
|
212
|
-
|
213
217
|
def draft?
|
214
218
|
flagged_as?('draft')
|
215
219
|
end
|