Class: NScript::CommandLine
- Inherits:
-
Object
- Object
- NScript::CommandLine
- Defined in:
- lib/nscript/command_line.rb
Overview
The CommandLine handles all of the functionality of the nscript utility.
Constant Summary collapse
- BANNER =
"nscript compiles NScript source files into JavaScript.\n\nUsage:\n nscript path/to/script.ns\n"- WATCH_INTERVAL =
Seconds to pause between checks for changed source files.
0.5
- ROOT =
Path to the root of the NScript install.
File.(File.dirname(__FILE__) + '/../..')
- RUNNERS =
Commands to execute NScripts.
{ :node => "node #{ROOT}/lib/nscript/runner.js", :narwhal => "narwhal -p #{ROOT} -e 'require(\"nscript\").run(system.args);'" }
Instance Method Summary collapse
-
#initialize ⇒ CommandLine
constructor
Run the CommandLine off the contents of ARGV.
-
#usage ⇒ Object
The “–help” usage message.
Constructor Details
#initialize ⇒ CommandLine
Run the CommandLine off the contents of ARGV.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/nscript/command_line.rb', line 38 def initialize @mtimes = {} return launch_repl if [:interactive] return eval_scriptlet if [:eval] check_sources return run_scripts if [:run] @sources.each {|source| compile_javascript(source) } watch_nscript_scripts if [:watch] end |
Instance Method Details
#usage ⇒ Object
The “–help” usage message.
50 51 52 53 |
# File 'lib/nscript/command_line.rb', line 50 def usage puts "\n#{@option_parser}\n" exit end |