mirror of
https://github.com/elastic/logstash.git
synced 2025-06-28 09:46:03 -04:00
73 lines
2.3 KiB
Text
73 lines
2.3 KiB
Text
[[publish-plugin]]
|
||
=== Publish your plugin to RubyGems.org
|
||
|
||
Logstash uses http://rubygems.org[RubyGems.org] as its repository for all plugin artifacts.
|
||
After you have developed your new plugin, you can make it available to
|
||
Logstash users by publishing it to RubyGems.org.
|
||
|
||
==== Licensing
|
||
Logstash and all its plugins are licensed under
|
||
https://github.com/elasticsearch/logstash/blob/main/LICENSE[Apache License, version 2 ("ALv2")].
|
||
If you make your plugin publicly available via http://rubygems.org[RubyGems.org],
|
||
please make sure to have this line in your gemspec:
|
||
|
||
* `s.licenses = ['Apache License (2.0)']`
|
||
|
||
==== Publish to http://rubygems.org[RubyGems.org]
|
||
|
||
You’ll need an account on RubyGems.org
|
||
|
||
* https://rubygems.org/sign_up[Sign-up for a RubyGems account].
|
||
|
||
After creating an account,
|
||
http://guides.rubygems.org/rubygems-org-api/#api-authorization[obtain] an API
|
||
key from RubyGems.org. By default, RubyGems uses the file `~/.gem/credentials`
|
||
to store your API key. These credentials will be used to publish the gem.
|
||
Replace `username` and `password` with the credentials you created at
|
||
RubyGems.org:
|
||
|
||
[source,sh]
|
||
----------------------------------
|
||
curl -u username:password https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials
|
||
chmod 0600 ~/.gem/credentials
|
||
----------------------------------
|
||
|
||
Before proceeding, make sure you have the right version in your gemspec file
|
||
and commit your changes.
|
||
|
||
* `s.version = '0.1.0'`
|
||
|
||
To publish version 0.1.0 of your new logstash gem:
|
||
|
||
[source,sh]
|
||
----------------------------------
|
||
bundle install
|
||
bundle exec rake vendor
|
||
bundle exec rspec
|
||
bundle exec rake publish_gem
|
||
----------------------------------
|
||
|
||
[NOTE]
|
||
========
|
||
Execute `rake publish_gem`:
|
||
|
||
. Reads the version from the gemspec file (`s.version = '0.1.0'`)
|
||
. Checks in your local repository if a tag exists for that version. If the tag
|
||
already exists, it aborts the process. Otherwise, it creates a new version tag
|
||
in your local repository.
|
||
. Builds the gem
|
||
. Publishes the gem to RubyGems.org
|
||
========
|
||
|
||
That's it! Your plugin is published! Logstash users can now install your plugin
|
||
by running:
|
||
|
||
[source,sh]
|
||
[subs="attributes"]
|
||
----------------------------------
|
||
bin/plugin install logstash-{plugintype}-mypluginname
|
||
----------------------------------
|
||
|
||
Where <plugintype> is `input`, `output`, `filter`, or `codec`, and
|
||
<mypluginname> is the name of your new plugin.
|
||
|