awestruct 0.6.1 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: cba6d723e3f0004e825f80ea48307f55a87f3377
4
- data.tar.gz: e0c2fb8c91294a8af0e5a54e8b81fc4bcbf25bcb
2
+ SHA256:
3
+ metadata.gz: 87462b3b89d000f6d65eed4d9c92c31376177bb611ae7a206f33bbd23d6739a2
4
+ data.tar.gz: 0d7820bf17266c7733102ad1d89407f71f580a74bbfedd8f39851a175bed98b9
5
5
  SHA512:
6
- metadata.gz: 8c9fed3b23b687e4c5b8254258cf4595d4d63baa59394e13a3e820c0b955f530b43cdcfa23114543ae3a72aff8eefcb2f467807c4c05cf715b88c55de2b0874b
7
- data.tar.gz: f95216f681a0323168edba565617a2e3e45699ca490761e7c2367fe17e6505cdbe72d4e113130131a7d65399ae7acc1f037c25a35bd48911c85e3d5b7d7bb7f4
6
+ metadata.gz: f45baef6a198a33465c0359e01338af16bfa854f39a2e10227aa6db740fff14e67f6b40c93de9685dc33eea4d546f0847bbafafdb562a7f2bcc10b81a5f42014
7
+ data.tar.gz: 8ab966c3a10df83a9844454adc0428f22050fa331676c94081be64b2a119927d324775d89a506d638b62091ae56d09238333466089dfbfe25e37e5bdacac97c7
data/Gemfile CHANGED
@@ -15,12 +15,10 @@ group :test do
15
15
  gem 'coffee-script', '~> 2.2.0'
16
16
  gem 'asciidoctor', '1.5.2'
17
17
  gem 'compass', '>= 1.0.1'
18
- gem 'sassc', '~> 1.6'
18
+ gem 'sassc', '~> 2.0'
19
19
  gem 'slim', '~> 3.0'
20
- gem 'kramdown', '~> 1.3.3'
21
- gem 'therubyracer', '~> 0.12.1', :platforms => :ruby
20
+ gem 'kramdown', '~> 2.4.0'
22
21
  gem 'therubyrhino', '~> 2.0.3', :platforms => :jruby
23
- gem 'less', '~> 2.5.0'
24
22
  gem 'org-ruby', '~> 0.9.3'
25
23
  gem 'RedCloth', '~> 4.2.9'
26
24
  gem 'mustache', '~> 0.99.5'
@@ -28,6 +26,7 @@ group :test do
28
26
  gem 'htmlcompressor', '~> 0.0.7'
29
27
  gem 'haml-contrib', '~> 1.0.0'
30
28
  gem 'sass'
29
+ gem 'ffi', '~> 1.15.5'
31
30
  gem 'bootstrap-sass'
32
31
  gem 'zurb-foundation'
33
32
  gem 'rspec'
data/awestruct.gemspec CHANGED
@@ -4,7 +4,7 @@ require 'awestruct/version'
4
4
  spec = Gem::Specification.new do |s|
5
5
  s.name = 'awestruct'
6
6
  s.version = Awestruct::VERSION
7
- s.date = '2020-05-24'
7
+ s.date = '2023-01-24'
8
8
 
9
9
  s.authors = ['Bob McWhirter', 'Jason Porter', 'Lance Ball', 'Dan Allen', 'Torsten Curdt', 'other contributors']
10
10
  s.email = ['bob@mcwhirter.org', 'lightguard.jp@gmail.com', 'lball@redhat.com', 'dan.j.allen@gmail.com', 'tcurdt@vafer.org']
@@ -12,14 +12,11 @@ spec = Gem::Specification.new do |s|
12
12
  s.summary = 'Static site baking and publishing tool'
13
13
  s.description = 'Awestruct is a static site baking and publishing tool. It supports an extensive list of both templating and markup languages via Tilt (Haml, Slim, AsciiDoc, Markdown, Sass via Compass, etc), provides mobile-first layout and styling via Bootstrap or Foundation, offers a variety of deployment options (rsync, git, S3), handles site optimizations (minification, compression, cache busting), includes built-in extensions such as blog post management and is highly extensible.'
