Top Level Namespace

Defined Under Namespace

Modules: OrgMode Classes: String

Instance Method Summary collapse

Instance Method Details

#capture_stdoutObject



3
4
5
6
7
8
9
10
11
12
# File 'lib/capture_stdout.rb', line 3

def capture_stdout
  out = StringIO.new
  old_stdout = $stdout
  $stdout = out
  yield
  out.rewind
  return out.read
ensure
  $stdout = old_stdout
end

#load_or_setup_default_configurationObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/org_mode/load_or_setup_default_configuration.rb', line 3

def load_or_setup_default_configuration
  dirname, fname = ENV['ORG_MODE_RC_DIR'], ENV['ORG_MODE_RC_FNAME']
  $config = OrgMode::Configuration.
    load(dirname, fname)
rescue OrgMode::Configuration::NonExistant => e
  $config = OrgMode::Configuration.
    create_default_config(dirname, fname)
rescue OrgMode::Configuration::Error => e
  puts "Problem loading configuration: #{e}"
  puts "Fix it first, and run me again ..."
  exit
end