nesta 0.15.0 → 0.16.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7080f8e4c8c7b993aaaf2f1f2ea59edbefd0b49ef73218a8f20d6877880b18c2
4
- data.tar.gz: 806b5caf9fbfc69221087bd98254e282ddb5ba0e4288ee835d3af22fc879ab9f
3
+ metadata.gz: f57754ef13ef4b4533c03ab454b2114fb35d3e168d20107c1fb39941d6af4b92
4
+ data.tar.gz: 9aa4a9b8e0715d77c1ec515a114f63827e8a117e1f3b807755a59d0c0eba0c45
5
5
  SHA512:
6
- metadata.gz: 17a405a098acca204751044cff182ee6484c93c373b7266a2c194345736438b71366b05cd04ea8d64e7949c9ab071e01cde387a1c68d1190a2087d211fa45060
7
- data.tar.gz: 8d37d4b2b1fb4df23d57403da16c865db06a4a899a942a594cfac47212f998c52ef330ae9091149e1858c06f390f2ed9e4ef94621b115c52f04ed821d0cc9b7d
6
+ metadata.gz: effa2dcecf9d3ed0de395102c893d9f1571171b4bc4d63968911f3538c27bd8ef15692df2586239e2986d1b32e4bd4ef23513245c2cd89d0d159df3d9bf79903
7
+ data.tar.gz: c0f318224b4f70322af4d30b55e517b1d790b3087129eb0601d434eabf79cc65e3b8ae24262f7300812a0414dd5402d2969d0f11be1f5d0516afe1ad7474d27c
@@ -8,10 +8,10 @@ jobs:
8
8
  strategy:
9
9
  fail-fast: false
10
10
  matrix:
11
- ruby: ["2.7", "3.0", "3.1", "3.2"]
11
+ ruby: ["3.0", "3.1", "3.2", "3.3"]
12
12
  runs-on: ubuntu-latest
13
13
  steps:
14
- - uses: actions/checkout@v3
14
+ - uses: actions/checkout@v4
15
15
  - uses: ruby/setup-ruby@v1
16
16
  with:
17
17
  ruby-version: ${{ matrix.ruby }}
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.16.0 (11 April 2024)
4
+
5
+ * Update Google Analytics JS code to GA4. (Matthew Bass)
6
+
7
+ * Upgrade to Sinatra 3.1. (なつき)
8
+
9
+ * Tilt renderers (e.g. for Markdown, Haml, or Textile) are now configurable.
10
+ See #146 for details. (Graham Ashton)
11
+
12
+ * Drop support for Ruby 2.7, which is no longer supported by Nokogiri,
13
+ which is one of Nesta's dependencies. This is understandable; Ruby
14
+ 2.7 reached end-of-life in March 2023. (Graham Ashton)
15
+
16
+ * Bug fix: Config variables that were defined for an environment (test,
17
+ dev, production), but for which there was no default, were always read
18
+ as nil. (Matthew Bass)
19
+
3
20
  ## 0.15.0 (11 July 2023)
4
21
 
5
22
  * Upgrade to Sinatra 3. (Graham Ashton)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nesta (0.15.0)
4
+ nesta (0.16.0)
5
5
  RedCloth (~> 4.2)
6
6
  haml (>= 3.1, < 6.0)
7
7
  haml-contrib (>= 1.0)
@@ -9,13 +9,13 @@ PATH
9
9
  rake
10
10
  rdiscount (~> 2.1)
11
11
  sass-embedded (~> 1.58)
12
- sinatra (~> 3.0)
13
- tilt (~> 2.0)
12
+ sinatra (~> 3.1)
13
+ tilt (~> 2.1)
14
14
 
15
15
  GEM
16
16
  remote: https://rubygems.org/
17
17
  specs:
18
- RedCloth (4.3.2)
18
+ RedCloth (4.3.3)
19
19
  addressable (2.8.1)
20
20
  public_suffix (>= 2.0.2, < 6.0)
21
21
  ansi (1.5.0)
@@ -41,7 +41,7 @@ GEM
41
41
  rb-inotify (>= 0.9)
42
42
  rb-kqueue (>= 0.2)
43
43
  mini_mime (1.1.2)
44
- mini_portile2 (2.8.1)
44
+ mini_portile2 (2.8.5)
45
45
  minitest (5.18.0)
46
46
  minitest-reporters (1.6.0)
47
47
  ansi
@@ -55,14 +55,14 @@ GEM
55
55
  unicorn (>= 4.5)
