Class: J1::Commands::Setup
- Inherits:
-
J1::Command
- Object
- J1::Command
- J1::Commands::Setup
- Defined in:
- lib/j1/commands/setup.rb
Class Method Summary collapse
Methods inherited from J1::Command
Class Method Details
.init_with_program(prog) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/j1/commands/setup.rb', line 10 def init_with_program(prog) prog.command(:setup) do |c| c.description 'Initialize a J1 Project for first use' c.syntax 'setup' c.option 'force', '--force', ' Force to install patches even already exists' c.option 'system', '--system', ' Install patches on the Ruby SYSTEM gem folder' c.option 'skip-patches', '--skip-patches', 'Skip install any PATCHES build-in with J1' c.action do |args, | J1::Commands::Setup.process(args, ) end end end |
.process(args, options = {}) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/j1/commands/setup.rb', line 23 def process(args, = {}) @args = args path = File.(Dir.getwd) if J1::Utils::is_project? bundle_install(path, ) if ['skip-patches'] J1.logger.info "#{} - SETUP: installing build-in patches skipped." else patch_install() end = Time.now.strftime("%Y-%m-%d %H:%M:%S") J1.logger.info "#{} - SETUP: initializing the project .." J1.logger.info "#{} - SETUP: be patient, this will take a while .." # process, output = J1::Utils::Exec.run('npm', 'run', 'setup') # output.to_s.each_line do |line| # J1.logger.info('SETUP:', line.strip) unless line.to_s.empty? # end process = J1::Utils::Exec2.run('SETUP','npm', 'run', 'setup') if process.success? = Time.now.strftime("%Y-%m-%d %H:%M:%S") J1.logger.info "#{} - SETUP: initializing the project finished successfully." J1.logger.info "#{} - SETUP: to open your site, run: j1 site" else raise SystemExit end else raise SystemExit end end |