Class: J1::Commands::App

Inherits:
J1::Command show all
Defined in:
lib/j1/commands/app.rb

Class Method Summary collapse

Methods inherited from J1::Command

inherited, subclasses

Class Method Details

.init_with_program(prog) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/j1/commands/app.rb', line 9

def init_with_program(prog)
  prog.command(:app) do |c|
    c.description 'Run the site of a J1 Project as an WebApp'
    c.syntax 'app'
    c.action do |args, options|
      J1::Commands::App.process(args, options)
    end
  end
end

.process(args, options = {}) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/j1/commands/app.rb', line 19

def process(args, options = {})
  timestamp = Time.now.strftime("%Y-%m-%d %H:%M:%S")
  if J1::Utils::is_project?
    if J1::Utils::is_project_setup?
      J1.logger.info "#{timestamp} - APP: starting up your site .."
      process = J1::Utils::Exec2.run('APP','npm', 'run', 'j1-app')
    else
      raise SystemExit
    end
  else
    raise SystemExit
  end
end