Sha256: a987defd23b2c56fbe2dbb0442f357f607a52a97b43e971b8b89c8b2b11292fd

Contents?: true

Size: 1.2 KB

Versions: 5

Compression:

Stored size: 1.2 KB

Contents

#!/usr/bin/env ruby

require 'thor'

module MadChatter
  
  class Cli < Thor
    include Thor::Actions
    
    def self.source_root
      File.expand_path('../../', __FILE__)
    end
    
    desc "new [name]", "Generates a new Mad Chatter chatroom application"
    def new(name)
      copy_file "templates/config.yml", "#{name}/config.yml"
      copy_file "templates/extensions.rb", "#{name}/extensions.rb"
      directory "templates/web", "#{name}/web"
    end
    
    desc 'preview', 'Starts both a web server and the Mad Chatter chat server'
    def preview
      t1 = Thread.new { require 'mad_chatter/web_server' }
      t2 = Thread.new { require 'mad_chatter'; MadChatter.start }
      t2.join()
    end
    
    desc 'start', 'Starts the chat server'
    def start
      require 'mad_chatter/daemon'
    end
    
    desc 'stop', 'Stops the chat server'
    def stop
      require 'mad_chatter/daemon'
    end
    
    desc 'restart', 'Restarts the chat server'
    def restart
      require 'mad_chatter/daemon'
    end
    
    desc 'version', 'Displays the current version number'
    def version
      require 'mad_chatter/version'
      puts MadChatter::VERSION
    end
    
  end
end

MadChatter::Cli.start(ARGV)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mad_chatter-0.3.1 bin/mad_chatter
mad_chatter-0.3.0 bin/mad_chatter
mad_chatter-0.2.9 bin/mad_chatter
mad_chatter-0.2.8 bin/mad_chatter
mad_chatter-0.2.7 bin/mad_chatter