Parent

Methods

Class Index [+]

Quicksearch

Ramaze::Bin::Console

Allows the user to enter an IRB like session that takes advantage of everything provided by Ramaze.

Usage:

   ramaze console
   ramaze console /path/to/app/start.rb

@author Yorick Peterse @since 21-07-2011

Constants

Description

String containing the description of this command.

Banner

The banner that is displayed when the -h or —help option is specified.

Public Class Methods

new() click to toggle source

Creates a new instance of the command and sets all the options.

@author Yorick Peterse @since 21-07-2011

    # File lib/ramaze/bin/console.rb, line 42
42:       def initialize
43:         @options = OptionParser.new do |opt|
44:           opt.banner         = Banner
45:           opt.summary_indent = '  '
46: 
47:           opt.separator "\nOptions:\n"
48: 
49:           opt.on('-h', '--help', 'Shows this help message') do
50:             puts @options
51:             exit
52:           end
53:         end
54:       end

Public Instance Methods

run(argv = []) click to toggle source

Runs the command based on the given command line arguments.

@author Yorick Peterse @since 21-07-2011 @param [Array] argv An array of command line arguments.

    # File lib/ramaze/bin/console.rb, line 63
63:       def run(argv = [])
64:         @options.parse!(argv)
65: 
66:         start_file = argv.delete_at(0)
67:         start_file = File.join(Dir.pwd, 'start.rb') if start_file.nil?
68: 
69:         if File.directory?(start_file)
70:           start_file = File.join(start_file, 'start.rb')
71:         end
72: 
73:         if !File.exist?(start_file)
74:           abort "The file #{start_file} does not exist"
75:         end
76: 
77:         start_file             = Pathname.new(start_file).realpath.to_s
78:         Ramaze.options.started = true
79: 
80:         require(start_file)
81: 
82:         IRB.start
83:         puts 'Ramazement has ended, go in peace.'
84:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.