Class: KStarter::Map
- Inherits:
-
Object
- Object
- KStarter::Map
- Defined in:
- lib/k_starter/map.rb
Overview
Handle the global access such as configuration
Class Method Summary collapse
Class Method Details
.project(project_hash) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/k_starter/map.rb', line 11 def project(project_hash) case project_hash[:type].to_sym when :gem KStarter::Schema::GemProject.new(project_hash) when :rails KStarter::Schema::RailsProject.new(project_hash) when :svelte KStarter::Schema::SvelteProject.new(project_hash) when :nuxt KStarter::Schema::NuxtProject.new(project_hash) else raise "Unknown project type: #{project_hash[:type]}" end rescue StandardError => e puts e. end |
.starter(project_data) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/k_starter/map.rb', line 28 def starter(project_data) project = project_data.is_a?(Hash) ? project(project_data) : project_data raise "Unknown project type: #{project_data[:type]}" if project.nil? case project.type when :gem KStarter::Starters::Gem.new(project) when :rails KStarter::Starters::Rails.new(project) when :svelte KStarter::Starters::Svelte.new(project) when :nuxt KStarter::Starters::Nuxt.new(project) end end |