Class: Commandable::AppController

Inherits:
Object
  • Object
show all
Extended by:
Commandable
Defined in:
lib/commandable/app_controller.rb

Overview

A helper to display the read me file and generate an example app

Constant Summary

Constants included from Commandable

HELP_COMMAND

Class Method Summary collapse

Methods included from Commandable

[], class_cache, clear_commands, commands, each, execute, execution_queue, help, parse_arguments, parse_optional, readline, reset_all, reset_colors, reset_screen_clearing

Class Method Details

.errorObject

Causes an error so you can see what it will look like if you have an error in your code.

Raises:

  • (Exception)


26
27
28
# File 'lib/commandable/app_controller.rb', line 26

def error
  raise Exception, "An example of what an error looks like if you make a mistake using Commandable."
end

.examples(path = "./examples") ⇒ Object

Copies the test classes to a folder so you can see a bunch of small examples



20
21
22
# File 'lib/commandable/app_controller.rb', line 20

def examples(path="./examples")
  copy_dir(File.expand_path(File.dirname(__FILE__) + '/../../spec/source_code_examples'),path)
end

.readmeObject



14
15
16
# File 'lib/commandable/app_controller.rb', line 14

def readme
  `open #{File.expand_path((File.dirname(__FILE__) + '/../../readme.md'))}`
end

.vObject Also known as: version

Version



32
33
34
# File 'lib/commandable/app_controller.rb', line 32

def v
  puts "Commandable: #{Commandable::VERSION}"
end