Class: Redcar::Textmate::Bundle
- Inherits:
-
Object
- Object
- Redcar::Textmate::Bundle
show all
- Includes:
- Observable
- Defined in:
- plugins/textmate/lib/textmate/bundle.rb
Constant Summary
Constant Summary
Constants included
from Observable
Observable::ASPECTS
Instance Attribute Summary (collapse)
Instance Method Summary
(collapse)
Methods included from Observable
#add_listener, #notify_listeners, #remove_listener
Constructor Details
- (Bundle) initialize(path)
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'plugins/textmate/lib/textmate/bundle.rb', line 9
def initialize(path)
@path = File.expand_path(path)
info_path = File.join(path, "info.plist")
if File.exist?(info_path)
@plist = Plist.xml_to_plist(File.read(info_path))
end
@snippets = snippet_paths.map {|path|
s = Snippet.new(path, self.name,self.uuid)
deleted.include?(s.uuid) ? nil : s
}.compact
@preferences = preference_paths.map {|path| Preference.new(path) }
end
|
Instance Attribute Details
Returns the value of attribute path
7
8
9
|
# File 'plugins/textmate/lib/textmate/bundle.rb', line 7
def path
@path
end
|
Returns the value of attribute plist
6
7
8
|
# File 'plugins/textmate/lib/textmate/bundle.rb', line 6
def plist
@plist
end
|
- (Object) preferences
Returns the value of attribute preferences
6
7
8
|
# File 'plugins/textmate/lib/textmate/bundle.rb', line 6
def preferences
@preferences
end
|
- (Object) snippets
Returns the value of attribute snippets
7
8
9
|
# File 'plugins/textmate/lib/textmate/bundle.rb', line 7
def snippets
@snippets
end
|
Instance Method Details
62
63
64
65
66
67
68
69
70
|
# File 'plugins/textmate/lib/textmate/bundle.rb', line 62
def (builder)
if main_menu and main_menu["items"]
builder. name do |m|
main_menu["items"].each do |item|
(builder, item)
end
end
end
end
|
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
|
# File 'plugins/textmate/lib/textmate/bundle.rb', line 72
def (builder, item)
unless deleted.include?(item)
if item =~ /^$/ builder.separator
elsif [item] = [item]
builder.(["name"]) do |sub_builder|
["items"].each do |sub_item|
(sub_builder, sub_item)
end
end
elsif Textmate.uuid_hash[item] snippet = Textmate.uuid_hash[item]
if snippet.is_a?(Textmate::Snippet)
return unless snippet.name and snippet.name != "" builder.item(snippet.) do
doc = EditView.focussed_edit_view_document
if doc
controller = doc.controllers(Snippets::DocumentController).first
controller.start_snippet!(snippet)
end
end
end
end
end
end
|
42
43
44
|
# File 'plugins/textmate/lib/textmate/bundle.rb', line 42
def contact_email
BundleEditor.rot13(@plist["contactEmailRot13"] ||= "")
end
|
38
39
40
|
# File 'plugins/textmate/lib/textmate/bundle.rb', line 38
def contact_name
@plist["contactName"]
end
|
50
51
52
|
# File 'plugins/textmate/lib/textmate/bundle.rb', line 50
def deleted
@plist["deleted"] ||= []
end
|
- (Object) description
46
47
48
|
# File 'plugins/textmate/lib/textmate/bundle.rb', line 46
def description
@plist["description"]
end
|
- (Object) main_menu
54
55
56
|
# File 'plugins/textmate/lib/textmate/bundle.rb', line 54
def main_menu
@plist["mainMenu"]
end
|
26
27
28
|
# File 'plugins/textmate/lib/textmate/bundle.rb', line 26
def name
@plist["name"]
end
|
- (Object) ordering
34
35
36
|
# File 'plugins/textmate/lib/textmate/bundle.rb', line 34
def ordering
@plist["ordering"]
end
|
58
59
60
|
# File 'plugins/textmate/lib/textmate/bundle.rb', line 58
def
main_menu["submenus"]
end
|
30
31
32
|
# File 'plugins/textmate/lib/textmate/bundle.rb', line 30
def uuid
@plist["uuid"]
end
|
- (Boolean) writable?
22
23
24
|
# File 'plugins/textmate/lib/textmate/bundle.rb', line 22
def writable?
File.writable?(path)
end
|