xiki 0.6.4 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/etc/command/copy_xiki_command_to.rb +15 -2
- data/etc/install/el4r_setup.sh +1 -1
- data/lib/xiki.rb +1 -1
- data/lib/xiki/console.rb +4 -2
- data/lib/xiki/files.rb +2 -0
- data/lib/xiki/launcher.rb +6 -4
- data/lib/xiki/menu.rb +177 -83
- data/lib/xiki/search.rb +1 -1
- data/lib/xiki/tree.rb +11 -1
- data/lib/xiki/trouble_shooting.rb +3 -3
- data/menu/firefox.rb +1 -1
- data/menu/piano.rb +1 -1
- data/menu/{foo.rb → sammiches.rb} +9 -12
- data/menu/shoes.menu +1482 -0
- data/menu/shoes.rb +16 -0
- data/xiki.gemspec +3 -6
- metadata +16 -46
@@ -1,6 +1,17 @@
|
|
1
|
-
|
1
|
+
#
|
2
|
+
# Used to "install" the 'xiki' shell command (copy it to
|
3
|
+
# /usr/local/bin/) when installing Xiki manually from source
|
4
|
+
# rather than as a gem.
|
5
|
+
#
|
6
|
+
dest = ARGV[0] || "/usr/local/bin/xiki"
|
2
7
|
puts "Putting the 'xiki' shell command at:
|
3
|
-
|
8
|
+
|
9
|
+
#{dest}
|
10
|
+
|
11
|
+
You can pass a different path if you prefer...
|
12
|
+
|
13
|
+
$ xiki /bin/xiki
|
14
|
+
"
|
4
15
|
|
5
16
|
source = "etc/command/xiki_wrapper"
|
6
17
|
|
@@ -12,3 +23,5 @@ txt = File.read source
|
|
12
23
|
txt.sub! /\(xiki_dir\)/, xiki_dir
|
13
24
|
|
14
25
|
File.open(dest, "w", 0755) { |f| f << txt }
|
26
|
+
|
27
|
+
puts "Finished."
|
data/etc/install/el4r_setup.sh
CHANGED
data/lib/xiki.rb
CHANGED
data/lib/xiki/console.rb
CHANGED
@@ -349,7 +349,7 @@ class Console
|
|
349
349
|
return Remote.command path
|
350
350
|
end
|
351
351
|
if FileTree.handles?(path)
|
352
|
-
while(path.last =~
|
352
|
+
while(path.last =~ /^\$ /) do # Remove all $ foo lines from path
|
353
353
|
path.pop
|
354
354
|
end
|
355
355
|
dir = path.join('')
|
@@ -357,6 +357,8 @@ class Console
|
|
357
357
|
# If starts with ./, replace with current dir
|
358
358
|
dir.sub! /^\.\//, "#{View.dir}/"
|
359
359
|
|
360
|
+
dir = Bookmarks[dir]
|
361
|
+
|
360
362
|
end
|
361
363
|
View.to orig
|
362
364
|
end
|
@@ -364,7 +366,7 @@ class Console
|
|
364
366
|
dir ||= $1 unless $1.empty?
|
365
367
|
command = $2
|
366
368
|
|
367
|
-
return Tree.<<("- Directory doesn't exist) #{dir}") if dir && ! File.exists?(dir)
|
369
|
+
return Tree.<<("- Directory doesn't exist) #{dir}", :no_slash=>1) if dir && ! File.exists?(dir)
|
368
370
|
|
369
371
|
if options[:sync]
|
370
372
|
output = Console.run command, :dir=>dir, :sync=>true
|
data/lib/xiki/files.rb
CHANGED
data/lib/xiki/launcher.rb
CHANGED
@@ -210,7 +210,7 @@ class Launcher
|
|
210
210
|
|
211
211
|
if line =~ /^ *@$/
|
212
212
|
matches = Launcher.menu_keys
|
213
|
-
Tree.<< matches.sort.map{|o| "<< #{o.
|
213
|
+
Tree.<< matches.sort.map{|o| "<< #{o.gsub '_', ' '}/"}.join("\n"), :no_slash=>1
|
214
214
|
return
|
215
215
|
end
|
216
216
|
|
@@ -323,7 +323,7 @@ class Launcher
|
|
323
323
|
|
324
324
|
Line.sub! /\b$/, "..."
|
325
325
|
|
326
|
-
View.under matches.sort.map{|o| "<< #{o.
|
326
|
+
View.under matches.sort.map{|o| "<< #{o.gsub '_', ' '}/"}.join("\n")
|
327
327
|
return
|
328
328
|
end
|
329
329
|
end
|
@@ -1086,7 +1086,9 @@ class Launcher
|
|
1086
1086
|
|
1087
1087
|
# TODO: make generic
|
1088
1088
|
# TODO: load all the adapters and construct the "rb|js" part of the regex
|
1089
|
-
|
1089
|
+
|
1090
|
+
# Don't match if it's quoted (after a pipe)
|
1091
|
+
match = path.match(/^([^|]+\/)(\w+)\.(rb|js|coffee|py|notes|menu|haml)\/(.*)/)
|
1090
1092
|
if match
|
1091
1093
|
dir, file, extension, path = match[1..4]
|
1092
1094
|
# TODO: instead, call Launcher.invoke JsAdapter(dir, path), path
|
@@ -1095,7 +1097,7 @@ class Launcher
|
|
1095
1097
|
end
|
1096
1098
|
|
1097
1099
|
# For matches to filename instead of extensions?
|
1098
|
-
match = path.match(
|
1100
|
+
match = path.match(/^([^|]+\/)(Rakefile)\/(.*)/)
|
1099
1101
|
if match
|
1100
1102
|
dir, file, path = match[1..4]
|
1101
1103
|
# TODO: instead, call Launcher.invoke JsAdapter(dir, path), path
|
data/lib/xiki/menu.rb
CHANGED
@@ -13,6 +13,7 @@ class Menu
|
|
13
13
|
- gem/
|
14
14
|
- .setup/
|
15
15
|
- @~/menu/
|
16
|
+
- @$x/menu/
|
16
17
|
- .reload_menus/
|
17
18
|
- .api/
|
18
19
|
> Summary
|
@@ -67,32 +68,23 @@ class Menu
|
|
67
68
|
| If you want to create a very simple menu you can do so without code,
|
68
69
|
| by just putting the menu in a file such as ~/menu/foo.menu. See:
|
69
70
|
|
|
70
|
-
<< docs/
|
71
|
+
<< docs/creating/
|
71
72
|
- .docs/
|
72
|
-
- .
|
73
|
-
- .
|
74
|
-
- .keys/
|
75
|
-
> Summary
|
76
|
-
| Helpful keyboard shortcuts when using menus.
|
77
|
-
|
|
78
|
-
| - as+menu
|
79
|
-
| - Save changes to menu (or create new one)
|
80
|
-
| - to+menu
|
81
|
-
| - Jump to file that implements menu
|
82
|
-
|
|
73
|
+
- .using/
|
74
|
+
- .creating/
|
83
75
|
'
|
84
76
|
end
|
85
77
|
|
86
78
|
def self.install *args
|
87
79
|
Xiki.dont_search
|
88
|
-
|
80
|
+
'
|
89
81
|
> TODO
|
90
|
-
|
82
|
+
| implement this.
|
91
83
|
|
92
|
-
-
|
93
|
-
-
|
94
|
-
|
95
|
-
|
84
|
+
- Look in gem dirs for installed gems with this name
|
85
|
+
- Google search for xiki menu on web
|
86
|
+
@google/"foo.menu"
|
87
|
+
'
|
96
88
|
end
|
97
89
|
|
98
90
|
def self.create *args
|
@@ -247,82 +239,184 @@ class Menu
|
|
247
239
|
`
|
248
240
|
end
|
249
241
|
|
250
|
-
def self.
|
251
|
-
%`
|
252
|
-
|
253
|
-
|
254
|
-
|
|
255
|
-
| All menus can be used the same way. Just type something and double-click
|
256
|
-
| on it (or type Ctrl-enter while the cursor is on the line).
|
257
|
-
|
|
258
|
-
- example/
|
259
|
-
| 1: type "foo" on a line (the "@" isn't necessary when the line isn't indented)
|
260
|
-
@ foo
|
261
|
-
|
|
262
|
-
| 2: double-click on it to drill in. You can try it on the line above. It will look like this:
|
263
|
-
@ foo/
|
264
|
-
| - sammiches/
|
265
|
-
| - dranks/
|
266
|
-
|
|
267
|
-
| 3: double-click to drill in further. It will look like this:
|
268
|
-
@ foo/
|
269
|
-
| - sammiches/
|
270
|
-
| - ham/
|
271
|
-
| - tofu/
|
272
|
-
| - dranks/
|
273
|
-
|
|
274
|
-
- using the mouse/
|
275
|
-
| You can click on the "bullets" (the - and + at the beginnings of lines)
|
276
|
-
| to expand and collapse. You can also double-click to expand and
|
277
|
-
| collapse.
|
278
|
-
|
|
279
|
-
- search to narrow down/
|
280
|
-
| When you double-click a line the cursor turns blue and you can type
|
281
|
-
| letters to search and narrow down the list.
|
282
|
-
|
|
283
|
-
- misc keys/
|
284
|
-
| - Return: stops searching and launches (expands file or dir)
|
285
|
-
| - Tab: like return but hides others
|
286
|
-
| - ;: like return but collapses path
|
287
|
-
|
|
288
|
-
| - C-g: stops searching
|
242
|
+
def self.using *args
|
243
|
+
txt = %`
|
244
|
+
> Summary
|
245
|
+
| How to use Xiki menus. Xiki menus are menus you type, not menu bar.
|
289
246
|
|
|
290
|
-
|
|
247
|
+
| All xiki menus can be used the same way. Just type something and
|
248
|
+
| double-click on it (or type Ctrl-enter while the cursor is on the line)
|
249
|
+
| to open the menu.
|
291
250
|
|
|
292
|
-
|
251
|
+
- example/
|
252
|
+
| 1: Type "sammiches" on a line (the "@" isn't necessary when the line
|
253
|
+
| isn't indented)
|
254
|
+
@sammiches
|
255
|
+
|
|
256
|
+
| 2: Double-click (or Ctrl-enter) on it to open it. You can try it on
|
257
|
+
| the line above. It will look like this:
|
258
|
+
| @sammiches/
|
259
|
+
| + meat/
|
260
|
+
| + veggie/
|
261
|
+
| + checkout/
|
262
|
+
|
|
263
|
+
| 3: Double-click to open items. It will look like this:
|
264
|
+
| @sammiches/
|
265
|
+
| + meat/
|
266
|
+
| + veggie/
|
267
|
+
| + cucumber/
|
268
|
+
| + bark/
|
269
|
+
| + checkout/
|
270
|
+
|
|
271
|
+
- mouse/
|
272
|
+
| You can click on the "bullets" (the - and + at the beginnings of lines)
|
273
|
+
| to expand and collapse. You can also double-click to expand and
|
274
|
+
| collapse.
|
275
|
+
|
|
276
|
+
- keyboard/
|
277
|
+
| You can do everything with the keyboard that you can do with the mouse.
|
278
|
+
| Type Ctrl-enter while your cursor is on the same line as a menu or menu
|
279
|
+
| item to open it. Or, if it already has things under it, it will collapse.
|
280
|
+
|
|
281
|
+
| Right after you open a menu, some keys you type have special meaning. This
|
282
|
+
| is the case whether you you used the mouse or keyboard to open the menu.
|
283
|
+
| The cursor turns into a block to indicate this.
|
284
|
+
|
|
285
|
+
| Special keys right after opening:
|
286
|
+
- search to narrow down/
|
287
|
+
| If you type numbers and letters, it incrementally narrows down the list.
|
288
|
+
- opening/
|
289
|
+
| Return - opens menu item cursor is on
|
290
|
+
| Tab - opens, hiding the other items at that level
|
291
|
+
| Ctrl-/ - opens, moving the item onto the same line as its parent
|
292
|
+
| Ctrl-1, Ctrl-2, Ctr-3, etc. - opens the nth item
|
293
|
+
| Ctrl-G: stops searching
|
294
|
+
|
|
295
|
+
`
|
296
|
+
|
297
|
+
Tree.children txt, args
|
293
298
|
end
|
294
299
|
|
295
|
-
def self.
|
300
|
+
def self.creating *args
|
296
301
|
txt = %q`
|
297
302
|
> Summary
|
298
|
-
| How to make your own menus
|
299
|
-
| menus
|
303
|
+
| How to make your own Xiki menus. This is strongly encouraged! Make
|
304
|
+
| a bunch of menus for all the various things you do, if you're so
|
305
|
+
| inclined. You can make menus for from simple notes, to powerful
|
306
|
+
| CRUD interfaces etc. for controlling external tools.
|
300
307
|
|
|
308
|
+
- Pretend they exist/
|
309
|
+
| The easiest way to create new menus is to type them and open them as
|
310
|
+
| though they exist. Xiki will then guide you through turning them
|
311
|
+
| into actual menus.
|
312
|
+
|
|
313
|
+
| The simplest option is the first one it shows you. You can just type
|
314
|
+
| menu items inline to create the menu. For example, you could type
|
315
|
+
| this:
|
316
|
+
|
|
317
|
+
| milkshakes/
|
318
|
+
| - chocolate/
|
319
|
+
| - vanilla/
|
320
|
+
|
|
321
|
+
| And then with your cursor on one of these lines you could type
|
322
|
+
| Ctrl-a Ctrl-m (for "as menu") to turn it into an actual menu. Then,
|
323
|
+
| the next time you type "milkshakes" and open it, it would show the
|
324
|
+
| menu items. For this menu to be useful, you'll probably want to add
|
325
|
+
| more items underneath them, or open the items to be prompted to
|
326
|
+
| create a ruby class to run when they're opened in the future.
|
327
|
+
|
|
328
|
+
- Screencasts/
|
329
|
+
| Check out these two points in one of the xiki screencast to see
|
330
|
+
| creating menus in action:
|
331
|
+
|
|
332
|
+
@http://www.youtube.com/watch?v=bUR_eUVcABg#t=1m30s
|
333
|
+
@http://www.youtube.com/watch?v=bUR_eUVcABg#t=1m57s
|
334
|
+
|
|
301
335
|
- Creating .menu files/
|
302
|
-
| You can make menus without code, by just
|
303
|
-
| "menu
|
336
|
+
| You can make menus without code, by just putting "whatever.menu" files
|
337
|
+
| in the "menu" dir in your home dir.
|
338
|
+
|
|
339
|
+
| For example you could create a "drinks.menu" file, like the following.
|
340
|
+
| (The "|" characters aren't actually in the file).
|
341
|
+
|
|
342
|
+
| ~/menu/
|
343
|
+
| - drinks.menu
|
344
|
+
| | - fruit/
|
345
|
+
| | - lemonade/
|
346
|
+
| | - smoothie/
|
347
|
+
| | - caffeinated/
|
348
|
+
| | - coffee/
|
349
|
+
| | - tea/
|
304
350
|
|
|
305
|
-
|
|
306
|
-
|
|
351
|
+
| Then when you type drinks on a line and open it, it will look like
|
352
|
+
| this:
|
307
353
|
|
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
| - sammiches/
|
312
|
-
| - ham/
|
313
|
-
| - tofu/
|
314
|
-
| - dranks/
|
315
|
-
| - foty/
|
354
|
+
| drinks/
|
355
|
+
| + fruit/
|
356
|
+
| + caffeinated/
|
316
357
|
|
|
317
358
|
- Delegating/
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
359
|
+
| You can make simple menus that delegate to other things, using the
|
360
|
+
| "@" character. For example:
|
361
|
+
|
|
362
|
+
| ~/menu/
|
363
|
+
| - foo.menu
|
364
|
+
| | - @other menu/
|
365
|
+
| | - @MyClass.my_method
|
366
|
+
| | @$ shell command
|
367
|
+
|
|
368
|
+
- Wiki elements/
|
369
|
+
| You can put wiki elements in menus, like headings, paragraphs and
|
370
|
+
| bullet points. Thus you can make a menu just to store notes:
|
371
|
+
|
|
372
|
+
| shopping list/
|
373
|
+
| > Grocery
|
374
|
+
| - Eggs
|
375
|
+
| - Vodka
|
376
|
+
|
|
377
|
+
| > Pet store
|
378
|
+
| Not sure yet. Maybe just a bunch of snakes.
|
379
|
+
|
|
380
|
+
- Creating .rb files/
|
381
|
+
| Create ruby files in ~/menu/ to make dynamic menus. The .menu class
|
382
|
+
| method will be invoked. Example:
|
383
|
+
|
|
384
|
+
| ~/menu/
|
385
|
+
| - pie.rb
|
386
|
+
| | class Pie
|
387
|
+
| | def self.menu *args
|
388
|
+
| | "
|
389
|
+
| | - fruit/
|
390
|
+
| | - apple/
|
391
|
+
| | - pumpkin/
|
392
|
+
| | - nuts/
|
393
|
+
| | "
|
394
|
+
| | end
|
395
|
+
| | end
|
396
|
+
|
|
397
|
+
| To make a menu run a method, put a dot in front of it:
|
398
|
+
|
|
399
|
+
| ~/menu/
|
400
|
+
| - pie.rb
|
401
|
+
| | class Pie
|
402
|
+
| | def self.menu *args
|
403
|
+
| | "
|
404
|
+
| | - fruit/
|
405
|
+
| | - apple/
|
406
|
+
| | - pumpkin/
|
407
|
+
| | - .nuts/
|
408
|
+
| | "
|
409
|
+
| | end
|
410
|
+
| | def self.nuts *args
|
411
|
+
| | # Put any code here. The string you return will be inserted
|
412
|
+
| | # into the tree.
|
413
|
+
| | "- pecan/\n- pecan/"
|
414
|
+
| | end
|
415
|
+
| | end
|
416
|
+
|
|
321
417
|
|
|
322
|
-
|
323
|
-
|
324
|
-
| - @mymenu/
|
325
|
-
| - @MyClass.my_method
|
418
|
+
> For more info, see:
|
419
|
+
@menu/api/
|
326
420
|
|
|
327
421
|
`
|
328
422
|
|
@@ -579,8 +673,8 @@ Ol << "location: #{location.inspect}"
|
|
579
673
|
return if orig == View.line
|
580
674
|
|
581
675
|
# If it inserted something
|
582
|
-
output = Tree.siblings :everything=>1
|
583
|
-
|
676
|
+
# output = Tree.siblings :everything=>1
|
677
|
+
output = Tree.siblings :cross_blank_lines=>1, :everything=>1
|
584
678
|
|
585
679
|
# Shouldn't this be looping like self.collapser_launcher ?
|
586
680
|
Tree.to_parent
|
data/lib/xiki/search.rb
CHANGED
@@ -1112,7 +1112,7 @@ class Search
|
|
1112
1112
|
|
1113
1113
|
char = Keys.input(:chars=>1, :prompt=>"Enter one char: ")
|
1114
1114
|
if char == "m"
|
1115
|
-
Launcher.open("- #{Xiki.dir}
|
1115
|
+
Launcher.open("- #{Xiki.dir}\n - ##\\bdef /")
|
1116
1116
|
elsif char == "k"
|
1117
1117
|
Launcher.open("- $x/key_bindings.rb\n - ##\\bKeys\\./")
|
1118
1118
|
elsif char == "l"
|
data/lib/xiki/tree.rb
CHANGED
@@ -1024,6 +1024,12 @@ class Tree
|
|
1024
1024
|
siblings
|
1025
1025
|
end
|
1026
1026
|
|
1027
|
+
#
|
1028
|
+
# Gets position before and after sibling bounds.
|
1029
|
+
#
|
1030
|
+
# Tree.sibling_bounds # Returns: start, current line start, current line end, end
|
1031
|
+
# Tree.sibling_bounds :cross_blank_lines=>1 # Returns: top, bottom
|
1032
|
+
#
|
1027
1033
|
def self.sibling_bounds options={}
|
1028
1034
|
if options[:cross_blank_lines] # If :cross_blank_lines, just jump to parent, then use .after_children
|
1029
1035
|
orig = Location.new
|
@@ -1108,7 +1114,7 @@ class Tree
|
|
1108
1114
|
last_indent = line_indent
|
1109
1115
|
line_indent = tree[i+1] # Use indent of following line
|
1110
1116
|
line_indent = line_indent ? (line_indent[/^ */].length / 2) : 0
|
1111
|
-
raise "Blank lines in trees between parents and children aren't allowed." if line_indent > 0 && line_indent > last_indent
|
1117
|
+
raise "Blank lines in trees between parents and children aren't allowed. Also 2 consecutive blank lines isn't allowed." if line_indent > 0 && line_indent > last_indent
|
1112
1118
|
else
|
1113
1119
|
line_indent = line[/^ */].length / 2
|
1114
1120
|
line.strip!
|
@@ -1466,6 +1472,10 @@ class Tree
|
|
1466
1472
|
# Tree.children "a\n b\n c", "a"
|
1467
1473
|
#
|
1468
1474
|
def self.children tree=nil, target=nil, options={}
|
1475
|
+
|
1476
|
+
# Read in file, if tree looks like a file path
|
1477
|
+
tree = File.read(File.expand_path tree) if tree !~ /\n/ && tree =~ /^~/
|
1478
|
+
|
1469
1479
|
include_subitems = options[:include_subitems] # Include sub-items for all children
|
1470
1480
|
|
1471
1481
|
return self.children_at_cursor(tree) if tree.nil? || tree.is_a?(Hash) # tree is actually options
|