nesta 0.13.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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/tests.yml +1 -1
  3. data/.gitignore +1 -0
  4. data/CHANGES +73 -0
  5. data/Gemfile.lock +24 -22
  6. data/README.md +4 -2
  7. data/bin/nesta +4 -1
  8. data/lib/nesta/app.rb +1 -2
  9. data/lib/nesta/commands/build.rb +38 -0
  10. data/lib/nesta/commands/new.rb +2 -1
  11. data/lib/nesta/commands.rb +1 -0
  12. data/lib/nesta/config.rb +49 -75
  13. data/lib/nesta/config_file.rb +5 -1
  14. data/lib/nesta/helpers.rb +0 -5
  15. data/lib/nesta/models.rb +33 -34
  16. data/lib/nesta/navigation.rb +0 -5
  17. data/lib/nesta/overrides.rb +32 -43
  18. data/lib/nesta/plugin.rb +0 -16
  19. data/lib/nesta/static/assets.rb +50 -0
  20. data/lib/nesta/static/html_file.rb +26 -0
  21. data/lib/nesta/static/site.rb +104 -0
  22. data/lib/nesta/version.rb +1 -1
  23. data/lib/nesta.rb +1 -3
  24. data/nesta.gemspec +4 -4
  25. data/templates/config/config.yml +28 -2
  26. data/templates/themes/README.md +1 -1
  27. data/templates/themes/views/master.sass +1 -1
  28. data/test/integration/atom_feed_test.rb +1 -1
  29. data/test/integration/commands/build_test.rb +53 -0
  30. data/test/integration/overrides_test.rb +1 -1
  31. data/test/integration/sitemap_test.rb +1 -1
  32. data/test/support/temporary_files.rb +1 -1
  33. data/test/support/test_configuration.rb +2 -4
  34. data/test/unit/config_test.rb +25 -94
  35. data/test/unit/static/assets_test.rb +56 -0
  36. data/test/unit/static/html_file_test.rb +41 -0
  37. data/test/unit/static/site_test.rb +104 -0
  38. data/views/atom.haml +2 -2
  39. data/views/comments.haml +2 -2
  40. data/views/footer.haml +1 -1
  41. data/views/header.haml +2 -3
  42. data/views/layout.haml +2 -2
  43. data/views/master.sass +1 -1
  44. data/views/mixins.sass +2 -2
  45. data/views/normalize.scss +0 -1
  46. data/views/sitemap.haml +1 -1
  47. metadata +33 -25
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e80fef7e8fe518a674eb7527d91410d162fca8288985971e641a3329ae192eef
4
- data.tar.gz: bc6f671dc4f0ae10b403fa53b489f06c74ae8e9c6560ae49e08dc2518185dc22
3
+ metadata.gz: e14e3ed99700277225c068df787864f52f19385f08469d91bf1a8f4073e24568
4
+ data.tar.gz: 84e9c0fb31ba8b380b0ce86f9edc6f660fd8a8f9474ad28400e7c921fd745c01
5
5
  SHA512:
6
- metadata.gz: 857872073a0ea318df15323bd0f9a64de0104106b45c0c749a2261e266866abc0dd38f475fa98de07fb9cb09ee41411b837ec91a1e7d581bb1924f697557184d
7
- data.tar.gz: 828a24e35350cfae15ff093f42a67a6ee33faf48435b0e0d9ff831e3e5a1592b2e22db2910442eb39adc7642f5b3f451224dcf8f49fcc11d7a062e7a48f4b47c
6
+ metadata.gz: e39c4ada00a1ac3b4be18b6887240a670d4f1c050023771dc71fa6703bbb315bac54f959053788dc7018761a5bfc3e1fe387486e856629a785ae3098c8203704
7
+ data.tar.gz: 4da9e195b6679df8c9f2c9ec3a07b780409b2a68f6cffe66feab9276a0ee90b987b7221a13d5f363c0b700c3d5b8d956e9b6a5753a0aa81058e1e10458ced75f
@@ -8,7 +8,7 @@ jobs:
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
11
- ruby: ["2.7", "3.0", "3.1", "head"]
11
+ ruby: ["2.7", "3.0", "3.1", "3.2", "head"]
12
12
  runs-on: ubuntu-latest