56
56
  mustermann (3.0.0)
57
57
  ruby2_keywords (~> 0.0.1)
58
- nokogiri (1.14.3)
59
- mini_portile2 (~> 2.8.0)
58
+ nokogiri (1.16.2)
59
+ mini_portile2 (~> 2.8.2)
60
60
  racc (~> 1.4)
61
61
  public_suffix (5.0.1)
62
- racc (1.6.2)
63
- rack (2.2.6.4)
64
- rack-protection (3.0.5)
65
- rack
62
+ racc (1.7.3)
63
+ rack (2.2.8.1)
64
+ rack-protection (3.1.0)
65
+ rack (~> 2.2, >= 2.2.4)
66
66
  rack-test (2.0.2)
67
67
  rack (>= 1.3)
68
68
  raindrops (0.20.1)
@@ -78,10 +78,10 @@ GEM
78
78
  sass-embedded (1.58.3)
79
79
  google-protobuf (~> 3.21)
80
80
  rake (>= 10.0.0)
81
- sinatra (3.0.5)
81
+ sinatra (3.1.0)
82
82
  mustermann (~> 3.0)
83
83
  rack (~> 2.2, >= 2.2.4)
84
- rack-protection (= 3.0.5)
84
+ rack-protection (= 3.1.0)
85
85
  tilt (~> 2.0)
86
86
  temple (0.10.0)
87
87
  tilt (2.1.0)
data/RELEASING.md CHANGED
@@ -8,15 +8,16 @@ the steps:
8
8
 
9
9
  2. Bump the version number in `lib/nesta/version.rb`. This will cause
10
10
  the version number in `Gemfile.lock` to be updated too, so regenerate
11
- it now and check them in together.
11
+ it now (e.g. run `bundle install`) and check them in together.
12
12
 
13
13
  3. Update the `CHANGLOG.md` file with a summary of significant changes since
14
14
  the previous release.
15
15
 
16
16
  4. Commit these changes with a commit message of 'Bump version to <version>'
17
17
 
18
- 5. Generate a new site with the `nesta` command, install the demo content,
19
- check that it runs okay locally.
18
+ 5. Install the gem locally (`rake install`), then generate a new site
19
+ with the `nesta` command. Install the demo content site, check that
20
+ it runs okay locally.
20
21
 
21
22
  6. If everything seems fine, run `rake release`.
22
23
 
data/lib/nesta/config.rb CHANGED
@@ -33,10 +33,11 @@ module Nesta
33
33
  setting = setting.to_s
34
34
  self.config ||= read_config_file(setting)
35
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
- )
36
+ env_config.fetch(setting) do
37
+ config.fetch(setting) do
38
+ raise NotDefined.new(setting)
39
+ end
40
+ end
40
41
  rescue NotDefined
41
42
  default.empty? && raise || (return default.first)
42
43
  end
@@ -184,8 +184,12 @@ module Nesta
184
184
 
185
185
  def convert_to_html(format, scope, text)
186
186
  text = add_p_tags_to_haml(text) if @format == :haml
187
- template = Tilt[format].new { text }
187
+ template = Tilt[format].new(renderer_config(@format)) { text }
188
188
  template.render(scope)
189
189
  end
190
+
191
+ def renderer_config(format)
192
+ {}
193
+ end
190
194
  end
191
195
  end
@@ -12,23 +12,9 @@ module Nesta
12
12
  end
13
13
  end
14
14
 
15
- def scss(template, options = {}, locals = {})
16
- find_template(Nesta::App.settings.views, template, Tilt::ScssTemplate) do |file|
17
- return Tilt.new(file).render if File.exist?(file)
18
- end
19
- raise IOError, "SCSS template not found: #{template}"
20
- end
21
-
22
- def sass(template, options = {}, locals = {})
23
- find_template(Nesta::App.settings.views, template, Tilt::SassTemplate) do |file|
24
- return Tilt.new(file).render if File.exist?(file)
25
- end
26
- raise IOError, "Sass template not found: #{template}"
27
- end
28
-
29
15
  def stylesheet(template, options = {}, locals = {})
30
16
  scss(template, options, locals)
31
- rescue IOError
17
+ rescue Errno::ENOENT
32
18
  sass(template, options, locals)
33
19
  end
34
20
  end
data/lib/nesta/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Nesta
2
- VERSION = '0.15.0'
2
+ VERSION = '0.16.0'
3
3
  end
data/nesta.gemspec CHANGED
@@ -36,8 +36,8 @@ EOF
36
36
  s.add_dependency('rdiscount', '~> 2.1')
