class Lono::Configset::New
Public Class Methods
cli_options()
click to toggle source
# File lib/lono/configset/new.rb, line 13 def self.cli_options [ [:demo, type: :boolean, default: true, desc: "Include demo template"], [:force, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files."], ] end
source_root()
click to toggle source
# File lib/lono/configset/new.rb, line 8 def self.source_root templates = File.expand_path("../../templates", File.dirname(__FILE__)) "#{templates}/configset" end
Public Instance Methods
create_license()
click to toggle source
# File lib/lono/configset/new.rb, line 46 def create_license return unless ENV['LONO_LICENSE_FILE'] copy_file ENV['LONO_LICENSE_FILE'], "#{@cwd}/#{configset_name}/LICENSE.txt" end
create_project()
click to toggle source
# File lib/lono/configset/new.rb, line 34 def create_project puts "=> Creating new configset called #{configset_name}." if @demo options = {} else create_file "#{@cwd}/#{configset_name}/lib/configset.rb" options = {exclude_pattern: %r{configset\.rb}} end directory ".", "#{@cwd}/#{configset_name}", options end
set_cwd()
click to toggle source
for specs
# File lib/lono/configset/new.rb, line 25 def set_cwd @cwd = ENV['LONO_TEST'] ? File.dirname(Lono.root) : "#{Dir.pwd}/app/configsets" end
set_destination_root()
click to toggle source
After this commands are executed with the newly created project
# File lib/lono/configset/new.rb, line 52 def set_destination_root destination_root = "#{@cwd}/#{configset_name}" self.destination_root = destination_root @old_dir = Dir.pwd # for reset_current_dir FileUtils.cd(self.destination_root) end
set_variables()
click to toggle source
# File lib/lono/configset/new.rb, line 29 def set_variables @demo = @options[:demo] @demo = false if ENV["LONO_ORG"] # overrides --demo CLI option end
tree()
click to toggle source
# File lib/lono/configset/new.rb, line 73 def tree tree_structure("configset") end
welcome_message()
click to toggle source
# File lib/lono/configset/new.rb, line 59 def welcome_message puts <<~EOL #{"="*64} Congrats 🎉 You have successfully created a lono configset. Cd into your configset and check things out. cd #{configset_name} More info: https://lono.cloud/docs/core/configsets EOL end