How to release / use plugins
#1
Exclamation 
Guide: How to release plugins and use them the right way

I want to show you a tutorial how you could add your plugins to your server easily (and how to update them), and how you should release your plugins, so they can be used easily.

First, image the situation if you have compiled. You have a Server/Plugins dir where many Plugins are in there, eg Core. as user, the easiest way to set up a new plugin is, if it is on github or similar (any system that uses git), to cd into the Plugins dir and do "git submodule add <git url here>". git will now download it and place it into the Plugins dir. The big advantage of this method is, that every time you run "git submodule update" git checks for new versions of plugins and installs them. Thats great, but now the better part. Every time you compile the server (with compile.sh) to update the server, the script also runs "git submodule update" and updates all Plugins, both shipped with Cuberite and those who you added later on.

So, this part for plugin devs.... Please place your plugins in a git repository (anywhere, just git, probably github) and let them contain only the directory to place in Plugins/. If you have more than one folder, eg the webadmin part, then place it in a seperate repository, so users can do a "git submodule" in Plugins/ and one in webadmin/files/.
Why? because git lets you only add submodules (and clone those) into an empty directory. So if you need both, a webadmin part and one in Plugins/, place it into two repositories, it's still free, and name it eg <my-cool-plugin>-webadmin and <my-cool-plugin>. Also please provide a short message that and why you did it, please refer to this post.

For those who did not understand what i mean, a short review of what you have to do.

Users:

first, cd in the Server/Plugins directory
Code:
[qraut@alkaid cuberite]$ cd Server/Plugins/

then modify the .gitignore and remove the last '*/' line

and now add your submodule

Example 1: PaintBall
Code:
[qraut@alkaid Plugins]$ git submodule add https://github.com/NiLSPACE/PaintBall.git
Cloning into 'Server/Plugins/PaintBall'...
remote: Counting objects: 113, done.
remote: Total 113 (delta 0), reused 0 (delta 0), pack-reused 113
Receiving objects: 100% (113/113), 26.52 KiB | 0 bytes/s, done.
Resolving deltas: 100% (70/70), done.
Checking connectivity... done.

Example 2: WorldEdit
Code:
[qraut@alkaid Plugins]$ git submodule add https://github.com/mc-server/WorldEdit.git
Cloning into 'Server/Plugins/WorldEdit'...
remote: Counting objects: 1581, done.
remote: Total 1581 (delta 0), reused 0 (delta 0), pack-reused 1581
Receiving objects: 100% (1581/1581), 476.91 KiB | 857.00 KiB/s, done.
Resolving deltas: 100% (1016/1016), done.
Checking connectivity... done.


and thats it. activate the plugin and you are fine!


Devs:

lets say, you have code, but not at eg github. first, make a git repo
Code:
[qraut@alkaid PaintBall]$ git init
Initialized empty Git repository in /home/qraut/PaintBall/.git/

then, add your files and commit
Code:
[qraut@alkaid PaintBall]$ git add -A
[qraut@alkaid PaintBall]$ git commit -m "initial commit, added git repo"
[master (root-commit) b704a6b] initial commit, added git repo
9 files changed, 1531 insertions(+)
create mode 100644 ArenaState.lua
create mode 100644 CMDHandlers.lua
create mode 100644 Config.lua
create mode 100644 Hooks.lua
create mode 100644 Info.lua
create mode 100644 Init.lua
create mode 100644 PlayerState.lua
create mode 100644 Storage.lua
create mode 100644 functions.lua

now add your github repo and push the code (like explained on the github page, if the repository is empty
Code:
[qraut@alkaid PaintBall]$ git remote add origin git@github.com:Schwertspize/PaintBall.git
[qraut@alkaid PaintBall]$ git push -u origin master
Counting objects: 11, done.
Delta compression using up to 12 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (11/11), 9.98 KiB | 0 bytes/s, done.
Total 11 (delta 0), reused 0 (delta 0)
To git@github.com:Schwertspize/PaintBall.git
* [new branch]      master -> master
Branch master set up to track remote branch master from origin.

Done! users can now clone your code (or use it as submodule, as i explained). Now you should add a LICENCE and a README, after that add them and commit
Code:
[qraut@alkaid PaintBall]$ nano README.md
[qraut@alkaid PaintBall]$ nano LICENCE.md
[qraut@alkaid PaintBall]$ git add README.md LICENCE.md
[qraut@alkaid PaintBall]$ git commit -m "added licence and readme"
[master 4a3b88d] added licence and readme
2 files changed, 14 insertions(+)
create mode 100644 LICENCE.md
create mode 100644 README.md
[qraut@alkaid PaintBall]$ git push
Counting objects: 4, done.
Delta compression using up to 12 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 669 bytes | 0 bytes/s, done.
Total 4 (delta 1), reused 0 (delta 0)
To git@github.com:Schwertspize/PaintBall.git
   b704a6b..4a3b88d  master -> master
remember, nano is a simple text editor.

Reply
Thanks given by: HeCorr
#2
Good idea, thanks, but are you going to continue developing the paintball plugin? If not you might want to create a link to my repo instead so people get updates when I make fixes.

Also, I'm not sure if this is the right place to post this.
Reply
Thanks given by:
#3
No I don't, it's just a tutorial repo with existing code... Edited

ps: would be nice if you make it sticky and refer to it in the faq. I will adapt it for Windows soon
Reply
Thanks given by:
#4
It's a good idea to stick this yes, but this isn't the right place for it. Plugin Releases is for.. well.. plugin releasesTongue I believe Cuberite Discussion or Plugin / Lua Discussion is a better place, but I'll wait with moving it until more agree Smile

Perhaps instead of having a single link you could give some examples like WorldEdit, Essentials or Gallery
Reply
Thanks given by:
#5
what do you mean with examples? just provide more examples for users....
if you think it doesn't fit here, why don't you move it, you are admin? and, the reason why I posted it here is, many people just read the list and want to use. as long as there are no referees from plugin threads, no one who should use it would see it.
Reply
Thanks given by:
#6
Yes, just give them more examples Smile That would allow beginners to test it on more plugins. Or that's just me talking about how I would react if I were completely new to this Wink

Yeah, I can move it, but I don't know where. I guess I can stick it already though Wink

Thinking about it this is actually the perfect place to put it. Forget everything I said Wink
Reply
Thanks given by:
#7
I don't think you should be adding submodules - they will want to get checked into the main repo if you commit anything from your folder. Instead, do a clean git clone into the plugin's folder:
Code:
cd Plugins/MyPlugin
git clone https://github.com/madmaxoft/MyPlugin.git .
Reply
Thanks given by:
#8
@xoft I don't think if you develop, you should never use a version where you play on, install plugins,... you'd better create a fork of the main repo and edit this separately. (or, as I do, make changes to your "normal" server, compile and test, and after that, if it's working, rebase it onto the fork and make a clean test. then commit in your fork and push.
Reply
Thanks given by:




Users browsing this thread: 2 Guest(s)