Module: Rblock
- Defined in:
- lib/rblock.rb
Defined Under Namespace
Classes: Logfile, Screen, Server
Class Method Summary
collapse
Class Method Details
.fetch_bukkit(uri_str, download_location, limit = 10) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/rblock/utilities.rb', line 19
def Rblock::fetch_bukkit(uri_str, download_location, limit = 10)
uri = URI(uri_str)
raise ArgumentError, 'HTTP redirect too deep' if limit == 0
Net::HTTP.start(uri.host, uri.port) do |http|
request = Net::HTTP::Get.new uri.request_uri
http.request request do |response|
if response['Location'].nil?
open download_location, 'w' do |io|
response.read_body do |chunk|
io.write chunk
end
end
else
fetch_bukkit(response['Location'], download_location, limit - 1)
end
end
end
end
|
.tagline ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/rblock/utilities.rb', line 41
def Rblock::tagline
[
"taking the pain out of minecraft servers since 2012",
"because you just want to play the damn game",
"more minecraft, less server"
].sample
end
|
.test_dependencies ⇒ Object
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/rblock/utilities.rb', line 1
def Rblock::test_dependencies
tests = {
'Screen' => 'screen -v',
'Java' => 'java -version',
}
failed = []
tests.each do |name,command|
begin
`#{command}`
rescue Errno::ENOENT
failed << name
end
end
failed
end
|