xiki 0.5.0a
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/Gemfile +11 -0
- data/LICENSE +22 -0
- data/README.markdown +83 -0
- data/Rakefile +8 -0
- data/bin/xiki +46 -0
- data/etc/command/xiki_command.rb +203 -0
- data/etc/command/xiki_process.rb +52 -0
- data/etc/command/xiki_wrapper +2 -0
- data/etc/js/menu1.js +55 -0
- data/etc/js/xiki.js +259 -0
- data/etc/logo.png +0 -0
- data/etc/presentations/bootstrap.deck +5 -0
- data/etc/presentations/databases.deck +41 -0
- data/etc/presentations/diffs.deck +23 -0
- data/etc/presentations/documentation.deck +14 -0
- data/etc/presentations/effects.deck +5 -0
- data/etc/presentations/face.deck +297 -0
- data/etc/presentations/files.deck +79 -0
- data/etc/presentations/icons.deck +22 -0
- data/etc/presentations/images.deck +24 -0
- data/etc/presentations/key_shortcuts.deck +16 -0
- data/etc/presentations/macros.deck +18 -0
- data/etc/presentations/menu_classes.deck +44 -0
- data/etc/presentations/menu_directories.deck +30 -0
- data/etc/presentations/notes.deck +19 -0
- data/etc/presentations/other_languages.deck +55 -0
- data/etc/presentations/other_wiki_syntaxes.deck +4 -0
- data/etc/presentations/piano.deck +5 -0
- data/etc/presentations/potential/diffs.deck +38 -0
- data/etc/presentations/potential/evolution.deck +18 -0
- data/etc/presentations/potential/intro.deck +711 -0
- data/etc/presentations/potential/intro1.deck +711 -0
- data/etc/presentations/potential/intro2.deck +97 -0
- data/etc/presentations/potential/make_mysql_menu.deck +36 -0
- data/etc/presentations/potential/ruby_development.deck +17 -0
- data/etc/presentations/potential/ui_prototyping.deck +50 -0
- data/etc/presentations/potential/web_dev.deck +4 -0
- data/etc/presentations/potential/web_development.deck +10 -0
- data/etc/presentations/potential/wiki.deck +45 -0
- data/etc/presentations/presentations.deck +24 -0
- data/etc/presentations/rails_development.deck +29 -0
- data/etc/presentations/search_key_shortcuts.deck +37 -0
- data/etc/presentations/simplest_possible_ui.deck +37 -0
- data/etc/presentations/svg.deck +5 -0
- data/etc/presentations/testing.deck +28 -0
- data/etc/presentations/the_end.deck +13 -0
- data/etc/presentations/type_something_and_double_click.deck +57 -0
- data/etc/presentations/type_the_acronym.deck +144 -0
- data/etc/presentations/web_browser.deck +56 -0
- data/etc/presentations/xiki_command.deck +20 -0
- data/etc/presentations/xiki_url.deck +14 -0
- data/etc/shark.icns +0 -0
- data/etc/shark_script.icns +0 -0
- data/etc/snippets/html.notes +7 -0
- data/etc/snippets/notes.notes +20 -0
- data/etc/snippets/rb.notes +38 -0
- data/etc/templates/menu_template.menu +2 -0
- data/etc/templates/menu_template.rb +8 -0
- data/etc/templates/template.rb +5 -0
- data/etc/themes/Dark_Metal.notes +28 -0
- data/etc/themes/Orange_Path.notes +15 -0
- data/etc/themes/Shiny_Blue.notes +27 -0
- data/etc/themes/Shiny_Green.notes +27 -0
- data/etc/wrappers/wrapper.js +17 -0
- data/etc/wrappers/wrapper.py +20 -0
- data/etc/wrappers/wrapper.rb +25 -0
- data/lib/block.rb +72 -0
- data/lib/bookmarks.rb +352 -0
- data/lib/buffers.rb +170 -0
- data/lib/clipboard.rb +333 -0
- data/lib/code.rb +860 -0
- data/lib/code_tree.rb +476 -0
- data/lib/color.rb +274 -0
- data/lib/console.rb +557 -0
- data/lib/control_lock.rb +9 -0
- data/lib/control_tab.rb +176 -0
- data/lib/core_ext.rb +31 -0
- data/lib/cursor.rb +111 -0
- data/lib/deletes.rb +65 -0
- data/lib/diff_log.rb +297 -0
- data/lib/effects.rb +145 -0
- data/lib/environment.rb +5 -0
- data/lib/file_tree.rb +1875 -0
- data/lib/files.rb +334 -0
- data/lib/hide.rb +259 -0
- data/lib/history.rb +286 -0
- data/lib/image.rb +51 -0
- data/lib/incrementer.rb +15 -0
- data/lib/insert.rb +7 -0
- data/lib/irc.rb +22 -0
- data/lib/key_bindings.rb +658 -0
- data/lib/keys.rb +754 -0
- data/lib/launcher.rb +1351 -0
- data/lib/line.rb +429 -0
- data/lib/links.rb +6 -0
- data/lib/location.rb +175 -0
- data/lib/macros.rb +48 -0
- data/lib/man.rb +19 -0
- data/lib/menu.rb +708 -0
- data/lib/merb.rb +259 -0
- data/lib/message.rb +5 -0
- data/lib/meths.rb +56 -0
- data/lib/mode.rb +34 -0
- data/lib/move.rb +248 -0
- data/lib/notes.rb +1000 -0
- data/lib/numbers.rb +45 -0
- data/lib/ol.rb +203 -0
- data/lib/ol_helper.rb +44 -0
- data/lib/overlay.rb +167 -0
- data/lib/pause_means_space.rb +68 -0
- data/lib/php.rb +22 -0
- data/lib/projects.rb +21 -0
- data/lib/relinquish_exception.rb +2 -0
- data/lib/remote.rb +206 -0
- data/lib/requirer.rb +46 -0
- data/lib/rest_tree.rb +108 -0
- data/lib/ruby.rb +57 -0
- data/lib/ruby_console.rb +165 -0
- data/lib/search.rb +1572 -0
- data/lib/search_term.rb +40 -0
- data/lib/snippet.rb +68 -0
- data/lib/specs.rb +229 -0
- data/lib/styles.rb +274 -0
- data/lib/svn.rb +682 -0
- data/lib/text_util.rb +110 -0
- data/lib/tree.rb +1871 -0
- data/lib/tree_cursor.rb +87 -0
- data/lib/trouble_shooting.rb +27 -0
- data/lib/url_tree.rb +11 -0
- data/lib/view.rb +1474 -0
- data/lib/window.rb +133 -0
- data/lib/xiki.rb +404 -0
- data/menus/accounts.rb +5 -0
- data/menus/address_book.rb +21 -0
- data/menus/agenda.rb +28 -0
- data/menus/all.rb +5 -0
- data/menus/amazon.rb +16 -0
- data/menus/app.rb +16 -0
- data/menus/applescript.rb +46 -0
- data/menus/as.rb +15 -0
- data/menus/bookmarklet.rb +63 -0
- data/menus/bootstrap.rb +568 -0
- data/menus/browse.rb +13 -0
- data/menus/browser.rb +78 -0
- data/menus/cassandra_db.rb +36 -0
- data/menus/chmod.rb +27 -0
- data/menus/classes.rb +5 -0
- data/menus/coffee_script.rb +35 -0
- data/menus/computer.rb +24 -0
- data/menus/contacts.rb +5 -0
- data/menus/cookies.rb +25 -0
- data/menus/couch.rb +184 -0
- data/menus/crop.rb +45 -0
- data/menus/css.rb +55 -0
- data/menus/current.rb +5 -0
- data/menus/db.rb +12 -0
- data/menus/deck.rb +219 -0
- data/menus/dictionary.rb +9 -0
- data/menus/dir.rb +8 -0
- data/menus/disk.rb +5 -0
- data/menus/do.rb +13 -0
- data/menus/docs.rb +58 -0
- data/menus/dotsies.rb +107 -0
- data/menus/edited.rb +18 -0
- data/menus/emacs.rb +17 -0
- data/menus/enter.rb +13 -0
- data/menus/eval.rb +17 -0
- data/menus/executable.rb +16 -0
- data/menus/filter.rb +46 -0
- data/menus/firefox.rb +607 -0
- data/menus/foo.rb +30 -0
- data/menus/french.rb +7 -0
- data/menus/git.rb +185 -0
- data/menus/gito.rb +785 -0
- data/menus/google.rb +35 -0
- data/menus/google_images.rb +11 -0
- data/menus/google_patents.rb +10 -0
- data/menus/gutenberg.rb +13 -0
- data/menus/head.rb +10 -0
- data/menus/headings.rb +39 -0
- data/menus/html.rb +61 -0
- data/menus/icon.rb +40 -0
- data/menus/images.menu +2 -0
- data/menus/img.rb +15 -0
- data/menus/info.rb +9 -0
- data/menus/ip.rb +10 -0
- data/menus/iterm.rb +36 -0
- data/menus/itunes.rb +78 -0
- data/menus/javascript.rb +74 -0
- data/menus/layout.rb +18 -0
- data/menus/local_storage.rb +67 -0
- data/menus/ls.rb +19 -0
- data/menus/mac.rb +87 -0
- data/menus/maps.rb +18 -0
- data/menus/matches.rb +18 -0
- data/menus/memcache.rb +117 -0
- data/menus/mkdir.rb +23 -0
- data/menus/mongo.rb +83 -0
- data/menus/mysql.rb +294 -0
- data/menus/node.rb +88 -0
- data/menus/open.rb +19 -0
- data/menus/outline.rb +24 -0
- data/menus/piano.rb +746 -0
- data/menus/postgres.rb +34 -0
- data/menus/pre.rb +5 -0
- data/menus/python.rb +39 -0
- data/menus/rails.rb +160 -0
- data/menus/rake.rb +12 -0
- data/menus/redmine.rb +168 -0
- data/menus/riak_tree.rb +204 -0
- data/menus/rss.rb +15 -0
- data/menus/safari.rb +11 -0
- data/menus/sass.rb +15 -0
- data/menus/say.rb +6 -0
- data/menus/scale.rb +49 -0
- data/menus/serve.rb +78 -0
- data/menus/shuffle.rb +24 -0
- data/menus/spanish.rb +7 -0
- data/menus/standalone.rb +57 -0
- data/menus/tail.rb +41 -0
- data/menus/technologies.rb +19 -0
- data/menus/themes.rb +32 -0
- data/menus/thesaurus.rb +13 -0
- data/menus/to.rb +24 -0
- data/menus/twitter.rb +57 -0
- data/menus/wikipedia.rb +34 -0
- data/menus/words.rb +11 -0
- data/spec/code_tree_spec.rb +59 -0
- data/spec/diff_log_spec.rb +40 -0
- data/spec/file_tree_spec.rb +102 -0
- data/spec/keys_spec.rb +24 -0
- data/spec/line_spec.rb +68 -0
- data/spec/menu_spec.rb +50 -0
- data/spec/ol_spec.rb +98 -0
- data/spec/remote_spec.rb +43 -0
- data/spec/search_spec.rb +162 -0
- data/spec/text_util_spec.rb +119 -0
- data/spec/tree_cursor_spec.rb +91 -0
- data/spec/tree_spec.rb +955 -0
- data/tests/console_test.rb +11 -0
- data/tests/couch_db_test.rb +12 -0
- data/tests/diff_log_test.rb +43 -0
- data/tests/el_mixin.rb +16 -0
- data/tests/git_test.rb +95 -0
- data/tests/keys_test.rb +19 -0
- data/tests/line_test.rb +38 -0
- data/tests/merb_test.rb +11 -0
- data/tests/redmine_test.rb +50 -0
- data/tests/remote_test.rb +31 -0
- data/tests/rest_tree_test.rb +70 -0
- data/xiki.gemspec +37 -0
- metadata +332 -0
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2012 Craig D Muth
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
This file tells how to install Xiki. See http://xiki.org for a description of Xiki.
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
__UPDATE DIRECTIONS TO SAY GEM INSTALL BY DEFAULT__
|
|
6
|
+
|
|
7
|
+
## Step 1: Download Emacs
|
|
8
|
+
|
|
9
|
+
### On Mac:
|
|
10
|
+
- Try Aquamacs 1.9.1 if you're new to emacs (it's more mac-like)
|
|
11
|
+
- http://aquamacs.org/download-classic.shtml
|
|
12
|
+
- Or
|
|
13
|
+
- http://emacsformacosx.com/emacs-builds/Emacs-22.3-i386-10.5.7.dmg
|
|
14
|
+
- Note: newer mac versions (after 22) have a bug that makes communicating with processes 1000 times slower. Til this is fixed stick with the above versions.
|
|
15
|
+
|
|
16
|
+
### On Linux:
|
|
17
|
+
|
|
18
|
+
$ sudo apt-get install emacs
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Step 2: Install the EmacsRuby (el4r) gem
|
|
22
|
+
|
|
23
|
+
$ sudo gem install el4r
|
|
24
|
+
$ gem contents el4r | grep setup.rb # To see which dir to cd to in the next step
|
|
25
|
+
$ cd /Library/Ruby/Gems/1.8/gems/el4r-1.0.4/
|
|
26
|
+
$ ruby setup.rb
|
|
27
|
+
$ cd bin/
|
|
28
|
+
$ ruby -S el4r-rctool -p
|
|
29
|
+
$ sudo ruby -S el4r-rctool -i
|
|
30
|
+
|
|
31
|
+
## Step 3: Get Xiki from github
|
|
32
|
+
- Option 1: Download as zip
|
|
33
|
+
- Click on the 'ZIP' button on http://github.com/trogdoro/xiki
|
|
34
|
+
- Option 2: Clone repo
|
|
35
|
+
- git clone git@github.com:trogdoro/xiki.git
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## Step 4: Require Xiki in EmacsRuby's config
|
|
39
|
+
- Sample configuration
|
|
40
|
+
- ~/.el4r/init.rb
|
|
41
|
+
| $LOAD_PATH.unshift "/projects/xiki/lib"
|
|
42
|
+
| require 'xiki'
|
|
43
|
+
| Xiki.init
|
|
44
|
+
|
|
|
45
|
+
| KeyBindings.keys # Use default key bindings
|
|
46
|
+
| Styles.use_xiki_color_scheme # Use xiki's color scheme
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
## Step 5: Install dependant packages
|
|
50
|
+
- In the xiki dir, run:
|
|
51
|
+
$ bundle install --system
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## Trouble-shooting
|
|
55
|
+
The install is a bit rough at the moment...
|
|
56
|
+
|
|
57
|
+
- If you get an error (and you probably will)
|
|
58
|
+
- If you got partially through the load
|
|
59
|
+
- you will be able to use these keys to trouble-shoot:
|
|
60
|
+
- Option-l to reload xiki and .emacs
|
|
61
|
+
- also use this when you see "el4r-instance is dead"
|
|
62
|
+
- Option-e to look at the latest error
|
|
63
|
+
- It will be Command instead of Option if you're not using Aquamacs
|
|
64
|
+
|
|
65
|
+
- Or you can manually restart emacs (or reload .emacs) and look at the log
|
|
66
|
+
- Named something like: /tmp/el4r......log
|
|
67
|
+
- Go to the end and search backward for the last error
|
|
68
|
+
- probably contains ":Error:"
|
|
69
|
+
|
|
70
|
+
- If you get a "can't find header dir for ruby" error
|
|
71
|
+
$ sudo apt-get install ruby1.8-dev
|
|
72
|
+
|
|
73
|
+
- If you run into trouble installing EmacsRuby
|
|
74
|
+
- See: http://www.rubyist.net/~rubikitch/computer/el4r/index.en.html
|
|
75
|
+
- Click on 'Download / Install / Setup' link
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
## Google group
|
|
79
|
+
Join the google group for help with installing, or to chat about whatever or
|
|
80
|
+
share your ideas:
|
|
81
|
+
|
|
82
|
+
http://groups.google.com/group/xiki
|
|
83
|
+
|
data/Rakefile
ADDED
data/bin/xiki
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
# > Summary
|
|
5
|
+
# This file is aliased to /usr/local/bin/xiki, so it can be
|
|
6
|
+
# called from the command line. It exposes xiki menus.
|
|
7
|
+
#
|
|
8
|
+
# > Example
|
|
9
|
+
# $ xiki ip
|
|
10
|
+
# 111.1.1.111
|
|
11
|
+
#
|
|
12
|
+
# To create the alias, see:
|
|
13
|
+
# @xiki/setup/install command/
|
|
14
|
+
#
|
|
15
|
+
|
|
16
|
+
require 'rubygems'
|
|
17
|
+
|
|
18
|
+
# Generate with correct path (see below)
|
|
19
|
+
# xiki_dir = "/projects/xiki/"
|
|
20
|
+
xiki_dir = File.expand_path "#{File.dirname(__FILE__)}/.."
|
|
21
|
+
# p "xiki_dir: #{xiki_dir.inspect}"
|
|
22
|
+
|
|
23
|
+
# $:.unshift xiki_dir #.sub(/\/$/, '')
|
|
24
|
+
$:.unshift "#{xiki_dir}/lib" #.sub(/\/$/, '')
|
|
25
|
+
|
|
26
|
+
# require "#{xiki_dir}/ol"
|
|
27
|
+
require "ol"
|
|
28
|
+
# Ol.line
|
|
29
|
+
require "core_ext"
|
|
30
|
+
|
|
31
|
+
$:.unshift "#{xiki_dir}/etc/command"
|
|
32
|
+
# $:.unshift "#{xiki_dir}etc/command/stubs"
|
|
33
|
+
|
|
34
|
+
require "xiki_command.rb"
|
|
35
|
+
# load "xiki_command.rb"
|
|
36
|
+
|
|
37
|
+
result = XikiCommand.run
|
|
38
|
+
puts result if result != ""
|
|
39
|
+
|
|
40
|
+
exit 0
|
|
41
|
+
|
|
42
|
+
# TODO: Start with template, and when installing, change:
|
|
43
|
+
# - #!.. line to: result of: `which ruby`
|
|
44
|
+
# - xiki_dir to: Xiki.dir
|
|
45
|
+
|
|
46
|
+
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
require 'timeout'
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
# The 'xiki' shell command uses this class to run xiki menus.
|
|
5
|
+
# It tells the xiki process to run menus. It starts the xiki
|
|
6
|
+
# process if it's not running yet, and the process stays alive
|
|
7
|
+
# until the next time the shell command is run.
|
|
8
|
+
#
|
|
9
|
+
class XikiCommand
|
|
10
|
+
|
|
11
|
+
@@dont_show_output = false
|
|
12
|
+
@@initial_request = nil
|
|
13
|
+
def self.pop_initial_request
|
|
14
|
+
tmp = @@initial_request
|
|
15
|
+
@@initial_request = nil # So it doesn't loop
|
|
16
|
+
tmp
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Called by the 'xiki' shell command
|
|
20
|
+
def self.run
|
|
21
|
+
|
|
22
|
+
xiki_root = File.expand_path "#{File.dirname(__FILE__)}/../.."
|
|
23
|
+
argv = ARGV
|
|
24
|
+
|
|
25
|
+
if argv.empty?
|
|
26
|
+
puts self.usage
|
|
27
|
+
@@dont_show_output = true
|
|
28
|
+
argv = ['start'] # So it continues on and starts server
|
|
29
|
+
elsif argv.length == 1 && ['status', 'stop', 'restart'].member?(argv[0])
|
|
30
|
+
return self.ctrl argv[0]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
flags, path = argv.partition{|o| o =~ /^-/}
|
|
34
|
+
path = path.join ' '
|
|
35
|
+
|
|
36
|
+
return self.emacs path if flags.member?("-e") # If -p, just prompt user to type a menu name
|
|
37
|
+
|
|
38
|
+
wasnt_running = false
|
|
39
|
+
|
|
40
|
+
begin
|
|
41
|
+
`mkfifo -m 666 /tmp/xikirequest` if ! File.exists?("/tmp/xikirequest") # Always create first, so they have to be pipes and can't be files
|
|
42
|
+
`mkfifo -m 666 /tmp/xikiresponse` if ! File.exists?("/tmp/xikiresponse")
|
|
43
|
+
|
|
44
|
+
# Try writing to pipe...
|
|
45
|
+
|
|
46
|
+
open("/tmp/xikirequest", 'w+') do |out|
|
|
47
|
+
out.puts path
|
|
48
|
+
out.flush # do this when we're done writing data
|
|
49
|
+
out.close
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Try reading from pipe...
|
|
53
|
+
|
|
54
|
+
response = self.get_response
|
|
55
|
+
return response
|
|
56
|
+
|
|
57
|
+
rescue Exception=>e
|
|
58
|
+
|
|
59
|
+
# If error, remember we have to start the process...
|
|
60
|
+
|
|
61
|
+
if e.is_a?(Timeout::Error) || (e.is_a?(Errno::ENOENT) && e.to_s =~ /\/tmp\/xiki/)
|
|
62
|
+
# Seems like process hasn't been started, so keep going
|
|
63
|
+
wasnt_running = true
|
|
64
|
+
else
|
|
65
|
+
Ol << "Unknown error when trying to call pipe!"
|
|
66
|
+
Ol << "#{e.to_s}\n#{e.backtrace.join "\n"}"
|
|
67
|
+
return
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
process_succeeded = false
|
|
72
|
+
|
|
73
|
+
if wasnt_running
|
|
74
|
+
|
|
75
|
+
# Start the process...
|
|
76
|
+
|
|
77
|
+
require 'daemons'
|
|
78
|
+
|
|
79
|
+
begin
|
|
80
|
+
|
|
81
|
+
# Shell out as async to start it instead - don't know fucking how
|
|
82
|
+
|
|
83
|
+
pid_orig = Process.pid
|
|
84
|
+
|
|
85
|
+
@@initial_request = path
|
|
86
|
+
xiki_process = "#{xiki_root}/etc/command/xiki_process.rb"
|
|
87
|
+
Daemons.run xiki_process, :ARGV=>['start'], :monitor=>false, :multiple=>false #, :app_name=>'xiki'
|
|
88
|
+
# Daemons.run '../etc/command/xiki_process.rb', :ARGV=>['start'], :monitor=>false, :multiple=>false #, :app_name=>'xiki'
|
|
89
|
+
# Daemons.run 'etc/process/xiki_process.rb', :ARGV=>['start'], :monitor=>false, :multiple=>false #, :app_name=>'xiki'
|
|
90
|
+
# Daemons.run '../etc/process/xiki_process.rb', :ARGV=>['start'], :monitor=>false, :multiple=>false #, :app_name=>'xiki'
|
|
91
|
+
# Daemons.run 'xiki_daemon.rb', :ARGV=>['start'], :monitor=>false, :multiple=>false #, :app_name=>'xiki'
|
|
92
|
+
|
|
93
|
+
# Aparently this line never gets reached
|
|
94
|
+
"- Started the process, I think."
|
|
95
|
+
rescue SystemExit=>e
|
|
96
|
+
raise SystemExit.new if pid_orig != Process.pid # If new process that started, just exit
|
|
97
|
+
|
|
98
|
+
process_succeeded = true
|
|
99
|
+
|
|
100
|
+
rescue Exception=>e
|
|
101
|
+
puts "- service couldn't start!"
|
|
102
|
+
|
|
103
|
+
#rescue ... <Errno::EACCES: Permission denied - /projects/xiki/etc/command/xiki_process.rb.pid>!
|
|
104
|
+
end
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
if process_succeeded
|
|
108
|
+
puts self.get_response # Get response first time
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
raise SystemExit.new
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def self.get_response
|
|
115
|
+
|
|
116
|
+
# Simulate timeout error if process not running
|
|
117
|
+
process_running = `ps -e` =~ /xiki_process.rb/
|
|
118
|
+
if ! process_running
|
|
119
|
+
raise Timeout::Error
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# TODO: what if menu takes longer than 3 seconds to run?
|
|
123
|
+
|
|
124
|
+
# TODO: have process send ACK, so we can make timout short
|
|
125
|
+
|
|
126
|
+
timeout(3) do
|
|
127
|
+
# timeout(0.5) do
|
|
128
|
+
# timeout(1.5) do
|
|
129
|
+
open("/tmp/xikiresponse", "r+") do |response|
|
|
130
|
+
|
|
131
|
+
# old TODO Try using select here, to see if there's data avaliable
|
|
132
|
+
# old IO.select ["/tmp/xikiresponse"]
|
|
133
|
+
|
|
134
|
+
response = response.gets # will block if there's nothing in the pipe
|
|
135
|
+
|
|
136
|
+
response.strip!
|
|
137
|
+
response.gsub! "\036", "\n" # Escape linebreaks as 036 char (record separator)
|
|
138
|
+
response = "" if @@dont_show_output
|
|
139
|
+
response
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def self.usage
|
|
145
|
+
%`
|
|
146
|
+
> Summary
|
|
147
|
+
This command runs xiki menus, which come from simple files
|
|
148
|
+
found in ~/menus/.
|
|
149
|
+
|
|
150
|
+
> Show all menus
|
|
151
|
+
% xiki all
|
|
152
|
+
|
|
153
|
+
> Examples
|
|
154
|
+
Call 'ip' menu
|
|
155
|
+
% xiki ip
|
|
156
|
+
% xiki animals
|
|
157
|
+
% xiki tables
|
|
158
|
+
|
|
159
|
+
> Open 'ip' menu in emacs
|
|
160
|
+
% xiki -e ip
|
|
161
|
+
|
|
162
|
+
> Run under current dir
|
|
163
|
+
% xiki -e @git
|
|
164
|
+
|
|
165
|
+
> Service
|
|
166
|
+
Xiki automatically runs a service in the backgroundto keep
|
|
167
|
+
things fast.
|
|
168
|
+
|
|
169
|
+
% xiki # With no args, it starts the service.
|
|
170
|
+
% xiki status
|
|
171
|
+
% xiki stop
|
|
172
|
+
% xiki restart
|
|
173
|
+
`.unindent
|
|
174
|
+
end
|
|
175
|
+
|
|
176
|
+
def self.ctrl action
|
|
177
|
+
require 'daemons'
|
|
178
|
+
xiki_root = File.expand_path "#{File.dirname(__FILE__)}/../.."
|
|
179
|
+
xiki_process = "#{xiki_root}/etc/command/xiki_process.rb"
|
|
180
|
+
Daemons.run(xiki_process, :ARGV=>[action])
|
|
181
|
+
""
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
#
|
|
185
|
+
# Tells emacs to open and display menu.
|
|
186
|
+
#
|
|
187
|
+
def self.emacs menu
|
|
188
|
+
|
|
189
|
+
# Bring emacs to front
|
|
190
|
+
|
|
191
|
+
`open "/Applications/Aquamacs Emacs.app"`
|
|
192
|
+
|
|
193
|
+
ruby = %`Menu.external \\"#{menu}\\"`
|
|
194
|
+
ruby << %`, :dir=>\\"#{Dir.pwd}\\"` if menu =~ /^@/
|
|
195
|
+
|
|
196
|
+
command = %`emacsclient -n -e '(el4r-ruby-eval "#{ruby}")'`
|
|
197
|
+
`#{command}`
|
|
198
|
+
|
|
199
|
+
nil
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
end
|
|
203
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Don't hard-code, generate with script? - or use __file path xiki env var!
|
|
2
|
+
require '/projects/xiki/lib/ol'
|
|
3
|
+
require 'core_ext'
|
|
4
|
+
|
|
5
|
+
require 'menu'
|
|
6
|
+
|
|
7
|
+
require 'launcher'
|
|
8
|
+
|
|
9
|
+
Xiki.init
|
|
10
|
+
|
|
11
|
+
# Make named pipes for input and output
|
|
12
|
+
|
|
13
|
+
class XikiProcess
|
|
14
|
+
|
|
15
|
+
def self.run
|
|
16
|
+
|
|
17
|
+
open('/tmp/xikirequest', 'r+') do |f|
|
|
18
|
+
|
|
19
|
+
open('/tmp/xikiresponse', 'w+') do |response|
|
|
20
|
+
loop do
|
|
21
|
+
|
|
22
|
+
# Read request...
|
|
23
|
+
|
|
24
|
+
path = XikiCommand.pop_initial_request || f.gets
|
|
25
|
+
path.strip!
|
|
26
|
+
|
|
27
|
+
# Invoke menu and send response...
|
|
28
|
+
|
|
29
|
+
menu_output =
|
|
30
|
+
begin
|
|
31
|
+
Menu[path]
|
|
32
|
+
rescue Exception=>e
|
|
33
|
+
"#{e.message}\n#{e.backtrace.join("\n")}"
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
if menu_output.nil?
|
|
37
|
+
menu_output = ""
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
menu_output.gsub! "\n", "\036" # Escape linebreaks as 036 char (record separator)
|
|
41
|
+
response.puts menu_output
|
|
42
|
+
response.flush
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
rescue Exception=>e
|
|
48
|
+
puts "#{e.message}\n#{e.backtrace}"
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
XikiProcess.run
|
data/etc/js/menu1.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
$(function(){
|
|
2
|
+
xiki_txt = Xiki.unindent($('div[data-xiki=menu]').html());
|
|
3
|
+
// Render jquery mobile interface
|
|
4
|
+
|
|
5
|
+
$('body').html(Xiki.render_mobile_standalone());
|
|
6
|
+
|
|
7
|
+
// Grab children from txt and add menu for each
|
|
8
|
+
var children = Xiki.children(xiki_txt, "");
|
|
9
|
+
var html = Xiki.children_to_html(children);
|
|
10
|
+
// console.log("html:", html)
|
|
11
|
+
console.log(".ui-content:", $(".ui-content").length)
|
|
12
|
+
|
|
13
|
+
$("div[data-role=content]").html(html);
|
|
14
|
+
// $(".ui-content").trigger("create");
|
|
15
|
+
|
|
16
|
+
// $(".ui-page").trigger("create");
|
|
17
|
+
|
|
18
|
+
$(document).bind( "pagebeforechange", function(e, data) {
|
|
19
|
+
|
|
20
|
+
if(typeof data.toPage != "string") return;
|
|
21
|
+
|
|
22
|
+
var hash_orig = data.toPage.replace(/.+?(#|$)/, '');
|
|
23
|
+
var hash = hash_orig.replace(/,/g, '/');
|
|
24
|
+
|
|
25
|
+
Xiki.navigate(e, data, Xiki.children(xiki_txt, hash));
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// Old
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
// $("body").trigger("create");
|
|
36
|
+
|
|
37
|
+
// $('div:eq(0)').html("abc");
|
|
38
|
+
// $('body').html("abc");
|
|
39
|
+
|
|
40
|
+
// $(".ui-content").blink();
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
// $('body').html(Xiki.render_mobile_standalone());
|
|
44
|
+
// $("div:first").trigger("create");
|
|
45
|
+
// $("div:first").page();
|
|
46
|
+
// $("div:first").blink();
|
|
47
|
+
|
|
48
|
+
// $(".ui-page").page();
|
|
49
|
+
// $(".ui-page").trigger("refresh");
|
|
50
|
+
// $("div[data-role=header]").trigger("create");
|
|
51
|
+
// $(".ui-page").trigger("refresh");
|
|
52
|
+
|
|
53
|
+
// TODO: pass to xiki.children()
|
|
54
|
+
// $('div[data-xiki=menu]').blink();
|
|
55
|
+
})
|