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
initialize environment.
- .run(argv) ⇒ Object
Class Method Details
.init ⇒ Object
pull the simrb
Example
$ simrb init myapp
13 14 15 16 17 18 19 20 |
# File 'lib/simrb/command.rb', line 13 def self.init # get the copy from remote repository @appname = @args[0] ? @args[0] : 'simrb' system("git clone https://github.com/simrb/simrb.git #{@appname}") # initializes detected the running environment init_env end |
.init_env ⇒ Object
initialize environment
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/simrb/command.rb', line 23 def self.init_env # bash command if `which 3s`.empty? `echo 'alias 3s="ruby cmd.rb"' >> ~/.bashrc && source` end # basic gem bundling if @args.include? '--dev' system("bundle install --gemfile=#{@appname}/modules/system/stores/Gemfile --without=production") elsif @args.include? '--pro' system("bundle install --gemfile=#{@appname}/modules/system/stores/Gemfile --without=develpment") else end end |
.run(argv) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/simrb/command.rb', line 39 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 |