vimmate 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +10 -0
- data/CHANGELOG +108 -0
- data/COPYING +20 -0
- data/README +221 -0
- data/Rakefile +31 -0
- data/TODO +21 -0
- data/bin/vimmate +105 -0
- data/config/environment.rb +35 -0
- data/controllers/file_filter_controller.rb +101 -0
- data/controllers/file_popup_menu_controller.rb +40 -0
- data/controllers/vim_controller.rb +28 -0
- data/controllers/vim_mate_controller.rb +76 -0
- data/images/file.png +0 -0
- data/images/file_green.png +0 -0
- data/images/file_orange.png +0 -0
- data/images/file_red.png +0 -0
- data/images/folder.png +0 -0
- data/images/folder_green.png +0 -0
- data/images/folder_orange.png +0 -0
- data/images/folder_red.png +0 -0
- data/images/processing.png +0 -0
- data/images/svn_added.png +0 -0
- data/images/svn_conflict.png +0 -0
- data/images/svn_deleted.png +0 -0
- data/images/svn_locked.png +0 -0
- data/images/svn_modified.png +0 -0
- data/images/svn_normal.png +0 -0
- data/images/svn_readonly.png +0 -0
- data/images/vimmate16.png +0 -0
- data/images/vimmate32.png +0 -0
- data/images/vimmate48.png +0 -0
- data/lib/active_window/active_column.rb +218 -0
- data/lib/active_window/active_tree_store/columns.rb +88 -0
- data/lib/active_window/active_tree_store/extentions.rb +81 -0
- data/lib/active_window/active_tree_store/index.rb +53 -0
- data/lib/active_window/active_tree_store.rb +26 -0
- data/lib/active_window/application.rb +137 -0
- data/lib/active_window/controller.rb +58 -0
- data/lib/active_window/dot_file.rb +29 -0
- data/lib/active_window/filtered_active_tree_store.rb +113 -0
- data/lib/active_window/listed_item.rb +127 -0
- data/lib/active_window/signal.rb +46 -0
- data/lib/active_window.rb +8 -0
- data/lib/config_window.rb +90 -0
- data/lib/file_tree_store.rb +74 -0
- data/lib/filtered_file_tree_store.rb +34 -0
- data/lib/gtk_thread_helper.rb +73 -0
- data/lib/listed_directory.rb +45 -0
- data/lib/listed_file.rb +67 -0
- data/lib/try.rb +9 -0
- data/lib/vim/buffers.rb +18 -0
- data/lib/vim/integration.rb +38 -0
- data/lib/vim/netbeans.rb +154 -0
- data/lib/vim/source.vim +18 -0
- data/lib/vim_mate/config.rb +132 -0
- data/lib/vim_mate/dummy_window.rb +14 -0
- data/lib/vim_mate/files_menu.rb +110 -0
- data/lib/vim_mate/icons.rb +156 -0
- data/lib/vim_mate/nice_singleton.rb +53 -0
- data/lib/vim_mate/plugins/inotify/init.rb +4 -0
- data/lib/vim_mate/plugins/inotify/lib/INotify.rb +208 -0
- data/lib/vim_mate/plugins/inotify/lib/directory.rb +58 -0
- data/lib/vim_mate/plugins/subversion/init.rb +7 -0
- data/lib/vim_mate/plugins/subversion/lib/file.rb +59 -0
- data/lib/vim_mate/plugins/subversion/lib/menu.rb +96 -0
- data/lib/vim_mate/plugins/subversion/lib/subversion.rb +157 -0
- data/lib/vim_mate/plugins.rb +6 -0
- data/lib/vim_mate/requirer.rb +68 -0
- data/lib/vim_mate/search_window.rb +227 -0
- data/lib/vim_mate/tags_window.rb +167 -0
- data/lib/vim_mate/terminals_window.rb +163 -0
- data/lib/vim_mate/version.rb +29 -0
- data/lib/vim_mate/vim_widget.rb +143 -0
- data/spec/active_window/active_column_spec.rb +41 -0
- data/spec/active_window/active_tree_store_spec.rb +312 -0
- data/spec/active_window/controller_spec.rb +6 -0
- data/spec/lib/file_tree_store_spec.rb +40 -0
- data/spec/lib/listed_directory_spec.rb +26 -0
- data/spec/lib/listed_file_spec.rb +53 -0
- data/spec/nice_singleton_spec.rb +23 -0
- data/spec/spec.opts +6 -0
- data/spec/spec_helper.rb +10 -0
- data/views/vim_mate.glade +500 -0
- data/vimmate.gemspec +138 -0
- metadata +146 -0
@@ -0,0 +1,312 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe ActiveWindow::ActiveTreeStore do
|
4
|
+
before( :each ) do
|
5
|
+
@ats = ActiveWindow::ActiveTreeStore
|
6
|
+
end
|
7
|
+
it "should inherit from Gtk::TreeStore" do
|
8
|
+
@ats.should < Gtk::TreeStore
|
9
|
+
end
|
10
|
+
it "should store columns" do
|
11
|
+
@ats.column_id.should_not be_nil
|
12
|
+
@ats.column_id.should be_a(Hash)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should have basic columns" do
|
16
|
+
@ats.column_id.should have_key(:visible)
|
17
|
+
@ats.column_id.should have_key(:object)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should store column index in constants" do
|
21
|
+
@ats::VISIBLE.should == 0
|
22
|
+
@ats::OBJECT.should == 1
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should provide classes for columns" do
|
26
|
+
@ats.column_classes.should == [TrueClass, Object]
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "subclassing for Person with name and age" do
|
30
|
+
before( :each ) do
|
31
|
+
class PersonTree < @ats
|
32
|
+
column :name, String
|
33
|
+
column :age, Fixnum
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
after( :each ) do
|
38
|
+
Object::send :remove_const, :PersonTree
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should still have basic columns" do
|
42
|
+
PersonTree.column_id.should have_key(:visible)
|
43
|
+
PersonTree.column_id.should have_key(:object)
|
44
|
+
end
|
45
|
+
it "should have both new columns defined" do
|
46
|
+
PersonTree.column_id.should have_key(:name)
|
47
|
+
PersonTree.column_id.should have_key(:age)
|
48
|
+
end
|
49
|
+
it "should have 4 columns" do
|
50
|
+
PersonTree.column_count.should == 4
|
51
|
+
end
|
52
|
+
it "should store column index in constants" do
|
53
|
+
PersonTree::VISIBLE.should == 0
|
54
|
+
PersonTree::OBJECT.should == 1
|
55
|
+
PersonTree::NAME.should == 2
|
56
|
+
PersonTree::AGE.should == 3
|
57
|
+
end
|
58
|
+
it "should provde classes for columns" do
|
59
|
+
PersonTree.column_classes.should == [TrueClass, Object, String, Integer]
|
60
|
+
end
|
61
|
+
it "should store column index in hash" do
|
62
|
+
PersonTree.column_id.should == {:visible => 0, :object => 1, :name => 2, :age => 3}
|
63
|
+
end
|
64
|
+
|
65
|
+
describe "with index on name" do
|
66
|
+
before( :each ) do
|
67
|
+
PersonTree.index_by :name
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should define a method to remember People by name" do
|
71
|
+
PersonTree.public_instance_methods.should include('remember_iter_by_name')
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should define a method to find People by name" do
|
75
|
+
PersonTree.public_instance_methods.should include('find_by_name')
|
76
|
+
end
|
77
|
+
|
78
|
+
describe "added Peter, Paul and Mary" do
|
79
|
+
before( :each ) do
|
80
|
+
@person_tree = PersonTree.new
|
81
|
+
@person_tree.add :name => 'Peter', :age => 23
|
82
|
+
@person_tree.add :name => 'Paul', :age => 42
|
83
|
+
@person_tree.add :name => 'Mary', :age => 19
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should have indexed the items" do
|
87
|
+
@person_tree.index_by_name.should be_a(Hash)
|
88
|
+
@person_tree.index_by_name.should have_key('Peter')
|
89
|
+
@person_tree.index_by_name.should have_key('Paul')
|
90
|
+
@person_tree.index_by_name.should have_key('Mary')
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should index by Strings (the names)" do
|
94
|
+
@person_tree.index_by_name.keys.each do |key|
|
95
|
+
key.should be_a(String)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should index TreeRowReferences" do
|
100
|
+
@person_tree.index_by_name.values.each do |value|
|
101
|
+
value.should be_a(Gtk::TreeRowReference)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should find the row for Peter by its name" do
|
106
|
+
peter = nil
|
107
|
+
lambda { peter = @person_tree.find_by_name('Peter') }.should_not raise_error
|
108
|
+
peter.should_not be_nil
|
109
|
+
peter.should be_a(Gtk::TreeIter)
|
110
|
+
peter[2].should == 'Peter'
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
|
117
|
+
describe "instancing" do
|
118
|
+
before( :each ) do
|
119
|
+
@person_tree = PersonTree.new
|
120
|
+
end
|
121
|
+
|
122
|
+
describe "adding a Person" do
|
123
|
+
before( :each ) do
|
124
|
+
@person = mock(:name => 'Kate', :age => 23)
|
125
|
+
end
|
126
|
+
|
127
|
+
it "should succeed" do
|
128
|
+
lambda { @person_tree.add @person }.should_not raise_error
|
129
|
+
end
|
130
|
+
|
131
|
+
end
|
132
|
+
|
133
|
+
end
|
134
|
+
|
135
|
+
|
136
|
+
end
|
137
|
+
|
138
|
+
describe "subclassing twice with different columns" do
|
139
|
+
before( :each ) do
|
140
|
+
class AppleTree < @ats
|
141
|
+
column :apple_count, Fixnum
|
142
|
+
end
|
143
|
+
class LemonTree < @ats
|
144
|
+
column :lemon_count, Fixnum
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
after( :each ) do
|
149
|
+
Object::send :remove_const, :AppleTree
|
150
|
+
Object::send :remove_const, :LemonTree
|
151
|
+
end
|
152
|
+
|
153
|
+
|
154
|
+
it "should both still have basic columns" do
|
155
|
+
AppleTree.column_id[:visible].should == 0
|
156
|
+
AppleTree.column_id[:object].should == 1
|
157
|
+
LemonTree.column_id[:visible].should == 0
|
158
|
+
LemonTree.column_id[:object].should == 1
|
159
|
+
end
|
160
|
+
it "should define columns for both subclasses" do
|
161
|
+
AppleTree.column_id[:apple_count].should == 2
|
162
|
+
LemonTree.column_id[:lemon_count].should == 2
|
163
|
+
end
|
164
|
+
it "should keep the new columns to their Classes" do
|
165
|
+
AppleTree.column_id.should_not have_key(:lemon_count)
|
166
|
+
LemonTree.column_id.should_not have_key(:apple_count)
|
167
|
+
end
|
168
|
+
it "should both have 3 columns" do
|
169
|
+
AppleTree.column_count.should == 3
|
170
|
+
LemonTree.column_count.should == 3
|
171
|
+
end
|
172
|
+
it "should store first column index in constants" do
|
173
|
+
AppleTree::VISIBLE.should == 0
|
174
|
+
AppleTree::OBJECT.should == 1
|
175
|
+
AppleTree::APPLE_COUNT.should == 2
|
176
|
+
end
|
177
|
+
it "should store second column index in constants" do
|
178
|
+
LemonTree::VISIBLE.should == 0
|
179
|
+
LemonTree::OBJECT.should == 1
|
180
|
+
LemonTree::LEMON_COUNT.should == 2
|
181
|
+
end
|
182
|
+
it "should provde classes for columns" do
|
183
|
+
AppleTree.column_classes.should == [TrueClass, Object, Integer]
|
184
|
+
LemonTree.column_classes.should == [TrueClass, Object, Integer]
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
describe "Adding a column to a subclass" do
|
189
|
+
before( :each ) do
|
190
|
+
@sc = Class.new(@ats)
|
191
|
+
end
|
192
|
+
|
193
|
+
it "should return it to use it somewhere else" do
|
194
|
+
col = @sc.column(:name, :string)
|
195
|
+
col.should_not be_nil
|
196
|
+
col.should be_a(ActiveWindow::ActiveColumn)
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
describe "subclassing with a composite column with 2 subcolumns" do
|
201
|
+
before( :each ) do
|
202
|
+
class ComplexTree < @ats
|
203
|
+
composite_column "Name and Age" do |pack|
|
204
|
+
pack.add column(:name, :string)
|
205
|
+
pack.add column(:age, :integer)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
after( :each ) do
|
211
|
+
Object::send :remove_const, :ComplexTree
|
212
|
+
end
|
213
|
+
|
214
|
+
it "should create 3 columns" do
|
215
|
+
ComplexTree.should have_at_least(3).columns
|
216
|
+
end
|
217
|
+
|
218
|
+
it "should have 2 invisible columns" do
|
219
|
+
ComplexTree.should have_at_least(2).invisible_columns
|
220
|
+
end
|
221
|
+
|
222
|
+
it "should have 2 data columns" do
|
223
|
+
ComplexTree.should have_at_least(2).data_columns
|
224
|
+
end
|
225
|
+
|
226
|
+
it "should have constants for column ids" do
|
227
|
+
ComplexTree::NAME.should == 2
|
228
|
+
ComplexTree::AGE.should == 3
|
229
|
+
end
|
230
|
+
|
231
|
+
it "should have max 1 visible column (the composite one)" do
|
232
|
+
names = ComplexTree.visible_columns.map(&:name)
|
233
|
+
names.should == ['Name and Age']
|
234
|
+
ComplexTree.should have_at_most(1).visible_columns
|
235
|
+
names.should include('Name and Age')
|
236
|
+
end
|
237
|
+
|
238
|
+
it "should have 2 data columns (the subs)" do
|
239
|
+
ComplexTree.should have_at_least(2).data_columns
|
240
|
+
names = ComplexTree.data_columns.map(&:name)
|
241
|
+
names.should include('name')
|
242
|
+
names.should include('age')
|
243
|
+
end
|
244
|
+
|
245
|
+
describe "creating a class filtering it" do
|
246
|
+
before( :each ) do
|
247
|
+
class FilteredComplexTree < ActiveWindow::FilteredActiveTreeStore
|
248
|
+
def iter_visible?(iter)
|
249
|
+
!( iter[ self.class.column_id[:name] ].index(filter_string) ).nil?
|
250
|
+
end
|
251
|
+
end
|
252
|
+
end
|
253
|
+
after( :each ) do
|
254
|
+
Object::send :remove_const, :FilteredComplexTree
|
255
|
+
end
|
256
|
+
|
257
|
+
it "should take its columns from ComplexTree" do
|
258
|
+
FilteredComplexTree.columns.should == ComplexTree.columns
|
259
|
+
end
|
260
|
+
|
261
|
+
it "should take constants for the column ids from ComplexTrr" do
|
262
|
+
FilteredComplexTree::NAME.should == 2
|
263
|
+
FilteredComplexTree::AGE.should == 3
|
264
|
+
end
|
265
|
+
|
266
|
+
describe "instancing it with a model" do
|
267
|
+
before( :each ) do
|
268
|
+
@tree = ComplexTree.new
|
269
|
+
@filtered_tree = FilteredComplexTree.new @tree
|
270
|
+
end
|
271
|
+
|
272
|
+
describe "and filtering some data" do
|
273
|
+
before( :each ) do
|
274
|
+
@tree.add(:name => 'Niklas', :age => 27)
|
275
|
+
@tree.add(:name => 'Grandpa', :age => 99)
|
276
|
+
@filtering = lambda { @filtered_tree.filter = 'something' }
|
277
|
+
@vis_col = 0
|
278
|
+
end
|
279
|
+
it "should not break on filtering" do
|
280
|
+
@filtering.should_not raise_error
|
281
|
+
end
|
282
|
+
|
283
|
+
it "should check iter for visibility" do
|
284
|
+
@filtered_tree.should_receive(:iter_visible?).at_least(:twice)
|
285
|
+
@filtering.call
|
286
|
+
end
|
287
|
+
|
288
|
+
it "should hide rows that do not match" do
|
289
|
+
@filtered_tree.stub(:iter_visible?).and_return(false)
|
290
|
+
@filtering.call
|
291
|
+
@tree.each do |model, path, iter|
|
292
|
+
iter[@vis_col].should be_false
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
it "should show rows that do match" do
|
297
|
+
@filtered_tree.stub(:iter_visible?).and_return(true)
|
298
|
+
@filtering.call
|
299
|
+
@filtered_tree.found_count.should >= 2
|
300
|
+
@tree.each do |model, path, iter|
|
301
|
+
iter[@vis_col].should be_true
|
302
|
+
end
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
end
|
307
|
+
|
308
|
+
end
|
309
|
+
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe FileTreeStore do
|
4
|
+
it "should inherit from ActiveWindow::ActiveTreeStore" do
|
5
|
+
FileTreeStore.should < ActiveWindow::ActiveTreeStore
|
6
|
+
end
|
7
|
+
|
8
|
+
context "new" do
|
9
|
+
before( :each ) do
|
10
|
+
@tree = FileTreeStore.new
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should have an empty exclude list" do
|
14
|
+
@tree.excludes.should be_empty
|
15
|
+
end
|
16
|
+
|
17
|
+
context "excluding tmp, doc and public dirs" do
|
18
|
+
before( :each ) do
|
19
|
+
@rules = %w(tmp doc public)
|
20
|
+
@rules.each do |rule|
|
21
|
+
lambda { @tree.exclude! rule }.should change(@tree.excludes, :count).by(1)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should have stored the rules in excludes" do
|
26
|
+
@tree.excludes.should_not be_empty
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should ignore paths that end with /$rule" do
|
30
|
+
@tree.should be_excludes("foo/tmp")
|
31
|
+
@tree.should be_excludes("foo/bar/tmp")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should not ignore that contain $rule somewhere else the end" do
|
35
|
+
@tree.should_not be_excludes("foo/tmp/more")
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe ListedDirectory do
|
4
|
+
before(:each) do
|
5
|
+
@files_count = 7
|
6
|
+
@path = File.expand_path(File.dirname(__FILE__))
|
7
|
+
@dir = ListedDirectory.new(:full_path => @path)
|
8
|
+
end
|
9
|
+
it "should be a listed file" do
|
10
|
+
@dir.should be_instance_of(ListedDirectory)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should have an icon_type of folder" do
|
14
|
+
@dir.icon_name.should == "folder"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should have the path set" do
|
18
|
+
@dir.full_path.should == @path
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should have some files in it" do
|
22
|
+
pending "where is the count?"
|
23
|
+
@dir.files_count.should == @files_count
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe ListedFile do
|
4
|
+
context "giving a file path" do
|
5
|
+
before( :each ) do
|
6
|
+
@path = File.expand_path(__FILE__)
|
7
|
+
end
|
8
|
+
before(:each) do
|
9
|
+
@attrs = {
|
10
|
+
:full_path => @path,
|
11
|
+
:status => 'normal'
|
12
|
+
}
|
13
|
+
@file = ListedFile.create(@attrs)
|
14
|
+
end
|
15
|
+
it "should be recognized as a listed file" do
|
16
|
+
@file.should be_a(ListedFile)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should save the given attributes" do
|
20
|
+
@file.full_path.should == @path
|
21
|
+
@file.name.should == 'listed_file_spec.rb'
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should have an icon" do
|
25
|
+
@file.icon.should_not be_nil
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "giving a directory path" do
|
30
|
+
before( :each ) do
|
31
|
+
@path = File.dirname File.expand_path(__FILE__)
|
32
|
+
end
|
33
|
+
before(:each) do
|
34
|
+
@attrs = {
|
35
|
+
:full_path => @path,
|
36
|
+
:status => 'normal'
|
37
|
+
}
|
38
|
+
@file = ListedFile.create(@attrs)
|
39
|
+
end
|
40
|
+
it "should be recognized as a listed directry" do
|
41
|
+
@file.should be_a(ListedDirectory)
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should save the given attributes" do
|
45
|
+
@file.full_path.should == @path
|
46
|
+
@file.name.should == 'lib'
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should have an icon" do
|
50
|
+
@file.icon.should_not be_nil
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
describe VimMate::NiceSingleton do
|
4
|
+
before(:each) do
|
5
|
+
class MySingleton
|
6
|
+
include VimMate::NiceSingleton
|
7
|
+
|
8
|
+
def hello
|
9
|
+
"hello"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should respond to .hello" do
|
15
|
+
MySingleton.hello.should == 'hello'
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should not respond to .goodbye" do
|
19
|
+
lambda do
|
20
|
+
MySingleton.goodbye
|
21
|
+
end.should raise_error(NoMethodError)
|
22
|
+
end
|
23
|
+
end
|
data/spec/spec.opts
ADDED