nesta 0.11.1 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +5 -5
  2. data/.gitmodules +6 -0
  3. data/.travis.yml +9 -4
  4. data/CHANGES +18 -2
  5. data/Gemfile +1 -1
  6. data/Gemfile.lock +70 -54
  7. data/LICENSE +1 -1
  8. data/RELEASING.md +5 -6
  9. data/Rakefile +20 -3
  10. data/lib/nesta/app.rb +4 -8
  11. data/lib/nesta/commands/command.rb +1 -2
  12. data/lib/nesta/commands/demo/content.rb +23 -5
  13. data/lib/nesta/commands/theme/install.rb +9 -7
  14. data/lib/nesta/helpers.rb +14 -0
  15. data/lib/nesta/models.rb +26 -22
  16. data/lib/nesta/navigation.rb +1 -1
  17. data/lib/nesta/version.rb +1 -1
  18. data/nesta.gemspec +10 -11
  19. data/templates/config/config.yml +1 -1
  20. data/{spec → test}/fixtures/nesta-plugin-test/Gemfile +0 -0
  21. data/{spec → test}/fixtures/nesta-plugin-test/Rakefile +0 -0
  22. data/{spec → test}/fixtures/nesta-plugin-test/lib/nesta-plugin-test.rb +0 -0
  23. data/{spec → test}/fixtures/nesta-plugin-test/lib/nesta-plugin-test/init.rb +0 -0
  24. data/{spec → test}/fixtures/nesta-plugin-test/lib/nesta-plugin-test/version.rb +0 -0
  25. data/{spec → test}/fixtures/nesta-plugin-test/nesta-plugin-test.gemspec +0 -0
  26. data/test/integration/atom_feed_test.rb +178 -0
  27. data/test/integration/commands/demo/content_test.rb +31 -0
  28. data/test/integration/commands/edit_test.rb +21 -0
  29. data/test/integration/commands/new_test.rb +120 -0
  30. data/test/integration/commands/plugin/create_test.rb +128 -0
  31. data/test/integration/commands/theme/create_test.rb +35 -0
  32. data/test/integration/commands/theme/enable_test.rb +22 -0
  33. data/test/integration/commands/theme/install_test.rb +62 -0
  34. data/test/integration/default_theme_test.rb +220 -0
  35. data/test/integration/overrides_test.rb +118 -0
  36. data/test/integration/route_handlers_test.rb +96 -0
  37. data/test/integration/sitemap_test.rb +85 -0
  38. data/test/integration_test_helper.rb +61 -0
  39. data/test/support/model_factory.rb +169 -0
  40. data/test/support/silence_commands_during_tests.rb +5 -0
  41. data/test/support/temporary_files.rb +33 -0
  42. data/test/support/test_configuration.rb +19 -0
  43. data/test/test_helper.rb +26 -0
  44. data/test/unit/commands_test.rb +23 -0
  45. data/test/unit/config_test.rb +138 -0
  46. data/test/unit/file_model_test.rb +71 -0
  47. data/test/unit/menu_test.rb +82 -0
  48. data/test/unit/page_test.rb +571 -0
  49. data/test/unit/path_test.rb +41 -0
  50. data/test/unit/plugin_test.rb +47 -0
  51. data/views/master.sass +1 -1
  52. metadata +81 -85
  53. data/smoke-test.sh +0 -107
  54. data/spec/atom_spec.rb +0 -141
  55. data/spec/commands/demo/content_spec.rb +0 -65
  56. data/spec/commands/edit_spec.rb +0 -27
  57. data/spec/commands/new_spec.rb +0 -88
  58. data/spec/commands/plugin/create_spec.rb +0 -97
  59. data/spec/commands/system_spec.rb +0 -25
  60. data/spec/commands/theme/create_spec.rb +0 -41
  61. data/spec/commands/theme/enable_spec.rb +0 -44
  62. data/spec/commands/theme/install_spec.rb +0 -56
  63. data/spec/config_spec.rb +0 -127
  64. data/spec/model_factory.rb +0 -92
  65. data/spec/models_spec.rb +0 -700
  66. data/spec/overrides_spec.rb +0 -132
  67. data/spec/page_spec.rb +0 -560
  68. data/spec/path_spec.rb +0 -28
  69. data/spec/plugin_spec.rb +0 -51
  70. data/spec/sitemap_spec.rb +0 -105
  71. data/spec/spec_helper.rb +0 -114
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f7a279baf5e3392482afcd20db4e9a0dad93bd96
4
- data.tar.gz: 99e8396b1cf4d3895adab3cf9290845bd7142ee8
2
+ SHA256:
3
+ metadata.gz: a79722f3a6494862b4365151dd2300b0eccece20b6cb711298c753763926d9ea
4
+ data.tar.gz: 4eca7c5b41e3103500237791960658ca8a3b0d1bf50e83860d74d531dd40fb17
5
5
  SHA512:
