Sha256: 33efe73b04bfdb602060824270f23d21933e6ec3f766829e299de64a6da1f33b

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

Stored size: 1.34 KB

Contents

module Bukkit
	def self.new
		create_folder
		puts "  Do want the recommended build, beta build, or dev build?"
		print "  rb, beta, dev? "
		q1 = $stdin.gets.chomp

		case q1
		when "rb", "recommended", "r"
			puts "Downloading CraftBukkit Recommended build... (this could take a minute)\n"
			Bukkit::download("craftbukkit.jar", "http://cbukk.it/craftbukkit.jar")
			puts "\nSuccessfully downloaded Recommended build."
			Bukkit::start
		when "beta", "b"
			puts "Downloading CraftBukkit Beta build... (this could take a minute)\n"
			Bukkit::download("craftbukkit.jar", "http://cbukk.it/craftbukkit-beta.jar")
			puts "\nSuccessfully downloaded Beta build."
			Bukkit::start
		when "dev", "development", "d"
			puts "Downloading CraftBukkit Development build... (this could take a minute)\n"
			Bukkit::download("craftbukkit.jar", "http://cbukk.it/craftbukkit-dev.jar")
			puts "\nSuccessfully downloaded Development build."
			Bukkit::start
		else
			if q1.length > 0
				abort("  \"#{q1}\" is not an option.")
			else
				abort("  You didn't enter an option.")
			end
		end
	end
end

def create_folder
	opt2 = ARGV[1]
	if opt2.nil?
		abort("  Server name not specified.\n  USAGE: 'bukkit new SERVERNAME'")
	else
		begin
			Dir.mkdir(opt2.to_s)
			Dir.chdir(opt2.to_s)
		rescue Errno::EEXIST
			abort("  Directory already exists. Try a different name.")
		end
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bukkit-0.1.3 lib/bukkit/new.rb
bukkit-0.1.2 lib/bukkit/new.rb
bukkit-0.1.1 lib/bukkit/new.rb