jekyll-categorizer 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ccce1e5afaf3a8adfe5d3fc96ff21c07fd64551f
4
+ data.tar.gz: f980e82018fa566365a94dc5dd5d3e43f122defb
5
+ SHA512:
6
+ metadata.gz: 123097668fae678c793ce0118ccea82eead589858d33d3adba7e94824259c13e2fe5d5ab79b8cf595d33ec58ab95f6593931986a78ea5c43774afa34ba43f291
7
+ data.tar.gz: 739ed3172cc9162a47775609e561c793524f44971b84cd39b2e44ca76412748103e0a7aaa0f0e5c0f117e768d5eefe7a002e45a4dd855240b72af2b23185c6d4
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'jekyll/categorizer/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'jekyll-categorizer'
8
+ spec.version = Jekyll::Categorizer::VERSION
9
+ spec.authors = ['Ignacio Galindo']
10
+ spec.email = ['joiggama@gmail.com']
11
+
12
+ spec.summary = %q{ Generate simple category index pages with ease. }
13
+ spec.description = %q{ A Jekyll plugin to generate custom category index pages. Bring your own template. }
14
+ spec.homepage = 'https://github.com/joiggama/jekyll-categorizer'
15
+ spec.license = 'MIT'
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = 'exe'
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ['lib']
21
+
22
+
23
+ spec.add_development_dependency 'bundler', '~> 1.9'
24
+ spec.add_development_dependency 'rake', '~> 10.0'
25
+ spec.add_development_dependency 'pry-byebug', '~> 3.2.0'
26
+
27
+ spec.add_runtime_dependency 'jekyll', '~> 2.5.3'
28
+ end
@@ -0,0 +1,52 @@
1
+ module Jekyll
2
+ module Categorizer
3
+
4
+ class Builder < Jekyll::Generator
5
+
6
+ safe true
7
+ priority :low
8
+
9
+ def generate(site)
10
+ site.categories.keys.each do |category|
11
+ page = Page.new(site, category)
12
+ if page.render?
13
+ page.render(site.layouts, site.site_payload)
14
+ page.write(site.dest)
15
+ site.pages << page
16
+ end
17
+ end
18
+ end
19
+
20
+ end
21
+
22
+ class Page < Jekyll::Page
23
+
24
+ def initialize(site, category)
25
+ @site = site
26
+ @base = site.source
27
+ @dir = site.config['categorizer']['dir'].gsub(/^\/*(.*)\/*$/, '\1')
28
+ @name = "#{category}.html"
29
+
30
+ template_path = File.join(@base, '_layouts', "#{site.config['categorizer']['layout']}.html")
31
+
32
+ self.process(@name)
33
+
34
+ if File.exist?(template_path)
35
+ @perform_render = true
36
+ template_dir = File.dirname(template_path)
37
+ template = File.basename(template_path)
38
+ self.read_yaml(template_dir, template)
39
+ self.data['category'] = category
40
+ else
41
+ @perform_render = false
42
+ end
43
+ end
44
+
45
+ def render?
46
+ @perform_render
47
+ end
48
+
49
+ end
50
+
51
+ end
52
+ end
@@ -0,0 +1,5 @@
1
+ module Jekyll
2
+ module Categorizer
3
+ VERSION = '0.1.0'
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-categorizer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ignacio Galindo
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2015-08-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.9'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry-byebug
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.2.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.2.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: jekyll
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 2.5.3
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 2.5.3
69
+ description: " A Jekyll plugin to generate custom category index pages. Bring your
70
+ own template. "
71
+ email:
72
+ - joiggama@gmail.com
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - Gemfile
79
+ - jekyll-categorizer.gemspec
80
+ - lib/jekyll/categorizer.rb
81
+ - lib/jekyll/categorizer/version.rb
82
+ homepage: https://github.com/joiggama/jekyll-categorizer
83
+ licenses:
84
+ - MIT
85
+ metadata: {}
86
+ post_install_message:
87
+ rdoc_options: []
88
+ require_paths:
89
+ - lib
90
+ required_ruby_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ requirements: []
101
+ rubyforge_project:
102
+ rubygems_version: 2.4.5
103
+ signing_key:
104
+ specification_version: 4
105
+ summary: Generate simple category index pages with ease.
106
+ test_files: []