Sha256: d2d625f34a888e32e062582888dbafd0397b760da2b884a9c833af60f1ce78b9

Contents?: true

Size: 949 Bytes

Versions: 5

Compression:

Stored size: 949 Bytes

Contents

module Bukkit
	class Server
		# Create a new server.
		def create(options = {}) # Options: { :build => :rb/:beta/:dev, :force => false/true }
			force = options[:force]

			# If the dir already exists, fail gracefully.
			if Dir.exists?(@name) && force == false
				puts "'#{@name}' already exists.".red

				names = %w{ minecraftyness mine-opolis mineville minetown bukkits-o-fun }
				abort "Try ".yellow + "`bukkit new #{names.sample}` ".light_yellow + "or".yellow + " `bukkit new #{@name} --force`".light_blue
			end

			# Let the dark side of the force flow through you...
			if force == true
				puts "Overwriting: ".light_red + "#{@name}/"
				FileUtils.rm_rf(@name)
			end

			# Create the server directory and cd into it.
			Dir.mkdir(@name)
			puts "     Create: ".green + "#{@name}/"
			Dir.chdir(@name)

			# Download build.
			Bukkit::Server.download("http://dl.bukkit.org/latest-#{options[:build].to_s}/craftbukkit.jar")
		end
	end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bukkit-2.2.0 lib/bukkit/create.rb
bukkit-2.1.3 lib/bukkit/create.rb
bukkit-2.1.2 lib/bukkit/create.rb
bukkit-2.1.1 lib/bukkit/create.rb
bukkit-2.1.0 lib/bukkit/create.rb