13
13
  steps:
14
14
  - uses: actions/checkout@v3
data/.gitignore CHANGED
@@ -6,6 +6,7 @@
6
6
  /.rbenv-version
7
7
  /.ruby-version
8
8
  /.rvmrc
9
+ /checksums
9
10
  /config/config.yml
10
11
  /config/deploy.rb
11
12
  /db/*.db
data/CHANGES CHANGED
@@ -1,3 +1,76 @@
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
+
1
74
  = 0.13.0 / (28 September 2022)
2
75
 
3
76
  * Update dependencies in order to support Ruby 3.0 and above.
data/Gemfile.lock CHANGED
@@ -1,13 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nesta (0.13.0)
4
+ nesta (0.14.0)
5
5
  RedCloth (~> 4.2)
6
6
  haml (>= 3.1, < 6.0)
7
7
  haml-contrib (>= 1.0)
8
- rack (~> 2.0)
8
+ rack (~> 2)
9
+ rake
9
10
  rdiscount (~> 2.1)
10
- sassc (>= 2.2)
11
+ sass-embedded (~> 1.58)
11
12
  sinatra (~> 2.0)
12
13
  tilt (~> 2.0)
13
14
 
@@ -28,6 +29,7 @@ GEM
28
29
  rack-test (>= 0.5.4)
29
30
  xpath (>= 2.0, < 4.0)
30
31
  ffi (1.15.5)
32
+ google-protobuf (3.22.2)
31
33
  haml (5.2.2)
32
34
  temple (>= 0.8.0)
33
35
  tilt
@@ -39,9 +41,9 @@ GEM
39
41
  rb-inotify (>= 0.9)
40
42
  rb-kqueue (>= 0.2)
41
43
  mini_mime (1.1.2)
42
- mini_portile2 (2.8.0)
43
- minitest (5.16.3)
44
- minitest-reporters (1.5.0)
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)
@@ -53,35 +55,36 @@ GEM
53
55
  unicorn (>= 4.5)
54
56
  mustermann (2.0.2)
55
57
  ruby2_keywords (~> 0.0.1)
56
- nokogiri (1.13.8)
58
+ nokogiri (1.14.2)
57
59
  mini_portile2 (~> 2.8.0)
58
60
  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)
61
+ public_suffix (5.0.1)
62
+ racc (1.6.2)
63
+ rack (2.2.6.4)
64
+ rack-protection (2.2.4)
63
65
  rack
64
66
  rack-test (2.0.2)
65
67
  rack (>= 1.3)
66
- raindrops (0.20.0)
68
+ raindrops (0.20.1)
67
69
  rake (13.0.6)
68
70
  rb-fsevent (0.11.2)
69
71
  rb-inotify (0.10.1)
70
72
  ffi (~> 1.0)
71
73
  rb-kqueue (0.2.8)
72
74
  ffi (>= 0.5.0)
73
- rdiscount (2.2.0.2)
74
- ruby-progressbar (1.11.0)
75
+ rdiscount (2.2.7)
76
+ ruby-progressbar (1.13.0)
75
77
  ruby2_keywords (0.0.5)
76
- sassc (2.4.0)
77
- ffi (~> 1.9)
78
- sinatra (2.2.2)
78
+ sass-embedded (1.58.3)
79
+ google-protobuf (~> 3.21)
80
+ rake (>= 10.0.0)
81
+ sinatra (2.2.4)
79
82
  mustermann (~> 2.0)
80
83
  rack (~> 2.2)
81
- rack-protection (= 2.2.2)
84
+ rack-protection (= 2.2.4)
82
85
  tilt (~> 2.0)
83
- temple (0.8.2)
84
- tilt (2.0.11)
86
+ temple (0.10.0)
87
+ tilt (2.1.0)
85
88
  unicorn (6.1.0)
86
89
  kgio (~> 2.6)
87
90
  raindrops (~> 0.7)
@@ -98,7 +101,6 @@ DEPENDENCIES
98
101
  minitest-reporters
99
102
  mr-sparkle
100
103
  nesta!
101
- rake
102
104
 
103
105
  BUNDLED WITH
104
- 2.3.14
106
+ 2.4.6
data/README.md CHANGED
@@ -44,8 +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 feel free to file an issue, or contact me (@grahamashton)
48
- on Twitter.
47
+ help with anything feel free to file an issue, or contact me on Mastodon
48
+ (@gma@hachyderm.io) or Twitter (@grahamashton).
49
49
 
50
50
  If you like Nesta you can keep up with developments by following [@nestacms][]
51
51
  on Twitter, and on [the blog][].
@@ -53,6 +53,8 @@ on Twitter, and on [the blog][].
53
53
  [@nestacms]: http://twitter.com/nestacms
54
54
  [the blog]: http://nestacms.com/blog
55
55
 
56
+ ![Tests](https://github.com/gma/nesta/actions/workflows/tests.yml/badge.svg)
57
+
56
58
  ## Contributing
57
59
 
58
60
  If you want to add a new feature, I recommend that you file an issue to discuss
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],
@@ -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/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
@@ -25,7 +25,8 @@ module Nesta
25
25
  def create_repository(process)
26
26
  FileUtils.cd(@path) do
27
27
  File.open('.gitignore', 'w') do |file|
28
- file.puts %w[._* .*.swp .bundle .DS_Store .sass-cache].join("\n")
28
+ lines = %w[._* .*.swp .bundle .DS_Store .sass-cache dist]
29
+ file.puts lines.join("\n")
29
30
  end
30
31
  process.run('git', 'init')
31
32
  process.run('git', 'add', '.')
@@ -7,6 +7,7 @@ require File.expand_path('path', File.dirname(__FILE__))
7
7
  require File.expand_path('system_command', File.dirname(__FILE__))
8
8
  require File.expand_path('version', File.dirname(__FILE__))
9
9
 
10
+ require File.expand_path('commands/build', File.dirname(__FILE__))
10
11
  require File.expand_path('commands/demo', File.dirname(__FILE__))
11
12
  require File.expand_path('commands/edit', File.dirname(__FILE__))
12
13
  require File.expand_path('commands/new', File.dirname(__FILE__))
data/lib/nesta/config.rb CHANGED
@@ -1,115 +1,89 @@
1
+ require 'singleton'
1
2
  require 'yaml'
2
3
 
4
+ require_relative './config_file'
5
+
3
6
  module Nesta
4
7
  class Config
8
+ include Singleton
9
+
5
10
  class NotDefined < KeyError; end
6
11
 
7
- @settings = %w[
8
- cache
12
+ SETTINGS = %w[
13
+ author
14
+ build
9
15
  content
10
16
  disqus_short_name
17
+ domain
11
18
  google_analytics_code
12
19
  read_more
13
20
  subtitle
14
21
  theme
15
22
  title
16
23
  ]
17
- @author_settings = %w[name uri email]
18
- @yaml = nil
19
-
24
+
20
25
  class << self
21
- attr_accessor :settings, :author_settings, :yaml_conf
26
+ extend Forwardable
27
+ def_delegators *[:instance, :fetch].concat(SETTINGS.map(&:to_sym))
22
28
  end
23
29
 
24
- def self.fetch(key, *default)
25
- from_environment(key.to_s)
30
+ attr_accessor :config
31
+
32
+ def fetch(setting, *default)
33
+ setting = setting.to_s
34
+ self.config ||= read_config_file(setting)
35
+ env_config = config.fetch(Nesta::App.environment.to_s, {})
36
+ env_config.fetch(
37
+ setting,
38
+ config.fetch(setting) { raise NotDefined.new(setting) }
39
+ )
26
40
  rescue NotDefined
27
- begin
28
- from_yaml(key.to_s)
29
- rescue NotDefined
30
- default.empty? && raise || (return default.first)
31
- end
41
+ default.empty? && raise || (return default.first)
32
42
  end
33
43
 
34
- def self.method_missing(method, *args)
35
- if settings.include?(method.to_s)
36
- fetch(method, nil)
44
+ def method_missing(method, *args)
45
+ if SETTINGS.include?(method.to_s)
46
+ fetch(method.to_s, nil)
37
47
  else
38
48
  super
39
49
  end
40
50
  end
41
-
42
- def self.author
43
- environment_config = {}
44
- %w[name uri email].each do |setting|
45
- variable = "NESTA_AUTHOR__#{setting.upcase}"
46
- ENV[variable] && environment_config[setting] = ENV[variable]
47
- end
48
- environment_config.empty? ? from_yaml('author') : environment_config
49
- rescue NotDefined
50
- nil
51
- end
52
51
 
53
- def self.cache
54
- Nesta.deprecated('Nesta::Config.cache',
55
- 'see http://nestacms.com/docs/deployment/page-caching')
56
- end
57
-
58
- def self.content_path(basename = nil)
59
- get_path(content, basename)
60
- end
61
-
62
- def self.page_path(basename = nil)
63
- get_path(File.join(content_path, "pages"), basename)
52
+ def respond_to_missing?(method, include_private = false)
53
+ SETTINGS.include?(method.to_s) || super
64
54
  end
65
-
66
- def self.attachment_path(basename = nil)
67
- get_path(File.join(content_path, "attachments"), basename)
68
- end
69
-
70
- def self.yaml_path
71
- File.expand_path('config/config.yml', Nesta::App.root)
55
+
56
+ def build
57
+ fetch('build', {})
72
58
  end
73
59
 
74
- def self.read_more
60
+ def read_more
75
61
  fetch('read_more', 'Continue reading')
76
62
  end
77
63
 
78
- def self.from_environment(setting)
79
- value = ENV.fetch("NESTA_#{setting.upcase}")
80
- rescue KeyError
64
+ private
65
+
66
+ def read_config_file(setting)
67
+ YAML::load(ERB.new(IO.read(Nesta::ConfigFile.path)).result)
68
+ rescue Errno::ENOENT
81
69
  raise NotDefined.new(setting)
82
- else
83
- overrides = { "true" => true, "false" => false }
84
- overrides.has_key?(value) ? overrides[value] : value
85
- end
86
- private_class_method :from_environment
87
-
88
- def self.yaml_exists?
89
- File.exist?(yaml_path)
90
70
  end
91
- private_class_method :yaml_exists?
92
71
 
93
- def self.from_hash(hash, setting)
94
- hash.fetch(setting) { raise NotDefined.new(setting) }
95
- end
96
- private_class_method :from_hash
97
-
98
- def self.from_yaml(setting)
99
- raise NotDefined.new(setting) unless yaml_exists?
100
- self.yaml_conf ||= YAML::load(ERB.new(IO.read(yaml_path)).result)
101
- env_config = self.yaml_conf.fetch(Nesta::App.environment.to_s, {})
102
- begin
103
- from_hash(env_config, setting)
104
- rescue NotDefined
105
- from_hash(self.yaml_conf, setting)
106
- end
107
- end
108
- private_class_method :from_yaml
109
-
110
72
  def self.get_path(dirname, basename)
111
73
  basename.nil? ? dirname : File.join(dirname, basename)
112
74
  end
113
75
  private_class_method :get_path
76
+
77
+ def self.content_path(basename = nil)
78
+ get_path(content, basename)
79
+ end
80
+
81
+ def self.page_path(basename = nil)
82
+ get_path(File.join(content_path, "pages"), basename)
83
+ end
84
+
85
+ def self.attachment_path(basename = nil)
86
+ get_path(File.join(content_path, "attachments"), basename)
87
+ end
114
88
  end
115
89
  end
@@ -1,11 +1,15 @@
1
1
  module Nesta
2
2
  class ConfigFile
3
+ def self.path
4
+ File.expand_path('config/config.yml', Nesta::App.root)
5
+ end
6
+
3
7
  def set_value(key, value)
4
8
  pattern = /^\s*#?\s*#{key}:.*/
