jekyll-sqlite 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
+ SHA256:
3
+ metadata.gz: c4537bdf95266e26c50110d5ca259f83726b540fe3bf3a6714821d2aa64e83a4
4
+ data.tar.gz: f3aa0e1a40abd05e112a44b36aea75e39fc9bc03c49cf1f10710e0bf1fca1aee
5
+ SHA512:
6
+ metadata.gz: 97d7e1abe1fdcf60b04336443201eb2063e6f4c7c226d4c9b1052efc01b770d080cc967a3d7f9cebe479fa2b2abce800ddb5e8655a0023c682e9d845d0c5c2c7
7
+ data.tar.gz: 97508c414be1884ba85f465316eb33c0494fc49190e4f3dec2a6a05739cca7e72b3fd745b45a2bb30d263660fea942fb92c8c210cf38d3f737a739ca1a3c8147
data/.rubocop.yml ADDED
@@ -0,0 +1,18 @@
1
+ require: rubocop-rake
2
+ AllCops:
3
+ TargetRubyVersion: 3.0
4
+ NewCops: enable
5
+
6
+ Style/StringLiterals:
7
+ Enabled: true
8
+ EnforcedStyle: double_quotes
9
+
10
+ Style/StringLiteralsInInterpolation:
11
+ Enabled: true
12
+ EnforcedStyle: double_quotes
13
+
14
+ Layout/LineLength:
15
+ Max: 120
16
+
17
+ Metrics/AbcSize:
18
+ Max: 20
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2023-05-08
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at coc@captnemo.in. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in jekyll-sqlite.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+ gem "rubocop", "~> 1.21"
10
+ gem "rubocop-rake", "~> 0.6.0"
data/Gemfile.lock ADDED
@@ -0,0 +1,47 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ jekyll-sqlite (0.1.0)
5
+ sqlite3 (~> 1.6)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ json (2.6.3)
12
+ parallel (1.23.0)
13
+ parser (3.2.2.1)
14
+ ast (~> 2.4.1)
15
+ rainbow (3.1.1)
16
+ rake (13.0.6)
17
+ regexp_parser (2.8.0)
18
+ rexml (3.2.5)
19
+ rubocop (1.50.2)
20
+ json (~> 2.3)
21
+ parallel (~> 1.10)
22
+ parser (>= 3.2.0.0)
23
+ rainbow (>= 2.2.2, < 4.0)
24
+ regexp_parser (>= 1.8, < 3.0)
25
+ rexml (>= 3.2.5, < 4.0)
26
+ rubocop-ast (>= 1.28.0, < 2.0)
27
+ ruby-progressbar (~> 1.7)
28
+ unicode-display_width (>= 2.4.0, < 3.0)
29
+ rubocop-ast (1.28.1)
30
+ parser (>= 3.2.1.0)
31
+ rubocop-rake (0.6.0)
32
+ rubocop (~> 1.0)
33
+ ruby-progressbar (1.13.0)
34
+ sqlite3 (1.6.2-aarch64-linux)
35
+ unicode-display_width (2.4.2)
36
+
37
+ PLATFORMS
38
+ aarch64-linux
39
+
40
+ DEPENDENCIES
41
+ jekyll-sqlite!
42
+ rake (~> 13.0)
43
+ rubocop (~> 1.21)
44
+ rubocop-rake (~> 0.6.0)
45
+
46
+ BUNDLED WITH
47
+ 2.4.1
data/README.md ADDED
@@ -0,0 +1,79 @@
1
+ # Jekyll SQlite plugin
2
+
3
+ A Jekyll generator plugin to lets you use SQLite database instead of data files as a data source.
4
+
5
+ [![Continuous Integration](https://github.com/captn3m0/jekyll-sqlite/actions/workflows/main.yml/badge.svg)](https://github.com/captn3m0/jekyll-sqlite/actions/workflows/main.yml) [![Gem Version](https://badge.fury.io/rb/jekyll-sqlite.svg)](https://badge.fury.io/rb/jekyll-sqlite)
6
+
7
+ ## Installation
8
+
9
+ Add this line to your site's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'jekyll-sqlite'
13
+ ```
14
+
15
+ And then add this line to your site's `_config.yml`:
16
+
17
+ ```yml
18
+ plugins:
19
+ - jekyll-sqlite
20
+ ```
21
+
22
+ :warning: If you are using Jekyll < 3.5.0 use the `gems` key instead of `plugins`.
23
+
24
+
25
+ ## Installation
26
+
27
+ TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
28
+
29
+ Install the gem and add to the application's Gemfile by executing:
30
+
31
+ $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
32
+
33
+ If bundler is not being used to manage dependencies, install the gem by executing:
34
+
35
+ $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
36
+
37
+ ## Usage
38
+
39
+ Update your `_config.yml` to define your data sources with your SQLite database.
40
+
41
+ ```yml
42
+ ...
43
+ sqlite:
44
+ members:
45
+ file: _db/users.db
46
+ sql: SELECT * FROM members ORDER by created_at DESC
47
+ # You can use `results_as_hash` to switch between array or hash results (default).
48
+ verified:
49
+ results_as_hash: false # default true
50
+ file: _db/users.db
51
+ sql: SELECT username, email FROM members WHERE verified=1
52
+ ```
53
+
54
+ Then, you can use the `site.data` attributes accordingly:
55
+
56
+ ```liquid
57
+ {% for user in site.data.members %}
58
+ - {{user.username}}
59
+ {% endfor %}
60
+
61
+ # Result here is an array instead of a hash.
62
+ {% for user in site.data.verified %}
63
+ - :check: {{user[0]}} (Email: {{user[1]}})
64
+ {% endfor %}
65
+ ```
66
+
67
+ ## Development
68
+
69
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
70
+
71
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
72
+
73
+ ## Contributing
74
+
75
+ Bug reports and pull requests are welcome on GitHub at https://github.com/captn3m0/jekyll-sqlite. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/captn3m0/jekyll-sqlite/blob/main/CODE_OF_CONDUCT.md).
76
+
77
+ ## Code of Conduct
78
+
79
+ Everyone interacting in the Jekyll::Sqlite project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/captn3m0/jekyll-sqlite/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rubocop/rake_task"
5
+
6
+ RuboCop::RakeTask.new
7
+
8
+ task default: :rubocop
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module JekyllSQlite
4
+ # Main generator class
5
+ class Generator < Jekyll::Generator
6
+ safe true
7
+ # Set to high to be higher than the Jekyll Datapages Plugin
8
+ priority :high
9
+ # Default pragma
10
+ def fast_setup(db)
11
+ db.execute("PRAGMA synchronous = OFF")
12
+ db.execute("PRAGMA journal_mode = OFF")
13
+ db.execute("PRAGMA query_only = ON")
14
+ end
15
+
16
+ def generate(site)
17
+ site.config["sqlite"].each do |name, config|
18
+ SQLite3::Database.new config["file"], readonly: true do |db|
19
+ Jekyll.logger.info "Jekyll SQLite:", "Starting to load #{name}"
20
+ fast_setup db
21
+ db.results_as_hash = config.fetch("results_as_hash", true)
22
+ site.data[name] = db.execute(config["query"])
23
+ Jekyll.logger.info "Jekyll SQLite:", "Loaded #{name}. Count=#{site.data[name].size}"
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Jekyll
4
+ module Sqlite
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "jekyll"
4
+ require "jekyll-sqlite/generator"
5
+
6
+ module JekyllSQlite
7
+ class Error < StandardError; end
8
+ # Your code goes here...
9
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jekyll-sqlite
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Nemo
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-05-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: sqlite3
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ description:
28
+ email:
29
+ - jekyll@captnemo.in
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".rubocop.yml"
35
+ - CHANGELOG.md
36
+ - CODE_OF_CONDUCT.md
37
+ - Gemfile
38
+ - Gemfile.lock
39
+ - README.md
40
+ - Rakefile
41
+ - lib/jekyll-sqlite/generator.rb
42
+ - lib/jekyll-sqlite/version.rb
43
+ - lib/jekyll_sqlite.rb
44
+ homepage: https://github.com/captn3m0/jekyll-sqlite
45
+ licenses:
46
+ - MIT
47
+ metadata:
48
+ homepage_uri: https://github.com/captn3m0/jekyll-sqlite
49
+ source_code_uri: https://github.com/captn3m0/jekyll-sqlite
50
+ changelog_uri: https://github.com/captn3m0/jekyll-sqlite/blob/master/CHANGELOG.md
51
+ rubygems_mfa_required: 'true'
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 3.0.0
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubygems_version: 3.3.25
68
+ signing_key:
69
+ specification_version: 4
70
+ summary: A Jekyll plugin that lets you use SQLite database instead of data files as
71
+ a data source.
72
+ test_files: []