lib/lono/blueprint/new.rb in lono-7.4.5 vs lib/lono/blueprint/new.rb in lono-7.4.6

- old
+ new

@@ -50,11 +50,11 @@ @demo = false if ENV["LONO_ORG"] # overrides --demo CLI option end def create_project puts "=> Creating new blueprint called #{blueprint_name}." - directory ".", "#{@cwd}/#{blueprint_name}" + directory ".", "#{@cwd}/#{blueprint_name}", directory_options end def create_app_folder return if @options[:import] @@ -70,26 +70,20 @@ # Note: Not using Lono::Core::Config::PATHS.keys to create all of them because # think it is more common to not have all the folders. Instead create them explicitly. empty_directory "#{@cwd}/#{blueprint_name}/app/templates" end - def create_starter_configs - return unless @demo - return if @options[:import] - - if options[:from_new] # lono new command - directory "../blueprint_configs", options[:project_name] - else # lono blueprint new command - directory "../blueprint_configs", "." - end - end - def create_license return unless ENV['LONO_LICENSE_FILE'] copy_file ENV['LONO_LICENSE_FILE'], "#{@cwd}/#{blueprint_name}/LICENSE.txt" end + def create_readme + return unless ENV['LONO_README_FILE'] + template ENV['LONO_README_FILE'], "#{@cwd}/#{blueprint_name}/README.md" + end + # After this commands are executed with the newly created project def set_destination_root destination_root = "#{@cwd}/#{blueprint_name}" self.destination_root = destination_root @old_dir = Dir.pwd # for reset_current_dir @@ -117,8 +111,17 @@ # Reason: So `lono code import` prints out the params values with relative paths # when the config files are generated. def reset_current_dir FileUtils.cd(@old_dir) + end + + private + def directory_options + if ENV['LONO_README_FILE'] + {exclude_pattern: /README/} + else + {} + end end end end