6
- metadata.gz: 66f8714a375bc4cf7e801ca9f8f1f6f24a103736763a4b87e850c58ff983344999543e260b1dbb3add73a8ebae935e08109828fac06a649c4958fb9c3f2c2c8c
7
- data.tar.gz: 44ee76299e95a5a329fc8fd6679d8d3be9d7a0eac5c4ef321029c7038b56024ed100a0890937ba045dc46836e96ca1c6d7f3f023b4f0d0444b85a84c69e53b34
6
+ metadata.gz: 36a89f709fa69d85e340a93ef44ca6fa43a31f54585d0da3c7ca359ed40dddd1003374a75feb0350bd53403595df0f71e513255a16e13dce0568c434fca62d9e
7
+ data.tar.gz: b3c443a50646d62b70247743c6157433a946d98566b72631284217458e218908720c2ce3bf01534630458cb35cd4c3045d187861385ad3ada43256f74e55f054
@@ -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
@@ -1,6 +1,11 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
- - 2.0.0
5
- - 2.1.5
6
- - 2.2.1
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
@@ -1,4 +1,4 @@
1
- source 'http://rubygems.org'
1
+ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in nesta.gemspec
4
4
  gemspec
@@ -1,86 +1,102 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nesta (0.11.1)
4
+ nesta (0.12.0)
5
5
  RedCloth (~> 4.2)
6
6
  haml (>= 3.1)
7
7
  haml-contrib (>= 1.0)
8
- rack (>= 1.3)
8
+ rack (~> 2.0)
9
9
  rdiscount (~> 2.1)
10
- sass (>= 3.1)
11
- sinatra (~> 1.4)
12
- tilt (~> 1.4)
10
+ sassc (>= 2.2)
11
+ sinatra (~> 2.0)
12
+ tilt (~> 2.0)
13
13
 
14
14
  GEM
15
- remote: http://rubygems.org/
15
+ remote: https://rubygems.org/
16
16
  specs:
17
- RedCloth (4.2.9)
18
- diff-lcs (1.2.5)
19
- ffi (1.9.8)
20
- haml (4.0.6)
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
- hoe (3.13.1)
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
- mini_portile (0.6.2)
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
- nokogiri (1.6.6.2)
38
- mini_portile (~> 0.6.0)
39
- rack (1.6.0)
40
- rack-protection (1.5.3)
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 (0.6.1)
43
- rack (>= 1.0)
44
- raindrops (0.13.0)
45
- rake (10.4.2)
46
- rb-fsevent (0.9.4)
47
- rb-inotify (0.9.5)
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
- rb-kqueue (0.2.3)
50
- ffi (>= 0.5.0)
51
- rdiscount (2.1.8)
52
- rspec (2.14.1)
53
- rspec-core (~> 2.14.0)
54
- rspec-expectations (~> 2.14.0)
55
- rspec-mocks (~> 2.14.0)
56
- rspec-core (2.14.8)
57
- rspec-expectations (2.14.5)
58
- diff-lcs (>= 1.1.3, < 2.0)
59
- rspec-mocks (2.14.6)
60
- sass (3.4.13)
61
- sinatra (1.4.5)
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
- webrat (0.7.3)
73
- nokogiri (>= 1.2.0)
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
- mr-sparkle (>= 0.0.2)
93
+ byebug
94
+ capybara (~> 2.0)
95
+ minitest (~> 5.0)
96
+ minitest-reporters
97
+ mr-sparkle
82
98
  nesta!
