jekyll-get-json 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +16 -0
- data/.gitignore +4 -0
- data/LICENSE +21 -0
- data/README.md +3 -0
- data/jekyll-get-json.gemspec +17 -0
- data/lib/jekyll-get-json/converter.rb +39 -0
- data/lib/jekyll-get-json/version.rb +3 -0
- data/lib/jekyll-get-json.rb +5 -0
- metadata +80 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: aa994163e5787ab9e97e19987c0f91934b22c33f76f162f4cd1d4d8d8b061da8
|
4
|
+
data.tar.gz: 18de3e56a3a7149cfd9d0716c1141103a65765c3cf967e32cf09435de29018cd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b1f0d394fa15bcc794993415c4c25e6ada3783663beecef3157b9b1f2fc481cb4bd88acd77045f70ba1ecb536e0e20641ddb7d598feea77e51fa7224983f32ba
|
7
|
+
data.tar.gz: c7b8355e25edf64eccb28c9e09e5906ac874af5b1a0f95ea09c0ec5b000f94ca7b07fbfca61ccdc167ecc252f8f74b4f6da6d7bdf71c202be0c36bd2756e252c
|
data/.editorconfig
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
root = true
|
2
|
+
|
3
|
+
[*]
|
4
|
+
indent_style = space
|
5
|
+
indent_size = 2
|
6
|
+
trim_trailing_whitespace = true
|
7
|
+
insert_final_newline = true
|
8
|
+
|
9
|
+
[*.{md,rb,gemspec},Makefile]
|
10
|
+
charset = utf-8
|
11
|
+
|
12
|
+
[Makefile]
|
13
|
+
indent_style = tab
|
14
|
+
|
15
|
+
[*.md]
|
16
|
+
trim_trailing_whitespace = false
|
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Brock Fanning <brockfanning@gmail.com> (https://github.com/brockfanning
|
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,17 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "jekyll-get-json/version"
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = "jekyll-get-json"
|
6
|
+
spec.summary = "Import remote JSON data into the data for a Jekyll site"
|
7
|
+
spec.description = "Import remote JSON data into the data for a Jekyll site"
|
8
|
+
spec.version = JekyllGetJson::VERSION
|
9
|
+
spec.authors = ["Brock Fanning"]
|
10
|
+
spec.email = ["brockfanning@gmail.com"]
|
11
|
+
spec.homepage = "https://github.com/brockfanning/jekyll-get-json"
|
12
|
+
spec.licenses = ["MIT"]
|
13
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|spec|features)/!) }
|
14
|
+
spec.require_paths = ["lib"]
|
15
|
+
spec.add_dependency "jekyll", "~> 3.0"
|
16
|
+
spec.add_dependency "deep_merge", "~> 1.2"
|
17
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require "jekyll"
|
2
|
+
require 'json'
|
3
|
+
require 'deep_merge'
|
4
|
+
require 'open-uri'
|
5
|
+
|
6
|
+
module JekyllGetJson
|
7
|
+
class GetJsonGenerator < Jekyll::Generator
|
8
|
+
safe true
|
9
|
+
priority :highest
|
10
|
+
|
11
|
+
def generate(site)
|
12
|
+
|
13
|
+
config = site.config['jekyll_get_json']
|
14
|
+
if !config
|
15
|
+
warn "No config".yellow
|
16
|
+
return
|
17
|
+
end
|
18
|
+
if !config.kind_of?(Array)
|
19
|
+
config = [config]
|
20
|
+
end
|
21
|
+
|
22
|
+
config.each do |d|
|
23
|
+
begin
|
24
|
+
target = site.data[d['data']]
|
25
|
+
source = JSON.load(open(d['json']))
|
26
|
+
|
27
|
+
if target
|
28
|
+
target.deep_merge(source)
|
29
|
+
else
|
30
|
+
site.data[d['data']] = source
|
31
|
+
end
|
32
|
+
rescue
|
33
|
+
next
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-get-json
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brock Fanning
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-02-22 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: deep_merge
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.2'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.2'
|
41
|
+
description: Import remote JSON data into the data for a Jekyll site
|
42
|
+
email:
|
43
|
+
- brockfanning@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".editorconfig"
|
49
|
+
- ".gitignore"
|
50
|
+
- LICENSE
|
51
|
+
- README.md
|
52
|
+
- jekyll-get-json.gemspec
|
53
|
+
- lib/jekyll-get-json.rb
|
54
|
+
- lib/jekyll-get-json/converter.rb
|
55
|
+
- lib/jekyll-get-json/version.rb
|
56
|
+
homepage: https://github.com/brockfanning/jekyll-get-json
|
57
|
+
licenses:
|
58
|
+
- MIT
|
59
|
+
metadata: {}
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options: []
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 2.7.6
|
77
|
+
signing_key:
|
78
|
+
specification_version: 4
|
79
|
+
summary: Import remote JSON data into the data for a Jekyll site
|
80
|
+
test_files: []
|