5
9
  replacement = "#{key}: #{value}"
6
10
 
7
11
  configured = false
8
- File.open(Nesta::Config.yaml_path, 'r+') do |file|
12
+ File.open(self.class.path, 'r+') do |file|
9
13
  output = ''
10
14
  file.each_line do |line|
11
15
  if configured
data/lib/nesta/helpers.rb CHANGED
@@ -60,11 +60,6 @@ module Nesta
60
60
  date.strftime("%d %B %Y")
61
61
  end
62
62
 
63
- def local_stylesheet?
64
- Nesta.deprecated('local_stylesheet?', 'use local_stylesheet_link_tag')
65
- File.exist?(File.expand_path('views/local.sass', Nesta::App.root))
66
- end
67
-
68
63
  def local_stylesheet_link_tag(name)
69
64
  pattern = File.expand_path("views/#{name}.s{a,c}ss", Nesta::App.root)
70
65
  if Dir.glob(pattern).size > 0
data/lib/nesta/models.rb CHANGED
@@ -380,45 +380,44 @@ module Nesta
380
380
  end
381
381
  end
382
382
 
383
- private
384
- def self.append_menu_item(menu, file, depth)
385
- path = file.readline
386
- rescue EOFError
387
- else
388
- page = Page.load(path.strip)
389
- current_depth = path.scan(INDENT).size
390
- if page
391
- if current_depth > depth
392
- sub_menu_for_depth(menu, depth) << [page]
393
- else
394
- sub_menu_for_depth(menu, current_depth) << page
395
- end
383
+ private_class_method def self.append_menu_item(menu, file, depth)
384
+ path = file.readline
385
+ rescue EOFError
386
+ else
387
+ page = Page.load(path.strip)
388
+ current_depth = path.scan(INDENT).size
389
+ if page
390
+ if current_depth > depth
391
+ sub_menu_for_depth(menu, depth) << [page]
392
+ else
393
+ sub_menu_for_depth(menu, current_depth) << page
396
394
  end
