-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from beer-garden/update-plugin-docs
Update plugin creation docs
- Loading branch information
Showing
7 changed files
with
65 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,16 @@ | ||
[source,python] | ||
.plugin.py | ||
.main.py | ||
---- | ||
from brewtils import command, system | ||
from brewtils import Plugin, command | ||
@system # <1> | ||
class HelloWorldClient(object): | ||
@command <2> | ||
@command <1> | ||
def hello_world(self): | ||
greeting = "Hello, World!" | ||
print(greeting) | ||
return greeting | ||
---- | ||
<1> The `@system` decorator marks this class as a Beer Garden plugin. | ||
<2> The `@command` decorator marks this method as a Command that's part of the enclosing System. | ||
<1> The `@command` decorator marks this method as a Command that's part of the enclosing Client. |
26 changes: 22 additions & 4 deletions
26
docs/plugins/python/_includes/hello-world-local-entry-point.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,33 @@ | ||
[source,python] | ||
.plugin.py | ||
.main.py | ||
---- | ||
from brewtils import Plugin | ||
from brewtils import Plugin, command | ||
class HelloWorldClient(object): | ||
@command <1> | ||
def say_hello(self): | ||
greeting = "Hello, World!" | ||
print(greeting) | ||
return greeting | ||
# Your implementation of the client goes here | ||
def main(): | ||
client = HelloWorldClient() | ||
plugin = Plugin(client) | ||
plugin = Plugin( | ||
client=client, | ||
name="hello-world", <2> | ||
version="1.0", | ||
description="Say hello" | ||
) | ||
plugin.run() | ||
if __name__ == "__main__": | ||
main() | ||
---- | ||
<1> The `@command` decorator marks this method as a Command that's part of the enclosing Client. | ||
<2> The values defined here determine how the plugin is listed in the UI. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters