bukin 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +37 -2
- data/bukin.gemspec +1 -0
- data/lib/bukin/cli.rb +5 -1
- data/lib/bukin/friendly_errors.rb +1 -1
- data/lib/bukin/installer.rb +43 -4
- data/lib/bukin/providers/bukget.rb +2 -2
- data/lib/bukin/utils.rb +2 -1
- data/lib/bukin/version.rb +1 -1
- metadata +18 -2
data/README.md
CHANGED
@@ -1,6 +1,41 @@
|
|
1
|
-
|
1
|
+
Bukin
|
2
|
+
=====
|
2
3
|
|
3
|
-
Plugin and server
|
4
|
+
Plugin and server installer for Minecraft similar to [Bundler](http://gembundler.com/). Still a work in progress...
|
4
5
|
|
5
6
|
[![Dependency Status](https://gemnasium.com/Nullreff/bukin.png)](https://gemnasium.com/Nullreff/bukin)
|
6
7
|
[![Code Climate](https://codeclimate.com/github/Nullreff/bukin.png)](https://codeclimate.com/github/Nullreff/bukin)
|
8
|
+
|
9
|
+
Installation
|
10
|
+
------------
|
11
|
+
|
12
|
+
Install [rubygems](http://docs.rubygems.org/read/chapter/3) then:
|
13
|
+
|
14
|
+
gem install bukin
|
15
|
+
|
16
|
+
|
17
|
+
Usage
|
18
|
+
-----
|
19
|
+
|
20
|
+
Bukin works by reading a list of dependencies from a `Bukfile`. The most basic usage would be:
|
21
|
+
|
22
|
+
echo "server 'craftbukkit'" > Bukfile
|
23
|
+
bukin install
|
24
|
+
|
25
|
+
Currently only [Craftbukkit](http://bukkit.org/) is available as a server and [BukkitDev](http://dev.bukkit.org/) is the only plugin api supported. Specify a server using the `server` keyword and a plugin using the `plugin` keyword.
|
26
|
+
|
27
|
+
server 'craftbukkit'
|
28
|
+
plugin 'worldedit'
|
29
|
+
plugin 'worldguard'
|
30
|
+
|
31
|
+
You can specify specific versions of a plugin or server to install. Craftbukkit uses its own [special version naming](http://dl.bukkit.org/about/) (artifact slugs).
|
32
|
+
|
33
|
+
server 'craftbukkit', 'build-2754'
|
34
|
+
plugin 'worldedit', '5.5.5'
|
35
|
+
plugin 'worldguard', '5.7.3'
|
36
|
+
|
37
|
+
Need something custom? Use the `download` option. Version is optional but will display when the plugin is downloading.
|
38
|
+
|
39
|
+
server 'craftbukkit', 'spigot-735', download: 'http://ci.md-5.net/job/Spigot/735/artifact/Spigot-Server/target/spigot.jar'
|
40
|
+
plugin 'mycustomplugin', '2.4', download: 'http://example.com/My-Custom-Plugin.jar'
|
41
|
+
|
data/bukin.gemspec
CHANGED
data/lib/bukin/cli.rb
CHANGED
@@ -27,7 +27,11 @@ class Bukin::CLI < Thor
|
|
27
27
|
section "Fetching information from #{bukget.url}" do
|
28
28
|
plugins.map do |plugin|
|
29
29
|
plugin[:server] ||= server[:name]
|
30
|
-
|
30
|
+
begin
|
31
|
+
bukget.resolve_info(plugin)
|
32
|
+
rescue OpenURI::HTTPError => ex
|
33
|
+
raise Bukin::BukinError, "There was an error downloading #{plugin[:name]} (#{plugin[:version]}).\n#{ex.message}"
|
34
|
+
end
|
31
35
|
end
|
32
36
|
end
|
33
37
|
|
@@ -3,7 +3,7 @@ require 'socket'
|
|
3
3
|
module Bukin
|
4
4
|
def self.with_friendly_errors
|
5
5
|
yield
|
6
|
-
rescue BukinError => error
|
6
|
+
rescue Bukin::BukinError => error
|
7
7
|
abort error.message
|
8
8
|
rescue SocketError => error
|
9
9
|
abort "#{error.message}\nCheck that you have a stable connection and the service is online"
|
data/lib/bukin/installer.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'bukin/lockfile'
|
2
|
+
require 'zip/zip'
|
2
3
|
|
3
4
|
class Bukin::Installer
|
4
5
|
|
@@ -13,11 +14,49 @@ class Bukin::Installer
|
|
13
14
|
unless @paths.keys.include?(type)
|
14
15
|
raise(ArgumentError, "You must specify one of the following types to install: #{@paths.keys.to_s}")
|
15
16
|
end
|
17
|
+
|
16
18
|
file_data, file_name = download_file(data[:download])
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
if File.extname(file_name) == '.zip'
|
20
|
+
match = data[:extract] || /\.jar$/
|
21
|
+
file_names = extract_files(file_data, @paths[type], match)
|
22
|
+
if file_names.empty?
|
23
|
+
raise(Bukin::InstallError, "The plugin #{data[:name]} (#{data[:version]}) has no jar files in it's download (zip file).")
|
24
|
+
end
|
25
|
+
if @lockfile
|
26
|
+
if file_names.size == 1
|
27
|
+
data[:file] = file_names.first
|
28
|
+
else
|
29
|
+
data[:files] = file_names
|
30
|
+
end
|
31
|
+
@lockfile.add(type, data)
|
32
|
+
end
|
33
|
+
else
|
34
|
+
save_download(file_data, file_name, @paths[type])
|
35
|
+
if @lockfile
|
36
|
+
data[:file] = file_name
|
37
|
+
@lockfile.add(type, data)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def extract_files(file_data, path, match)
|
43
|
+
file_names = []
|
44
|
+
file = Tempfile.new('bukin')
|
45
|
+
begin
|
46
|
+
file.write(file_data)
|
47
|
+
file.close
|
48
|
+
|
49
|
+
Zip::ZipFile.open(file.path) do |zipfile|
|
50
|
+
jars = zipfile.find_all {|file| file.name =~ match}
|
51
|
+
jars.each do |file|
|
52
|
+
file.extract(path + '/' + file.name) { true }
|
53
|
+
file_names << file.name
|
54
|
+
end
|
55
|
+
end
|
56
|
+
ensure
|
57
|
+
file.close
|
58
|
+
file.unlink
|
21
59
|
end
|
60
|
+
file_names
|
22
61
|
end
|
23
62
|
end
|
@@ -36,8 +36,8 @@ class Bukin::Bukget
|
|
36
36
|
data[:version] = version_data['version']
|
37
37
|
data[:download] = version_data['download']
|
38
38
|
else
|
39
|
-
|
40
|
-
|
39
|
+
data[:version] = versions.first['version']
|
40
|
+
data[:download] = versions.first['download']
|
41
41
|
end
|
42
42
|
|
43
43
|
data
|
data/lib/bukin/utils.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'bukin/version'
|
1
2
|
require 'open-uri'
|
2
3
|
|
3
4
|
def save_download(data, name, path)
|
@@ -8,7 +9,7 @@ def save_download(data, name, path)
|
|
8
9
|
end
|
9
10
|
|
10
11
|
def download_file(url, content_disposition = false)
|
11
|
-
open(url) do |download|
|
12
|
+
open(url, "User-Agent" => "Bukin #{Bukin::VERSION}") do |download|
|
12
13
|
file_name = if download.meta['content-disposition']
|
13
14
|
download.meta['content-disposition']
|
14
15
|
.match(/filename=(\"?)(.+)\1/)[2]
|
data/lib/bukin/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bukin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -43,6 +43,22 @@ dependencies:
|
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: 1.7.7
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rubyzip
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.9.9
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.9.9
|
46
62
|
description: Plugin and server package manager for Minecraft
|
47
63
|
email:
|
48
64
|
- rsmendivil@gmail.com
|