Permalink
Browse files

Ruby 1.9: many fixes. Welcome: made it appear the first time you use …

…xiki.
  • Loading branch information...
trogdoro committed Aug 26, 2012
1 parent 707bb8a commit af04a9019d652b52c5353795df87b0e2870be625
Showing with 999 additions and 1,488 deletions.
  1. +1 −11 Gemfile
  2. +7 −3 README.markdown
  3. +110 −36 etc/command/xiki_command.rb
  4. +5 −0 etc/install/el4r_setup.sh
  5. +8 −0 etc/themes/Black_BG.notes
  6. +0 −6 etc/themes/Dark_Metal.notes
  7. +24 −0 etc/themes/Default.notes
  8. +1 −1 etc/themes/Orange_Path.notes
  9. +14 −18 etc/themes/Shiny_Blue.notes
  10. +0 −6 etc/themes/Shiny_Green.notes
  11. +5 −0 etc/themes/White_BG.notes
  12. +2 −2 etc/wrappers/wrapper.rb
  13. +1 −1 etc/www/index.rb
  14. +0 −249 etc/www/web_server.rb
  15. +5 −0 etc/xiki.org/xiki_bootstrap_source.notes
  16. +0 −709 lib/menu.rb
  17. +75 −10 lib/xiki.rb
  18. +9 −8 lib/xiki/bookmarks.rb
  19. +10 −10 lib/xiki/buffers.rb
  20. +2 −6 lib/xiki/code.rb
  21. +1 −1 lib/xiki/code_tree.rb
  22. +2 −12 lib/xiki/color.rb
  23. +6 −0 lib/xiki/console.rb
  24. +5 −1 lib/xiki/control_lock.rb
  25. +3 −1 lib/xiki/control_tab.rb
  26. +6 −2 lib/xiki/core_ext.rb
  27. +4 −5 lib/xiki/cursor.rb
  28. +3 −3 lib/xiki/diff_log.rb
  29. +4 −1 lib/xiki/effects.rb
  30. +30 −20 lib/xiki/file_tree.rb
  31. +15 −5 lib/xiki/files.rb
  32. +1 −0 lib/xiki/history.rb
  33. +7 −4 lib/xiki/key_bindings.rb
  34. +27 −31 lib/xiki/keys.rb
  35. +36 −19 lib/xiki/launcher.rb
  36. +1 −1 lib/xiki/line.rb
  37. +62 −11 lib/xiki/menu.rb
  38. +25 −34 lib/xiki/notes.rb
  39. +2 −3 lib/xiki/ol.rb
  40. +1 −1 lib/xiki/pause_means_space.rb
  41. +8 −1 lib/xiki/projects.rb
  42. +1 −1 lib/xiki/remote.rb
  43. +2 −2 lib/xiki/requirer.rb
  44. +3 −4 lib/xiki/search.rb
  45. +8 −72 lib/xiki/styles.rb
  46. +39 −31 lib/xiki/tree.rb
  47. +39 −16 lib/xiki/view.rb
  48. +6 −4 menus/address_book.rb
  49. +21 −10 menus/applescript.rb
  50. +1 −0 menus/black.menu
  51. +2 −7 menus/bootstrap.rb
  52. +8 −5 menus/browser.rb
  53. +5 −0 menus/conf.rb
  54. +30 −0 menus/dimensions_config.menu
  55. +5 −0 menus/dimensions_config.rb
  56. +33 −34 menus/docs.rb
  57. +1 −0 menus/dotsies.rb
  58. +7 −2 menus/emacs.rb
  59. +2 −2 menus/gito.rb
  60. +2 −2 menus/ip.rb
  61. +9 −2 menus/itunes.rb
  62. +3 −1 menus/javascript.rb
  63. +4 −4 menus/local_storage.rb
  64. +2 −2 menus/mongo.rb
  65. +47 −23 menus/piano.rb
  66. +57 −0 menus/r.rb
  67. +88 −26 menus/rails.rb
  68. +2 −0 menus/settings.menu
  69. +4 −1 menus/technologies.rb
  70. +18 −0 menus/welcome.menu
  71. +1 −0 menus/white.menu
  72. +21 −5 xiki.gemspec
