Socket
Book a DemoInstallSign in
Socket

kitkat

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kitkat

1.0.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

Kitkat

File/Metadata Database Populator

Gem Version Ruby Gem CI Maintainability License: MIT

I had a need to recursively enumerate a directory and load the paths, and some metadata about the files, into a SQLite file. Currently, the following metadata is stored in the SQLite file

fielddescription
pathpath of the file (with the root removed)
mime_typeleft-side mime type (i.e. image)
mime_subtyperight-side mime type (i.e. jpeg)
bytesizesize in bytes of the file.
last_modified_atlast time the file was reported to be modified by the filesystem.
digestSHA256 hash of the file's contents.
created_atUTC date and time when the record was inserted into the DB.

Installation

To install through Rubygems:

gem install kitkat

You can also add this to your Gemfile using:

bundle add kitkat

Usage

Executable

This library ships with an executable: kitkat. Simply run this from your shell:

bundle exec kitkat <path> <database>

For Example: bundle exec kitkat some_directory some_directory_contents.db. This will recursively scan the relative path at: some_directory and list all its contents in a SQLite database file relatively located at: some_directory_contents.db.

Notes:

  • The database positional argument is optional. If it is not supplied then it will default to: kitkat.db

Ruby API

You can also include this gem and use directly through code:

Kitkat.crawl(db: 'some_directory_contents.db', path: 'some_directory')

The Ruby code above is functionally equivalent to running the executable script above.

Contributing

Development Environment Configuration

Basic steps to take to get this repository compiling:

  • Install Ruby (check kitkat.gemspec for versions supported)
  • Install bundler (gem install bundler)
  • Clone the repository (git clone git@github.com:mattruggio/kitkat.git)
  • Navigate to the root folder (cd kitkat)
  • Install dependencies (bundle)

Running Tests

To execute the test suite run:

bin/rspec spec --format documentation

Alternatively, you can have Guard watch for changes:

bin/guard

Also, do not forget to run Rubocop:

bin/rubocop

And auditing the dependencies:

bin/bundler-audit check --update

Publishing

Note: ensure you have proper authorization before trying to publish new versions.

After code changes have successfully gone through the Pull Request review process then the following steps should be followed for publishing new versions:

  • Merge Pull Request into main
  • Update version.rb using semantic versioning
  • Install dependencies: bundle
  • Update CHANGELOG.md with release notes
  • Commit & push main to remote and ensure CI builds main successfully
  • Run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Code of Conduct

Everyone interacting in this codebase, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

License

This project is MIT Licensed.

FAQs

Package last updated on 12 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.