Class: Simrb::Scommand
- Inherits:
-
Object
- Object
- Simrb::Scommand
- Defined in:
- lib/simrb/command.rb
Class Method Summary collapse
-
.init ⇒ Object
pull the simrb.
-
.init_env ⇒ Object
pull the module.
- .run(argv) ⇒ Object
Class Method Details
.init ⇒ Object
pull the simrb
Example
$ simrb init myapp
13 14 15 16 17 18 19 |
# File 'lib/simrb/command.rb', line 13 def self.init name = @args[0] ? @args[0] : 'simrb' `git clone https://github.com/simrb/simrb.git #{name}` # initializes detected the running environment init_env end |
.init_env ⇒ Object
pull the module
22 23 24 25 26 |
# File 'lib/simrb/command.rb', line 22 def self.init_env if `which 3s`.empty? `echo 'alias 3s="ruby cmd.rb"' >> ~/.bashrc && source` end end |
.run(argv) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/simrb/command.rb', line 28 def self.run argv if argv.count > 0 @cmd = argv.shift @args = argv ? argv : [] end case @cmd when 'init' init puts "Successfully initialized" else puts "No #{@cmd} command found in simrb" end end |