Class: Lono::New
- Includes:
- Helper
- Defined in:
- lib/lono/new.rb
Defined Under Namespace
Modules: Helper
Class Method Summary collapse
-
.cli_options ⇒ Object
Ugly, but when the class_option is only defined in the Thor::Group class it doesnt show up with cli-template new help :( If anyone knows how to fix this let me know. Also options from the cli can be pass through to here.
Instance Method Summary collapse
- #bundle_install ⇒ Object
- #create_project ⇒ Object
- #create_starter_blueprint ⇒ Object
- #git_commit ⇒ Object
- #git_init ⇒ Object
- #make_executable ⇒ Object
-
#set_cwd ⇒ Object
for specs.
-
#set_destination_root ⇒ Object
After this commands are executed with the newly created project.
- #welcome_message ⇒ Object
Methods inherited from Sequence
Class Method Details
.cli_options ⇒ Object
Ugly, but when the class_option is only defined in the Thor::Group class it doesnt show up with cli-template new help :( If anyone knows how to fix this let me know. Also options from the cli can be pass through to here
11 12 13 14 15 16 17 18 19 |
# File 'lib/lono/new.rb', line 11 def self. [ [:bundle, type: :boolean, default: true, desc: "Runs bundle install on the project"], [:demo, type: :boolean, default: false, desc: "Also generate demo blueprint"], [:force, type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files."], [:git, type: :boolean, default: true, desc: "Git initialize the project"], [:type, default: "dsl", desc: "Blueprint type: dsl or erb"], ] end |
Instance Method Details
#bundle_install ⇒ Object
57 58 59 60 61 62 63 64 |
# File 'lib/lono/new.rb', line 57 def bundle_install return unless [:bundle] puts "=> Installing dependencies with: bundle install" Bundler.with_clean_env do system("BUNDLE_IGNORE_CONFIG=1 bundle install") end end |
#create_project ⇒ Object
30 31 32 33 |
# File 'lib/lono/new.rb', line 30 def create_project puts "=> Creating new project called #{project_name}." directory ".", "#{@cwd}/#{project_name}" end |
#create_starter_blueprint ⇒ Object
35 36 37 38 39 |
# File 'lib/lono/new.rb', line 35 def create_starter_blueprint return unless @options[:demo] # https://github.com/erikhuda/thor/wiki/Invocations Lono::Blueprint::New.start(["demo", "--from-new", "--type", @options[:type], "--project-name", project_name]) end |
#git_commit ⇒ Object
66 67 68 |
# File 'lib/lono/new.rb', line 66 def git_commit run_git_commit end |
#git_init ⇒ Object
52 53 54 55 |
# File 'lib/lono/new.rb', line 52 def git_init return if File.exist?(".git") # this is a clone repo run_git_init end |
#make_executable ⇒ Object
48 49 50 |
# File 'lib/lono/new.rb', line 48 def make_executable chmod("exe", 0755 & ~File.umask, verbose: false) if File.exist?("exe") end |
#set_cwd ⇒ Object
for specs
26 27 28 |
# File 'lib/lono/new.rb', line 26 def set_cwd @cwd = Dir.pwd end |
#set_destination_root ⇒ Object
After this commands are executed with the newly created project
42 43 44 45 46 |
# File 'lib/lono/new.rb', line 42 def set_destination_root destination_root = "#{@cwd}/#{project_name}" self.destination_root = destination_root FileUtils.cd(self.destination_root) end |
#welcome_message ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/lono/new.rb', line 70 def puts <<~EOL #{"="*64} Congrats 🎉 You have successfully created a lono project. Check things out by going into the created infra folder. cd #{project_name} To create a new blueprint run: lono blueprint new demo To deploy the blueprint: lono cfn deploy my-demo --blueprint demo If you name the stack according to conventions, you can run: lono cfn deploy demo To list and create additional blueprints refer to https://lono.cloud/docs/core/blueprints More info: http://lono.cloud/ EOL end |