module VueApp::Core::CLI::InitHelper

Helper for CLI [vueapp init]

Public Instance Methods

app_path(path) click to toggle source

Get VUEAPP root path @param [String] path @return [String]

# File lib/vueapp/core/cli/init_helper.rb, line 26
def app_path(path)
  File.expand_path(path, Dir.pwd)
end
init_config_folder() click to toggle source

Copy config folder files

# File lib/vueapp/core/cli/init_helper.rb, line 73
def init_config_folder
  copy_file('config/app.js', src_path('config/app.js'))
  copy_file('config/routes.js', src_path('config/routes.js'))
  copy_file('config/router.js', src_path('config/router.js'))
end
init_core_folder() click to toggle source

Copy all core files

# File lib/vueapp/core/cli/init_helper.rb, line 45
def init_core_folder
  copy_file('_core/vendor/vue.js', src_vendor_path('vue.js'))
  copy_file('_core/vendor/vue.dev.js', src_vendor_path('vue.dev.js'))
  copy_file(
    '_core/vendor/vue_router.js',
    src_vendor_path('vue_router.js')
  )
end
init_pages_folder() click to toggle source
# File lib/vueapp/core/cli/init_helper.rb, line 63
def init_pages_folder
  copy_file('pages/home/home.js', src_path('pages/home/home.js'))
  copy_file('pages/home/home.scss', src_path('pages/home/home.scss'))
  copy_file('pages/home/home.slim', src_path('pages/home/home.slim'))
  copy_file('pages/about_us/about_us.js', src_path('pages/about_us/about_us.js'))
  copy_file('pages/about_us/about_us.scss', src_path('pages/about_us/about_us.scss'))
  copy_file('pages/about_us/about_us.slim', src_path('pages/about_us/about_us.slim'))
end
init_src_folder() click to toggle source

Create src folders

# File lib/vueapp/core/cli/init_helper.rb, line 55
def init_src_folder
  copy_file('index.slim', src_path('index.slim'))
  copy_file('styles.scss', src_path('styles.scss'))
  empty_directory(src_path('mixins'))
  empty_directory(src_path('filters'))
  empty_directory(src_path('components'))
end
run_init() click to toggle source

Run initialization

# File lib/vueapp/core/cli/init_helper.rb, line 9
def run_init
  ask_text = "Do you want to initialize [VUEAPP]\n"
  ask_text += 'in folder: [' + app_path('') + ']?(yes/no):'
  return unless yes?(ask_text, :green)

  empty_directory(app_path('build/development'))
  empty_directory(app_path('build/production'))
  empty_directory(app_path('build/test'))
  init_core_folder
  init_src_folder
  init_config_folder
  init_pages_folder
end
src_path(path) click to toggle source

Get VUEAPP src path @param [String] path @return [String]

# File lib/vueapp/core/cli/init_helper.rb, line 33
def src_path(path)
  app_path('src/' + path)
end
src_vendor_path(path) click to toggle source

Get VUEAPP src/_core/vendor path @param [String] path @return [String]

# File lib/vueapp/core/cli/init_helper.rb, line 40
def src_vendor_path(path)
  app_path('src/_core/vendor/' + path)
end