Sha256: 0b5c3d03150b6aa2859dfcd1d210190e43470314190785aa05526d96b052251b

Contents?: true

Size: 1.91 KB

Versions: 19

Compression:

Stored size: 1.91 KB

Contents

Capricorn.runtime_gem('thor', Capricorn::THOR_VERSION)

module Capricorn
  module Apps
    
    class Server < Thor
      
      desc "start", 'start the server'
      method_options :foreground => :boolean,  :config => :optional
      def start
        Capricorn.server? true
        Capricorn::System.load!(options[:root_path])
        
        begin
          FileUtils.mkdir_p(Capricorn.system.root)
        rescue Errno::EACCES
          Capricorn.logger.out.fatal "must be executed as root"
          exit(1)
        end
        
        unless Capricorn.system.is_user('root')
          Capricorn.logger.out.fatal "must be executed as root"
          exit(1)
        end
        
        if options[:foreground]
          Capricorn::Server.start
        else
          Capricorn::Server.daemonize
        end
      end
      
      desc "stop", 'stop the server'
      method_options :token => :optional
      def stop
        Capricorn.client(options[:token]).stop_server
      end
      
      desc "restart", 'restart the server'
      method_options :token => :optional
      def restart
        Capricorn.client(options[:token]).restart_server
      end
      
      desc "reload", 'reload the server'
      method_options :token => :optional
      def reload
        Capricorn.client(options[:token]).reload_server
      end
      
      desc "update", 'update the capricorn'
      method_options :token => :optional
      def update
        Capricorn.client(options[:token]).update_server
      end
      
      desc "gupdate", 'update the gems'
      method_options :token => :optional
      def gupdate
        Capricorn.client(options[:token]).update_gems
      end
      
      desc "version", 'version of the server'
      method_options :token => :optional
      def version
        puts "Client: #{Capricorn.version}"
        puts "Server: #{Capricorn.client(options[:token]).server_version}"
      end
      
    end
    
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
simonmenke-capricorn-0.2.25 lib/capricorn/apps/server.rb
simonmenke-capricorn-0.2.26 lib/capricorn/apps/server.rb
capricorn-0.2.25 lib/capricorn/apps/server.rb
capricorn-0.2.24 lib/capricorn/apps/server.rb
capricorn-0.2.23 lib/capricorn/apps/server.rb
capricorn-0.2.22 lib/capricorn/apps/server.rb
capricorn-0.2.21 lib/capricorn/apps/server.rb
capricorn-0.2.20 lib/capricorn/apps/server.rb
capricorn-0.2.19 lib/capricorn/apps/server.rb
capricorn-0.2.18 lib/capricorn/apps/server.rb
capricorn-0.2.17 lib/capricorn/apps/server.rb
capricorn-0.2.16 lib/capricorn/apps/server.rb
capricorn-0.2.15 lib/capricorn/apps/server.rb
capricorn-0.2.14 lib/capricorn/apps/server.rb
capricorn-0.2.13 lib/capricorn/apps/server.rb
capricorn-0.2.12 lib/capricorn/apps/server.rb
capricorn-0.2.11 lib/capricorn/apps/server.rb
capricorn-0.2.10 lib/capricorn/apps/server.rb
capricorn-0.2.09 lib/capricorn/apps/server.rb