jekyll-handlebars 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.com"
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013 Brendan Tobolaski
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # jekyll-handlebars
2
+
3
+ ## Basic Setup
4
+
5
+ ### Requirements
6
+
7
+ - `node` is required for running handlebars
8
+ - If you are on a Mac and have brew installed, installing this is as easy as `brew install node`
9
+ - `handlebars` compiles the templates
10
+ - Since you already have node installed you just need to run `npm -g install handlebars`
11
+
12
+ ### Installation
13
+
14
+ Install the gem
15
+
16
+ [sudo] gem install jekyll-handlebars
17
+
18
+ Then in a plugin file within your Jekyll project's `_plugins` directory:
19
+
20
+ #_plugins/handlebars.rb
21
+ require 'rubygems'
22
+ require 'jekyll-handlebars'
23
+
24
+ or if you are using bundler just add:
25
+
26
+ gem 'jekyll-handlebars'
27
+
28
+ to your Gemfile. Create a plugin file that looks like this in you `_plugins` directory:
29
+
30
+ #_plugins/handlebars.rb
31
+ require 'rubygems'
32
+ require 'bundler/setup'
33
+ require 'jekyll-handlebars'
34
+
35
+ ## Usage
36
+
37
+ Make a directory for handlebars templates `_assets/templates`. All of your templates should end
38
+ with `.template`. You'll also have to manually include [the handlebars runtime][1]
39
+ ([direct link][2]) in your layouts. You'll also have to manually include each template in your
40
+ layout. They end up in `/assets/templates/<name>.js`. Be sure to include the runtime first or the
41
+ template won't work.
42
+
43
+ ## Improvements
44
+
45
+ 1. Include Handlebars to not force people to manually manage dependencies
46
+ 2. Add liquid tags for templates so people don't need to manually add templates to layouts
47
+ 3. Find a way to drop the dependency on node.js, to make it easier to setup
48
+
49
+ [1]:http://handlebarsjs.com
50
+ [2]:https://raw.github.com/wycats/handlebars.js/1.0.0/dist/handlebars.runtime.js
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "jekyll-handlebars/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "jekyll-handlebars"
7
+ s.version = Jekyll::Handlebars::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Brendan Tobolaski"]
10
+ s.email = ["brendan@tobolaski.com"]
11
+ s.homepage = "https://github.com/btobolaski/jekyll-handlebars"
12
+ s.summary = %q{Makes working with Handlebars templates easier for Jekyll}
13
+ s.description = %q{Easily compile Handlebars template for use with Jekyll}
14
+ s.license = 'MIT'
15
+
16
+ s.rubyforge_project = "jekyll-handlebars"
17
+
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+
23
+ s.add_runtime_dependency('jekyll', [">= 1.0.0"])
24
+ end
@@ -0,0 +1,37 @@
1
+ module Jekyll
2
+ module JekyllHandlebars
3
+
4
+ class HandlebarsTemplate < Jekyll::StaticFile
5
+ def initialize(site, base, name)
6
+ @site = site
7
+ @base = base
8
+ @name = name
9
+ @dir = '/assets/templates'
10
+ @src = File.join(base, '_assets/templates/', name)
11
+ end
12
+
13
+ def destination(dest)
14
+ js_ext = '.js'
15
+ dest_name = @name.gsub(/\.template/, js_ext)
16
+ File.join(dest, @dir, dest_name)
17
+ end
18
+
19
+ def write(dest)
20
+ dest_path = destination(dest)
21
+ FileUtils.mkdir_p(File.dirname(dest_path))
22
+ `handlebars #{@src} -f #{dest_path}`
23
+
24
+ true
25
+ end
26
+ end
27
+
28
+ class HandlebarsTemplateCompiler < Generator
29
+ def generate(site)
30
+ Dir.glob(File.join(site.source, '_assets/templates', "*.template")) do |template|
31
+ site.static_files << HandlebarsTemplate.new(site, site.source, File.basename(template))
32
+ end
33
+ end
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,5 @@
1
+ module Jekyll
2
+ module Handlebars
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-handlebars
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Brendan Tobolaski
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2013-10-08 00:00:00 -05:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: jekyll
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 0
30
+ - 0
31
+ version: 1.0.0
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ description: Easily compile Handlebars template for use with Jekyll
35
+ email:
36
+ - brendan@tobolaski.com
37
+ executables: []
38
+
39
+ extensions: []
40
+
41
+ extra_rdoc_files: []
42
+
43
+ files:
44
+ - .gitignore
45
+ - Gemfile
46
+ - LICENSE
47
+ - README.md
48
+ - Rakefile
49
+ - jekyll-handlebars.gemspec
50
+ - lib/jekyll-handlebars.rb
51
+ - lib/jekyll-handlebars/version.rb
52
+ has_rdoc: true
53
+ homepage: https://github.com/btobolaski/jekyll-handlebars
54
+ licenses:
55
+ - MIT
56
+ post_install_message:
57
+ rdoc_options: []
58
+
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ segments:
66
+ - 0
67
+ version: "0"
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ requirements: []
76
+
77
+ rubyforge_project: jekyll-handlebars
78
+ rubygems_version: 1.3.6
79
+ signing_key:
80
+ specification_version: 3
81
+ summary: Makes working with Handlebars templates easier for Jekyll
82
+ test_files: []
83
+