liquidum 1.0.22 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +11 -34
- data/Gemfile +0 -11
- data/Rakefile +15 -19
- data/lib/liquidum/configuration.rb +44 -12
- data/lib/liquidum/version.rb +1 -1
- data/lib/liquidum.rb +15 -12
- data/liquidum.gemspec +29 -32
- metadata +16 -17
- data/.rubocop_todo.yml +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16e876c05fe67578580e9b365f02e957d0931317ced4765c9eeccc46e997deac
|
4
|
+
data.tar.gz: 20d60c9963067edc071ec34fc37833dc98cb41d8099ba6b8d860def2a8f90584
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f909afdc2966789818915b4fe6ad11f8a6ce9b7cba39ff3ccaec3af357a1b236242d66f6aa3ac35c2b3ce4c077674d9602b620fb2f4ef449fbab4ae690a9b206
|
7
|
+
data.tar.gz: ecc6f3c0bb6c259f468ba80afca0fa98de1ec096b0111c129d4ea9a7766d28aeb0be51c9281bd6ca9cd7acb0994ed8d5b094687457e66b9dc8c88c41e7c1e62c
|
data/.rubocop.yml
CHANGED
@@ -1,37 +1,14 @@
|
|
1
|
-
|
2
|
-
AllCops:
|
3
|
-
TargetRubyVersion: 2.7
|
4
|
-
Exclude:
|
5
|
-
- 'bin/**/*'
|
6
|
-
- 'db/**/*'
|
7
|
-
- 'vagrant/**/*'
|
8
|
-
- 'vendor/**/*'
|
9
|
-
- 'spec/**/*'
|
10
|
-
- 'lib/generators/**/*'
|
11
|
-
- 'node_modules/**/*'
|
12
|
-
- 'test/dummy/**/*'
|
13
|
-
- 'test/dummy/config/**/*'
|
14
|
-
|
15
|
-
Metrics:
|
16
|
-
Enabled: false
|
1
|
+
# https://www.fastruby.io/blog/ruby/code-quality/how-we-use-rubocop-and-standardrb.html
|
17
2
|
|
18
|
-
|
19
|
-
|
20
|
-
'%': '[]'
|
21
|
-
'%i': '[]'
|
22
|
-
'%q': '[]'
|
23
|
-
'%Q': '[]'
|
24
|
-
'%r': '[]'
|
25
|
-
'%s': '[]'
|
26
|
-
'%w': '[]'
|
27
|
-
'%W': '[]'
|
28
|
-
'%x': '[]'
|
3
|
+
require:
|
4
|
+
- standard
|
29
5
|
|
30
|
-
|
31
|
-
|
6
|
+
inherit_gem:
|
7
|
+
standard: config/base.yml
|
32
8
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
9
|
+
AllCops:
|
10
|
+
NewCops: enable
|
11
|
+
Exclude:
|
12
|
+
- node_modules/**/*
|
13
|
+
- public/**/*
|
14
|
+
- vendor/**/*
|
data/Gemfile
CHANGED
@@ -1,18 +1,7 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
3
|
-
git_source(:entdec) { |repo_name| "git@github.com:entdec/#{repo_name}.git" }
|
4
3
|
|
5
4
|
# Declare your gem's dependencies in liquidum.gemspec.
|
6
5
|
# Bundler will treat runtime dependencies like base dependencies, and
|
7
6
|
# development dependencies will be added by default to the :development group.
|
8
7
|
gemspec
|
9
|
-
|
10
|
-
# Declare any dependencies that are still in development here instead of in
|
11
|
-
# your gemspec. These might include edge Rails or gems from your path or
|
12
|
-
# Git. Remember to move these dependencies to your gemspec before releasing
|
13
|
-
# your gem to rubygems.org.
|
14
|
-
|
15
|
-
# To use a debugger
|
16
|
-
# gem 'byebug', group: [:development, :test]
|
17
|
-
gem 'pry'
|
18
|
-
gem 'solargraph'
|
data/Rakefile
CHANGED
@@ -1,37 +1,33 @@
|
|
1
1
|
begin
|
2
|
-
require
|
2
|
+
require "bundler/setup"
|
3
3
|
rescue LoadError
|
4
|
-
puts
|
4
|
+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
5
5
|
end
|
6
6
|
|
7
|
-
require
|
7
|
+
require "rdoc/task"
|
8
8
|
|
9
9
|
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
-
rdoc.rdoc_dir =
|
11
|
-
rdoc.title
|
12
|
-
rdoc.options <<
|
13
|
-
rdoc.rdoc_files.include(
|
14
|
-
rdoc.rdoc_files.include(
|
10
|
+
rdoc.rdoc_dir = "rdoc"
|
11
|
+
rdoc.title = "Liquidum"
|
12
|
+
rdoc.options << "--line-numbers"
|
13
|
+
rdoc.rdoc_files.include("README.md")
|
14
|
+
rdoc.rdoc_files.include("lib/**/*.rb")
|
15
15
|
end
|
16
16
|
|
17
|
-
APP_RAKEFILE = File.expand_path(
|
18
|
-
load
|
17
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
18
|
+
load "rails/tasks/engine.rake"
|
19
19
|
|
20
|
-
load
|
20
|
+
load "rails/tasks/statistics.rake"
|
21
21
|
|
22
|
-
require
|
22
|
+
require "bundler/gem_tasks"
|
23
23
|
|
24
|
-
require
|
24
|
+
require "rake/testtask"
|
25
25
|
|
26
26
|
Rake::TestTask.new(:test) do |t|
|
27
|
-
t.libs <<
|
28
|
-
t.pattern =
|
27
|
+
t.libs << "test"
|
28
|
+
t.pattern = "test/**/*_test.rb"
|
29
29
|
t.verbose = false
|
30
30
|
t.warning = false
|
31
31
|
end
|
32
32
|
|
33
33
|
task default: :test
|
34
|
-
|
35
|
-
# Adds the Auxilium semver task
|
36
|
-
spec = Gem::Specification.find_by_name 'auxilium'
|
37
|
-
load "#{spec.gem_dir}/lib/tasks/semver.rake"
|
@@ -1,23 +1,55 @@
|
|
1
1
|
module Liquidum
|
2
|
+
module Options
|
3
|
+
module ClassMethods
|
4
|
+
def option(name, default: nil)
|
5
|
+
attr_accessor(name)
|
6
|
+
|
7
|
+
schema[name] = default
|
8
|
+
end
|
9
|
+
|
10
|
+
def schema
|
11
|
+
@schema ||= {}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def set_defaults!
|
16
|
+
self.class.schema.each do |name, default|
|
17
|
+
instance_variable_set(:"@#{name}", default)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.included(cls)
|
22
|
+
cls.extend(ClassMethods)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
2
26
|
class Configuration
|
3
|
-
|
4
|
-
|
5
|
-
|
27
|
+
include Options
|
28
|
+
|
29
|
+
option :logger, default: -> { Logger.new($stdout).tap { |l| l.level = Logger::INFO } }
|
30
|
+
option :liquidum_file_system, default: "Liquidum::LiquidumFileSystem"
|
31
|
+
option :i18n_store, default: ->(context, block) {}
|
6
32
|
|
7
33
|
def initialize
|
8
|
-
|
9
|
-
@logger.level = Logger::INFO
|
10
|
-
@liquidum_file_system = 'Liquidum::LiquidumFileSystem'
|
11
|
-
@i18n_store = ->(context, block) { nil }
|
34
|
+
set_defaults!
|
12
35
|
end
|
36
|
+
end
|
37
|
+
|
38
|
+
module Configurable
|
39
|
+
attr_writer :config
|
13
40
|
|
14
|
-
|
15
|
-
|
16
|
-
@logger.is_a?(Proc) ? instance_exec(&@logger) : @logger
|
41
|
+
def config
|
42
|
+
@config ||= Configuration.new
|
17
43
|
end
|
18
44
|
|
19
|
-
def
|
20
|
-
|
45
|
+
def configure
|
46
|
+
yield(config)
|
47
|
+
end
|
48
|
+
|
49
|
+
alias_method :setup, :configure
|
50
|
+
|
51
|
+
def reset_config!
|
52
|
+
@config = Configuration.new
|
21
53
|
end
|
22
54
|
end
|
23
55
|
end
|
data/lib/liquidum/version.rb
CHANGED
data/lib/liquidum.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'liquid'
|
4
4
|
require 'tilt'
|
5
5
|
require 'sassc'
|
6
|
-
require
|
6
|
+
require 'addressable/uri'
|
7
7
|
|
8
8
|
require 'liquidum/version'
|
9
9
|
require 'liquidum/engine'
|
@@ -17,11 +17,14 @@ require 'liquidum/liquid/liquidum_tag'
|
|
17
17
|
require 'liquidum/liquid/parser'
|
18
18
|
|
19
19
|
module Liquidum
|
20
|
+
extend Configurable
|
21
|
+
|
20
22
|
class Error < StandardError; end
|
21
23
|
class UnknownStepTypeError < Error; end
|
22
24
|
|
23
25
|
class LiquidumFileSystem
|
24
26
|
attr_reader :registers
|
27
|
+
|
25
28
|
def initialize(registers)
|
26
29
|
@registers = registers
|
27
30
|
end
|
@@ -37,19 +40,14 @@ module Liquidum
|
|
37
40
|
end
|
38
41
|
|
39
42
|
class << self
|
40
|
-
attr_reader :config
|
41
|
-
|
42
|
-
def setup
|
43
|
-
@config = Configuration.new
|
44
|
-
yield config
|
45
|
-
end
|
46
|
-
|
47
43
|
def render(content, options = {})
|
48
44
|
template = Liquid::Template.parse(content)
|
49
45
|
options[:assigns] ||= {}
|
50
46
|
options[:registers] ||= {}
|
51
|
-
options[:registers]['file_system'] =
|
52
|
-
|
47
|
+
options[:registers]['file_system'] =
|
48
|
+
Liquidum.config.liquidum_file_system.constantize.new(options[:registers])
|
49
|
+
result = template.render(options[:context] || options[:assigns].stringify_keys,
|
50
|
+
registers: options[:registers])
|
53
51
|
|
54
52
|
if template.errors.present?
|
55
53
|
Liquidum.config.logger.error '--- Template rendering errors: ' + '-' * 49
|
@@ -66,9 +64,14 @@ module Liquidum
|
|
66
64
|
assigns = assigns.merge(template.assigns.stringify_keys) if template.assigns
|
67
65
|
options[:registers].deep_merge!(template.registers.stringify_keys) if template.registers
|
68
66
|
|
69
|
-
|
67
|
+
if options[:filter].present? && Tilt[options[:filter]]
|
68
|
+
result = Tilt[options[:filter]].new(options[:filter_options]) do
|
69
|
+
result
|
70
|
+
end.render
|
71
|
+
end
|
70
72
|
if options[:layout].present?
|
71
|
-
result = render(options[:layout], assigns: assigns.merge('content' => result),
|
73
|
+
result = render(options[:layout], assigns: assigns.merge('content' => result),
|
74
|
+
registers: options[:registers])
|
72
75
|
end
|
73
76
|
|
74
77
|
result
|
data/liquidum.gemspec
CHANGED
@@ -1,47 +1,44 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
$LOAD_PATH.push File.expand_path(
|
3
|
+
$LOAD_PATH.push File.expand_path("lib", __dir__)
|
4
4
|
|
5
5
|
# Maintain your gem's version:
|
6
|
-
require
|
6
|
+
require "liquidum/version"
|
7
7
|
|
8
8
|
Gem::Specification.new do |spec|
|
9
|
-
spec.name =
|
9
|
+
spec.name = "liquidum"
|
10
10
|
spec.version = Liquidum::VERSION
|
11
11
|
|
12
|
-
spec.required_rubygems_version = Gem::Requirement.new(
|
13
|
-
spec.require_paths = [
|
14
|
-
spec.authors = [
|
15
|
-
spec.
|
16
|
-
spec.
|
17
|
-
spec.email = ['tom@degrunt.nl']
|
12
|
+
spec.required_rubygems_version = Gem::Requirement.new(">= 0") if spec.respond_to? :required_rubygems_version=
|
13
|
+
spec.require_paths = ["lib"]
|
14
|
+
spec.authors = ["Tom de Grunt"]
|
15
|
+
spec.description = "Ready made set of tags, parsings and awesomeness"
|
16
|
+
spec.email = ["tom@degrunt.nl"]
|
18
17
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
19
18
|
f.match(%r{^(test|spec|features)/})
|
20
19
|
end
|
21
|
-
spec.homepage =
|
22
|
-
spec.licenses = [
|
23
|
-
spec.
|
24
|
-
spec.summary = 'Liquid templating - on steroids'
|
20
|
+
spec.homepage = "https://github.com/entdec/liquidum"
|
21
|
+
spec.licenses = ["MIT"]
|
22
|
+
spec.summary = "Liquid templating - on steroids"
|
25
23
|
|
26
|
-
spec.installed_by_version =
|
24
|
+
spec.installed_by_version = "3.1.6" if spec.respond_to? :installed_by_version
|
27
25
|
|
28
|
-
spec.
|
29
|
-
|
30
|
-
spec.add_runtime_dependency(
|
31
|
-
spec.add_runtime_dependency(
|
32
|
-
spec.add_runtime_dependency(
|
33
|
-
spec.add_runtime_dependency(
|
34
|
-
spec.add_runtime_dependency(
|
35
|
-
spec.add_runtime_dependency(
|
36
|
-
spec.add_runtime_dependency(
|
37
|
-
spec.add_runtime_dependency(
|
38
|
-
spec.add_runtime_dependency('rails', ['>= 5.2'])
|
39
|
-
spec.add_runtime_dependency('sassc', ['~> 2.2'])
|
26
|
+
spec.add_runtime_dependency("addressable", ["~> 2"])
|
27
|
+
spec.add_runtime_dependency("babel-transpiler", ["~> 0.7"])
|
28
|
+
spec.add_runtime_dependency("i18n", ["~> 1.8"])
|
29
|
+
spec.add_runtime_dependency("kramdown", ["~> 2.1"])
|
30
|
+
spec.add_runtime_dependency("kramdown-parser-gfm", ["~> 1.0"])
|
31
|
+
spec.add_runtime_dependency("liquid", ["= 5.1.0"])
|
32
|
+
spec.add_runtime_dependency("parslet", [">= 0"])
|
33
|
+
spec.add_runtime_dependency("pg", [">= 0"])
|
34
|
+
spec.add_runtime_dependency("rails", [">= 5.2"])
|
35
|
+
spec.add_runtime_dependency("sassc", ["~> 2.2"])
|
40
36
|
spec.add_runtime_dependency "slim-rails", "~> 3.6"
|
41
|
-
spec.add_development_dependency(
|
42
|
-
spec.add_development_dependency(
|
43
|
-
spec.add_development_dependency(
|
44
|
-
spec.add_development_dependency(
|
45
|
-
spec.add_development_dependency
|
46
|
-
|
37
|
+
spec.add_development_dependency("minitest", ["~> 5.11"])
|
38
|
+
spec.add_development_dependency("minitest-reporters", ["~> 1.1"])
|
39
|
+
spec.add_development_dependency("pry", ["> 0"])
|
40
|
+
spec.add_development_dependency("pry-rails", ["~> 0.3"])
|
41
|
+
spec.add_development_dependency "rubocop", "~> 1"
|
42
|
+
|
43
|
+
spec.add_development_dependency "standard", "~> 1"
|
47
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: liquidum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom de Grunt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -164,20 +164,6 @@ dependencies:
|
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '3.6'
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
|
-
name: auxilium
|
169
|
-
requirement: !ruby/object:Gem::Requirement
|
170
|
-
requirements:
|
171
|
-
- - "~>"
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '3'
|
174
|
-
type: :development
|
175
|
-
prerelease: false
|
176
|
-
version_requirements: !ruby/object:Gem::Requirement
|
177
|
-
requirements:
|
178
|
-
- - "~>"
|
179
|
-
- !ruby/object:Gem::Version
|
180
|
-
version: '3'
|
181
167
|
- !ruby/object:Gem::Dependency
|
182
168
|
name: minitest
|
183
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -248,6 +234,20 @@ dependencies:
|
|
248
234
|
- - "~>"
|
249
235
|
- !ruby/object:Gem::Version
|
250
236
|
version: '1'
|
237
|
+
- !ruby/object:Gem::Dependency
|
238
|
+
name: standard
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - "~>"
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: '1'
|
244
|
+
type: :development
|
245
|
+
prerelease: false
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - "~>"
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: '1'
|
251
251
|
description: Ready made set of tags, parsings and awesomeness
|
252
252
|
email:
|
253
253
|
- tom@degrunt.nl
|
@@ -258,7 +258,6 @@ files:
|
|
258
258
|
- ".github/workflows/gem-push.yml"
|
259
259
|
- ".gitignore"
|
260
260
|
- ".rubocop.yml"
|
261
|
-
- ".rubocop_todo.yml"
|
262
261
|
- Gemfile
|
263
262
|
- MIT-LICENSE
|
264
263
|
- README.md
|
data/.rubocop_todo.yml
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
# This configuration was generated by
|
2
|
-
# `rubocop --auto-gen-config`
|
3
|
-
# on 2019-01-25 20:13:51 +0100 using RuboCop version 0.63.1.
|
4
|
-
# The point is for the user to remove these configuration records
|
5
|
-
# one by one as the offenses are removed from the code base.
|
6
|
-
# Note that changes in the inspected code, or installation of new
|
7
|
-
# versions of RuboCop, may require this file to be generated again.
|
8
|
-
|
9
|
-
# Offense count: 1
|
10
|
-
# Cop supports --auto-correct.
|
11
|
-
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
12
|
-
# SupportedStyles: nested, compact
|
13
|
-
Style/ClassAndModuleChildren:
|
14
|
-
Exclude:
|
15
|
-
- "test/liquidum_test.rb"
|
16
|
-
|
17
|
-
# Offense count: 6
|
18
|
-
Style/Documentation:
|
19
|
-
Exclude:
|
20
|
-
- "spec/**/*"
|
21
|
-
- "test/**/*"
|
22
|
-
- "app/controllers/liquidum/application_controller.rb"
|
23
|
-
- "app/helpers/liquidum/application_helper.rb"
|
24
|
-
- "app/mailers/liquidum/application_mailer.rb"
|
25
|
-
- "app/models/liquidum/application_record.rb"
|
26
|
-
- "lib/liquidum.rb"
|
27
|
-
- "lib/liquidum/engine.rb"
|
28
|
-
|
29
|
-
# Offense count: 2
|
30
|
-
Style/MixinUsage:
|
31
|
-
Exclude:
|
32
|
-
- "test/dummy/bin/setup"
|
33
|
-
- "test/dummy/bin/update"
|
34
|
-
|
35
|
-
# Offense count: 27
|
36
|
-
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
37
|
-
# URISchemes: http, https
|
38
|
-
Metrics/LineLength:
|
39
|
-
Max: 112
|