spigoter 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +106 -0
- data/Guardfile +90 -0
- data/LICENSE.txt +21 -0
- data/README.md +39 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/spigoter +22 -0
- data/lib/spigoter/cli/cli.rb +16 -0
- data/lib/spigoter/cli/cli_compile.rb +7 -0
- data/lib/spigoter/cli/cli_start.rb +24 -0
- data/lib/spigoter/cli/cli_update.rb +30 -0
- data/lib/spigoter/log/log.rb +37 -0
- data/lib/spigoter/plugins.rb +14 -0
- data/lib/spigoter/version.rb +3 -0
- data/lib/spigoter/webapi/curse.rb +63 -0
- data/lib/spigoter.rb +12 -0
- data/pkg/.gitignore +2 -0
- data/spigoter.gemspec +42 -0
- data/tmp/.gitignore +2 -0
- metadata +226 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 428e95fe3257f3b80a1243feff08548fc4c6af3b
|
4
|
+
data.tar.gz: 0f05544476abbdc88311248b976ae7ce2e24c03d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5b12eafa9055487e50f8aab9d78e7febcdd78591321639b8ca665eee0e83a6a82a3023f1716abfc084e8a815b2662b666913fa90346136e2714fc78f0a4e48a9
|
7
|
+
data.tar.gz: f639e2d4f8403a74c271a035f16ef8926358d11e927cb3e4f68e63fdf303983a7bcafc56ad208c5a86eb02ddcac33e0ce4ca74456df033cff0464f727dc9cb3c
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at danielramosacosta@hotmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
spigoter (0.1.2)
|
5
|
+
json (~> 1.8)
|
6
|
+
logging (~> 2.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
coderay (1.1.0)
|
12
|
+
coveralls (0.8.13)
|
13
|
+
json (~> 1.8)
|
14
|
+
simplecov (~> 0.11.0)
|
15
|
+
term-ansicolor (~> 1.3)
|
16
|
+
thor (~> 0.19.1)
|
17
|
+
tins (~> 1.6.0)
|
18
|
+
diff-lcs (1.2.5)
|
19
|
+
docile (1.1.5)
|
20
|
+
ffi (1.9.10)
|
21
|
+
formatador (0.2.5)
|
22
|
+
guard (2.13.0)
|
23
|
+
formatador (>= 0.2.4)
|
24
|
+
listen (>= 2.7, <= 4.0)
|
25
|
+
lumberjack (~> 1.0)
|
26
|
+
nenv (~> 0.1)
|
27
|
+
notiffany (~> 0.0)
|
28
|
+
pry (>= 0.9.12)
|
29
|
+
shellany (~> 0.0)
|
30
|
+
thor (>= 0.18.1)
|
31
|
+
guard-bundler (2.1.0)
|
32
|
+
bundler (~> 1.0)
|
33
|
+
guard (~> 2.2)
|
34
|
+
guard-compat (~> 1.1)
|
35
|
+
guard-compat (1.2.1)
|
36
|
+
guard-rspec (4.6.4)
|
37
|
+
guard (~> 2.1)
|
38
|
+
guard-compat (~> 1.1)
|
39
|
+
rspec (>= 2.99.0, < 4.0)
|
40
|
+
json (1.8.3)
|
41
|
+
listen (3.0.5)
|
42
|
+
rb-fsevent (>= 0.9.3)
|
43
|
+
rb-inotify (>= 0.9)
|
44
|
+
little-plugger (1.1.4)
|
45
|
+
logging (2.1.0)
|
46
|
+
little-plugger (~> 1.1)
|
47
|
+
multi_json (~> 1.10)
|
48
|
+
lumberjack (1.0.10)
|
49
|
+
method_source (0.8.2)
|
50
|
+
multi_json (1.11.2)
|
51
|
+
nenv (0.2.0)
|
52
|
+
notiffany (0.0.8)
|
53
|
+
nenv (~> 0.1)
|
54
|
+
shellany (~> 0.0)
|
55
|
+
pry (0.10.3)
|
56
|
+
coderay (~> 1.1.0)
|
57
|
+
method_source (~> 0.8.1)
|
58
|
+
slop (~> 3.4)
|
59
|
+
rake (11.1.2)
|
60
|
+
rb-fsevent (0.9.7)
|
61
|
+
rb-inotify (0.9.5)
|
62
|
+
ffi (>= 0.5.0)
|
63
|
+
rspec (3.4.0)
|
64
|
+
rspec-core (~> 3.4.0)
|
65
|
+
rspec-expectations (~> 3.4.0)
|
66
|
+
rspec-mocks (~> 3.4.0)
|
67
|
+
rspec-core (3.4.1)
|
68
|
+
rspec-support (~> 3.4.0)
|
69
|
+
rspec-expectations (3.4.0)
|
70
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
71
|
+
rspec-support (~> 3.4.0)
|
72
|
+
rspec-mocks (3.4.1)
|
73
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
74
|
+
rspec-support (~> 3.4.0)
|
75
|
+
rspec-support (3.4.1)
|
76
|
+
shellany (0.0.1)
|
77
|
+
simplecov (0.11.2)
|
78
|
+
docile (~> 1.1.0)
|
79
|
+
json (~> 1.8)
|
80
|
+
simplecov-html (~> 0.10.0)
|
81
|
+
simplecov-html (0.10.0)
|
82
|
+
slop (3.6.0)
|
83
|
+
term-ansicolor (1.3.2)
|
84
|
+
tins (~> 1.0)
|
85
|
+
thor (0.19.1)
|
86
|
+
tins (1.6.0)
|
87
|
+
trollop (2.1.2)
|
88
|
+
yard (0.8.7.6)
|
89
|
+
|
90
|
+
PLATFORMS
|
91
|
+
ruby
|
92
|
+
|
93
|
+
DEPENDENCIES
|
94
|
+
bundler (~> 1.11)
|
95
|
+
coveralls (~> 0.8)
|
96
|
+
guard (~> 2.13)
|
97
|
+
guard-bundler (~> 2.1)
|
98
|
+
guard-rspec (~> 4.6)
|
99
|
+
rake (~> 11.1)
|
100
|
+
rspec (~> 3.4)
|
101
|
+
spigoter!
|
102
|
+
trollop (~> 2.1)
|
103
|
+
yard (~> 0.8)
|
104
|
+
|
105
|
+
BUNDLED WITH
|
106
|
+
1.11.2
|
data/Guardfile
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features) \
|
6
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
+
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
+
#
|
12
|
+
# $ mkdir config
|
13
|
+
# $ mv Guardfile config/
|
14
|
+
# $ ln -s config/Guardfile .
|
15
|
+
#
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
+
|
18
|
+
guard :bundler do
|
19
|
+
require 'guard/bundler'
|
20
|
+
require 'guard/bundler/verify'
|
21
|
+
helper = Guard::Bundler::Verify.new
|
22
|
+
|
23
|
+
files = ['Gemfile']
|
24
|
+
files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
|
25
|
+
|
26
|
+
# Assume files are symlinked from somewhere
|
27
|
+
files.each { |file| watch(helper.real_path(file)) }
|
28
|
+
end
|
29
|
+
|
30
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
31
|
+
# rspec may be run, below are examples of the most common uses.
|
32
|
+
# * bundler: 'bundle exec rspec'
|
33
|
+
# * bundler binstubs: 'bin/rspec'
|
34
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
35
|
+
# installed the spring binstubs per the docs)
|
36
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
37
|
+
# * 'just' rspec: 'rspec'
|
38
|
+
|
39
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
40
|
+
require "guard/rspec/dsl"
|
41
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
42
|
+
|
43
|
+
# Feel free to open issues for suggestions and improvements
|
44
|
+
|
45
|
+
# RSpec files
|
46
|
+
rspec = dsl.rspec
|
47
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
48
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
49
|
+
watch(rspec.spec_files)
|
50
|
+
|
51
|
+
watch(/lib\/.*/) do |m|
|
52
|
+
file_changed = m.first.sub("lib/spigoter/", "").sub(".rb", "")
|
53
|
+
"spec/#{file_changed}_spec.rb"
|
54
|
+
end
|
55
|
+
watch(/exe\/spigoter/) do |m|
|
56
|
+
"spec/cli_spec.rb"
|
57
|
+
end
|
58
|
+
|
59
|
+
# Ruby files
|
60
|
+
ruby = dsl.ruby
|
61
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
62
|
+
|
63
|
+
# Rails files
|
64
|
+
rails = dsl.rails(view_extensions: %w(erb haml slim))
|
65
|
+
dsl.watch_spec_files_for(rails.app_files)
|
66
|
+
dsl.watch_spec_files_for(rails.views)
|
67
|
+
|
68
|
+
watch(rails.controllers) do |m|
|
69
|
+
[
|
70
|
+
rspec.spec.("routing/#{m[1]}_routing"),
|
71
|
+
rspec.spec.("controllers/#{m[1]}_controller"),
|
72
|
+
rspec.spec.("acceptance/#{m[1]}")
|
73
|
+
]
|
74
|
+
end
|
75
|
+
|
76
|
+
# Rails config changes
|
77
|
+
watch(rails.spec_helper) { rspec.spec_dir }
|
78
|
+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
|
79
|
+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
|
80
|
+
|
81
|
+
# Capybara features specs
|
82
|
+
watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") }
|
83
|
+
watch(rails.layouts) { |m| rspec.spec.("features/#{m[1]}") }
|
84
|
+
|
85
|
+
# Turnip features and steps
|
86
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
87
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
88
|
+
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
89
|
+
end
|
90
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Daniel Ramos
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Spigoter
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/DanielRamosAcosta/spigoter.svg?branch=master)](https://travis-ci.org/DanielRamosAcosta/spigoter) [![Coverage Status](https://coveralls.io/repos/github/DanielRamosAcosta/spigoter/badge.svg?branch=master)](https://coveralls.io/github/DanielRamosAcosta/spigoter?branch=master) [![Dependency Status](https://gemnasium.com/DanielRamosAcosta/spigoter.svg)](https://gemnasium.com/DanielRamosAcosta/spigoter)
|
4
|
+
|
5
|
+
|
6
|
+
Spigoter is a Ruby gem that gives you many tools make your server keepup easier.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem install spigoter
|
12
|
+
```
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
|
16
|
+
### Run the server
|
17
|
+
spigoter
|
18
|
+
|
19
|
+
### Update plugins
|
20
|
+
spigoter {-u|--update} {all|plugin1,plugin2,...}
|
21
|
+
|
22
|
+
### Compile spigot and set that version
|
23
|
+
spigoter {-c|--compile} [lastest|1.9|1.8|...]
|
24
|
+
|
25
|
+
## Development
|
26
|
+
|
27
|
+
After checking out the repo, run `bundle install` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
28
|
+
|
29
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/DanielRamosAcosta/spigoter. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
34
|
+
|
35
|
+
|
36
|
+
## License
|
37
|
+
|
38
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
39
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "spigoter"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/exe/spigoter
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'spigoter'
|
4
|
+
require 'trollop'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
|
8
|
+
opts = Trollop::options do
|
9
|
+
banner <<-EOS
|
10
|
+
Spigoter, a command line utity for minecraft servers.
|
11
|
+
|
12
|
+
Usage:
|
13
|
+
spigoter [options]
|
14
|
+
where [options] are:
|
15
|
+
EOS
|
16
|
+
opt :javaparm, 'Sets the java parameters', :default => '-Xms1024M -Xmx4096M -jar spigot.jar' #TODO: Poner esto aqui
|
17
|
+
opt :compile, "Compiles spigot and sets the new version"
|
18
|
+
opt :update, "Set permissons plugin"
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
Spigoter::CLI.main(opts)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Spigoter
|
2
|
+
module CLI
|
3
|
+
def self.main(opts)
|
4
|
+
Log.info "Estoy en la main, mi opts son: #{opts}"
|
5
|
+
if(opts[:update])
|
6
|
+
Spigoter::CLI.update(opts)
|
7
|
+
return
|
8
|
+
end
|
9
|
+
if(opts[:compile])
|
10
|
+
Spigoter::CLI.compile(opts)
|
11
|
+
return
|
12
|
+
end
|
13
|
+
Spigoter::CLI.start(opts)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Spigoter
|
2
|
+
module CLI
|
3
|
+
def self.start(opts)
|
4
|
+
unless which('java').nil?
|
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
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.which(cmd)
|
13
|
+
# http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
|
14
|
+
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
15
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
16
|
+
exts.each { |ext|
|
17
|
+
exe = File.join(path, "#{cmd}#{ext}")
|
18
|
+
return exe if File.executable?(exe) && !File.directory?(exe)
|
19
|
+
}
|
20
|
+
end
|
21
|
+
return nil
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Spigoter
|
2
|
+
module CLI
|
3
|
+
def self.update(opts)
|
4
|
+
puts opts
|
5
|
+
Log.info "Updating!"
|
6
|
+
unless File.exists?('plugins.json')
|
7
|
+
Log.error "plugins.json doesn't exists, please, create one"
|
8
|
+
exit(1)
|
9
|
+
end
|
10
|
+
unless Dir.exists?('plugins')
|
11
|
+
Log.error "plugins directory doesn't exists, please, create it"
|
12
|
+
exit(1)
|
13
|
+
end
|
14
|
+
|
15
|
+
file = File.read("plugins.json")
|
16
|
+
plugins = JSON.parse(file)
|
17
|
+
plugins.each do |plugin_data|
|
18
|
+
Log.info "Getting plugin #{plugin_data['name']}"
|
19
|
+
begin
|
20
|
+
hash = Plugins.get_plugin(plugin_data)
|
21
|
+
plugin_file = File.open("plugins/#{hash[:name]}", 'wb')
|
22
|
+
plugin_file.write(hash[:file])
|
23
|
+
Log.info "#{plugin_data['name']} was downloaded correctly"
|
24
|
+
rescue Exception => e
|
25
|
+
Log.error "Unkown source #{plugin_data['type']}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'logging'
|
2
|
+
|
3
|
+
Logging.color_scheme( 'bright',
|
4
|
+
:levels => {
|
5
|
+
:info => :green,
|
6
|
+
:warn => :yellow,
|
7
|
+
:error => :red,
|
8
|
+
:fatal => [:white, :on_red]
|
9
|
+
},
|
10
|
+
:date => :blue,
|
11
|
+
:logger => :cyan,
|
12
|
+
:message => :magenta
|
13
|
+
)
|
14
|
+
|
15
|
+
Logging.appenders.stdout(
|
16
|
+
'stdout',
|
17
|
+
:layout => Logging.layouts.pattern(
|
18
|
+
:pattern => '[%d] %-5l %c: %m\n',
|
19
|
+
:color_scheme => 'bright'
|
20
|
+
)
|
21
|
+
)
|
22
|
+
|
23
|
+
module Log
|
24
|
+
@log = Logging.logger['Spigoter']
|
25
|
+
@log.add_appenders 'stdout'
|
26
|
+
@log.level = :info
|
27
|
+
|
28
|
+
def self.info(msg)
|
29
|
+
@log.info msg
|
30
|
+
end
|
31
|
+
def self.warn(msg)
|
32
|
+
@log.warn msg
|
33
|
+
end
|
34
|
+
def self.error(msg)
|
35
|
+
@log.error msg
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Spigoter
|
2
|
+
module Plugins
|
3
|
+
def self.get_plugin(data)
|
4
|
+
case data['type']
|
5
|
+
when 'curse'
|
6
|
+
f = Spigoter::PluginCurse.new(data['url']).download
|
7
|
+
hash = {:name => "#{data['name']}.jar", :file => f}
|
8
|
+
return hash
|
9
|
+
else
|
10
|
+
raise "Unkown source"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'logging'
|
3
|
+
|
4
|
+
module Spigoter
|
5
|
+
class PluginCurse
|
6
|
+
def initialize(website)
|
7
|
+
@url = website # Url of the plugin
|
8
|
+
@main_page # Mainpage content
|
9
|
+
@name # Name of the plugin
|
10
|
+
@download_page # Content of the download page
|
11
|
+
@download_url # Download url of the plugin
|
12
|
+
|
13
|
+
raise "Bad URL #{@url}" if @url.match(/^http:\/\/mods.curse.com\/bukkit-plugins\/minecraft\/[a-z\-]+$/).nil?
|
14
|
+
end
|
15
|
+
def main_page
|
16
|
+
return @main_page unless @main_page.nil?
|
17
|
+
Log.info "Downloading main page"
|
18
|
+
begin
|
19
|
+
@main_page = open(@url).read
|
20
|
+
rescue
|
21
|
+
raise "404 Error, that plugin URL doesn't exists"
|
22
|
+
end
|
23
|
+
return @main_page
|
24
|
+
end
|
25
|
+
def download_page
|
26
|
+
return @download_page unless @download_page.nil?
|
27
|
+
Log.info "Downloading download page"
|
28
|
+
begin
|
29
|
+
@download_page = open(@url+'/download').read
|
30
|
+
rescue
|
31
|
+
raise "404 Error, that plugin URL doesn't exists"
|
32
|
+
end
|
33
|
+
return @download_page
|
34
|
+
end
|
35
|
+
def download_url
|
36
|
+
return @download_url unless @download_url.nil?
|
37
|
+
download_page
|
38
|
+
Log.info "Parsing download url"
|
39
|
+
@download_url = /(?<download_url>http:\/\/addons.curse.cursecdn.com.+\.jar)/.match(@download_page)[:download_url]
|
40
|
+
end
|
41
|
+
def version
|
42
|
+
return @version unless @version.nil?
|
43
|
+
main_page
|
44
|
+
Log.info "Getting version"
|
45
|
+
@version = /Newest File: (?<version>.+)</.match(@main_page)[:version]
|
46
|
+
end
|
47
|
+
def name
|
48
|
+
return @name unless @name.nil?
|
49
|
+
Log.info "Getting name"
|
50
|
+
@name = /minecraft\/(?<name>.+)/.match(@url)[:name]
|
51
|
+
end
|
52
|
+
def download
|
53
|
+
download_url
|
54
|
+
Log.info "Downloading"
|
55
|
+
begin
|
56
|
+
file = open(@download_url).read
|
57
|
+
rescue
|
58
|
+
raise "Can't download file for #{name}, #{@download_url}, check internet?"
|
59
|
+
end
|
60
|
+
return file
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/lib/spigoter.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require "spigoter/version"
|
2
|
+
require "spigoter/log/log"
|
3
|
+
require 'spigoter/plugins'
|
4
|
+
require 'spigoter/webapi/curse'
|
5
|
+
require 'spigoter/cli/cli_update'
|
6
|
+
require 'spigoter/cli/cli_compile'
|
7
|
+
require 'spigoter/cli/cli_start'
|
8
|
+
require 'spigoter/cli/cli'
|
9
|
+
|
10
|
+
module Spigoter
|
11
|
+
# Your code goes here...
|
12
|
+
end
|
data/pkg/.gitignore
ADDED
data/spigoter.gemspec
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'spigoter/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "spigoter"
|
8
|
+
spec.version = Spigoter::VERSION
|
9
|
+
spec.authors = ["Daniel Ramos"]
|
10
|
+
spec.email = ["danielramosacosta@hotmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{A CLI utility for Minecraft servers}
|
13
|
+
spec.description = %q{A CLI utility for Minecraft servers}
|
14
|
+
spec.homepage = "https://github.com/DanielRamosAcosta/spigoter"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
31
|
+
spec.add_development_dependency "rake", "~> 11.1"
|
32
|
+
spec.add_development_dependency "rspec", "~> 3.4"
|
33
|
+
spec.add_development_dependency "guard", "~> 2.13"
|
34
|
+
spec.add_development_dependency "guard-rspec", "~> 4.6"
|
35
|
+
spec.add_development_dependency "guard-bundler", "~> 2.1"
|
36
|
+
spec.add_development_dependency "coveralls", "~> 0.8"
|
37
|
+
spec.add_development_dependency "yard", "~> 0.8"
|
38
|
+
spec.add_development_dependency "trollop", "~> 2.1"
|
39
|
+
|
40
|
+
spec.add_runtime_dependency "json", "~> 1.8"
|
41
|
+
spec.add_runtime_dependency "logging", "~> 2.1"
|
42
|
+
end
|
data/tmp/.gitignore
ADDED
metadata
ADDED
@@ -0,0 +1,226 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spigoter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Daniel Ramos
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '11.1'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '11.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.4'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.4'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.13'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.13'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard-rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '4.6'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '4.6'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard-bundler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.1'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '2.1'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: coveralls
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.8'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.8'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: yard
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.8'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0.8'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: trollop
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.1'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '2.1'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: json
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '1.8'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '1.8'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: logging
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '2.1'
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '2.1'
|
167
|
+
description: A CLI utility for Minecraft servers
|
168
|
+
email:
|
169
|
+
- danielramosacosta@hotmail.com
|
170
|
+
executables:
|
171
|
+
- spigoter
|
172
|
+
extensions: []
|
173
|
+
extra_rdoc_files: []
|
174
|
+
files:
|
175
|
+
- ".gitignore"
|
176
|
+
- ".rspec"
|
177
|
+
- ".travis.yml"
|
178
|
+
- CODE_OF_CONDUCT.md
|
179
|
+
- Gemfile
|
180
|
+
- Gemfile.lock
|
181
|
+
- Guardfile
|
182
|
+
- LICENSE.txt
|
183
|
+
- README.md
|
184
|
+
- Rakefile
|
185
|
+
- bin/console
|
186
|
+
- bin/setup
|
187
|
+
- exe/spigoter
|
188
|
+
- lib/spigoter.rb
|
189
|
+
- lib/spigoter/cli/cli.rb
|
190
|
+
- lib/spigoter/cli/cli_compile.rb
|
191
|
+
- lib/spigoter/cli/cli_start.rb
|
192
|
+
- lib/spigoter/cli/cli_update.rb
|
193
|
+
- lib/spigoter/log/log.rb
|
194
|
+
- lib/spigoter/plugins.rb
|
195
|
+
- lib/spigoter/version.rb
|
196
|
+
- lib/spigoter/webapi/curse.rb
|
197
|
+
- pkg/.gitignore
|
198
|
+
- spigoter.gemspec
|
199
|
+
- tmp/.gitignore
|
200
|
+
homepage: https://github.com/DanielRamosAcosta/spigoter
|
201
|
+
licenses:
|
202
|
+
- MIT
|
203
|
+
metadata:
|
204
|
+
allowed_push_host: https://rubygems.org
|
205
|
+
post_install_message:
|
206
|
+
rdoc_options: []
|
207
|
+
require_paths:
|
208
|
+
- lib
|
209
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
210
|
+
requirements:
|
211
|
+
- - ">="
|
212
|
+
- !ruby/object:Gem::Version
|
213
|
+
version: '0'
|
214
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
215
|
+
requirements:
|
216
|
+
- - ">="
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: '0'
|
219
|
+
requirements: []
|
220
|
+
rubyforge_project:
|
221
|
+
rubygems_version: 2.5.1
|
222
|
+
signing_key:
|
223
|
+
specification_version: 4
|
224
|
+
summary: A CLI utility for Minecraft servers
|
225
|
+
test_files: []
|
226
|
+
has_rdoc:
|