tilt-pipeline 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +3 -0
- data/MIT-LICENSE +18 -0
- data/README.rdoc +43 -0
- data/Rakefile +45 -0
- data/lib/tilt/pipeline.rb +60 -0
- metadata +90 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 01b2162adc28a3586902a942e53b1a25921b9c34
|
4
|
+
data.tar.gz: e8eed0913e25495a77825c54743c01dc74a4f06e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 43f61198a046987a31bb57d4fbf8ebf3d12e7f6665246f146c56e12c3ff537a5c03ed3c5a6cda9518964659640fa494cc15d014177b2c80666788bbe62761f92
|
7
|
+
data.tar.gz: 09795696f9d82f6da2ec2353fc92735335791628707e3f0f771b9bdff9304a8d7e104ec7d5a0b863571573475def789cb06d6ce426f7975c456287eb47545298
|
data/CHANGELOG
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Copyright (c) 2015 Jeremy Evans
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to
|
5
|
+
deal in the Software without restriction, including without limitation the
|
6
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
16
|
+
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
= tilt-pipeline
|
2
|
+
|
3
|
+
tilt-pipeline allows you to easily construct rendering pipelines using tilt.
|
4
|
+
For example, you can register the scss.erb pipeline so that your scss
|
5
|
+
templates will be preprocessed by ERB before being processed by sass.
|
6
|
+
|
7
|
+
= Installation
|
8
|
+
|
9
|
+
gem install tilt-pipeline
|
10
|
+
|
11
|
+
= Source Code
|
12
|
+
|
13
|
+
Source code is available on GitHub at https://github.com/jeremyevans/tilt-pipeline
|
14
|
+
|
15
|
+
= Examples
|
16
|
+
|
17
|
+
If you are using the default template mapping, you just call +Tilt.pipeline+ with
|
18
|
+
the pipeline extension:
|
19
|
+
|
20
|
+
Tilt.pipeline('scss.erb')
|
21
|
+
|
22
|
+
This will register the +scss.erb+ extension, so that template files ending in
|
23
|
+
+scss.erb+ will be processed by the +erb+ processor first, and the output of
|
24
|
+
the +erb+ processor will be passed to the +scss+ processor.
|
25
|
+
|
26
|
+
You can also call +pipeline+ on any <tt>Tilt::Mapping</tt>:
|
27
|
+
|
28
|
+
mapping.pipeline('scss.erb')
|
29
|
+
|
30
|
+
and it will register that pipeline in that mapping instead of the default mapping.
|
31
|
+
|
32
|
+
= Want it Upstream?
|
33
|
+
|
34
|
+
If you think this library would be useful to have in tilt itself, there is an open
|
35
|
+
pull request that you can comment on: https://github.com/rtomayko/tilt/pull/259
|
36
|
+
|
37
|
+
= License
|
38
|
+
|
39
|
+
MIT
|
40
|
+
|
41
|
+
= Author
|
42
|
+
|
43
|
+
Jeremy Evans <code@jeremyevans.net>
|
data/Rakefile
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
require "rake"
|
2
|
+
require "rake/clean"
|
3
|
+
|
4
|
+
CLEAN.include ["tilt-pipeline-*.gem", "rdoc", "coverage"]
|
5
|
+
|
6
|
+
desc "Build tilt-pipeline gem"
|
7
|
+
task :package=>[:clean] do |p|
|
8
|
+
sh %{#{FileUtils::RUBY} -S gem build tilt-pipeline.gemspec}
|
9
|
+
end
|
10
|
+
|
11
|
+
### Specs
|
12
|
+
|
13
|
+
desc "Run tests"
|
14
|
+
task :test do
|
15
|
+
sh "#{FileUtils::RUBY} -rubygems test/tilt_pipeline_test.rb"
|
16
|
+
end
|
17
|
+
|
18
|
+
task :default => :test
|
19
|
+
|
20
|
+
### RDoc
|
21
|
+
|
22
|
+
RDOC_DEFAULT_OPTS = ["--quiet", "--line-numbers", "--inline-source", '--title', 'tilt-pipeline: Easily construct rendering pipelines using tilt']
|
23
|
+
|
24
|
+
begin
|
25
|
+
gem 'hanna-nouveau'
|
26
|
+
RDOC_DEFAULT_OPTS.concat(['-f', 'hanna'])
|
27
|
+
rescue Gem::LoadError
|
28
|
+
end
|
29
|
+
|
30
|
+
rdoc_task_class = begin
|
31
|
+
require "rdoc/task"
|
32
|
+
RDoc::Task
|
33
|
+
rescue LoadError
|
34
|
+
require "rake/rdoctask"
|
35
|
+
Rake::RDocTask
|
36
|
+
end
|
37
|
+
|
38
|
+
RDOC_OPTS = RDOC_DEFAULT_OPTS + ['--main', 'README.rdoc']
|
39
|
+
|
40
|
+
rdoc_task_class.new do |rdoc|
|
41
|
+
rdoc.rdoc_dir = "rdoc"
|
42
|
+
rdoc.options += RDOC_OPTS
|
43
|
+
rdoc.rdoc_files.add %w"README.rdoc CHANGELOG MIT-LICENSE lib/**/*.rb"
|
44
|
+
end
|
45
|
+
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'tilt'
|
2
|
+
|
3
|
+
module Tilt
|
4
|
+
# @see Tilt::Mapping#pipeline
|
5
|
+
def self.pipeline(ext, options={})
|
6
|
+
default_mapping.pipeline(ext, options)
|
7
|
+
end
|
8
|
+
|
9
|
+
class Mapping
|
10
|
+
# Register a new template class using the given extension that
|
11
|
+
# represents a pipeline of multiple existing template, where the
|
12
|
+
# output from the previous template is used as input to the next
|
13
|
+
# template. For example, if you just call this with a single
|
14
|
+
# extension string:
|
15
|
+
#
|
16
|
+
# mapping.pipeline('scss.erb')
|
17
|
+
#
|
18
|
+
# This will register a template class that processes the input
|
19
|
+
# with the +erb+ template processor, and takes the output of
|
20
|
+
# that and feeds it to the +scss+ template processor, returning
|
21
|
+
# the output of the +scss+ template processor as the result of
|
22
|
+
# the pipeline.
|
23
|
+
#
|
24
|
+
# Options:
|
25
|
+
# :templates :: specify the templates to call in the given
|
26
|
+
# order, instead of determining them from the
|
27
|
+
# extension (e.g. <tt>['erb', 'scss']</tt>)
|
28
|
+
# :extra_exts :: Any additional extensions you want to register
|
29
|
+
# for the created class (e.g. <tt>'scsserb'</tt>)
|
30
|
+
# String :: Any string option that matches one of the templates
|
31
|
+
# being used in the pipeline is considered options
|
32
|
+
# for that template (e.g. <tt>'erb'=>{:outvar=>'@foo'},
|
33
|
+
# 'scss'=>{:style=>:compressed}</tt>)
|
34
|
+
def pipeline(ext, options={})
|
35
|
+
templates = options[:templates] || ext.split('.').reverse
|
36
|
+
templates = templates.map{|t| [self[t], options[t] || {}]}
|
37
|
+
|
38
|
+
klass = Class.new(Pipeline)
|
39
|
+
klass.send(:const_set, :TEMPLATES, templates)
|
40
|
+
|
41
|
+
register(klass, ext, *Array(options[:extra_exts]))
|
42
|
+
klass
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Superclass used for pipeline templates. Should not be used directly.
|
47
|
+
class Pipeline < Template
|
48
|
+
def prepare
|
49
|
+
@pipeline = self.class::TEMPLATES.inject(proc{|*| data}) do |data, (klass, options)|
|
50
|
+
proc do |s,l,&sb|
|
51
|
+
klass.new(file, line, options, &proc{|*| data.call(s, l, &sb)}).render(s, l, &sb)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def evaluate(scope, locals, &block)
|
57
|
+
@pipeline.call(scope, locals, &block)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tilt-pipeline
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jeremy Evans
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-10-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: tilt
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: |
|
42
|
+
tilt-pipeline allows you to easily construct rendering pipelines using tilt.
|
43
|
+
For example, you can register the scss.erb pipeline so that your scss
|
44
|
+
templates will be preprocessed by ERB before being processed by sass.
|
45
|
+
email: code@jeremyevans.net
|
46
|
+
executables: []
|
47
|
+
extensions: []
|
48
|
+
extra_rdoc_files:
|
49
|
+
- README.rdoc
|
50
|
+
- CHANGELOG
|
51
|
+
- MIT-LICENSE
|
52
|
+
files:
|
53
|
+
- CHANGELOG
|
54
|
+
- MIT-LICENSE
|
55
|
+
- README.rdoc
|
56
|
+
- Rakefile
|
57
|
+
- lib/tilt/pipeline.rb
|
58
|
+
homepage: https://github.com/jeremyevans/tilt-pipeline
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
metadata: {}
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options:
|
64
|
+
- "--quiet"
|
65
|
+
- "--line-numbers"
|
66
|
+
- "--inline-source"
|
67
|
+
- "--title"
|
68
|
+
- 'tilt-pipeline: Easily construct rendering pipelines using tilt'
|
69
|
+
- "--main"
|
70
|
+
- README.rdoc
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 2.4.5.1
|
86
|
+
signing_key:
|
87
|
+
specification_version: 4
|
88
|
+
summary: Easily construct rendering pipelines using tilt
|
89
|
+
test_files: []
|
90
|
+
has_rdoc: true
|