Class: Manlycraft::Command::Init
- Inherits:
-
Base
- Object
- Base
- Manlycraft::Command::Init
show all
- Defined in:
- lib/manlycraft/command/init.rb
Instance Attribute Summary
Attributes inherited from Base
#args
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#create_server_directory ⇒ Object
#create_user(username = "minecraft") ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/manlycraft/command/init.rb', line 13
def create_user(username="minecraft")
@username = username
if RUBY_PLATFORM.match /darwin/
`dscl . -create /Users/#{username}`
`dscl . -create /Users/#{username} UserShell /bin/bash`
`dscl . -create /Users/#{username} RealName "Lucius Q. User"`
`dscl . -create /Users/#{username} UniqueID "1010"`
`dscl . -create /Users/#{username} PrimaryGroupID 80`
`dscl . -create /Users/#{username} NFSHomeDirectory /Users/#{username}`
elsif RUBY_PLATFORM.match /linux/
`sudo adduser --system --no-create-home --home /srv/minecraft-server #{username}`
end
end
|
#download_minecraft_jar ⇒ Object
33
34
35
|
# File 'lib/manlycraft/command/init.rb', line 33
def download_minecraft_jar
`sudo -u minecraft wget -P #{Manlycraft::Config.server_directory} https://s3.amazonaws.com/MinecraftDownload/launcher/minecraft_server.jar`
end
|
#run ⇒ Object
6
7
8
9
10
11
|
# File 'lib/manlycraft/command/init.rb', line 6
def run
create_user
create_server_directory
download_minecraft_jar
change_permissions
end
|