spigoter 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +20 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +1156 -0
- data/.travis.yml +4 -1
- data/Guardfile +1 -1
- data/README.md +41 -53
- data/exe/spigoter +65 -18
- data/lib/spigoter.rb +3 -1
- data/lib/spigoter/cli/cli.rb +12 -16
- data/lib/spigoter/cli/cli_compile.rb +31 -2
- data/lib/spigoter/cli/cli_start.rb +15 -17
- data/lib/spigoter/cli/cli_update.rb +37 -20
- data/lib/spigoter/plugins.rb +5 -6
- data/lib/spigoter/utils.rb +26 -0
- data/lib/spigoter/version.rb +1 -1
- data/lib/spigoter/webapi/curse.rb +2 -24
- data/lib/spigoter/webapi/devbukkit.rb +2 -25
- data/lib/spigoter/webapi/plugin.rb +29 -0
- data/spigoter.gemspec +1 -1
- metadata +9 -6
data/.travis.yml
CHANGED
data/Guardfile
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
# Spigoter
|
2
2
|
|
3
|
-
[![
|
3
|
+
[![Gem Version](https://img.shields.io/gem/v/spigoter.svg?style=flat-square)](https://badge.fury.io/rb/spigoter)
|
4
|
+
[![Build Status](https://img.shields.io/travis/DanielRamosAcosta/spigoter.svg?style=flat-square)](https://travis-ci.org/DanielRamosAcosta/spigoter)
|
5
|
+
[![Coverage Status](https://img.shields.io/coveralls/DanielRamosAcosta/spigoter.svg?style=flat-square)](https://coveralls.io/github/DanielRamosAcosta/spigoter?branch=master)
|
6
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/DanielRamosAcosta/spigoter.svg?style=flat-square)](https://codeclimate.com/github/DanielRamosAcosta/spigoter)
|
7
|
+
[![Dependency Status](https://img.shields.io/gemnasium/DanielRamosAcosta/spigoter.svg?style=flat-square)](https://gemnasium.com/DanielRamosAcosta/spigoter)
|
4
8
|
|
5
9
|
|
6
|
-
Spigoter is a Ruby gem that gives you many tools make your server keepup easier.
|
10
|
+
Spigoter is a Ruby gem that gives you many tools in order to make your server keepup easier.
|
7
11
|
|
8
12
|
## Installation
|
9
13
|
|
@@ -14,59 +18,42 @@ gem install spigoter
|
|
14
18
|
## Features
|
15
19
|
|
16
20
|
### Run the server
|
17
|
-
spigoter
|
21
|
+
spigoter start
|
18
22
|
|
19
23
|
### Update plugins
|
20
|
-
spigoter
|
21
|
-
|
22
|
-
|
23
|
-
You have to drop a `plugin.
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
```
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
"last_update": "31-3-2016 - 0:40"
|
52
|
-
},
|
53
|
-
{
|
54
|
-
"name": "ClickSort",
|
55
|
-
"url": "http://mods.curse.com/bukkit-plugins/minecraft/clicksort",
|
56
|
-
"type": "curse",
|
57
|
-
"last_update": "31-3-2016 - 0:40"
|
58
|
-
},
|
59
|
-
{
|
60
|
-
"name": "Dynmap",
|
61
|
-
"url": "http://dev.bukkit.org/media/files/911/888/dynmap-2.3-alpha-1.jar",
|
62
|
-
"type": "direct",
|
63
|
-
"keep_eye_on": "http://dev.bukkit.org/bukkit-plugins/dynmap/files/",
|
64
|
-
"last_update": "31-3-2016 - 0:40"
|
65
|
-
}
|
66
|
-
]
|
24
|
+
spigoter update [--list=plugin1,plugin2,...]
|
25
|
+
|
26
|
+
#### Usage
|
27
|
+
You have to drop a `plugin.yml` file in the server root directory. There will be saved some relevant information of plugins, as well as some customization.
|
28
|
+
|
29
|
+
Basic example:
|
30
|
+
|
31
|
+
```yml
|
32
|
+
Authme:
|
33
|
+
type: curse
|
34
|
+
url: "http://mods.curse.com/bukkit-plugins/minecraft/authme-reloaded"
|
35
|
+
ChopTree:
|
36
|
+
type: spigotmc
|
37
|
+
url: "https://www.spigotmc.org/resources/choptree.2046/"
|
38
|
+
Dynmap:
|
39
|
+
type: devbukkit
|
40
|
+
url: "http://dev.bukkit.org/bukkit-plugins/dynmap/"
|
41
|
+
Essentials:
|
42
|
+
type: direct
|
43
|
+
url: "https://hub.spigotmc.org/jenkins/job/Spigot-Essentials/lastSuccessfulBuild/artifact/Essentials/target/Essentials-2.x-SNAPSHOT.jar"
|
44
|
+
keep_eye_on: "https://hub.spigotmc.org/jenkins/job/Spigot-Essentials/"
|
45
|
+
EssentialsChat:
|
46
|
+
type: direct
|
47
|
+
url: "https://hub.spigotmc.org/jenkins/job/Spigot-Essentials/lastSuccessfulBuild/artifact/EssentialsChat/target/EssentialsChat-2.x-SNAPSHOT.jar"
|
48
|
+
Multiverse-core:
|
49
|
+
keep_eye_on: "http://mods.curse.com/bukkit-plugins/minecraft/multiverse-core"
|
50
|
+
type: direct
|
51
|
+
url: "http://ci.onarandombox.com/job/Multiverse-Core/lastSuccessfulBuild/artifact/target/Multiverse-Core-2.5.jar"
|
52
|
+
Towny:
|
53
|
+
type: manual
|
54
|
+
url: "http://palmergames.com"
|
67
55
|
```
|
68
56
|
|
69
|
-
I'm trying to switch to YAML.
|
70
57
|
#### Currently suported plugin hosted sites
|
71
58
|
* [Curse](http://mods.curse.com/bukkit-plugins/minecraft)
|
72
59
|
* [BukkitDev](http://dev.bukkit.org/)
|
@@ -74,10 +61,11 @@ I'm trying to switch to YAML.
|
|
74
61
|
#### Planned
|
75
62
|
* [Spigot](https://www.spigotmc.org/)
|
76
63
|
* Direct download
|
64
|
+
* Manual
|
77
65
|
* Custom download via piping (first download, second unrar, then extract X file, ...)
|
78
66
|
|
79
|
-
###
|
80
|
-
spigoter
|
67
|
+
### Update Spigot's version
|
68
|
+
spigoter compile [--version={1.9|1.8|...}]
|
81
69
|
|
82
70
|
This command excecute the `buildtools .jar` in a `build`directory in the root server folder. Then, it'll replace the old version with the new one.
|
83
71
|
|
data/exe/spigoter
CHANGED
@@ -1,24 +1,71 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'spigoter'
|
4
|
-
require '
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
options = {}
|
7
|
+
|
8
|
+
subtext = <<HELP
|
9
|
+
COMMAND are:
|
10
|
+
start [options] starts the server
|
11
|
+
update [options] updates plugin
|
12
|
+
compile [options] compiles spigot and replaces as the current version
|
13
|
+
|
14
|
+
See '#{File.basename $0} COMMAND --help' for more information on a specific command.
|
15
|
+
HELP
|
16
|
+
|
17
|
+
global = OptionParser.new do |opts|
|
18
|
+
opts.banner = "Usage: #{File.basename $0} <COMMAND> [options]"
|
19
|
+
opts.separator ""
|
20
|
+
opts.separator subtext
|
21
|
+
opts.on_tail("-v", "--version", "Show version information about this program and quit.") do
|
22
|
+
puts "Spigoter v#{Spigoter::VERSION}"
|
23
|
+
exit
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
subcommands = {
|
28
|
+
'init' => OptionParser.new do |opts|
|
29
|
+
opts.banner = "Usage: #{File.basename $0} init"
|
30
|
+
opts.separator "\nCreates a new spigoter.yml for you"
|
31
|
+
end,
|
32
|
+
'start' => OptionParser.new do |opts|
|
33
|
+
opts.banner = "Usage: #{File.basename $0} start"
|
34
|
+
opts.separator "\nStarts the server"
|
35
|
+
end,
|
36
|
+
'update' => OptionParser.new do |opts|
|
37
|
+
opts.banner = "Usage: #{File.basename $0} update [options]"
|
38
|
+
opts.on("-l", "--list=[x,y,z]", Array, "list of plugins to update") do |par|
|
39
|
+
options[:list] = par
|
40
|
+
end
|
41
|
+
opts.on("-f", "--force", "forces to updates all plugins, even if no new version was found") do |par|
|
42
|
+
options[:force] = par
|
43
|
+
end
|
44
|
+
opts.separator "\nUpdates the plugins"
|
45
|
+
end,
|
46
|
+
'compile' => OptionParser.new do |opts|
|
47
|
+
opts.banner = "Usage: #{File.basename $0} update [options]"
|
48
|
+
opts.on("-v", "--version version", "version of spigot to compile (lastest by default)") do |par|
|
49
|
+
options[:version] = par
|
50
|
+
end
|
51
|
+
opts.separator "\nCompiles spigot and sets it as the current version"
|
52
|
+
end
|
53
|
+
}
|
54
|
+
|
55
|
+
global.order!
|
56
|
+
|
57
|
+
command = ARGV.shift
|
58
|
+
|
59
|
+
begin
|
60
|
+
subcommands[command].order!
|
61
|
+
rescue
|
62
|
+
Log.error "Unrecognized subcommand or param, do #{File.basename $0} --help"
|
63
|
+
exit(1)
|
20
64
|
end
|
21
65
|
|
22
|
-
puts "
|
66
|
+
#puts "Command: #{command} "
|
67
|
+
#p options
|
68
|
+
#puts "ARGV:"
|
69
|
+
#p ARGV
|
23
70
|
|
24
|
-
Spigoter::CLI
|
71
|
+
Spigoter::CLI::run(command, options)
|
data/lib/spigoter.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
require "spigoter/version"
|
2
2
|
require "spigoter/log/log"
|
3
|
+
require 'spigoter/utils'
|
3
4
|
require 'spigoter/plugins'
|
5
|
+
require 'spigoter/webapi/plugin'
|
4
6
|
require 'spigoter/webapi/curse'
|
5
7
|
require 'spigoter/webapi/devbukkit'
|
8
|
+
require 'spigoter/cli/cli'
|
6
9
|
require 'spigoter/cli/cli_update'
|
7
10
|
require 'spigoter/cli/cli_compile'
|
8
11
|
require 'spigoter/cli/cli_start'
|
9
|
-
require 'spigoter/cli/cli'
|
10
12
|
|
11
13
|
module Spigoter
|
12
14
|
# Your code goes here...
|
data/lib/spigoter/cli/cli.rb
CHANGED
@@ -1,22 +1,18 @@
|
|
1
1
|
module Spigoter
|
2
2
|
module CLI
|
3
|
-
def self.
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
puts Spigoter::VERSION
|
16
|
-
puts Spigoter::VERSION.class
|
17
|
-
return
|
3
|
+
def self.run(command, opts={})
|
4
|
+
Run.new.task[command].call(opts)
|
5
|
+
end
|
6
|
+
|
7
|
+
class Run
|
8
|
+
attr_reader :task
|
9
|
+
def initialize
|
10
|
+
@task = {
|
11
|
+
'update' => Spigoter::CLI.update,
|
12
|
+
'compile' => Spigoter::CLI.compile,
|
13
|
+
'start' => Spigoter::CLI.start
|
14
|
+
}
|
18
15
|
end
|
19
|
-
Spigoter::CLI.start(opts)
|
20
16
|
end
|
21
17
|
end
|
22
18
|
end
|
@@ -1,7 +1,36 @@
|
|
1
1
|
module Spigoter
|
2
2
|
module CLI
|
3
|
-
def self.compile
|
4
|
-
|
3
|
+
def self.compile
|
4
|
+
return Compile::compile
|
5
|
+
end
|
6
|
+
module Compile
|
7
|
+
def self.compile
|
8
|
+
return lambda do |opts|
|
9
|
+
main(opts)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
def self.main(opts = {})
|
13
|
+
if !Spigoter::Utils.which('java').nil? and !Spigoter::Utils.which('git').nil?
|
14
|
+
Log.info "Compiling Spigot!"
|
15
|
+
FileUtils.mkdir_p 'build'
|
16
|
+
Dir.chdir('build')
|
17
|
+
unless File.exist?('BuildTools.jar')
|
18
|
+
file = Spigoter::Utils.download('https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar')
|
19
|
+
File.open('BuildTools.jar', 'wb').write(file)
|
20
|
+
end
|
21
|
+
if opts[:version].nil?
|
22
|
+
Log.info "Compiling lastest spigot version"
|
23
|
+
system("java -jar BuildTools.jar")
|
24
|
+
else
|
25
|
+
Log.info "Compiling spigot version #{opts[:version]}"
|
26
|
+
system("java -jar BuildTools.jar --rev #{opts[:version]}")
|
27
|
+
end
|
28
|
+
Dir.chdir('..')
|
29
|
+
FileUtils.cp(Dir['build/spigot*.jar'].first, 'spigot.jar')
|
30
|
+
else
|
31
|
+
Log.error "You don't have java or git in PATH"
|
32
|
+
end
|
33
|
+
end
|
5
34
|
end
|
6
35
|
end
|
7
36
|
end
|
@@ -1,24 +1,22 @@
|
|
1
1
|
module Spigoter
|
2
2
|
module CLI
|
3
|
-
def self.start
|
4
|
-
|
5
|
-
Log.info "Starting the server!"
|
6
|
-
system("java #{opts[:javaparm]}")
|
7
|
-
else
|
8
|
-
Log.error "You don't have java in PATH"
|
9
|
-
end
|
3
|
+
def self.start
|
4
|
+
return Start::start
|
10
5
|
end
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
6
|
+
module Start
|
7
|
+
def self.start
|
8
|
+
return lambda do |opts|
|
9
|
+
main(opts)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
def self.main(opts = {})
|
13
|
+
unless Spigoter::Utils.which('java').nil?
|
14
|
+
Log.info "Starting the server!"
|
15
|
+
system("java #{opts[:javaparm]} -jar spigot.jar")
|
16
|
+
else
|
17
|
+
Log.error "You don't have java in PATH"
|
18
|
+
end
|
20
19
|
end
|
21
|
-
return nil
|
22
20
|
end
|
23
21
|
end
|
24
22
|
end
|
@@ -1,27 +1,44 @@
|
|
1
1
|
module Spigoter
|
2
2
|
module CLI
|
3
|
-
def self.update
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
exit(1)
|
3
|
+
def self.update
|
4
|
+
return Update::update
|
5
|
+
end
|
6
|
+
module Update
|
7
|
+
def self.update
|
8
|
+
return lambda do |opts|
|
9
|
+
main(opts)
|
10
|
+
end
|
12
11
|
end
|
12
|
+
def self.main(opts)
|
13
|
+
Log.info "Updating!"
|
14
|
+
unless File.exist?('plugins.yml')
|
15
|
+
Log.error "plugins.yml doesn't exists, please, create one (you can use spigoter init)"
|
16
|
+
exit(1)
|
17
|
+
end
|
18
|
+
unless Dir.exist?('plugins')
|
19
|
+
Log.error "plugins directory doesn't exists, please, create it"
|
20
|
+
exit(1)
|
21
|
+
end
|
22
|
+
|
23
|
+
file = File.read('plugins.yml')
|
24
|
+
plugins_data = YAML.load(file)
|
25
|
+
list = plugins_data.keys
|
26
|
+
unless opts[:list].nil?
|
27
|
+
unless opts[:list].empty?
|
28
|
+
list = opts[:list]
|
29
|
+
end
|
30
|
+
end
|
13
31
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
Log.error "Unkown source #{data['type']}"
|
32
|
+
list.each do |plugin|
|
33
|
+
begin
|
34
|
+
Log.info "Starting to download #{plugin}"
|
35
|
+
hash = Plugins.get_plugin(plugin, plugins_data[plugin])
|
36
|
+
plugin_file = File.open("plugins/#{plugin}.jar", 'wb')
|
37
|
+
plugin_file.write(hash[:file])
|
38
|
+
Log.info "#{plugin} was downloaded correctly"
|
39
|
+
rescue
|
40
|
+
Log.error "Unkown source #{plugins_data[plugin]['type']}"
|
41
|
+
end
|
25
42
|
end
|
26
43
|
end
|
27
44
|
end
|
data/lib/spigoter/plugins.rb
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
module Spigoter
|
2
2
|
module Plugins
|
3
3
|
def self.get_plugin(name, data)
|
4
|
+
f = nil
|
4
5
|
case data['type']
|
5
6
|
when 'curse'
|
6
|
-
f = Spigoter::PluginCurse.new(data['url']).
|
7
|
-
hash = {:name => "#{name}.jar", :file => f}
|
8
|
-
return hash
|
7
|
+
f = Spigoter::PluginCurse.new(data['url']).file
|
9
8
|
when 'devbukkit'
|
10
|
-
f = Spigoter::PluginBukkit.new(data['url']).
|
11
|
-
hash = {:name => "#{name}.jar", :file => f}
|
12
|
-
return hash
|
9
|
+
f = Spigoter::PluginBukkit.new(data['url']).file
|
13
10
|
else
|
14
11
|
raise "Unkown source"
|
15
12
|
end
|
13
|
+
hash = {:name => "#{name}.jar", :file => f}
|
14
|
+
return hash
|
16
15
|
end
|
17
16
|
end
|
18
17
|
end
|