Everything

Gem Version Build Status Code Climate Dependency Status

For familiarity with a everything repository, see the intro.

The piece is the most important concept of everything. This is the core for everything, and other pieces will be components you can add into it.

Setup

Must define these environment variables:

  • EVERYTHING_PATH - the full path to your everything repo.

Installation

Add this line to your application's Gemfile:

gem 'everything-core', require: 'everything'

And then execute:

$ bundle

Or install it yourself as:

$ gem install everything-core

Requiring

You can require it yourself in your code:

require 'everything'

Or, if you use Bundler and list the gem in your Gemfile, you can require all the gems from your Gemfile:

require 'rubygems'
require 'bundler/setup'
Bundler.require(:default)

Usage

This assumes you have a EVERYTHING_PATH environment variable either set in your shell or in dotenv's .env file.

For example, let's assume you have the following folder and file under your everything path

your-piece-here/index.md

# Your Piece Here

The rest of the body of your file...

To use the piece from IRB, you could do the following to get the piece's title and content.

require 'everything'

piece_path = File.join(Everything.path, 'your-piece-here')
piece      = Everything::Piece.new(piece_path)

piece.name          # => 'your-piece-here'
piece.title         # => "Your Piece Here"
piece.body          # => "The rest of the body of your file...\n\n"
piece['categories'] # Returns the value for the `categories` metadata key
piece.public?       # Convience method to return the value for the boolean `public` metadata key
piece.content       # Return an instance of the piece's content
piece.      # Return an instance of the piece's metadata

You can also edit a piece's content and metadata

piece.raw_markdown = some_markdown # Sets the raw_markdown on the piece's content
piece.raw_yaml     = some_yaml     # Sets the raw_yaml on the piece's metadata
piece.save                         # Save the piece's content and metadata to disk

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

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 tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/kyletolle/everything-core. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.