pakman 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bf628523ec0e01ade19c4d0b9967ff96a2e93c70
4
+ data.tar.gz: d807a80bd056b41af7fcf8727527a9ba9e297c68
5
+ SHA512:
6
+ metadata.gz: 153efdc52b28be5f10a99e3cda57d52aa2b9409c24040d907793cdcc4737ebb4b41b4a555b075b0a115ef9af668d329fa21b4ba28efc7d9a3d33e984ce5fd33b
7
+ data.tar.gz: 0706462e1b030112b656624be971eeb66f4db754f37f28917f3351acdc266cbaa50edfa4704f67f9c26e9c47858920256360d491404cabfa8e5061d3309b7e1e
File without changes
@@ -1,21 +1,40 @@
1
- History.markdown
2
- Manifest.txt
3
- README.markdown
4
- Rakefile
5
- bin/pakman
6
- lib/pakman.rb
7
- lib/pakman/cli/commands/fetch.rb
8
- lib/pakman/cli/commands/gen.rb
9
- lib/pakman/cli/commands/list.rb
10
- lib/pakman/cli/ctx.rb
11
- lib/pakman/cli/helpers.rb
12
- lib/pakman/cli/opts.rb
13
- lib/pakman/cli/runner.rb
14
- lib/pakman/copier.rb
15
- lib/pakman/fetcher.rb
16
- lib/pakman/finder.rb
17
- lib/pakman/manifest.rb
18
- lib/pakman/template.rb
19
- lib/pakman/templater.rb
20
- lib/pakman/utils.rb
21
- lib/pakman/version.rb
1
+ History.md
2
+ Manifest.txt
3
+ README.md
4
+ Rakefile
5
+ bin/pakman
6
+ lib/pakman.rb
7
+ lib/pakman/cli/commands/fetch.rb
8
+ lib/pakman/cli/commands/gen.rb
9
+ lib/pakman/cli/commands/list.rb
10
+ lib/pakman/cli/ctx.rb
11
+ lib/pakman/cli/helpers.rb
12
+ lib/pakman/cli/opts.rb
13
+ lib/pakman/cli/runner.rb
14
+ lib/pakman/copier.rb
15
+ lib/pakman/erb/template.rb
16
+ lib/pakman/erb/templater.rb
17
+ lib/pakman/fetcher.rb
18
+ lib/pakman/finder.rb
19
+ lib/pakman/liquid/template.rb
20
+ lib/pakman/liquid/templater.rb
21
+ lib/pakman/manifest.rb
22
+ lib/pakman/page.rb
23
+ lib/pakman/utils.rb
24
+ lib/pakman/version.rb
25
+ test/data/test.yml
26
+ test/erb/pak/test.html.erb
27
+ test/erb/pak/test.txt
28
+ test/helper.rb
29
+ test/liquid/pak/test.html
30
+ test/liquid/pak/test.txt
31
+ test/liquid/test.html
32
+ test/pages/empty.txt
33
+ test/pages/page1.txt
34
+ test/pages/page2.txt
35
+ test/pages/page3.txt
36
+ test/pages/text.txt
37
+ test/test_erb.rb
38
+ test/test_liquid.rb
39
+ test/test_liquid_drops.rb
40
+ test/test_page.rb
@@ -1,11 +1,11 @@
1
- # `pakman` - Template Pack Manager in Ruby
1
+ # `pakman` - Template Pack Manager in Ruby (incl. Embedded Ruby, Liquid, etc.)
2
2
 
3
3
 
