Sha256: affc61745bad61f0fba59eb817cc448b2149c1bc330ee6e519afdfa6b253fdd5
Contents?: true
Size: 1.32 KB
Versions: 1
Compression:
Stored size: 1.32 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' \nIDE = nil # your ide name in bash, for example Visual Studio Code = 'code' \nLazyNavigator::Opener.lead(path: PATH_TO_LAST_PROJECT, ide: IDE)".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-2.0.0 | lib/entities/generator.rb |