diff options
| author | Jérémy Zurcher <jeremy@asynk.ch> | 2024-08-12 10:01:51 +0200 | 
|---|---|---|
| committer | Jérémy Zurcher <jeremy@asynk.ch> | 2024-08-12 10:01:51 +0200 | 
| commit | f2ce1b055d483318487b60fa8c6eeb3a0b475efb (patch) | |
| tree | e566cd5b412c23ff1e4410bbfa11bd5880156ccb | |
| parent | bbdd0e0de0d24a962a6452d31dc26936bea1f958 (diff) | |
| download | zorglub-f2ce1b055d483318487b60fa8c6eeb3a0b475efb.zip zorglub-f2ce1b055d483318487b60fa8c6eeb3a0b475efb.tar.gz  | |
bundle update && support ruby 3.2.x
| -rw-r--r-- | Gemfile | 2 | ||||
| -rw-r--r-- | Gemfile.lock | 65 | ||||
| -rw-r--r-- | lib/zorglub/engines/haml.rb | 9 | ||||
| -rw-r--r-- | lib/zorglub/node.rb | 10 | 
4 files changed, 41 insertions, 45 deletions
@@ -12,7 +12,7 @@ end  group :test, :development do      gem 'haml' -    gem 'sass' +    gem 'sassc'  end  gem 'coveralls', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 9bc9358..bbdff45 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,54 +6,51 @@ PATH  GEM    remote: http://rubygems.org/    specs: +    bigdecimal (3.1.8)      coveralls (0.8.23)        json (>= 1.8, < 3)        simplecov (~> 0.16.1)        term-ansicolor (~> 1.3)        thor (>= 0.19.4, < 2.0)        tins (~> 1.6) -    diff-lcs (1.5.0) -    docile (1.4.0) -    ffi (1.15.5) -    haml (5.2.2) -      temple (>= 0.8.0) +    diff-lcs (1.5.1) +    docile (1.4.1) +    ffi (1.17.0) +    haml (6.3.0) +      temple (>= 0.8.2) +      thor        tilt -    json (2.6.2) -    rack (2.2.3.1) -    rake (13.0.6) -    rb-fsevent (0.11.1) -    rb-inotify (0.10.1) -      ffi (~> 1.0) -    rspec (3.11.0) -      rspec-core (~> 3.11.0) -      rspec-expectations (~> 3.11.0) -      rspec-mocks (~> 3.11.0) -    rspec-core (3.11.0) -      rspec-support (~> 3.11.0) -    rspec-expectations (3.11.0) +    json (2.7.2) +    rack (3.1.7) +    rake (13.2.1) +    rspec (3.13.0) +      rspec-core (~> 3.13.0) +      rspec-expectations (~> 3.13.0) +      rspec-mocks (~> 3.13.0) +    rspec-core (3.13.0) +      rspec-support (~> 3.13.0) +    rspec-expectations (3.13.1)        diff-lcs (>= 1.2.0, < 2.0) -      rspec-support (~> 3.11.0) -    rspec-mocks (3.11.1) +      rspec-support (~> 3.13.0) +    rspec-mocks (3.13.1)        diff-lcs (>= 1.2.0, < 2.0) -      rspec-support (~> 3.11.0) -    rspec-support (3.11.0) -    sass (3.7.4) -      sass-listen (~> 4.0.0) -    sass-listen (4.0.0) -      rb-fsevent (~> 0.9, >= 0.9.4) -      rb-inotify (~> 0.9, >= 0.9.7) +      rspec-support (~> 3.13.0) +    rspec-support (3.13.1) +    sassc (2.4.0) +      ffi (~> 1.9)      simplecov (0.16.1)        docile (~> 1.1)        json (>= 1.8, < 3)        simplecov-html (~> 0.10.0)      simplecov-html (0.10.2)      sync (0.5.0) -    temple (0.8.2) -    term-ansicolor (1.7.1) +    temple (0.10.3) +    term-ansicolor (1.11.2)        tins (~> 1.0) -    thor (1.2.1) -    tilt (2.0.10) -    tins (1.31.1) +    thor (1.3.1) +    tilt (2.4.0) +    tins (1.33.0) +      bigdecimal        sync  PLATFORMS @@ -65,8 +62,8 @@ DEPENDENCIES    rack    rake    rspec -  sass +  sassc    zorglub!  BUNDLED WITH -   2.3.14 +   2.5.17 diff --git a/lib/zorglub/engines/haml.rb b/lib/zorglub/engines/haml.rb index 382645e..e5013f8 100644 --- a/lib/zorglub/engines/haml.rb +++ b/lib/zorglub/engines/haml.rb @@ -1,19 +1,18 @@  # -*- coding: UTF-8 -*-  require 'haml/util' -require 'haml/engine' +require 'haml/template'  module Zorglub      module Engines          module Haml              def self.proc path,obj +                haml = ::Haml::Template.new( path )                  if obj.app.opt(:engines_cache_enabled)                      key = path.sub obj.app.opt(:root),'' -                    haml = obj.app.engines_cache[key] ||= ::Haml::Engine.new( ::File.open(path,'r'){|f| f.read }, obj.app.opt(:haml_options) ) -                else -                    haml = ::Haml::Engine.new( ::File.open(path,'r'){|f| f.read }, obj.app.opt(:haml_options) ) +                    obj.app.engines_cache[key] ||= haml                  end -                html = haml.render(obj) +                html = haml.render(obj, obj.app.opt(:haml_options))                  return html, 'text/html'              end          end diff --git a/lib/zorglub/node.rb b/lib/zorglub/node.rb index 793e81c..b360a5c 100644 --- a/lib/zorglub/node.rb +++ b/lib/zorglub/node.rb @@ -300,7 +300,7 @@ module Zorglub          end          def static_page! path -            if File.exists?(path) and  ( @cache_lifetime.nil? or @cache_lifetime==0 or ( (Time.now-File.stat(path).mtime) < @cache_lifetime ) ) +            if File.exist?(path) and  ( @cache_lifetime.nil? or @cache_lifetime==0 or ( (Time.now-File.stat(path).mtime) < @cache_lifetime ) )                  $stderr << " * use cache file : #{path}\n" if @debug                  content = File.open(path, 'r') {|f| f.read }                  @content = content.sub /^@mime:(.*)\n/,'' @@ -318,14 +318,14 @@ module Zorglub              v, l = view, layout              if @debug                  $stderr << " * "+(e ? 'use engine' : 'no engine ')+" : "+(e ? e.to_s : '')+"\n" -                $stderr << " * "+((l and File.exists?(l)) ? 'use layout' : 'no layout ')+" : "+(l ? l : '')+"\n" -                $stderr << " * "+((v and File.exists?(v)) ? 'use view  ' : 'no view   ')+" : "+(v ? v : '')+"\n" +                $stderr << " * "+((l and File.exist?(l)) ? 'use layout' : 'no layout ')+" : "+(l ? l : '')+"\n" +                $stderr << " * "+((v and File.exist?(v)) ? 'use view  ' : 'no view   ')+" : "+(v ? v : '')+"\n"              end              @state = ( @partial ? :partial : :view ) -            @content, mime = e.call v, self if e and v and File.exists? v +            @content, mime = e.call v, self if e and v and File.exist? v              @mime ||= mime              @state = :layout -            @content, mime = e.call l, self if e and l and File.exists? l +            @content, mime = e.call l, self if e and l and File.exist? l              @mime = mime if @mime.nil? and not mime.nil?          end  | 