83
- rack-test (= 0.6.1)
84
- rspec (~> 2.14.0)
85
- test-unit (= 1.2.3)
86
- webrat (~> 0.7.3)
99
+ rake
100
+
101
+ BUNDLED WITH
102
+ 2.1.4
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2008-2014 Graham Ashton
1
+ Copyright (c) 2008-2020 Graham Ashton
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
@@ -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. Update the versions of Ruby used in `.travis.yml` and
14
- `smoke-test.sh`. If not, commit and push. Verify that all relevant
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. Run `smoke-test.sh`.
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. Once you're confident the freshly generated sites work okay in the
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
- require 'rspec/core/rake_task'
9
- RSpec::Core::RakeTask.new(:spec)
8
+ namespace :test do
9
+ task :set_load_path do
10
+ $LOAD_PATH.unshift File.expand_path('test')
11
+ end
10
12
 
11
- task :default => :spec
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
@@ -1,6 +1,6 @@
1
1
  require 'sinatra/base'
2
2
  require 'haml'
3
- require 'sass'
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 %r{/attachments/([\w/.@-]+)} do |file|
59
- file = File.join(Nesta::Config.attachment_path, params[:captures].first)
60
- if file =~ /\.\.\//
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
@@ -11,8 +11,7 @@ module Nesta
11
11
  else
12
12
  "'#{args.join(' ')}' failed with status #{$?.exitstatus}"
13
13
  end
14
- $stderr.puts "Error: #{message}"
15
- exit 1
14
+ fail(message)
16
15
  end
17
16
  end
18
17
 
@@ -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', repository, path)
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
- excludes = Nesta::Path.local('.git/info/exclude')
25
- if File.exist?(excludes) && File.read(excludes).scan(@dir).empty?
26
- File.open(excludes, 'a') { |file| file.puts @dir }
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
- url.nil? && (raise UsageError.new('URL not specified'))
13
- @url = url
14
- @name = File.basename(url, '.git').sub(/nesta-theme-/, '')
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/#{@name}")
19
- FileUtils.rm_r(File.join("themes/#{@name}", '.git'))
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(@name).execute
26
+ Enable.new(theme_name).execute
25
27
  end
26
28
  end
27
29
  end
@@ -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
@@ -1,10 +1,19 @@
1
1
  require 'time'
2
2
 
3
- Tilt.register Tilt::MarukuTemplate, 'mdown', 'md'
4
- Tilt.register Tilt::KramdownTemplate, 'mdown', 'md'
5
- Tilt.register Tilt::BlueClothTemplate, 'mdown', 'md'
6
- Tilt.register Tilt::RDiscountTemplate, 'mdown', 'md'
7
- Tilt.register Tilt::RedcarpetTemplate, 'mdown', 'md'
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
- @@page_cache = {}
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
- @@page_cache[path].nil? || File.mtime(filename) > @@page_cache[path].mtime
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
- @@page_cache[path] = self.new(filename)
69
+ @@model_cache[path] = self.new(filename)
61
70
  end
62
- @@page_cache[path]
71
+ @@model_cache[path]
63
72
  end
64
73
 
65
74
  def self.purge_cache
66
- @@page_cache = {}
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
- page_path = @filename.sub(Nesta::Config.page_path, '')
100
+ file_path = @filename.sub(self.class.model_path, '')
93
101
  if index_page?
94
- File.dirname(page_path)
102
+ File.dirname(file_path)
95
103
  else
96
- File.join(File.dirname(page_path), File.basename(page_path, '.*'))
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