Class: Raxe::Commands
- Inherits:
-
Object
- Object
- Raxe::Commands
- Defined in:
- lib/raxe/commands.rb
Instance Method Summary collapse
-
#command(command_data) ⇒ Object
initialize.
-
#display_error ⇒ Object
display_help.
-
#display_help ⇒ Object
commands.
-
#initialize(raxe) ⇒ Commands
constructor
A new instance of Commands.
Constructor Details
#initialize(raxe) ⇒ Commands
Returns a new instance of Commands.
5 6 7 |
# File 'lib/raxe/commands.rb', line 5 def initialize( raxe ) @raxe = raxe end |
Instance Method Details
#command(command_data) ⇒ Object
initialize
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/raxe/commands.rb', line 9 def command( command_data ) if command_data.nil? || command_data.empty? display_help else case command_data[0] when "install", "uninstall" c = command_data[0] == "uninstall" ? :uninstall : nil @raxe.install(c) when "generate", "ungenerate" c = command_data[0] == "generate" ? :generate : :ungenerate p = command_data[1] f = command_data[2] if p.nil? || f.nil? display_error return -1 else @raxe.generate( :req => c, :package => p, :file => f ) end # if bad cmds when "routes" if @raxe.setup_flag puts @raxe.paths else puts "Raxe has not been installed yet. Consider installing before using" end # if installed else display_help end # case command_data end # if null command return 0 end |
#display_error ⇒ Object
display_help
50 51 52 |
# File 'lib/raxe/commands.rb', line 50 def display_error puts "Bad usage, you're probably missing some parameters or put in too many." end |
#display_help ⇒ Object
commands
40 41 42 43 44 45 46 47 48 |
# File 'lib/raxe/commands.rb', line 40 def display_help puts "Usage : raxe [command] [arguments]" puts "Commands : " puts " install # installs the raxe application into the current workspace" puts " uninstall # removes the raxe application if there is one in the current workspace" puts " generate [package] [file] # generates a standard raxe package" puts " ungenerate [package] [file] # removes the named package if it exists" puts " routes # shows the current haxe pathing" end |