397
- append_menu_item(menu, file, current_depth)
398
395
  end
396
+ append_menu_item(menu, file, current_depth)
397
+ end
399
398
 
400
- def self.sub_menu_for_depth(menu, depth)
401
- sub_menu = menu
402
- depth.times { sub_menu = sub_menu[-1] }
403
- sub_menu
404
- end
399
+ private_class_method def self.sub_menu_for_depth(menu, depth)
400
+ sub_menu = menu
401
+ depth.times { sub_menu = sub_menu[-1] }
402
+ sub_menu
403
+ end
405
404
 
406
- def self.find_menu_item_by_path(menu, path)
407
- item = menu.detect do |item|
408
- item.respond_to?(:path) && (item.path == path)
409
- end
410
- if item
411
- subsequent = menu[menu.index(item) + 1]
412
- item = [item]
413
- item << subsequent if subsequent.respond_to?(:each)
414
- else
415
- sub_menus = menu.select { |menu_item| menu_item.respond_to?(:each) }
416
- sub_menus.each do |sub_menu|
417
- item = find_menu_item_by_path(sub_menu, path)
418
- break if item
419
- end
405
+ private_class_method def self.find_menu_item_by_path(menu, path)
406
+ item = menu.detect do |item|
407
+ item.respond_to?(:path) && (item.path == path)
408
+ end
409
+ if item
410
+ subsequent = menu[menu.index(item) + 1]
411
+ item = [item]
412
+ item << subsequent if subsequent.respond_to?(:each)
413
+ else
414
+ sub_menus = menu.select { |menu_item| menu_item.respond_to?(:each) }
415
+ sub_menus.each do |sub_menu|
416
+ item = find_menu_item_by_path(sub_menu, path)
417
+ break if item
420
418
  end
421
- item
422
419
  end
420
+ item
421
+ end
423
422
  end
424
423
  end
@@ -64,11 +64,6 @@ module Nesta
64
64
  raise
65
65
  end
66
66
 
67
- def breadcrumb_label(page)
68
- Nesta.deprecated('breadcrumb_label', 'use link_text')
69
- link_text(page)
70
- end
71
-
72
67
  def current_item?(item)
73
68
  request.path_info == item.abspath
74
69
  end