14
14
 
15
- s.rubyforge_project = s.name
16
-
17
15
  s.license = 'MIT'
18
16
 
19
17
  s.platform = Gem::Platform::RUBY
20
18
  s.required_ruby_version = '>= 2.4.0'
21
19
 
22
- s.has_rdoc = true
23
20
  s.rdoc_options = ['--charset=UTF-8']
24
21
  s.extra_rdoc_files = 'README.md'
25
22
 
@@ -97,7 +97,7 @@ module Awestruct
97
97
  abort( "No config file at #{site_yaml_file}" )
98
98
  end
99
99
 
100
- site_yaml = YAML.load( ERB.new(File.read( site_yaml_file ), nil, '<>').result )
100
+ site_yaml = YAML.load( ERB.new(File.read( site_yaml_file ), trim_mode: '<>').result )
101
101
 
102
102
  if ( !site_yaml )
103
103
  abort( "Failed to parse #{site_yaml_file}" )
@@ -232,7 +232,7 @@ module Awestruct
232
232
  def perform(dir)
233
233
 
234
234
  begin
235
- rendered = ERB.new(File.read(@input_path), nil, '<>').result(
235
+ rendered = ERB.new(File.read(@input_path), trim_mode: '<>').result(
236
236
  OpenStruct.new(@state).instance_eval { binding })
237
237
  rescue => e
238
238
  $LOG.debug "::DEBUG:: #{e.message} state - #{@state}"
@@ -43,7 +43,7 @@ module Awestruct
43
43
 
44
44
  # Dir[] doesn't like empty list
45
45
  ignore_file = File.join(@dir, ".awestruct_ignore")
46
- if File.exists?(ignore_file)
46
+ if File.exist?(ignore_file)
47
47
  ignore_stmts = IO.read(ignore_file).each_line.map(&:strip)
48
48
  end
49
49
 
@@ -1,6 +1,7 @@
1
1
  require 'awestruct/util/inflector'
2
2
  require 'awestruct/util/exception_helper'
3
3
  require 'awestruct/util/default_inflections'
4
+ require 'awestruct/util/yaml_load'
4
5
 
5
6
  require 'awestruct/config'
6
7
  require 'awestruct/site'
@@ -181,7 +182,7 @@ module Awestruct
181
182
  def load_site_yaml(yaml_path, profile = nil)
182
183
  if File.exist?(yaml_path)
183
184
  begin
184
- data = YAML.load( ERB.new(File.read( yaml_path, :encoding => 'bom|utf-8' ), nil, '<>').result )
185
+ data = Awestruct.yaml_load( ERB.new(File.read( yaml_path, :encoding => 'bom|utf-8' ), trim_mode: '<>').result)
185
186
  if profile
186
187
  # JP: Interpolation now turned off by default, turn it per page if needed
187
188
  site.interpolate = false
@@ -211,7 +212,7 @@ module Awestruct
211
212
 
212
213
  def load_yaml(yaml_path)
213
214
  begin
214
- data = YAML.load( ERB.new(File.read( yaml_path ), nil, '<>').result )
215
+ data = Awestruct.yaml_load( ERB.new(File.read( yaml_path ), trim_mode: '<>').result )
215
216
  rescue Exception => e
216
217
  ExceptionHelper.log_building_error e, yaml_path
217
218
  ExceptionHelper.mark_failed
@@ -283,7 +284,7 @@ module Awestruct
283
284
  def load_pipeline
284
285
  ext_dir = File.join( site.config.extension_dir )
285
286
  pipeline_file = File.join( ext_dir, 'pipeline.rb' )
286
- if File.exists?(pipeline_file)
287
+ if File.exist?(pipeline_file)
287
288
  p = eval(File.read( pipeline_file ), nil, pipeline_file, 1)
288
289
  p.before_all_extensions.each do |e|
289
290
  pipeline.add_before_extension( e )
@@ -379,7 +380,7 @@ module Awestruct
379
380
  end
380
381
 
381
382
  compass_config_file = File.join(site.config.config_dir, 'compass.rb')
382
- if File.exists? compass_config_file
383
+ if File.exist? compass_config_file
383
384
  ::Compass.add_configuration ::Compass::Configuration::FileData.new_from_file(compass_config_file)
384
385
  end
385
386
  ::Compass.configuration # return for use elsewhere
@@ -1,3 +1,5 @@
1
+ require 'awestruct/util/yaml_load'
2
+
1
3
  module Awestruct
2
4
  module Extensions
3
5
  class DataDir
@@ -11,18 +13,22 @@ module Awestruct
11
13
  end
12
14
 
13
15
  def execute(site)
14
- Dir[ "#{site.dir}/#{@data_dir}/*" ].each do |entry|
15
- if ( File.directory?( entry ) )
16
- data_key = File.basename( entry )
17
- data_map = {}
18
- Dir[ "#{entry}/*" ].each do |chunk|
19
- File.basename( chunk ) =~ /^([^\.]+)/
20
- key = $1.to_sym
21
- chunk_page = site.engine.load_page( chunk )
22
- data_map[ key ] = chunk_page
16
+ Dir.glob(File.join(site.dir, @data_dir, '*')).each do |entry|
17
+ next unless File.directory? entry
18
+ data_key = File.basename(entry)
19
+ data_map = {}
20
+ Dir.glob(File.join(entry, '*')).each do |chunk|
21
+ File.basename(chunk) =~ /^([^\.]+)/
22
+ key = $1.to_sym
23
+ chunk_page = nil
24
+ if chunk.end_with?('.yml')
25
+ chunk_page = Awestruct.yaml_load_file(chunk)
26
+ else
27
+ chunk_page = site.engine.load_page(chunk)
23
28
  end
24
- site.send( "#{data_key}=", data_map )
29
+ data_map[key] = chunk_page
25
30
  end
31
+ site.send("#{data_key}=", data_map)
26
32
  end
27
33
  end
28
34
 
@@ -5,7 +5,7 @@ module Awestruct
5
5
  def partial(path, params = {})
6
6
  filename = File.join( ::Awestruct::Engine.instance.config.dir, '_partials', path )
7
7
 
8
- if !File.exists?( filename )
8
+ if !File.exist?( filename )
9
9
  $LOG.error "Could not find #{filename}" if $LOG.error?
10
10
  return nil
11
11
  end
@@ -1,4 +1,5 @@
1
1
  require 'awestruct/handler_chain'
2
+ require 'awestruct/util/yaml_load'
2
3
  require 'awestruct/handlers/base_tilt_handler'
3
4
  require 'awestruct/handlers/file_handler'
4
5
  require 'awestruct/handlers/layout_handler'
@@ -136,7 +137,7 @@ module Awestruct
136
137
  template = ::Tilt::new(delegate.path.to_s, delegate.content_line_offset + 1, options)
137
138
  headers = template.parse_headers(content, /^(?:page|awestruct)\-(?=.)/).inject({'interpolate' => false}) do |hash, (k,v)|
138
139
  unless v.nil?
139
- hash[k] = v.empty? ? v : YAML.load(v)
140
+ hash[k] = v.empty? ? v : Awestruct.yaml_load(v)
140
141
  if hash[k].kind_of? Time
141
142
  # use DateTime to preserve timezone information
142
143
  hash[k] = DateTime.parse(v)
@@ -0,0 +1,14 @@
1
+ require 'yaml'
2
+
3
+ module Awestruct
4
+ def self.yaml_load(str)
5
+ return YAML.load(str) unless YAML.method('load').parameters.any? {|k,v| v == :permitted_classes}
6
+ YAML.load(str, permitted_classes: [Date, Symbol])
7
+ end
8
+
9
+ def self.yaml_load_file(str)
10
+ return YAML.load_file(str) unless YAML.method('load_file').parameters.any? {|k,v| v == :permitted_classes}
11
+ YAML.load_file(str, permitted_classes: [Date, Symbol])
12
+ end
13
+
14
+ end
@@ -1,3 +1,3 @@
1
1
  module Awestruct
2
- VERSION = '0.6.1'
2
+ VERSION = '0.6.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awestruct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob McWhirter
@@ -10,10 +10,10 @@ authors:
10
10
  - Dan Allen
11
11
  - Torsten Curdt
12
12
  - other contributors
13
- autorequire:
13
+ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2020-05-24 00:00:00.000000000 Z
16
+ date: 2023-01-24 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: haml
@@ -450,6 +450,7 @@ files:
450
450
  - lib/awestruct/util/default_inflections.rb
451
451
  - lib/awestruct/util/exception_helper.rb
452
452
  - lib/awestruct/util/inflector.rb
453
+ - lib/awestruct/util/yaml_load.rb
453
454
  - lib/awestruct/version.rb
454
455
  - man/awestruct.1
455
456
  - man/awestruct.adoc
@@ -480,7 +481,6 @@ files:
480
481
  - spec/awestruct/handlers/interpolation_handler_spec.rb
481
482
  - spec/awestruct/handlers/javascript_handler_spec.rb
482
483
  - spec/awestruct/handlers/layout_handler_spec.rb
483
- - spec/awestruct/handlers/less_handler_spec.rb
484
484
  - spec/awestruct/handlers/markdown_handler_spec.rb
485
485
  - spec/awestruct/handlers/mustache_handler_spec.rb
486
486
  - spec/awestruct/handlers/orgmode_handler_spec.rb
@@ -609,7 +609,7 @@ homepage: http://awestruct.org
609
609
  licenses:
610
610
  - MIT
611
611
  metadata: {}
612
- post_install_message:
612
+ post_install_message:
613
613
  rdoc_options:
614
614
  - "--charset=UTF-8"
615
615
  require_paths:
@@ -629,9 +629,8 @@ requirements:
629
629
  Any markup languages you are using and its dependencies.
630
630
  Haml and Markdown filters are touchy things. Redcarpet or Rdiscount work well if you're running on MRI. JRuby should be using haml 4.0.0+ with Kramdown.
631
631
  Compass and sass are no longer hard dependencies. You'll need too add them on your own should you want them. We also should be able to work with sassc.
632
- rubyforge_project: awestruct
633
- rubygems_version: 2.6.1
634
- signing_key:
632
+ rubygems_version: 3.3.3
633
+ signing_key:
635
634
  specification_version: 4
636
635
  summary: Static site baking and publishing tool
637
636
  test_files:
@@ -662,7 +661,6 @@ test_files:
662
661
  - spec/awestruct/handlers/interpolation_handler_spec.rb
663
662
  - spec/awestruct/handlers/javascript_handler_spec.rb
664
663
  - spec/awestruct/handlers/layout_handler_spec.rb
665
- - spec/awestruct/handlers/less_handler_spec.rb
666
664
  - spec/awestruct/handlers/markdown_handler_spec.rb
667
665
  - spec/awestruct/handlers/mustache_handler_spec.rb
668
666
  - spec/awestruct/handlers/orgmode_handler_spec.rb
@@ -1,33 +0,0 @@
1
- require 'spec_helper'
2
-
3
- verify = lambda { |output|
4
- output.should =~ /\.class {\n width: 2;\n}/
5
- }
6
-
7
- theories =
8
- [
9
- {
10
- :page => "less-page.less",
11
- :simple_name => "less-page",
12
- :syntax => :less,
13
- :extension => '.css',
14
- :matcher => verify
15
- },
16
- {
17
- :page => "less-page-with-import.less",
18
- :simple_name => "less-page-with-import",
19
- :syntax => :less,
20
- :extension => '.css',
21
- :matcher => verify,
22
- :unless => {
23
- :message => "Tilt 1.3.3 does not forward given options to Less parser. @import won't work unless :paths are set",
24
- :exp => lambda { Tilt::VERSION.eql? "1.3.3" }
25
- }
26
- }
27
- ]
28
-
29
- describe Awestruct::Handlers::TiltHandler.to_s + "-Less" do
30
-
31
- it_should_behave_like "a handler", theories
32
-
33
- end