View
12 Gemfile
@@ -1,13 +1,3 @@
source 'https://rubygems.org'
-gem 'ruby2ruby'
-gem 'ParseTree'
-gem 'httparty'
-gem 'activesupport'
-gem 'method_source'
-gem 'net-ssh'
-gem 'net-ssh'
-gem 'rspec'
-gem 'memcached'
-gem 'el4r'
-
+gemspec
View
@@ -7,21 +7,24 @@ Either install as a gem, or install from github.
## As a gem
- $ gem install xiki --pre
+ $ sudo gem install xiki --pre
## Or, from github
$ git clone git@github.com:trogdoro/xiki.git
$ cd xiki
+ $ gem install bundler
$ bundle install --system
$ cp <xiki dir>/etc/command/xiki_wrapper /usr/local/bin/xiki
$ chmod 755 /usr/local/bin/xiki
+If you don't have permission, to run some of the commands put "sudo" at the beginning of the command.
+
# Verify the 'xiki' shell command works
$ xiki
-It should delay slightly the first time, but be fast subsequent times.
+It should delay slightly the first time, but be fast subsequent times. If you run into errors and then fix them, you'll want to run the "xiki restart" command.
# Configure your editor to use Xiki
@@ -70,13 +73,14 @@ Sample configuration:
Xiki.init
KeyBindings.keys # Use default key bindings
- Themes.use "Default" # Use xiki coloring
+ Themes.use "Default" # Use xiki theme
Be sure to substitute "&lt;xiki dir&gt;" with the actual dir.
### If you get an error
If you got partially through the load...
+
- You may be able to use these keys to trouble-shoot:
- Option+e to look at the latest error in the log
- Option+l to reload xiki and .emacs
View
@@ -23,7 +23,7 @@ def self.run
argv = ARGV
if argv.empty?
- puts self.usage
+ puts "#{self.usage}\n"
@@dont_show_output = true
argv = ['start'] # So it continues on and starts server
elsif argv.length == 1 && ['status', 'stop', 'restart'].member?(argv[0])
@@ -38,8 +38,8 @@ def self.run
wasnt_running = false
begin
- `mkfifo -m 666 /tmp/xikirequest` if ! File.exists?("/tmp/xikirequest") # Always create first, so they have to be pipes and can't be files
- `mkfifo -m 666 /tmp/xikiresponse` if ! File.exists?("/tmp/xikiresponse")
+ `mkfifo -m 600 /tmp/xikirequest` if ! File.exists?("/tmp/xikirequest") # Always create first, so they have to be pipes and can't be files
+ `mkfifo -m 600 /tmp/xikiresponse` if ! File.exists?("/tmp/xikiresponse")
# Try writing to pipe...
@@ -126,45 +126,68 @@ def self.get_response
# old IO.select ["/tmp/xikiresponse"]
response = response.gets # will block if there's nothing in the pipe
-
response.strip!
response.gsub! "\036", "\n" # Escape linebreaks as 036 char (record separator)
- response = "" if @@dont_show_output
- response
+ return "" if @@dont_show_output
+ self.add_coloring response
end
end
end
def self.usage
- %`
- > Summary
- This command runs xiki menus, which come from simple files
- found in ~/menus/.
-
- > Show all menus
- % xiki all
-
- > Examples
- Call 'ip' menu
- % xiki ip
- % xiki animals
- % xiki tables
-
- > Open 'ip' menu in emacs
- % xiki -e ip
-
- > Run under current dir
- % xiki -e @git
-
- > Service
- Xiki automatically runs a service in the backgroundto keep
- things fast.
-
- % xiki # With no args, it starts the service.
- % xiki status
- % xiki stop
- % xiki restart
- `.unindent
+ txt = %`
+ > Summary
+ The 'xiki' shell command is mostly meant to be called by programs
+ that want to interface with xiki. But it is sometimes useful for
+ people to call it directly. Example usages:
+
+ $ xiki ip
+ $ xiki docs/faq
+
+ > Setting up your editor
+ The most common way to use Xiki is from a text editor. For
+ example, typing "tables" on any blank line and double-clicking on
+ it (or typing control-enter or command-enter) to browse and update
+ your mysql database.
+
+ See this file for help setting up your editor:
+
+ $xiki/README.markdown
+
+ > Service
+ The 'xiki' shell command automatically runs a service in the
+ backgroundto keep things fast.
+
+ % xiki status
+ % xiki stop
+ % xiki restart
+
+ > Interfaces
+ Xiki can be used from...
+ - A text editor
+ - The 'xiki' shell command
+ - The http://xiki/ url in your browser (experimental)
+
+ For more information type:
+
+ $ xiki docs
+
+ > Google Group
+ Join the google group for help with installing, or just to chat or
+ share your ideas:
+
+ http://groups.google.com/group/xiki/
+
+ > Troubleshooting
+ Be sure to run this command to install required gems:
+
+ % bundle install
+
+ Also see $xiki/README.markdown
+
+ `.unindent
+
+ self.add_coloring txt
end
def self.ctrl action
@@ -193,5 +216,56 @@ def self.emacs menu
nil
end
-end
+ def self.add_coloring txt
+ return txt if ! STDOUT.tty?
+ txt.gsub!(/.+/) do |line|
+ case line
+ when /^(>) (.+)/
+ "#{self.heading_bracket $1} #{self.bold $2}"
+ when /^http:\/\/.+/
+ "#{self.url $&}"
+ when /^.+\/$/
+ "#{self.path $&}"
+ when /^( *- )(.*!)$/
+ "#{self.bullet $1}#{self.exclamation $2}"
+ when /^( *)(- )(.+: )(.+)/
+ "#{$1}#{self.bullet $2}#{self.label $3}#{$4}"
+ when /^( *)(- )(.+)/
+ "#{$1}#{self.bullet $2}#{$3}"
+
+ else
+ line
+ end
+ end
+
+ txt << "\n" # Add extra linebreak, but only when in console
+ txt
+ end
+
+ def self.colorize txt, color_code
+ "\e[#{color_code}m#{txt}\e[0m"
+ end
+ def self.bullet txt
+ self.colorize txt, "1;31" # Red # colorize("1;91") # Red
+ end
+ def self.label txt
+ self.colorize txt, "1;33" # Yellow
+ end
+ def self.path txt
+ colorize(txt, "1;90")
+ end
+ def self.url txt
+ colorize(txt, "1;36") # Cyan
+ end
+ def self.heading_bracket txt
+ colorize(txt, "0;37")
+ end
+ def self.bold txt
+ colorize(txt, "1")
+ end
+ def self.exclamation txt
+ colorize(txt, "1;32") # Green
+ end
+
+end
@@ -0,0 +1,5 @@
+cd `dirname \`gem contents trogdoro-el4r | grep setup.rb\``
+ruby setup.rb
+cd bin/
+ruby -S el4r-rctool -p
+ruby -S el4r-rctool -i
@@ -0,0 +1,8 @@
+$el.set_face_background :trailing_whitespace, "#333333"
+
+Styles.define :default, :bg=>'151515', :fg=>'fff'
+Styles.define :fringe, :bg=>'151515', :fg=>'111111'
+
+Styles.minibuffer_prompt :size=>110, :face=>"Monaco", :fg=>"#bbb"
+Styles.minibuffer :size=>110, :face=>"Monaco"
+Styles.echo_area :size=>110, :face=>"Monaco"
@@ -14,12 +14,6 @@ Styles.mode_line_inactive(
:bold=>false,
:fg=>'000'
)
-Styles.mode_line_dir(
- :fg=>"777",
- :size=>"0",
- :face=>"arial",
- :bold=>false
- )
Styles.mode_line_file(
:fg=>"fff",
:size=>"0",
View
@@ -0,0 +1,24 @@
+Themes.use "Black BG"
+Themes.use "Shiny Blue"
+Themes.use "Path Mode Line"
+
+$el.el4r_lisp_eval %`
+ (progn
+ (tool-bar-mode -1) ; Turn off the toolbar
+
+ (custom-set-variables
+ '(tabbar-mode nil) ; No tabs
+ '(cua-rectangle-mark-key (kbd "<C-S-return>")) ; No tabs
+ ;; '(tabbar-mode t) ; No tabs
+ ;; '(show-paren-mode nil)
+ )
+
+ (set-face-attribute 'region nil :background "#333333" :foreground "#ffffff") ;; More mac-like selection color
+
+ (setq-default
+ frame-title-format
+ '("%b"))
+
+ (setq frame-title-format '("%b" ))
+ )
+ `
@@ -1,4 +1,4 @@
-if Styles.inverse # Black bg
+if Styles.dark_bg? # Black bg
Styles.mode_line :bg=>'333', :border=>['666', -1], :face=>'Lucida Grande', :size=>'3', :bold=>false, :fg=>'fff'
Styles.mode_line_inactive :bg=>'666', :border=>['888', -1], :face=>'Lucida Grande', :size=>'3', :bold=>false, :fg=>'fff'
@@ -1,27 +1,23 @@
Styles.mode_line(
- :bg=>'5483bf',
- :border=>['6593b3', -5, 'released-button'],
- :face=>'Lucida Grande',
- :size=>'3',
- :bold=>false,
- :fg=>'fff'
+ :bg=>'6483af',
+ :border=>['6483af', 3],
+ :face=>"arial",
+ :bold=>true,
+ :size=>'1',
+ :fg=>'001122'
)
+
Styles.mode_line_inactive(
- :bg=>'bbb',
- :border=>['bbbbbb', -1],
- :face=>'Lucida Grande',
- :bold=>false,
- :fg=>'000'
- )
-Styles.mode_line_dir(
- :fg=>"222222",
- :size=>"0",
+ :bg=>'bbbbbb',
+ :border=>['bbbbbb', 3],
:face=>"arial",
- :bold=>false
+ :bold=>true,
+ :size=>'1',
+ :fg=>'555555'
)
+
Styles.mode_line_file(
:fg=>"fff",
- :size=>"0",
:face=>"arial",
- :bold=>false
+ :bold=>true
)
@@ -13,12 +13,6 @@ Styles.mode_line_inactive(
:bold=>false,
:fg=>'000'
)
-Styles.mode_line_dir(
- :fg=>"222222",
- :size=>"0",
- :face=>"arial",
- :bold=>false
- )
Styles.mode_line_file(
:fg=>"fff",
:size=>"0",
@@ -0,0 +1,5 @@
+$el.set_face_background :trailing_whitespace, "#aaaaaa"
+
+Styles.define :default, :bg=>'f8f8f8', :fg=>'000'
+Styles.define :fringe, :bg=>'f8f8f8', :fg=>'f8f8f8'
+
View
@@ -1,8 +1,8 @@
# Gets shelled out to by xiki to delegate call to a no-dependency .rb file.
# Just gets the args passed in and requires and invokes.
-# TODO Don't hard-code path
-require "/projects/xiki/lib/ol.rb"
+# TODO Don't hard-code path - use __FILE__?
+# require "/projects/xiki/lib/xiki/ol.rb"
file = ARGV.shift
path = ARGV.shift
View
@@ -2,7 +2,7 @@
print "Content-type: text/html\n\n";
-require "/projects/xiki/lib/ol.rb"
+require "../../lib/xiki/ol.rb"
require "web_server"
require "cgi"
WebServer.index
Oops, something went wrong.

0 comments on commit af04a90

Please sign in to comment.