wip-runner 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wip/runner/cli.rb +5 -6
- data/lib/wip/runner/renderer.rb +11 -10
- data/lib/wip/runner/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 304d59789fe54ce68f808bc36a0c8026b3991b43
|
4
|
+
data.tar.gz: e9469925268294ca0437cf71cda2c06ff783fde5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0946ea1475abe8ae990bbc595def4c7dd44eb9f24d74895a9752ad52b93ce12ad341130f52f5fece3e35627aaa09c3efabfd63ead2928e45c50ce19e74a702c0
|
7
|
+
data.tar.gz: 8061d80dcc3b29bd94ec3da40bc97dd575cd288386dc0d41d601d507a9458c717b3b987c36b5f5776af37dcaa149e7d143c5c48b4afea15d76bebd7e96042686
|
data/lib/wip/runner/cli.rb
CHANGED
@@ -10,8 +10,7 @@ module WIP
|
|
10
10
|
if File.exist?("#{extension}.rb")
|
11
11
|
$:.push(File.join(extension, 'lib'))
|
12
12
|
require extension
|
13
|
-
|
14
|
-
templates(File.join(extension, 'templates'))
|
13
|
+
assets(File.join(extension, 'assets'))
|
15
14
|
end
|
16
15
|
end
|
17
16
|
end
|
@@ -32,12 +31,12 @@ module WIP
|
|
32
31
|
@namespace || WIP::Runner
|
33
32
|
end
|
34
33
|
|
35
|
-
def
|
36
|
-
@
|
34
|
+
def assets(*paths)
|
35
|
+
@assets ||= []
|
37
36
|
unless paths.empty?
|
38
|
-
@
|
37
|
+
@assets = (@assets + paths.flatten).uniq
|
39
38
|
end
|
40
|
-
@
|
39
|
+
@assets
|
41
40
|
end
|
42
41
|
end
|
43
42
|
|
data/lib/wip/runner/renderer.rb
CHANGED
@@ -1,20 +1,21 @@
|
|
1
1
|
module WIP
|
2
2
|
module Runner
|
3
3
|
module Renderer
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
handler(:ERB, content).render(Context.for(context))
|
8
|
-
end
|
9
|
-
|
10
|
-
def template(path)
|
11
|
-
base_paths = WIP::Runner::CLI.templates
|
12
|
-
base_paths.each do |base|
|
4
|
+
def asset(path)
|
5
|
+
paths = WIP::Runner::CLI.assets
|
6
|
+
paths.each do |base|
|
13
7
|
file = File.join("#{base}/#{path}")
|
14
8
|
return File.read(file) if File.exist?(file)
|
15
9
|
end
|
16
10
|
|
17
|
-
raise WIP::Runner::InvalidArgument,
|
11
|
+
raise WIP::Runner::InvalidArgument,
|
12
|
+
"#{path} not found in:\n#{paths.map { |base| " - #{base}" }.join("\n")}"
|
13
|
+
end
|
14
|
+
|
15
|
+
# TODO: allow handler configuration/option
|
16
|
+
def render(content, context = {})
|
17
|
+
content = path?(content) ? asset(content) : content
|
18
|
+
handler(:ERB, content).render(Context.for(context))
|
18
19
|
end
|
19
20
|
|
20
21
|
private
|
data/lib/wip/runner/version.rb
CHANGED