Sha256: 7976ccc460a22633cf7d814b9095adc265c14217fdaa7a81f81bb699999137d7
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
module LazyNavigator class Generator SUCCESS_BASH_MSG = 'bash script generated'.freeze SUCCESS_RUBY_MSG = 'ruby script generated'.freeze BASH_SCRIPT_NAME = 'l'.freeze RUBY_SCRIPT_NAME = 'last_project.rb'.freeze TEXT_FOR_BASH = "#!/bin/bash\nruby lazy_navigator/last_project.rb\nkill -9 $PPID".freeze TEXT_FOR_RUBY = "require 'lazy_navigator'\n\nPATH_TO_LAST_PROJECT = 'RubyGarage/codebreaker <-- change me' \n#IDE = your ide name in bash, for example VSC = code \nLazyNavigator::Opener.lead(path: PATH_TO_LAST_PROJECT, ide: nil)".freeze class << self def generate_script(folder = 'lazy_navigator') puts SUCCESS_BASH_MSG.green if generate_bash puts SUCCESS_RUBY_MSG.green if generate_ruby(folder) end alias g generate_script private def generate_bash File.new(BASH_SCRIPT_NAME, 'w') File.open(BASH_SCRIPT_NAME, 'w').write(TEXT_FOR_BASH) add_script_command end def generate_ruby(folder) Dir.mkdir(folder) Dir.chdir(folder) do File.new(RUBY_SCRIPT_NAME, 'w') File.open(RUBY_SCRIPT_NAME, 'w').write(TEXT_FOR_RUBY) end end def add_script_command system "chmod +x #{BASH_SCRIPT_NAME}" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lazy_navigator-1.5.0 | lib/entities/generator.rb |