Simple Ruby CLI Apps

with tags DokuWiki ruby -

See Also

General Notes

Allow file to be a library/script at the same time

script.rb

###############
# Entry Point
###############
if __FILE__ == $0 then
  # Setup / Invocation code here
end

Generic Script Header

Sets up Bundler and the current directory to be in the load path.

script.rb

#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
Bundler.require
$: << File.dirname(__FILE__) unless $:.include? File.dirname(__FILE__)

###############
# Entry Point
###############
if __FILE__ == $0 then
  # Setup / Invocation code here
end