Methods

Gist::Standalone

Public Instance Methods

build() click to toggle source
# File lib/gist/standalone.rb, line 33
def build
  root = File.dirname(__FILE__)

  standalone = ''
  standalone << PREAMBLE

  Dir["#{root}/../**/*.rb"].each do |file|
    # skip standalone.rb
    next if File.expand_path(file) == File.expand_path(__FILE__)

    File.readlines(file).each do |line|
      next if line =~ /^\s*#/
      standalone << line
    end
  end

  standalone << POSTAMBLE
  standalone << MANPAGE
  standalone << CACERT
  standalone
end
save(filename, path = '.') click to toggle source
# File lib/gist/standalone.rb, line 25
def save(filename, path = '.')
  target = File.join(File.expand_path(path), filename)
  File.open(target, 'w') do |f|
    f.puts build
    f.chmod 0755
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.