Class: Lono::Upgrade::Upgrade5
- Defined in:
- lib/lono/upgrade/upgrade5.rb
Instance Method Summary collapse
- #create_blueprints_folder ⇒ Object
- #move_configs ⇒ Object
- #move_to_main_blueprint ⇒ Object
- #sanity_check ⇒ Object
- #starter_files ⇒ Object
Methods inherited from Sequence
Instance Method Details
#create_blueprints_folder ⇒ Object
18 19 20 21 |
# File 'lib/lono/upgrade/upgrade5.rb', line 18 def create_blueprints_folder puts "Creating: blueprints folder" FileUtils.mkdir_p("blueprints/main") end |
#move_configs ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/lono/upgrade/upgrade5.rb', line 32 def move_configs puts "Setting up the new configs structure" FileUtils.mkdir_p("configs/main") FileUtils.mv("blueprints/main/config/params", "configs/main/params") FileUtils.mv("blueprints/main/config/variables", "configs/main/variables") FileUtils.mv("blueprints/main/config/settings.yml", "configs/settings.yml") FileUtils.rmdir("blueprints/main/config") if Dir.empty?("blueprints/main/config") end |
#move_to_main_blueprint ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/lono/upgrade/upgrade5.rb', line 23 def move_to_main_blueprint puts "Moving files to blueprints folder" # Dir.entries includes hidden files Dir.entries('.').each do |p| next if %w[blueprints .git .. .].include?(p) FileUtils.mv(p, "blueprints/main/#{p}") end end |
#sanity_check ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/lono/upgrade/upgrade5.rb', line 6 def sanity_check if File.exist?("blueprints") puts "The blueprints folder already exist. The project already seems to have the lono v5 structure." exit end unless File.exist?("config/settings.yml") puts "ERROR: The config/settings.yml file does not exist. Are you sure you're within a lono project?".color(:red) exit 1 end end |
#starter_files ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/lono/upgrade/upgrade5.rb', line 42 def starter_files puts "Creating remaining starter lono project files" files = %w[ .gitignore Gemfile Guardfile README.md ] files.each { |f | template(f) } template("../upgrade5/blueprints/main/.meta/config.yml", "blueprints/main/.meta/config.yml") end |