4
- * home :: [github.com/geraldb/pakman](https://github.com/geraldb/pakman)
5
- * bugs :: [github.com/geraldb/pakman/issues](https://github.com/geraldb/pakman/issues)
6
- * gem :: [rubygems.org/gems/pakman](https://rubygems.org/gems/pakman)
7
- * rdoc :: [rubydoc.info/gems/pakman](http://rubydoc.info/gems/pakman)
8
-
4
+ * home :: [github.com/rubylibs/pakman](https://github.com/rubylibs/pakman)
5
+ * bugs :: [github.com/rubylibs/pakman/issues](https://github.com/rubylibs/pakman/issues)
6
+ * gem :: [rubygems.org/gems/pakman](https://rubygems.org/gems/pakman)
7
+ * rdoc :: [rubydoc.info/gems/pakman](http://rubydoc.info/gems/pakman)
8
+ * forum :: [groups.google.com/group/wwwmake](http://groups.google.com/group/wwwmake)
9
9
 
10
10
  ## Usage - Ruby Code
11
11
 
@@ -75,12 +75,17 @@ and author slides in plain text using a wiki-style markup language that's easy-t
75
75
 
76
76
  ## Real World Template Packs
77
77
 
78
- * [S6 Template Pack](https://github.com/slideshow-s9/slideshow-s6-blank)
79
- * [impress.js Template Pack](https://github.com/slideshow-s9/slideshow-impress.js)
80
- * [deck.js Template Pack](https://github.com/slideshow-s9/slideshow-deck.js)
78
+ * [S6 Template Pack](https://github.com/slideshow-templates/slideshow-s6-blank)
79
+ * [impress.js Template Pack](https://github.com/slideshow-templates/slideshow-impress.js)
80
+ * [deck.js Template Pack](https://github.com/slideshow-templates/slideshow-deck.js)
81
81
 
82
82
 
83
83
  ## License
84
84
 
85
85
  The `pakman` scripts are dedicated to the public domain.
86
- Use it as you please with no restrictions whatsoever.
86
+ Use it as you please with no restrictions whatsoever.
87
+
88
+ ## Questions? Comments?
89
+
90
+ Send them along to the [wwwmake forum/mailing list](http://groups.google.com/group/wwwmake).
91
+ Thanks!
data/Rakefile CHANGED
@@ -5,21 +5,28 @@ Hoe.spec 'pakman' do
5
5
 
6
6
  self.version = Pakman::VERSION
7
7
 
8
- self.summary = 'pakman - Template Pack Manager'
8
+ self.summary = 'pakman - Template Pack Manager (incl. Embedded Ruby, Liquid, etc.)'
9
9
  self.description = summary
10
10
 
11
- self.urls = ['https://github.com/geraldb/pakman']
11
+ self.urls = ['https://github.com/rubylibs/pakman']
12
12
 
13
13
  self.author = 'Gerald Bauer'
14
- self.email = 'webslideshow@googlegroups.com'
14
+ self.email = 'wwwmake@googlegroups.com'
15
15
 
16
16
  self.extra_deps = [
17
- ['fetcher', '>= 0.3.0'],
18
- ['logutils', '>= 0.6.0']
17
+ ['fetcher', '>= 0.4.5'],
18
+ ['logutils', '>= 0.6.1'],
19
+ ['liquid', '>= 3.0.6'],
19
20
  ]
20
21
 
21
22
  # switch extension to .rdoc for gihub formatting
22
- self.readme_file = 'README.markdown'
23
- self.history_file = 'History.markdown'
23
+ # self.readme_file = 'README.md'
24
+ # self.history_file = 'History.md'
25
+
26
+ self.licenses = ['Public Domain']
27
+
28
+ self.spec_extras = {
29
+ required_ruby_version: '>= 1.9.2'
30
+ }
24
31
 
25
32
  end
data/bin/pakman CHANGED
File without changes
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  ###
2
4
  # NB: for local testing run like:
3
5
  #
@@ -18,14 +20,23 @@ require 'logutils'
18
20
  require 'fetcher' # fetch (download) files
19
21
 
20
22
 
23
+ # 3rd party rubygems
24
+ require 'liquid'
25
+
21
26
  # our own code
22
27
 
23
28
  require 'pakman/copier'
24
29
  require 'pakman/fetcher'
25
30
  require 'pakman/finder'
26
31
  require 'pakman/manifest'
27
- require 'pakman/template'
28
- require 'pakman/templater'
32
+
33
+ require 'pakman/erb/template'
34
+ require 'pakman/erb/templater'
35
+
36
+ require 'pakman/liquid/template'
37
+ require 'pakman/liquid/templater'
38
+
39
+ require 'pakman/page'
29
40
  require 'pakman/utils'
30
41
  require 'pakman/version'
31
42
 
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+
3
+ module Pakman
4
+
5
+ class ErbTemplate
6
+
7
+ def self.from_file( path )
8
+ puts " Loading template (from file) >#{path}<..."
9
+ text = File.read( path ) ## use/todo: use read utf8 - why? why not??
10
+ self.new( text, path: path ) ## note: pass along path as an option
11
+ end
12
+
13
+ def self.from_string( text ) ### use parse as alias - why?? why not??
14
+ self.new( text )
15
+ end
16
+
17
+ def initialize( text, opts={} )
18
+ @template = ERB.new( text )
19
+ end
20
+
21
+ def render( binding )
22
+ @template.result( binding )
23
+ end
24
+
25
+ end # class ErbTemplate
26
+ end # module Pakman
@@ -1,5 +1,11 @@
1
+ # encoding: utf-8
2
+
1
3
  module Pakman
2
4
 
5
+ ### todo:
6
+ ## rename to ErbTemplater (or RubyTemplater) - why? why not?
7
+
8
+
3
9
  class Templater
4
10
 
5
11
  include LogUtils::Logging
@@ -46,7 +52,7 @@ class Templater
46
52
  puts " Merging to #{dest}..."
47
53
 
48
54
  out = File.new( destfull, 'w+' )
49
- out << Template.new( source ).render( binding )
55
+ out << ErbTemplate.from_file( source ).render( binding )
50
56
  out.flush
51
57
  out.close
52
58
  else
@@ -60,4 +66,4 @@ class Templater
60
66
  end # method merge_pak
61
67
 
62
68
  end # class Templater
63
- end # module Pakman
69
+ end # module Pakman
@@ -0,0 +1,61 @@
1
+ # encoding: utf-8
2
+
3
+ module Pakman
4
+
5
+
6
+ class LiquidTemplate
7
+
8
+ def self.from_file( path )
9
+ puts " Loading template (from file) >#{path}<..."
10
+ text = File.read( path ) ## use/todo: use read utf8 - why? why not??
11
+ self.new( text, path: path ) ## note: pass along path as an option
12
+ end
13
+
14
+ def self.from_string( text ) ### use parse as alias - why?? why not??
15
+ self.new( text )
16
+ end
17
+
18
+ def initialize( text, opts={} )
19
+ @template = Liquid::Template.parse( text ) # parses and compiles the template
20
+ end
21
+
22
+ def render( hash )
23
+ ## note: hash keys MUST be strings (not symbols) e.g. 'name' => 'Toby'
24
+ ## pp hash
25
+ @template.render( hash )
26
+ end
27
+
28
+ end # class LiquidTemplate
29
+
30
+
31
+
32
+ #########################
33
+ ## convenience helper for pages (with headers/front matter)
34
+
35
+ class LiquidPageTemplate
36
+ def self.from_file( path )
37
+ ## todo: (auto)-add headers as page.title etc. -- why? why not??
38
+ puts " Loading page template (from file) >#{path}<..."
39
+ page = Page.from_file( path ) ## use/todo: use read utf8 - why? why not??
40
+ self.new( page.contents, path: path ) ## note: pass along path as an option
41
+ end
42
+
43
+ def self.from_string( text ) ### use parse as alias - why?? why not??
44
+ ## todo: (auto)-add headers as page.title etc. -- why? why not??
45
+ page = Page.from_string( text )
46
+ self.new( page.contents )
47
+ end
48
+
49
+ def initialize( text, opts={} )
50
+ @template = LiquidTemplate.new( text, opts )
51
+ end
52
+
53
+ def render( hash )
54
+ @template.render( hash )
55
+ end
56
+
57
+ end ## class LiquidPageTemplate
58
+
59
+
60
+ end # module Pakman
61
+
@@ -0,0 +1,68 @@
1
+ # encoding: utf-8
2
+
3
+ module Pakman
4
+
5
+
6
+ class LiquidTemplater
7
+
8
+ include LogUtils::Logging
9
+
10
+ def initialize
11
+ end
12
+
13
+ ## rename binding/hash to assigns or something more specific - why? why not?
14
+ def merge_pak( manifestsrc, pakpath, binding, name )
15
+
16
+ start = Time.now
17
+
18
+ pakname = Pakman.pakname_from_file( manifestsrc )
19
+
20
+ puts "Merging template pack '#{pakname}'"
21
+
22
+ # todo: rename to load_file once depreated API got removed
23
+ manifest = Manifest.load_file_v2( manifestsrc )
24
+
25
+ manifest.each do |entry|
26
+ dest = entry[0]
27
+ source = entry[1]
28
+
29
+ if dest =~ /__file__/ # replace w/ name
30
+ dest = dest.gsub( '__file__', name )
31
+ end
32
+
33
+ # get full (absolute) path and make sure path exists
34
+ destfull = File.expand_path( dest, pakpath )
35
+ destpath = File.dirname( destfull )
36
+ FileUtils.makedirs( destpath ) unless File.directory?( destpath )
37
+
38
+ logger.debug "destfull=>#{destfull}<"
39
+ logger.debug "destpath=>#{destpath}<"
40
+
41
+ ###
42
+ # note:
43
+ # use jekyll convention for now
44
+ # check if file starts with front matter (yaml block)
45
+ # if yes, process (with liquid) otherwise copy as is 1:1
46
+
47
+ source_page = Page.from_file( source )
48
+ if source_page.headers?
49
+ puts " Merging to #{dest}..."
50
+
51
+ out = File.new( destfull, 'w+' )
52
+ ## note: only pass along contents (not headers e.g. front matter for now)
53
+ ## (auto-)add front matter headers as page.[xxx] - why? why not??
54
+ out << LiquidTemplate.from_string( source_page.contents ).render( binding )
55
+ out.flush
56
+ out.close
57
+ else
58
+ puts " Copying to #{dest} from #{source}..."
59
+
60
+ FileUtils.copy( source, destfull )
61
+ end
62
+ end # each entry in manifest
63
+
64
+ puts "Done (in #{Time.now-start} s)."
65
+ end # method merge_pak
66
+
67
+ end # class LiquidTemplater
68
+ end # module Pakman
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  module Pakman
2
4
 
3
5
  class Manifest
@@ -0,0 +1,56 @@
1
+ # encoding: utf-8
2
+
3
+ module Pakman
4
+
5
+
6
+ ## Jekyll-style page
7
+ ## with optional front-matter (yaml block)
8
+
9
+ class Page
10
+
11
+ def self.from_file( path )
12
+ puts " Loading page (from file) >#{path}<..."
13
+ text = File.read( path ) ## use/todo: use read utf8 - why? why not??
14
+ self.new( text, path: path ) ## note: pass along path as an option
15
+ end
16
+
17
+ def self.from_string( text ) ### use parse as alias - why?? why not??
18
+ self.new( text )
19
+ end
20
+
21
+ attr_reader :contents
22
+ attr_reader :headers
23
+
24
+ ## has headers/metadata (front matter block) - yes/no - use hash for check for now
25
+ def headers?() @headers.kind_of?( Hash ); end
26
+
27
+ ## check if \s includes newline too?
28
+ ## fix/check ^ - just means start of newline (use /A or something --- MUST always be first
29
+ ##
30
+ ## note: include --- in headers
31
+ ## e.g. --- results in nil
32
+ ## empty string (without leading ---) results in false! (we want nil if no headers for empty block)
33
+ HEADERS_PATTERN = /
34
+ ^(?<headers>---\s*\n
35
+ .*?)
36
+ ^(---\s*$\n?)
37
+ /xm
38
+
39
+ def initialize( text, opts={} )
40
+ ## todo/fix: check regex in jekyll (add link to source etc.)
41
+ if m=HEADERS_PATTERN.match( text )
42
+ @contents = m.post_match
43
+ pp m
44
+ pp m[:headers]
45
+ @headers = YAML.load( m[:headers] )
46
+ pp @headers
47
+ @headers = {} if @headers.nil? ## check if headers is nil use/assign empty hash
48
+ else
49
+ @contents = text
50
+ @headers = nil
51
+ end
52
+ end
53
+
54
+ end # class Page
55
+ end # module Pakman
56
+
@@ -1,3 +1,4 @@
1
+
1
2
  module Pakman
2
- VERSION = '0.5.0'
3
+ VERSION = '0.6.0'
3
4
  end
@@ -0,0 +1,12 @@
1
+ headers:
2
+ title: test title
3
+ author: test author
4
+
5
+
6
+ slides:
7
+ - header: test header 1
8
+ content: test content 1
9
+ - header: test header 2
10
+ content: test content 2
11
+ - content: test content 3
12
+
@@ -0,0 +1,24 @@
1
+ <html>
2
+ <head>
3
+ <title>pakman Test Template</title>
4
+ </head>
5
+ <body>
6
+
7
+ <h1>Hello pakman</h1>
8
+
9
+ <h3>Headers</h3>
10
+
11
+ <ul>
12
+ <li>author: <%= headers['author'] %></li>
13
+ <li>title: <%= headers['title'] %></li>
14
+ </ul>
15
+
16
+ <h3>Slides</h3>
17
+
18
+ <% slides.each do |slide| %>
19
+ <div><%= slide['content'] %></div>
20
+ <div><%= slide['header'] %></div>
21
+ <% end %>
22
+
23
+ </body>
24
+ </html>
@@ -0,0 +1,4 @@
1
+ ######
2
+ # simple test manifest
3
+
4
+ __file__.html test.html.erb
@@ -0,0 +1,9 @@
1
+ # encoding: utf-8
2
+
3
+ # minitest setup
4
+ require 'minitest/autorun'
5
+
6
+
7
+ ## our own code
8
+ require 'pakman'
9
+
@@ -0,0 +1,27 @@
1
+ ---
2
+ ---
3
+
4
+ <html>
5
+ <head>
6
+ <title>pakman Test Template</title>
7
+ </head>
8
+ <body>
9
+
10
+ <h1>Hello pakman</h1>
11
+
12
+ <h3>Headers</h3>
13
+
14
+ <ul>
15
+ <li>author: {{ headers.author }}</li>
16
+ <li>title: {{ headers.title }}</li>
17
+ </ul>
18
+
19
+ <h3>Slides</h3>
20
+
21
+ {% for slide in slides %}
22
+ <div>{{ slide.content }}</div>
23
+ <div>{{ slide.header }}</div>
24
+ {% endfor %}
25
+
26
+ </body>
27
+ </html>
@@ -0,0 +1,4 @@
1
+ ######
2
+ # simple test manifest
3
+
4
+ __file__.html test.html
@@ -0,0 +1,21 @@
1
+
2
+ <h3>Headers</h3>
3
+
4
+ <ul>
5
+ <li>author: {{ headers['author'] }}</li>
6
+ <li>title: {{ headers['title'] }}</li>
7
+
8
+ <li>author: {{ headers.author }}</li>
9
+ <li>title: {{ headers.title }}</li>
10
+ </ul>
11
+
12
+
13
+ <h3>Slides</h3>
14
+
15
+ {% for slide in slides %}
16
+ <div>{{ slide['content'] }}</div>
17
+ <div>{{ slide['header'] }}</div>
18
+
19
+ <div>{{ slide.content }}</div>
20
+ <div>{{ slide.header }}</div>
21
+ {% endfor %}
File without changes
@@ -0,0 +1,5 @@
1
+ ---
2
+ title: hello
3
+ ---
4
+
5
+ some text here
@@ -0,0 +1,5 @@
1
+ ---
2
+ ---
3
+
4
+ try empty front matter
5
+
@@ -0,0 +1,3 @@
1
+ ---
2
+ # try empty front matter with comments
3
+ ---
@@ -0,0 +1,3 @@
1
+ just some text
2
+ no headers
3
+
@@ -0,0 +1,50 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_erb.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+
11
+ class TestErb < MiniTest::Test
12
+
13
+ class Ctx # Context
14
+
15
+ def initialize( hash )
16
+ @hash = hash
17
+ @headers = hash['headers']
18
+ @slides = hash['slides']
19
+
20
+ puts 'hash:'
21
+ pp @hash
22
+ puts 'headers:'
23
+ pp @headers
24
+ puts 'slides:'
25
+ pp @slides
26
+ end
27
+
28
+ attr_reader :headers
29
+ attr_reader :slides
30
+
31
+ def ctx
32
+ ### todo: check if method_missing works with binding in erb???
33
+ binding
34
+ end
35
+ end
36
+
37
+ def test_merge
38
+ hash = YAML.load_file( "#{Pakman.root}/test/data/test.yml" )
39
+ ctx = Ctx.new( hash )
40
+
41
+ manifestsrc = "#{Pakman.root}/test/erb/pak/test.txt"
42
+ outpath = "#{Pakman.root}/tmp/#{Time.now.to_i}" ## pakpath/output path
43
+
44
+ Pakman::Templater.new.merge_pak( manifestsrc, outpath, ctx.ctx, 'test' )
45
+
46
+ assert true
47
+ end # method test_merge
48
+
49
+ end # class TestErb
50
+
@@ -0,0 +1,57 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_liquid.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+
11
+ class TestLiquid < MiniTest::Test
12
+
13
+
14
+ def setup
15
+ Liquid::Template.error_mode = :strict
16
+ end
17
+
18
+
19
+ def test_template
20
+ hash = YAML.load_file( "#{Pakman.root}/test/data/test.yml" )
21
+ ctx= { 'headers' => hash['headers'], 'slides' => hash['slides'] }
22
+ pp ctx
23
+
24
+ path = "#{Pakman.root}/test/liquid/test.html"
25
+ t = Pakman::LiquidTemplate.from_file( path )
26
+ pp t.render( ctx )
27
+
28
+ assert true
29
+ end
30
+
31
+ def test_page_template
32
+ hash = YAML.load_file( "#{Pakman.root}/test/data/test.yml" )
33
+ ctx= { 'headers' => hash['headers'], 'slides' => hash['slides'] }
34
+ pp ctx
35
+
36
+ path = "#{Pakman.root}/test/liquid/pak/test.html"
37
+ t = Pakman::LiquidPageTemplate.from_file( path )
38
+ pp t.render( ctx )
39
+
40
+ assert true
41
+ end
42
+
43
+ def test_merge
44
+ hash = YAML.load_file( "#{Pakman.root}/test/data/test.yml" )
45
+ ctx= { 'headers' => hash['headers'], 'slides' => hash['slides'] }
46
+ pp ctx
47
+
48
+ manifestsrc = "#{Pakman.root}/test/liquid/pak/test.txt"
49
+ outpath = "#{Pakman.root}/tmp/#{Time.now.to_i}" ## pakpath/output path
50
+
51
+ Pakman::LiquidTemplater.new.merge_pak( manifestsrc, outpath, ctx, 'test' )
52
+
53
+ assert true
54
+ end # method test_merge
55
+
56
+ end # class TestLiquid
57
+
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_liquid_drops.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+
11
+ class TestLiquidDrops < MiniTest::Test
12
+
13
+ class HeadersDrop < Liquid::Drop
14
+
15
+ def initialize( h )
16
+ @h = h
17
+ end
18
+
19
+ def author() puts "call author"; @h['author']; end
20
+ def title() puts "call title"; @h['title']; end
21
+ end
22
+
23
+ class SlideDrop < Liquid::Drop
24
+
25
+ def initialize( h )
26
+ @h = h
27
+ end
28
+
29
+ def content() puts "call content"; @h['content']; end
30
+ def header() puts "call header"; @h['header']; end
31
+ end
32
+
33
+ def setup
34
+ Liquid::Template.error_mode = :strict
35
+ end
36
+
37
+
38
+ def test_template
39
+ hash = YAML.load_file( "#{Pakman.root}/test/data/test.yml" )
40
+ headers = HeadersDrop.new( hash['headers'] )
41
+ slides = hash['slides'].map { |h| SlideDrop.new( h ) }
42
+ ctx= { 'headers' => headers, 'slides' => slides }
43
+ pp ctx
44
+
45
+ path = "#{Pakman.root}/test/liquid/test.html"
46
+ t = Pakman::LiquidTemplate.from_file( path )
47
+ pp t.render( ctx )
48
+
49
+ assert true
50
+ end
51
+
52
+ end # class TestLiquidDrops
53
+
@@ -0,0 +1,41 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_page.rb
6
+
7
+
8
+ require 'helper'
9
+
10
+
11
+ class TestPage < MiniTest::Test
12
+
13
+ def test_page1
14
+ page = Pakman::Page.from_file( "#{Pakman.root}/test/pages/page1.txt" )
15
+ assert page.headers?
16
+ end # method test_page1
17
+
18
+ def test_page2
19
+ page = Pakman::Page.from_file( "#{Pakman.root}/test/pages/page2.txt" )
20
+ assert page.headers?
21
+ end # method test_page2
22
+
23
+ def test_page3
24
+ page = Pakman::Page.from_file( "#{Pakman.root}/test/pages/page3.txt" )
25
+ assert page.headers?
26
+ end # method test_page3
27
+
28
+ def test_empty
29
+ page = Pakman::Page.from_file( "#{Pakman.root}/test/pages/empty.txt" )
30
+ assert page.headers? == false
31
+ end # method test_empty
32
+
33
+ def test_text
34
+ page = Pakman::Page.from_file( "#{Pakman.root}/test/pages/text.txt" )
35
+ assert page.headers? == false
36
+ end # method test_text
37
+
38
+ end # class TestPage
39
+
40
+
41
+
metadata CHANGED
@@ -1,71 +1,98 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pakman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
5
- prerelease:
4
+ version: 0.6.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Gerald Bauer
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-07 00:00:00.000000000 Z
11
+ date: 2016-03-28 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: fetcher
16
- requirement: &68820270 !ruby/object:Gem::Requirement
17
- none: false
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
- version: 0.3.0
19
+ version: 0.4.5
22
20
  type: :runtime
23
21
  prerelease: false
24
- version_requirements: *68820270
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.4.5
25
27
  - !ruby/object:Gem::Dependency
26
28
  name: logutils
27
- requirement: &68819720 !ruby/object:Gem::Requirement
28
- none: false
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.6.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.6.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: liquid
43
+ requirement: !ruby/object:Gem::Requirement
29
44
  requirements:
30
- - - ! '>='
45
+ - - ">="
31
46
  - !ruby/object:Gem::Version
32
- version: 0.6.0
47
+ version: 3.0.6
33
48
  type: :runtime
34
49
  prerelease: false
35
- version_requirements: *68819720
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 3.0.6
36
55
  - !ruby/object:Gem::Dependency
37
56
  name: rdoc
38
- requirement: &68819170 !ruby/object:Gem::Requirement
39
- none: false
57
+ requirement: !ruby/object:Gem::Requirement
40
58
  requirements:
41
- - - ~>
59
+ - - "~>"
42
60
  - !ruby/object:Gem::Version
43
- version: '3.10'
61
+ version: '4.0'
44
62
  type: :development
45
63
  prerelease: false
46
- version_requirements: *68819170
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '4.0'
47
69
  - !ruby/object:Gem::Dependency
48
70
  name: hoe
49
- requirement: &68818530 !ruby/object:Gem::Requirement
50
- none: false
71
+ requirement: !ruby/object:Gem::Requirement
51
72
  requirements:
52
- - - ~>
73
+ - - "~>"
53
74
  - !ruby/object:Gem::Version
54
- version: '3.3'
75
+ version: '3.14'
55
76
  type: :development
56
77
  prerelease: false
57
- version_requirements: *68818530
58
- description: pakman - Template Pack Manager
59
- email: webslideshow@googlegroups.com
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.14'
83
+ description: pakman - Template Pack Manager (incl. Embedded Ruby, Liquid, etc.)
84
+ email: wwwmake@googlegroups.com
60
85
  executables:
61
86
  - pakman
62
87
  extensions: []
63
88
  extra_rdoc_files:
89
+ - History.md
64
90
  - Manifest.txt
91
+ - README.md
65
92
  files:
66
- - History.markdown
93
+ - History.md
67
94
  - Manifest.txt
68
- - README.markdown
95
+ - README.md
69
96
  - Rakefile
70
97
  - bin/pakman
71
98
  - lib/pakman.rb
@@ -77,37 +104,56 @@ files:
77
104
  - lib/pakman/cli/opts.rb
78
105
  - lib/pakman/cli/runner.rb
79
106
  - lib/pakman/copier.rb
107
+ - lib/pakman/erb/template.rb
108
+ - lib/pakman/erb/templater.rb
80
109
  - lib/pakman/fetcher.rb
81
110
  - lib/pakman/finder.rb
111
+ - lib/pakman/liquid/template.rb
112
+ - lib/pakman/liquid/templater.rb
82
113
  - lib/pakman/manifest.rb
83
- - lib/pakman/template.rb
84
- - lib/pakman/templater.rb
114
+ - lib/pakman/page.rb
85
115
  - lib/pakman/utils.rb
86
116
  - lib/pakman/version.rb
87
- homepage: https://github.com/geraldb/pakman
88
- licenses: []
117
+ - test/data/test.yml
118
+ - test/erb/pak/test.html.erb
119
+ - test/erb/pak/test.txt
120
+ - test/helper.rb
121
+ - test/liquid/pak/test.html
122
+ - test/liquid/pak/test.txt
123
+ - test/liquid/test.html
124
+ - test/pages/empty.txt
125
+ - test/pages/page1.txt
126
+ - test/pages/page2.txt
127
+ - test/pages/page3.txt
128
+ - test/pages/text.txt
129
+ - test/test_erb.rb
130
+ - test/test_liquid.rb
131
+ - test/test_liquid_drops.rb
132
+ - test/test_page.rb
133
+ homepage: https://github.com/rubylibs/pakman
134
+ licenses:
135
+ - Public Domain
136
+ metadata: {}
89
137
  post_install_message:
90
138
  rdoc_options:
91
- - --main
92
- - README.markdown
139
+ - "--main"
140
+ - README.md
93
141
  require_paths:
94
142
  - lib
95
143
  required_ruby_version: !ruby/object:Gem::Requirement
96
- none: false
97
144
  requirements:
98
- - - ! '>='
145
+ - - ">="
99
146
  - !ruby/object:Gem::Version
100
- version: '0'
147
+ version: 1.9.2
101
148
  required_rubygems_version: !ruby/object:Gem::Requirement
102
- none: false
103
149
  requirements:
104
- - - ! '>='
150
+ - - ">="
105
151
  - !ruby/object:Gem::Version
106
152
  version: '0'
107
153
  requirements: []
108
- rubyforge_project: pakman
109
- rubygems_version: 1.8.17
154
+ rubyforge_project:
155
+ rubygems_version: 2.2.3
110
156
  signing_key:
111
- specification_version: 3
112
- summary: pakman - Template Pack Manager
157
+ specification_version: 4
158
+ summary: pakman - Template Pack Manager (incl. Embedded Ruby, Liquid, etc.)
113
159
  test_files: []
@@ -1,20 +0,0 @@
1
- module Pakman
2
-
3
- class Template
4
-
5
- def initialize( path )
6
- @path = path
7
- end
8
-
9
- def render( binding )
10
- ERB.new( load_template() ).result( binding )
11
- end
12
-
13
- private
14
- def load_template
15
- puts " Loading template >#{@path}<..."
16
- File.read( @path )
17
- end
18
-
19
- end # class Template
20
- end # module Pakman