Class: Tane::Commands::Exec

Inherits:
Base
  • Object
show all
Defined in:
lib/tane/commands/exec.rb

Class Method Summary collapse

Methods inherited from Base

fire

Methods included from Helpers

included

Class Method Details

.help_textObject



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/tane/commands/exec.rb', line 22

def help_text
  "Usage:\n\ntane exec any_command\n\nExecutes any command specified in a simulated Cloudfuji environment. The following example shows you how to run rails applications.\n\ntane exec rails s\n\nThis is how you should be running Cloudfuji rails applications locally. All the configuration required for `tane exec` is obtained from `.cloudfuji` directory in the current directory. This can only be used if `tane init` has been run in the current directory.\n"
end

.process(args) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/tane/commands/exec.rb', line 4

def process(args)
  authenticate_user
  cloudfuji_envs.each_pair do |key, value|
    ENV[key] = value
  end
  
  command = args.join(' ')
  
  if command.empty?
    term.say("please enter a command for tane exec to run. example:")
    term.say("\t tane exec rails s")
    
    exit 1
  end
  
  exec command
end