Module: DitzStr
- Defined in:
- lib/ditzstr.rb,
lib/ditzstr/hook.rb,
lib/ditzstr/html.rb,
lib/ditzstr/view.rb,
lib/ditzstr/brick.rb,
lib/ditzstr/model.rb,
lib/ditzstr/views.rb,
lib/ditzstr/operator.rb,
lib/ditzstr/file-storage.rb,
lib/ditzstr/model-objects.rb
Defined Under Namespace
Classes: BrickView, Component, Config, DitzStrServlet, ErbHtml, FileStorage, HookManager, HtmlView, Issue, ModelObject, Operator, Project, Release, ScreenView, View
Constant Summary
collapse
- VERSION =
"0.5"
Class Method Summary
collapse
Class Method Details
5
6
7
|
# File 'lib/ditzstr.rb', line 5
def debug s
puts "# #{s}" if $verbose
end
|
.find_dir_containing(target, start = Pathname.new(".")) ⇒ Object
helper for recursive search
35
36
37
38
39
40
|
# File 'lib/ditzstr.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
48
|
# File 'lib/ditzstr.rb', line 43
def find_ditz_file fn
dir = File.exist? File.expand_path(File.join(Gem.datadir("ditz-str"), fn))
raise "can't find #{fn} in any load path (tried #{File.join(Gem.datadir("ditz-str"),fn)}" unless dir
File.expand_path File.join(Gem.datadir("ditz-str"), fn)
end
|
.has_readline=(val) ⇒ Object
14
15
16
|
# File 'lib/ditzstr.rb', line 14
def self.has_readline= val
@has_readline = val
end
|
.has_readline? ⇒ Boolean
10
11
12
|
# File 'lib/ditzstr.rb', line 10
def self.has_readline?
@has_readline
end
|
26
27
28
29
30
31
32
|
# File 'lib/ditzstr.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
|
.load_plugins(fn) ⇒ Object
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/ditzstr.rb', line 50
def load_plugins fn
DitzStr::debug "loading plugins from #{fn}"
plugins = YAML::load_file $opts[:plugins_file]
plugins.each do |p|
fn = DitzStr::find_ditz_file "plugins/#{p}.rb"
DitzStr::debug "loading plugin #{p.inspect} from #{fn}"
require File.expand_path(fn)
end
plugins
end
|