Module: Ditz

Defined in:
lib/ditz.rb,
lib/hook.rb,
lib/html.rb,
lib/view.rb,
lib/model.rb,
lib/views.rb,
lib/operator.rb,
lib/plugins/git.rb,
lib/model-objects.rb

Defined Under Namespace

Classes: Component, Config, ErbHtml, HookManager, HtmlView, Issue, ModelObject, Operator, Project, Release, ScreenView, View

Constant Summary collapse

VERSION =
"0.4"

Class Method Summary collapse

Class Method Details

.debug(s) ⇒ Object



5
6
7
# File 'lib/ditz.rb', line 5

def debug s
  puts "# #{s}" if $opts[:verbose]
end

.find_dir_containing(target, start = Pathname.new(".")) ⇒ Object

helper for recursive search



35
36
37
38
39
40
# File 'lib/ditz.rb', line 35

def find_dir_containing target, start=Pathname.new(".")
  return start if (start + target).exist?
  unless start.parent.realpath == start.realpath
    find_dir_containing target, start.parent
  end
end

.find_ditz_file(fn) ⇒ Object

my brilliant solution to the ‘gem datadir’ problem



43
44
45
46
47
# File 'lib/ditz.rb', line 43

def find_ditz_file fn
  dir = $:.find { |p| File.exist? File.expand_path(File.join(p, fn)) }
  raise "can't find #{fn} in any load path" unless dir
  File.expand_path File.join(dir, fn)
end

.has_readline=(val) ⇒ Object



14
15
16
# File 'lib/ditz.rb', line 14

def self.has_readline= val
  @has_readline = val
end

.has_readline?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/ditz.rb', line 10

def self.has_readline?
  @has_readline
end

.home_dirObject



26
27
28
29
30
31
32
# File 'lib/ditz.rb', line 26

def home_dir
  @home ||=
    ENV["HOME"] || (ENV["HOMEDRIVE"] && ENV["HOMEPATH"] ? ENV["HOMEDRIVE"] + ENV["HOMEPATH"] : nil) || begin
    $stderr.puts "warning: can't determine home directory, using '.'"
    "."
  end
end