A simple HTTParty based wrapper for the Outline API. Comes with ready scripts to import|export content from Outline.
Go to file
Nemo 16e5ea504a [sync] Adds proper sync support 2020-04-26 06:19:43 +05:30
bin [docker] Adds export and general re-org 2019-08-12 16:55:57 +05:30
exe [style] Fixes rubocop warnings 2019-08-12 19:27:49 +05:30
lib Version Bump (v0.2.2) 2019-08-14 15:42:37 +05:30
test Initial Commit 2019-07-24 19:36:18 +05:30
.dockerignore [docker] Adds export and general re-org 2019-08-12 16:55:57 +05:30
.editorconfig Adds import script 2019-07-24 20:47:46 +05:30
.gitignore [sync] Adds proper sync support 2020-04-26 06:19:43 +05:30
CHANGELOG.md Version Bump (v0.2.2) 2019-08-14 15:42:37 +05:30
CODE_OF_CONDUCT.md Initial Commit 2019-07-24 19:36:18 +05:30
Dockerfile [sync] Adds proper sync support 2020-04-26 06:19:43 +05:30
Gemfile Initial Commit 2019-07-24 19:36:18 +05:30
LICENSE [sync] Adds proper sync support 2020-04-26 06:19:43 +05:30
README.md [git] Finishes push command 2019-08-14 15:09:11 +05:30
Rakefile Sets up Rakefile 2019-07-24 19:39:02 +05:30
entrypoint.sh [sync] Adds proper sync support 2020-04-26 06:19:43 +05:30
env.sample [sync] Adds proper sync support 2020-04-26 06:19:43 +05:30
outliner.gemspec [sync] Adds proper sync support 2020-04-26 06:19:43 +05:30

README.md

Outliner Gem Version

A simple HTTParty based wrapper for the Outline API. It also offers a one-line import option to let you migrate an existing set of Markdown files to Outline. For quickly running export/import commands, you can use the Docker Image as well.

Installation

Add this line to your application's Gemfile:

gem 'outliner'

And then execute:

$ bundle

Or install it yourself as:

$ gem install outliner

Usage

The API Client automatically picks up the Token from the OUTLINE_TOKEN environment variable. All the API calls are available with the . replaced with a _ in the method name. So if you need to call the collections.remove_user API, use the collections_remove_user method.

require 'outliner'

client = Outliner.new('https://knowledge.example.com')
pp client.auth_info
pp client.collections_list(offset: 0, limit: 10)

Import

outliner can be used to import an existing collection of documents into Outline. To do this, run:

export OUTLINE_BASE_URI="https://kb.example.com"
export OUTLINE_TOKEN="PUT YOUR TOKEN HERE"
export SOURCE_DIRECTORY="/home/user/wiki"
export DESTINATION_COLLECTION_NAME="Archive"
bundle install outliner
outliner-import "$SOURCE_DIRECTORY" "$DESTINATION_COLLECTION_NAME"

Export

outliner can be used to run a one-time export of all documents in Outline to a local directory. To do this, run:

export OUTLINE_BASE_URI="https://kb.example.com"
export OUTLINE_TOKEN="PUT YOUR TOKEN HERE"
# Ensure that this exists and is writable
export DESTINATION_DIRECTORY="/data"
bundle install outliner
outliner-export "$DESTINATION_DIRECTORY"

Docker

You can use the pre-built docker image to run the above commands as well. See the following commands for examples:

Export

docker run --env OUTLINE_BASE_URI="https://kb.example.com" \
           --env OUTLINE_TOKEN="PUT YOUR TOKEN HERE" \
           --volume /tmp:/data \
           captn3m0/outliner \
           export \
           /data

Import

docker run --env OUTLINE_BASE_URI="https://kb.example.com" \
           --env OUTLINE_TOKEN="PUT YOUR TOKEN HERE" \
           --volume /path/to/wiki:/data \
           captn3m0/outliner \
           import "/data" "Archive"

Push

Note: Push is currently only available as a Docker Command

docker run --env OUTLINE_BASE_URI="https://kb.example.com" \
           --env OUTLINE_TOKEN="PUT YOUR TOKEN HERE" \
           --env OUTLINE_TOKEN="PUT YOUR TOKEN HERE" \
           --env GIT_BRANCH=outline \
           --env GIT_REMOTE_URL=git@example.com:org/outline.backup.git
           --volume /etc/ssh/private.key:/root/.ssh/id_rsa
           captn3m0/outliner \
           push

Limitations

  • Images are currently not imported. Host them externally for this to work.
  • Only .md files are currently supported
  • push doesn't sync file-history, but is meant to push a one-time backup to Git.
  • StrictHostKeyChecking is currently disabled for push, please only run this in trusted networks.

Development

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.

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/captn3m0/outliner. 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.

Code of Conduct

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

License

Licensed under the MIT License. See LICENSE file for details.