Sha256: c1d19d414e9045f1fc4297b98beca740ed68f6bb3c30ca9e55027b6a73dc7956

Contents?: true

Size: 756 Bytes

Versions: 7

Compression:

Stored size: 756 Bytes

Contents

# ~*~ encoding: utf-8 ~*~
require 'aladdin'
require 'optparse'

module Aladdin

  module Commands

    # @example
    #   $> aladdin server path/to/lesson/root
    module Server

      # Parses the command line arguments.
      # @param [Array] argv           command line arguments
      # @return [Void]
      def parse!(argv)
        opt_parser = OptionParser.new do |opts|
          opts.banner = "Usage: aladdin server [options] [LESSON_PATH]"
        end
        opt_parser.parse! argv
      end

      extend self

      Commands.register do
        def server(argv=ARGV, opts={})
          Server.parse! argv
          Aladdin.launch opts.merge(from: argv[0])
        rescue => e
          puts e.message
        end
      end

    end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
aladdin-0.2 lib/aladdin/commands/server.rb
aladdin-0.1.0.pre.1 lib/aladdin/commands/server.rb
aladdin-0.1.0.pre lib/aladdin/commands/server.rb
aladdin-0.0.8 lib/aladdin/commands/server.rb
aladdin-0.0.7 lib/aladdin/commands/server.rb
aladdin-0.0.6 lib/aladdin/commands/server.rb
aladdin-0.0.5 lib/aladdin/commands/server.rb