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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d413a11e0b1cfb45470e00f5cce34cab1e448559
4
- data.tar.gz: bb708de6862257be0a54293e2b991685e31d35b1
3
+ metadata.gz: 304d59789fe54ce68f808bc36a0c8026b3991b43
4
+ data.tar.gz: e9469925268294ca0437cf71cda2c06ff783fde5
5
5
  SHA512:
6
- metadata.gz: 6302c700ae25540cf4bf6bb9e798ac14bab2f8bbf875d0f842ada0a5dce54153f6c177f8f36305b52d657b97902d74a820ec5cd782be848ca445a6bd4af15a8e
7
- data.tar.gz: de618c82acfd607a308672b88eafc11c9655fb78800b2bc4d2aa7daceaf5756d8345c5c0b09d584661e29b4e48f3b275c622b54ca1137d386d5c656eb6275a76
6
+ metadata.gz: 0946ea1475abe8ae990bbc595def4c7dd44eb9f24d74895a9752ad52b93ce12ad341130f52f5fece3e35627aaa09c3efabfd63ead2928e45c50ce19e74a702c0
7
+ data.tar.gz: 8061d80dcc3b29bd94ec3da40bc97dd575cd288386dc0d41d601d507a9458c717b3b987c36b5f5776af37dcaa149e7d143c5c48b4afea15d76bebd7e96042686
@@ -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 templates(*paths)
36
- @templates ||= []
34
+ def assets(*paths)
35
+ @assets ||= []
37
36
  unless paths.empty?
38
- @templates = (@templates + paths.flatten).uniq
37
+ @assets = (@assets + paths.flatten).uniq
39
38
  end
40
- @templates
39
+ @assets
41
40
  end
42
41
  end
43
42
 
@@ -1,20 +1,21 @@
1
1
  module WIP
2
2
  module Runner
3
3
  module Renderer
4
- # TODO: allow handler configuration/option
5
- def render(content, context = {})
6
- content = path?(content) ? template(content) : content
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, "#{path} not found in:\n#{base_paths.map { |base| " - #{base}" }.join("\n")}"
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
@@ -1,5 +1,5 @@
1
1
  module WIP
2
2
  module Runner
3
- VERSION = "0.3.2"
3
+ VERSION = "0.3.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wip-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Corey Innis