modular-jekyll 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b2f39305bf891e0d72997031a89a97f683ef5114
4
+ data.tar.gz: a6b30234305b9ef840eef7469cc3b1f4499815f3
5
+ SHA512:
6
+ metadata.gz: 298837c8146588fe3eaec1e9d7a438b9fef9ac55c2a6f22813c42190ab2b4b18918bb957400ba00f47eab598ccc8dcca18ff41c76db5f190853ce0d9937ceb7b
7
+ data.tar.gz: 9b40d5e6bacf710a65bbd58bceefb84d0772db705a11c1056efedffd47da0c2cf7bcdd2f1b881d9a0b6452bc85397783930a1253311d1cdcbcbb47c8441820f1
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,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in modular-jekyll.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Scott Dover
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all 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,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # modular-jekyll
2
+
3
+ A modular approach to Jekyll
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "modular/jekyll"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ module Modular
2
+ module Jekyll
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,50 @@
1
+ require "modular/jekyll/version"
2
+
3
+ module Modular
4
+ module Jekyll < Jekyll::Generator
5
+ def create_modular_content(page, modules, modules_dir)
6
+ content = ''
7
+
8
+ modules.each do | mod |
9
+ module_html = '';
10
+ params = Hash.new
11
+
12
+ if mod.is_a? String
13
+ # If we've a string, just load the file
14
+ module_html = File.read File.join Dir.pwd, modules_dir, "#{mod}.html"
15
+ else
16
+ # Otherwise, we have params. Load the file and inject the params
17
+ mod.select do |modName, modParams|
18
+ module_html = File.read File.join Dir.pwd, modules_dir, "#{modName}.html"
19
+ params['include'] = modParams
20
+ end
21
+ end
22
+
23
+ # Pass page into our partial
24
+ params['page'] = page
25
+ tmpl = Liquid::Template.parse(module_html).render(params)
26
+
27
+ # Append it to the content
28
+ content += tmpl
29
+ end
30
+
31
+ content
32
+ end
33
+
34
+ def generate(site)
35
+ modules_dir = site.config['modules']
36
+ modules_dir = '_includes/modules' if not modules_dir else modules_dir
37
+
38
+ site.pages.map do | page |
39
+ if (page.data['modules'])
40
+ page.data['moduleContent'] = create_modular_content(
41
+ page,
42
+ page.data['modules'],
43
+ modules_dir
44
+ )
45
+ end
46
+ page
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'modular/jekyll/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "modular-jekyll"
8
+ spec.version = Modular::Jekyll::VERSION
9
+ spec.authors = ["Scott Dover"]
10
+ spec.email = ["sdover102@gmail.com"]
11
+
12
+ spec.summary = %q{A modular approach to Jekyll}
13
+ spec.homepage = "https://github.com/scottdover/modular-jekyll"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_runtime_dependency 'jekyll', '~> 3.0'
24
+ spec.add_development_dependency "bundler", "~> 1.13"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ end
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: modular-jekyll
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Scott Dover
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-09-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: jekyll
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.13'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.13'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description:
56
+ email:
57
+ - sdover102@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - bin/console
68
+ - bin/setup
69
+ - lib/modular/jekyll.rb
70
+ - lib/modular/jekyll/version.rb
71
+ - modular-jekyll.gemspec
72
+ homepage: https://github.com/scottdover/modular-jekyll
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.6.3
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: A modular approach to Jekyll
96
+ test_files: []