class LazyNavigator::Generator

Constants

BASH_SCRIPT_NAME
RUBY_SCRIPT_NAME
SUCCESS_BASH_MSG
SUCCESS_RUBY_MSG
TEXT_FOR_BASH
TEXT_FOR_RUBY

Public Class Methods

g(folder = 'lazy_navigator')
Alias for: generate_script
generate_script(folder = 'lazy_navigator') click to toggle source
# File lib/entities/generator.rb, line 14
def generate_script(folder = 'lazy_navigator')
  puts SUCCESS_BASH_MSG.green if generate_bash
  puts SUCCESS_RUBY_MSG.green if generate_ruby(folder)
end
Also aliased as: g

Private Class Methods

add_script_command() click to toggle source
# File lib/entities/generator.rb, line 37
def add_script_command
  system "chmod +x #{BASH_SCRIPT_NAME}"
end
generate_bash() click to toggle source
# File lib/entities/generator.rb, line 23
def generate_bash
  File.new(BASH_SCRIPT_NAME, 'w')
  File.open(BASH_SCRIPT_NAME, 'w').write(TEXT_FOR_BASH)
  add_script_command
end
generate_ruby(folder) click to toggle source
# File lib/entities/generator.rb, line 29
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