jekyll-get-books 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/.gitignore +56 -0
- data/LICENSE +21 -0
- data/README.md +17 -0
- data/jekyll-get-books.gemspec +17 -0
- data/lib/jekyll-get-books.rb +5 -0
- data/lib/jekyll-get-books/converter.rb +44 -0
- data/lib/jekyll-get-books/version.rb +3 -0
- metadata +79 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 275194cc664d8e84e812fff3bfe8a2c52f483f5fc8e694020a7c8b88592a5035
|
4
|
+
data.tar.gz: 33c95cc3a7a56e2829398b5b61055d7df91cd6c9ee09fc4cb4227e7fd6eb09ff
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 42108614acfc215355fe489194bb58290132436f17d66d01061b2a393d76c35eb409133613090d2c33621eedd1313aee65a9bb996bd1ff8435fca3cb06a04c04
|
7
|
+
data.tar.gz: 7785ce6ddf46d59e370397a6b9a1b72467b5b20e43c184dbdc049cd9f3accfb4e7bef912ba4ef7a1e45d792ca95315043bd5a13dd918fd3ec319e7f5adf6ac65
|
data/.gitignore
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
# Ignore Byebug command history file.
|
17
|
+
.byebug_history
|
18
|
+
|
19
|
+
## Specific to RubyMotion:
|
20
|
+
.dat*
|
21
|
+
.repl_history
|
22
|
+
build/
|
23
|
+
*.bridgesupport
|
24
|
+
build-iPhoneOS/
|
25
|
+
build-iPhoneSimulator/
|
26
|
+
|
27
|
+
## Specific to RubyMotion (use of CocoaPods):
|
28
|
+
#
|
29
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
30
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
31
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
32
|
+
#
|
33
|
+
# vendor/Pods/
|
34
|
+
|
35
|
+
## Documentation cache and generated files:
|
36
|
+
/.yardoc/
|
37
|
+
/_yardoc/
|
38
|
+
/doc/
|
39
|
+
/rdoc/
|
40
|
+
|
41
|
+
## Environment normalization:
|
42
|
+
/.bundle/
|
43
|
+
/vendor/bundle
|
44
|
+
/lib/bundler/man/
|
45
|
+
|
46
|
+
# for a library or gem, you might want to ignore these files since the code is
|
47
|
+
# intended to run in multiple environments; otherwise, check them in:
|
48
|
+
# Gemfile.lock
|
49
|
+
# .ruby-version
|
50
|
+
# .ruby-gemset
|
51
|
+
|
52
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
53
|
+
.rvmrc
|
54
|
+
|
55
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
56
|
+
# .rubocop-https?--*
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Clemens Leitner
|
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 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,
|
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# jekyll-get-books
|
2
|
+
> 💎 Fetch and safe meta information for books from the Google Book API for a Jekyll Site.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
|
6
|
+
Add a `jekyll_get_books` section to your `_config.yml` file. This section should be an array of objects containing `data`, `json` and `file` properties:
|
7
|
+
* The `data` property specifies where in the `site.data` you would like to put this data.
|
8
|
+
* The `json` property is the remote URL of the JSON file.
|
9
|
+
|
10
|
+
|
11
|
+
## Contributing
|
12
|
+
|
13
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/tokzk/jekyll-amazon.
|
14
|
+
|
15
|
+
## Credit
|
16
|
+
|
17
|
+
This plugin was inspired by [jekyll-get-json](https://github.com/brockfanning/jekyll-get-json).
|
@@ -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-books/version"
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'jekyll-get-books'
|
6
|
+
s.version = JekyllGetBooks::VERSION
|
7
|
+
s.summary = 'Fetch and safe meta information for books from the Google Book API for a Jekyll Site.'
|
8
|
+
s.description = 'Fetch and safe meta information for books from the Google Book API for a Jekyll Site. For more infos about usage and installation visit the package homepage'
|
9
|
+
s.authors = ["Clemens Leitner"]
|
10
|
+
s.email = 'clemens@velocit.at'
|
11
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r!^(test|spec|features)/!) }
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
s.homepage = 'https://github.com/c-leitner/jekyll-get-books'
|
14
|
+
s.license = 'MIT'
|
15
|
+
s.add_dependency "jekyll", ">= 3.0"
|
16
|
+
s.add_dependency "deep_merge", "~> 1.2"
|
17
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require "jekyll"
|
2
|
+
require 'json'
|
3
|
+
require 'deep_merge'
|
4
|
+
require 'open-uri'
|
5
|
+
require 'csv'
|
6
|
+
|
7
|
+
module JekyllGetBooks
|
8
|
+
class GetBooksGenerator < Jekyll::Generator
|
9
|
+
safe true
|
10
|
+
priority :highest
|
11
|
+
|
12
|
+
def generate(site)
|
13
|
+
|
14
|
+
config = site.config['jekyll_get_books']
|
15
|
+
if !config
|
16
|
+
warn "No config".yellow
|
17
|
+
return
|
18
|
+
end
|
19
|
+
if !config.kind_of?(Array)
|
20
|
+
config = [config]
|
21
|
+
end
|
22
|
+
|
23
|
+
config.each do |d|
|
24
|
+
begin
|
25
|
+
target = site.data[d['data']]
|
26
|
+
source = d['json']
|
27
|
+
file = d['file']
|
28
|
+
results = {}
|
29
|
+
if !(File.file?(file))
|
30
|
+
warn "File does not exist / Path is incorrect".yellow
|
31
|
+
end
|
32
|
+
CSV.foreach((file), headers: true, col_sep: ",") do |row|
|
33
|
+
output = JSON.load(URI.open(source+row['isbn']))
|
34
|
+
results.deep_merge(output)
|
35
|
+
end
|
36
|
+
site.data[d['data']] = results
|
37
|
+
rescue
|
38
|
+
next
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-get-books
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Clemens Leitner
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-07-20 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: Fetch and safe meta information for books from the Google Book API for
|
42
|
+
a Jekyll Site. For more infos about usage and installation visit the package homepage
|
43
|
+
email: clemens@velocit.at
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- LICENSE
|
50
|
+
- README.md
|
51
|
+
- jekyll-get-books.gemspec
|
52
|
+
- lib/jekyll-get-books.rb
|
53
|
+
- lib/jekyll-get-books/converter.rb
|
54
|
+
- lib/jekyll-get-books/version.rb
|
55
|
+
homepage: https://github.com/c-leitner/jekyll-get-books
|
56
|
+
licenses:
|
57
|
+
- MIT
|
58
|
+
metadata: {}
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options: []
|
61
|
+
require_paths:
|
62
|
+
- lib
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
requirements: []
|
74
|
+
rubygems_version: 3.2.18
|
75
|
+
signing_key:
|
76
|
+
specification_version: 4
|
77
|
+
summary: Fetch and safe meta information for books from the Google Book API for a
|
78
|
+
Jekyll Site.
|
79
|
+
test_files: []
|