![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
gollum lib -- A wiki built on top of Git.
========================================
It is made for the GitLab application and used in the Gitaly project.
For use outside of GitLab, refer to the upstream gollum-lib
gem.
Gollum is a simple wiki system built on top of Git that powers GitHub Wikis.
Gollum-lib is the Ruby API that allows you to retrieve raw or formatted wiki content from a Git repository, write new content to the repository, and collect various meta data about the wiki as a whole.
Gollum-lib follows the rules of Semantic Versioning and uses TomDoc for inline documentation.
The best way to install Gollum-lib is with RubyGems:
$ [sudo] gem install gitlab-gollum-lib
If you're installing from source, you can use Bundler to pick up all the gems:
$ bundle install
In order to use the various formats that Gollum supports, you will need to separately install the necessary dependencies for each format. You only need to install the dependencies for the formats that you plan to use.
gem install asciidoctor
gem install creole
gem install redcarpet
gem install github-markdown
gem install org-ruby
Pod::Simple::HTML
comes with Perl >= 5.10. Lower versions should install Pod::Simple from CPAN.easy_install docutils
gem install RedCloth
gem install wikicloth
Gollum supports a variety of formats and extensions (Markdown, MediaWiki, Textile, …). On top of these formats Gollum lets you insert headers, footers, links, image, math and more.
Check out the Gollum Wiki for all of Gollum's formats and syntactic options.
Initialize the Gollum::Repo
object:
# Require rubygems if necessary
require 'rubygems'
# Require the Gollum library
require 'gollum-lib'
# Create a new Gollum::Wiki object by initializing it with the path to the
# Git repository.
wiki = Gollum::Wiki.new("my-gollum-repo.git")
# => <Gollum::Wiki>
By default, internal wiki links are all absolute from the root. To specify a different
base path, you can specify the :base_path
option:
wiki = Gollum::Wiki.new("my-gollum-repo.git", :base_path => "/wiki")
Note that base_path
just modifies the links.
Get the latest version of the given human or canonical page name:
page = wiki.page('page-name')
# => <Gollum::Page>
page.raw_data
# => "# My wiki page"
page.formatted_data
# => "<h1>My wiki page</h1>"
page.format
# => :markdown
vsn = page.version
# => <Gollum::Git::Commit>
vsn.id
# => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
Get the footer (if any) for a given page:
page.footer
# => <Gollum::Page>
Get the header (if any) for a given page:
page.header
# => <Gollum::Page>
Get a list of versions for a given page:
vsns = wiki.page('page-name').versions
# => [<Gollum::Git::Commit, <Gollum::Git::Commit, <Gollum::Git::Commit>]
vsns.first.id
# => '3ca43e12377ea1e32ea5c9ce5992ec8bf266e3e5'
vsns.first.authored_date
# => Sun Mar 28 19:11:21 -0700 2010
Get a specific version of a given canonical page file:
wiki.page('page-name', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')
Get the latest version of a given static file:
file = wiki.file('asset.js')
# => <Gollum::File>
file.raw_data
# => "alert('hello');"
file.version
# => <Gollum::Git::Commit>
Get a specific version of a given static file:
wiki.file('asset.js', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')
Get an in-memory Page preview (useful for generating previews for web interfaces):
preview = wiki.preview_page("My Page", "# Contents", :markdown)
preview.formatted_data
# => "<h1>Contents</h1>"
Methods that write to the repository require a Hash of commit data that takes the following form:
commit = { :message => 'commit message',
:name => 'Tom Preston-Werner',
:email => 'tom@github.com' }
Write a new version of a page (the file will be created if it does not already exist) and commit the change. The file will be written at the repo root.
wiki.write_page('Page Name', :markdown, 'Page contents', commit)
Update an existing page. If the format is different than the page's current format, the file name will be changed to reflect the new format.
page = wiki.page('Page Name')
wiki.update_page(page, page.name, page.format, 'Page contents', commit)
To delete a page and commit the change:
wiki.delete_page(page, commit)
Register or unregister a hook to be called after a page commit:
Gollum::Hook.register(:post_commit, :hook_id) do |committer, sha1|
# Your code here
end
Gollum::Hook.unregister(:post_commit, :hook_id)
Note that filenames on windows must not contain any of the following characters \ / : * ? " < > |
. See this support article for details.
Gollum-lib uses Semantic Versioning. Having x.y.z
:
For z releases:
$ rake bump
$ rake release
For x.y releases:
$ rake gemspec
$ rake release
$ gem uninstall -aIx gollum-lib
$ git clone https://github.com/gollum/gollum-lib.git
$ cd gollum-lib
gollum-lib$ rake build
gollum-lib$ rake install
$ bundle install
$ bundle exec rake test
An example of how to add a test file to the bare repository lotr.git
.
$ mkdir tmp; cd tmp
$ git clone ../lotr.git/ .
Cloning into '.'...
done.
$ git log
$ echo "test" > test.md
$ git add . ; git commit -am "Add test"
$ git push ../lotr.git/ master
FAQs
Unknown package
We found that gitlab-gollum-lib demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.