Sha256: 30d49ba77ab7b7af7bca4c0d855d115456ac62dda79e5d169c9465000ae851e9
Contents?: true
Size: 1.81 KB
Versions: 3
Compression:
Stored size: 1.81 KB
Contents
#!/usr/bin/env ruby require 'rubygems' require 'fileutils' LOCATION_ROOT = File.join(File.dirname(__FILE__), "..") DEST = ARGV[1] || "./marvin" def j(*args); File.join(*args); end def copy(f, t = nil) t = f if t.nil? File.open(j(DEST, t), "w+") do |file| file.puts File.read(j(LOCATION_ROOT, f)) end end puts "Marvin - A Ruby IRC Library / Framework" if ARGV.include?("-h") || ARGV.include?("--help") puts "Usage: marvin create <name> - Creates a marvin directory at name or ./marvin" puts " marvin (in a Marvin dir) - Starts it, equiv. to script/marvin" exit end if ARGV.length >= 1 && !["start", "stop", "run", "restart"].include?(ARGV[0]) if ARGV[0].to_s.downcase != "create" puts "'#{ARGV[0]}' isn't a valid command. - Please use #{__FILE__} --help" exit(1) end if File.exist?(DEST) && File.directory?(DEST) puts "The folder '#{DEST}' already exists." exit(1) end # Generate it. FileUtils.mkdir(DEST) ["log", "tmp", "config", "handlers", "script"].each do |folder| FileUtils.mkdir(j(DEST, folder)) end puts "Writing Settings file" copy "config/settings.yml.sample", "config/settings.yml" puts "Writing setup.rb" copy "config/setup.rb" puts "Copying start script - script/run" copy "script/run" copy "script/daemon-runner" FileUtils.chmod 0755, j(DEST, "script/run") FileUtils.chmod 0755, j(DEST, "script/daemon-runner") puts "Copying example handler" copy "handlers/hello_world.rb" puts "Done!" elsif ARGV.length >= 1 if !File.exist?("script/daemon-runner") puts "Woops! This isn't a marvin directory." exit(1) end exec "script/daemon-runner #{ARGV.map {|a| a.include?(" ") ? "\"#{a}\"" : a }.join(" ")}" else if !File.exist?("script/run") puts "Woops! This isn't a marvin directory." exit(1) end exec "script/run" end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
Sutto-marvin-0.1.0.20081016 | bin/marvin |
Sutto-marvin-0.1.20081115 | bin/marvin |
jeffrafter-marvin-0.1.20081115 | bin/marvin |