class MrHyde::Toolii

NOTE: gli added function are class methods (thus, wrap class Toolii in Tool for now)

Public Class Methods

fetch_script( name ) click to toggle source
# File lib/mrhyde/cli/main.rb, line 50
def self.fetch_script( name )

  ## first try local version in working folder

  text = ''
  local_script = "./#{name}.rb"
  if File.exist?( local_script )
    text = File.read_utf8( local_script )
  else  ## fetch remote script
    url = "https://github.com/mrhydescripts/scripts/raw/master/#{name}.rb"

    puts "GET #{url}"    ##  todo - add color e.g. .bold.green
    
    ## assume utf8 text encoding for now
    worker = Fetcher::Worker.new
    text = worker.read_utf8!( url )
  end

  text
end
logger() click to toggle source
# File lib/mrhyde/cli/main.rb, line 25
def self.logger()       @@logger; end
logger=(value) click to toggle source
# File lib/mrhyde/cli/main.rb, line 24
def self.logger=(value) @@logger=value; end
opts() click to toggle source
# File lib/mrhyde/cli/main.rb, line 29
def self.opts()        @@opts; end
opts=(value) click to toggle source

todo: find a better name e.g. change to settings? config? safe_opts? why? why not?

# File lib/mrhyde/cli/main.rb, line 28
def self.opts=(value)  @@opts = value; end