Module: VueApp::Core::CLI::InitHelper
- Included in:
- VueApp::CLI
- Defined in:
- lib/vueapp/core/cli/init_helper.rb
Overview
Helper for CLI [vueapp init]
Instance Method Summary collapse
-
#app_path(path) ⇒ String
Get VUEAPP root path.
-
#init_config_folder ⇒ Object
Copy config folder files.
-
#init_core_folder ⇒ Object
Copy all core files.
- #init_pages_folder ⇒ Object
-
#init_src_folder ⇒ Object
Create src folders.
-
#run_init ⇒ Object
Run initialization.
-
#src_path(path) ⇒ String
Get VUEAPP src path.
-
#src_vendor_path(path) ⇒ String
Get VUEAPP src/_core/vendor path.
Instance Method Details
#app_path(path) ⇒ String
Get VUEAPP root path
26 27 28 |
# File 'lib/vueapp/core/cli/init_helper.rb', line 26 def app_path(path) File.(path, Dir.pwd) end |
#init_config_folder ⇒ Object
Copy config folder files
73 74 75 76 77 |
# 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 ⇒ Object
Copy all core files
45 46 47 48 49 50 51 52 |
# 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 ⇒ Object
63 64 65 66 67 68 69 70 |
# 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 ⇒ Object
Create src folders
55 56 57 58 59 60 61 |
# 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 ⇒ Object
Run initialization
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# 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) ⇒ String
Get VUEAPP src path
33 34 35 |
# File 'lib/vueapp/core/cli/init_helper.rb', line 33 def src_path(path) app_path('src/' + path) end |
#src_vendor_path(path) ⇒ String
Get VUEAPP src/_core/vendor path
40 41 42 |
# File 'lib/vueapp/core/cli/init_helper.rb', line 40 def src_vendor_path(path) app_path('src/_core/vendor/' + path) end |