require_relative 'frenchpress/blog' # The FrenchPress class houses some conveience methods for accessing a Blog # object, as well as misc properties (such as self.version) and settings # manipulation (such as self.default=) class FrenchPress @working = nil def self.open(dir) default_file = File.join Dir.home, '.frenchpress_dir' dir ||= File.open(default_file).read.to_s if File.exist?(default_file) dir ||= Dir.getwd dir = File.expand_path(dir) FrenchPress.working = FrenchPress::Blog.new dir # sets a class inst var FrenchPress.working end def self.version '0.1.0' end def self.default=(default_dir) Dir.chdir(Dir.home) do File.open('.frenchpress_dir', 'w+') do |f| f.truncate 0 f.write default_dir end end end def self.working @working end def self.working=(blag) @working = blag end end