Jist is a gem that allows you to publish a gist from Ruby.
As with all ruby gems, you can install Jist (assuming you have ruby and rubygems) with:
$ gem install jist
If you want to use the library in your application, and you're using Bundler. Add the following to your Gemfile.
source :rubygems gem 'jist'
The jist gem provides a
jist command that you can use from your terminal to
upload content to https://gist.github.com/.
It's easy to use. To upload the contents of
$ jist a.rb https://gist.github.com/0d07bc98c139810a4075
Upload multiple files :
$ jist a b c $ jist *.rb
By default it reads from STDIN, and you can set a filename with
$ jist -f test.rb <a.rb https://gist.github.com/7db51bb5f4f35c480fc8
Alternatively, you can just paste from the clipboard:
$ jist -P https://gist.github.com/6a330a11a0db8e52a6ee
-p to make the gist public and
-d to add a description.
$ jist -p -d "Random rbx bug" a.rb https://gist.github.com/2977722
You can update existing gists with
$ jist lib/jist.rb bin/jist -u 42f2c239d2eb57299408 https://gist.github.com/42f2c239d2eb57299408
If you'd like to copy the resulting URL to your clipboard, use
$ jist -c <a.rb https://gist.github.com/7db51bb5f4f35c480fc8
If you'd like to copy the resulting embeddable URL to your clipboard, use
$ jist --copy-js <a.rb <script src="https://gist.github.com/7db51bb5f4f35c480fc8"></script>
And you can just ask jist to open a browser window directly with
$ jist -o <a.rb https://gist.github.com/7db51bb5f4f35c480fc8
jist --help for more detail.
If you want to associate your gists with your github account, you need to login with jist. It doesn't store your username and password, it just uses them to get an OAuth2 token (with the "gist" permission).
jist --login Obtaining OAuth2 access_token from github. Github username: ConradIrwin Github password: Success! https://github.com/settings/applications
This token is stored in
~/.jist and used for all future gisting. If you need to
you can revoke it from https://github.com/settings/applications, or just delete the
After you've done this, you can still upload gists anonymously with
jist -a a.rb https://gist.github.com/6bf7ec379fc9119b1f15
You can also use Jist as a library from inside your ruby code:
.("Look.at(:my => 'awesome').code")
If you need more advanced features you can also pass:
:access_tokento authenticate using OAuth2 (default is `File.read("~/.jist")).
:filenameto change the syntax highlighting (default is
:publicif you want your gist to have a guessable url.
:descriptionto add a description to your gist.
:updateto update an existing gist (can be a URL or an id).
:anonymousto submit an anonymous gist (default is false).
:copyto copy the resulting URL to the clipboard (default is false).
:opento open the resulting URL in a browser (default is false).
NOTE: The access_token must have the "gist" scope.
If you want to upload multiple files in the same gist, you can:
.("a.rb" => "Foo.bar", "a.py" => "Foo.bar")
If you'd rather use jist's builtin access_token, then you can force the user to obtain one by calling:
This will take them through the process of obtaining an OAuth2 token, and storing it
~/.jist, where it can later be read by
If you'd like
jist to use your locally installed Github Enterprise,
you need to export the
GITHUB_URL environment variable in your
Once you've done this and restarted your terminal (or run
source ~/.bashrc), jist will
automatically use github enterprise instead of the public github.com
If you'd like
-c to be the default when you use the jist executable, add an
alias to your
~/.bashrc (or equivalent). For example:
alias jist='jist -c'
If you'd prefer jist to open a different browser, then you can export the BROWSER environment variable:
If clipboard or browser integration don't work on your platform, please file a bug or (more ideally) a pull request.
If you need to use an HTTP proxy to access the internet, export the
http_proxy environment variable and jist will use it.
I wrote this because the
gist gem is out of action, and has been for many months.
It's licensed under the MIT license, and bug-reports, and pull requests are welcome.