class Gn

Constants

PLAN_FILE

Attributes

name[R]

Public Class Methods

new(name) click to toggle source
# File lib/gn.rb, line 33
def initialize(name)
  @name = name
end

Public Instance Methods

blueprints() click to toggle source
# File lib/gn.rb, line 63
def blueprints
  Plan.constants.map do |constant|
    Blueprint.new(self, Plan.const_get(constant))
  end
end
edit(file) click to toggle source
# File lib/gn.rb, line 59
def edit(file)
  system "%s %s" % [editor, file.path]
end
editor() click to toggle source
# File lib/gn.rb, line 55
def editor
  ENV["EDITOR"] || "vi"
end
load!() click to toggle source
# File lib/gn.rb, line 41
def load!
  file = Tempfile.new([PLAN_FILE, ".rb"])
  file.write(File.read(path(PLAN_FILE)))
  file.close

  edit(file)

  if $?.success?
    load file.path
  else
    exit 1
  end
end
path(file) click to toggle source
# File lib/gn.rb, line 37
def path(file)
  File.join(Dir.home, ".gn", name, file)
end