37
37
  s.add_dependency('RedCloth', '~> 4.2')
38
38
  s.add_dependency('sass-embedded', '~> 1.58')
39
- s.add_dependency('sinatra', '~> 3.0')
40
- s.add_dependency('tilt', '~> 2.0')
39
+ s.add_dependency('sinatra', '~> 3.1')
40
+ s.add_dependency('tilt', '~> 2.1')
41
41
 
42
42
  # Useful in development
43
43
  s.add_development_dependency('mr-sparkle')
@@ -44,7 +44,7 @@ content: content
44
44
  # scroll down a bit to set it in production even if you're not deploying
45
45
  # to your own server.
46
46
  #
47
- # google_analytics_code: "UA-???????-?"
47
+ # google_analytics_code: "G-??????????"
48
48
 
49
49
  # read_more
50
50
  # When the summary of an article is displayed on the home page, or
@@ -64,7 +64,7 @@ content: content
64
64
 
65
65
  # production:
66
66
  # content: /var/apps/nesta/shared/content
67
- # google_analytics_code: "UA-???????-?"
67
+ # google_analytics_code: "G-??????????"
68
68
 
69
69
  # The following settings control the behaviour of the `nesta build`
70
70
  # command, which is used to generate a "static" version of your site.
@@ -33,7 +33,7 @@ describe 'Default theme' do
33
33
  end
34
34
 
35
35
  it 'includes Google Analytics JavaScript when configured' do
36
- analytics_code = { 'google_analytics_code' => 'UA-1234' }
36
+ analytics_code = { 'google_analytics_code' => 'G-1234' }
37
37
  stub_config(temp_content.merge('test' => analytics_code)) do
38
38
  visit '/'
39
39
  assert_nil all('script').find { |s| s[:src].match /analytics\.js/ }
@@ -38,6 +38,12 @@ describe Nesta::Config do
38
38
  end
39
39
  end
40
40
 
41
+ it 'returns environment specific settings' do
42
+ stub_config('test' => { 'content' => 'rack_env_specific/path'}) do
43
+ assert_equal 'rack_env_specific/path', Nesta::Config.content
44
+ end
45
+ end
46
+
41
47
  it 'overrides top level settings with environment specific settings' do
42
48
  config = {
43
49
  'content' => 'general/path',
data/views/analytics.haml CHANGED
@@ -1,11 +1,11 @@
1
1
  - if @google_analytics_code
2
2
  :plain
3
+ <!-- Google tag (gtag.js) -->
4
+ <script async src="https://www.googletagmanager.com/gtag/js?id=#{@google_analytics_code}"></script>
3
5
  <script>
4
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
5
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
6
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
7
- })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
6
+ window.dataLayer = window.dataLayer || [];
7
+ function gtag(){dataLayer.push(arguments);}
8
+ gtag('js', new Date());
8
9
 
9
- ga('create', '#{@google_analytics_code}', 'auto');
10
- ga('send', 'pageview');
10
+ gtag('config', '#{@google_analytics_code}');
11
11
  </script>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nesta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Graham Ashton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-11 00:00:00.000000000 Z
11
+ date: 2024-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: haml
@@ -120,28 +120,28 @@ dependencies:
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: '3.0'
123
+ version: '3.1'
124
124
  type: :runtime
125
125
  prerelease: false
126
126
  version_requirements: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - "~>"
129
129
  - !ruby/object:Gem::Version
130
- version: '3.0'
130
+ version: '3.1'
131
131
  - !ruby/object:Gem::Dependency
132
132
  name: tilt
133
133
  requirement: !ruby/object:Gem::Requirement
134
134
  requirements:
135
135
  - - "~>"
136
136
  - !ruby/object:Gem::Version
137
- version: '2.0'
137
+ version: '2.1'
138
138
  type: :runtime
139
139
  prerelease: false
140
140
  version_requirements: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - "~>"
143
143
  - !ruby/object:Gem::Version
144
- version: '2.0'
144
+ version: '2.1'
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: mr-sparkle
147
147
  requirement: !ruby/object:Gem::Requirement
@@ -369,7 +369,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
369
369
  - !ruby/object:Gem::Version
370
370
  version: '0'
371
371
  requirements: []
372
- rubygems_version: 3.4.10
372
+ rubygems_version: 3.5.3
373
373
  signing_key:
374
374
  specification_version: 4
375
375
  summary: Ruby CMS, written in Sinatra