xiki 0.5.1a → 0.5.3a
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -11
- data/README.markdown +67 -43
- data/bin/xiki +2 -15
- data/etc/command/xiki_command.rb +115 -41
- data/etc/command/xiki_process.rb +3 -7
- data/etc/install/el4r_setup.sh +5 -0
- data/etc/themes/Black_BG.notes +8 -0
- data/etc/themes/Dark_Metal.notes +0 -6
- data/etc/themes/Default.notes +24 -0
- data/etc/themes/Fall_Fonts.notes +6 -0
- data/etc/themes/Light_Gray_BG_Theme.notes +6 -0
- data/etc/themes/Orange_Path.notes +1 -1
- data/etc/themes/Pastel_Fonts.notes +6 -0
- data/etc/themes/Path_Mode_Line.notes +36 -0
- data/etc/themes/Rainbow_Fonts.notes +20 -0
- data/etc/themes/Shiny_Blue.notes +14 -18
- data/etc/themes/Shiny_Green.notes +0 -6
- data/etc/themes/White_BG.notes +5 -0
- data/etc/vim/vim_status.notes +32 -0
- data/etc/vim/xiki.vim +16 -0
- data/etc/wrappers/wrapper.rb +2 -2
- data/etc/www/index.rb +1 -1
- data/etc/www/public/error.html +47 -0
- data/etc/www/sinatra_server.rb +353 -0
- data/etc/www/web_server.rb +0 -252
- data/lib/xiki.rb +94 -26
- data/lib/{block.rb → xiki/block.rb} +0 -0
- data/lib/{bookmarks.rb → xiki/bookmarks.rb} +11 -10
- data/lib/{buffers.rb → xiki/buffers.rb} +10 -10
- data/lib/{clipboard.rb → xiki/clipboard.rb} +2 -2
- data/lib/{code.rb → xiki/code.rb} +3 -7
- data/lib/{code_tree.rb → xiki/code_tree.rb} +3 -3
- data/lib/{color.rb → xiki/color.rb} +4 -14
- data/lib/{console.rb → xiki/console.rb} +6 -0
- data/lib/{control_lock.rb → xiki/control_lock.rb} +5 -1
- data/lib/{control_tab.rb → xiki/control_tab.rb} +3 -1
- data/lib/{core_ext.rb → xiki/core_ext.rb} +7 -3
- data/lib/{cursor.rb → xiki/cursor.rb} +4 -5
- data/lib/{deletes.rb → xiki/deletes.rb} +0 -0
- data/lib/{diff_log.rb → xiki/diff_log.rb} +4 -4
- data/lib/{effects.rb → xiki/effects.rb} +5 -2
- data/lib/{environment.rb → xiki/environment.rb} +0 -0
- data/lib/{file_tree.rb → xiki/file_tree.rb} +34 -24
- data/lib/{files.rb → xiki/files.rb} +15 -5
- data/lib/{hide.rb → xiki/hide.rb} +0 -0
- data/lib/{history.rb → xiki/history.rb} +1 -0
- data/lib/{image.rb → xiki/image.rb} +0 -0
- data/lib/{incrementer.rb → xiki/incrementer.rb} +0 -0
- data/lib/{insert.rb → xiki/insert.rb} +0 -0
- data/lib/{irc.rb → xiki/irc.rb} +0 -0
- data/lib/{key_bindings.rb → xiki/key_bindings.rb} +7 -4
- data/lib/{keys.rb → xiki/keys.rb} +32 -36
- data/lib/{launcher.rb → xiki/launcher.rb} +42 -23
- data/lib/{line.rb → xiki/line.rb} +1 -1
- data/lib/{links.rb → xiki/links.rb} +0 -0
- data/lib/{location.rb → xiki/location.rb} +0 -0
- data/lib/{macros.rb → xiki/macros.rb} +0 -0
- data/lib/{man.rb → xiki/man.rb} +0 -0
- data/lib/{menu.rb → xiki/menu.rb} +62 -11
- data/lib/{merb.rb → xiki/merb.rb} +1 -1
- data/lib/{message.rb → xiki/message.rb} +0 -0
- data/lib/{meths.rb → xiki/meths.rb} +0 -0
- data/lib/{mode.rb → xiki/mode.rb} +0 -0
- data/lib/{move.rb → xiki/move.rb} +1 -1
- data/lib/{notes.rb → xiki/notes.rb} +41 -37
- data/lib/{numbers.rb → xiki/numbers.rb} +0 -0
- data/lib/{ol.rb → xiki/ol.rb} +2 -3
- data/lib/{ol_helper.rb → xiki/ol_helper.rb} +0 -0
- data/lib/{overlay.rb → xiki/overlay.rb} +0 -0
- data/lib/{pause_means_space.rb → xiki/pause_means_space.rb} +2 -2
- data/lib/{php.rb → xiki/php.rb} +0 -0
- data/lib/{projects.rb → xiki/projects.rb} +8 -1
- data/lib/{relinquish_exception.rb → xiki/relinquish_exception.rb} +0 -0
- data/lib/{remote.rb → xiki/remote.rb} +2 -2
- data/lib/{requirer.rb → xiki/requirer.rb} +3 -3
- data/lib/{rest_tree.rb → xiki/rest_tree.rb} +0 -0
- data/lib/{ruby.rb → xiki/ruby.rb} +0 -0
- data/lib/{ruby_console.rb → xiki/ruby_console.rb} +0 -0
- data/lib/{search.rb → xiki/search.rb} +7 -8
- data/lib/{search_term.rb → xiki/search_term.rb} +0 -0
- data/lib/{snippet.rb → xiki/snippet.rb} +0 -0
- data/lib/{specs.rb → xiki/specs.rb} +0 -0
- data/lib/{styles.rb → xiki/styles.rb} +8 -72
- data/lib/{svn.rb → xiki/svn.rb} +0 -0
- data/lib/{text_util.rb → xiki/text_util.rb} +2 -2
- data/lib/{tree.rb → xiki/tree.rb} +40 -32
- data/lib/{tree_cursor.rb → xiki/tree_cursor.rb} +0 -0
- data/lib/{trouble_shooting.rb → xiki/trouble_shooting.rb} +0 -0
- data/lib/{url_tree.rb → xiki/url_tree.rb} +0 -0
- data/lib/{view.rb → xiki/view.rb} +39 -16
- data/lib/xiki/vim/line.rb +8 -0
- data/lib/xiki/vim/tree.rb +9 -0
- data/lib/{window.rb → xiki/window.rb} +0 -0
- data/menus/address_book.rb +6 -4
- data/menus/agenda.rb +3 -3
- data/menus/amazon.rb +2 -2
- data/menus/applescript.rb +21 -10
- data/menus/black.menu +1 -0
- data/menus/bootstrap.rb +2 -7
- data/menus/browser.rb +8 -5
- data/menus/cassandra_db.rb +2 -2
- data/menus/chmod.rb +1 -1
- data/menus/conf.rb +5 -0
- data/menus/cookies.rb +1 -1
- data/menus/css.rb +2 -2
- data/menus/deck.rb +1 -1
- data/menus/dimensions_config.menu +30 -0
- data/menus/dimensions_config.rb +5 -0
- data/menus/docs.rb +33 -34
- data/menus/dotsies.rb +1 -0
- data/menus/emacs.rb +7 -2
- data/menus/firefox.rb +25 -25
- data/menus/git.rb +1 -1
- data/menus/gito.rb +2 -2
- data/menus/headings.rb +3 -3
- data/menus/ip.rb +2 -4
- data/menus/itunes.rb +9 -2
- data/menus/javascript.rb +3 -1
- data/menus/local_storage.rb +4 -4
- data/menus/mac.rb +2 -1
- data/menus/maps.rb +2 -2
- data/menus/models.rb +31 -0
- data/menus/mongo.rb +2 -2
- data/menus/piano.rb +47 -23
- data/menus/r.rb +57 -0
- data/menus/rails.rb +89 -27
- data/menus/redmine.rb +1 -1
- data/menus/sass.rb +1 -1
- data/menus/settings.menu +2 -0
- data/menus/technologies.rb +4 -1
- data/menus/web_interface.rb +58 -0
- data/menus/welcome.menu +18 -0
- data/menus/white.menu +1 -0
- data/menus/youtube.rb +32 -0
- data/spec/code_tree_spec.rb +1 -1
- data/spec/diff_log_spec.rb +4 -4
- data/spec/file_tree_spec.rb +2 -2
- data/spec/line_spec.rb +2 -2
- data/spec/menu_spec.rb +5 -5
- data/spec/ol_spec.rb +3 -3
- data/spec/remote_spec.rb +2 -2
- data/spec/search_spec.rb +2 -2
- data/spec/text_util_spec.rb +1 -1
- data/spec/tree_cursor_spec.rb +3 -3
- data/spec/tree_spec.rb +3 -3
- data/xiki.gemspec +22 -6
- metadata +311 -76
- data/menus/dir.rb +0 -8
data/etc/www/web_server.rb
CHANGED
@@ -1,249 +1,7 @@
|
|
1
1
|
class WebServer
|
2
2
|
|
3
|
-
def self.htmlify txt, options={}
|
4
|
-
|
5
|
-
return txt if ENV['HTTP_ACCEPT'] !~ /\Atext\/html/ # Only process if request wants html
|
6
|
-
|
7
|
-
# If starts with <foo or @bootstrap, just render it as html or bootstrap...
|
8
|
-
|
9
|
-
if txt =~ /\A<\w/
|
10
|
-
return txt
|
11
|
-
elsif txt =~ /\A@bootstrap\/\n /
|
12
|
-
|
13
|
-
xiki_dir = File.expand_path "#{File.dirname(__FILE__)}/../.."
|
14
|
-
|
15
|
-
$:.unshift "#{xiki_dir}/lib"
|
16
|
-
["lib/core_ext", "lib/line", "lib/tree", "menus/bootstrap"].each{|o| require "#{xiki_dir}/#{o}"}
|
17
|
-
|
18
|
-
txt.slice! /.+\n/
|
19
|
-
txt = txt.unindent
|
20
|
-
|
21
|
-
txt = Bootstrap.process txt
|
22
|
-
|
23
|
-
return txt
|
24
|
-
end
|
25
|
-
|
26
|
-
# Turn menu text into html...
|
27
|
-
|
28
|
-
# TODO: should probably maintain indenting?
|
29
|
-
txt.gsub! /^ *\| ?/, ''
|
30
|
-
|
31
|
-
txt.gsub! /^( *)[+-]+ /, "\\1" # Get rid of bullets
|
32
|
-
txt.gsub! /> (.+)/, "<h1>\\1</h1>"
|
33
|
-
|
34
|
-
path = ENV['REQUEST_URI']# =~ /\/$/ ? "" : "#{ENV['REQUEST_URI']}/" # Use relative links if path ends in slash, otherwise use absolute
|
35
|
-
path = "#{path}/" if path !~ /\/$/
|
36
|
-
|
37
|
-
txt.gsub!(/^( *)(.+?)(\/?)$/){
|
38
|
-
all = $&
|
39
|
-
indent, item, slash = $1, $2, $3
|
40
|
-
next all if all =~ /<h/ || all !~ /\/$/
|
41
|
-
my_path = path
|
42
|
-
my_path = "/" if item.slice!(/^<< /)
|
43
|
-
my_path = "/" if item.slice!(/^@ ?/)
|
44
|
-
"#{indent}<a href=\"#{my_path}#{item}\">#{item.gsub '_', ' '}</a>"
|
45
|
-
} # no slash
|
46
|
-
|
47
|
-
txt.gsub!(/^ +/){" " * $&.length} # Get rid of bullets
|
48
|
-
|
49
|
-
txt.gsub!(/.+/){
|
50
|
-
all = $&
|
51
|
-
next all if all =~ /<h/
|
52
|
-
next "<p class='info'>#{all}</p>" if all !~ /^<a/ # Don't end in "/" - just informational
|
53
|
-
all
|
54
|
-
}
|
55
|
-
txt.gsub! /^$/, "<p class='blank'> </p>"
|
56
|
-
|
57
|
-
print %`
|
58
|
-
<style>
|
59
|
-
a {
|
60
|
-
text-decoration: none;
|
61
|
-
}
|
62
|
-
|
63
|
-
.content a.selected {
|
64
|
-
background: -moz-linear-gradient(center top, #58b, #7ad) repeat scroll 0 0 transparent;
|
65
|
-
}
|
66
|
-
.content a {
|
67
|
-
color: #666;
|
68
|
-
display: block;
|
69
|
-
|
70
|
-
border-radius: 2px;
|
71
|
-
border: solid 1px;
|
72
|
-
border-color: #eee #ddd #bbb #ddd;
|
73
|
-
background: -moz-linear-gradient(center top, #fff, #f1f1f1) repeat scroll 0 0 transparent;
|
74
|
-
background: -webkit-gradient(linear,center bottom,center top,from(#f1f1f1),to(#fff));
|
75
|
-
display: block;
|
76
|
-
padding: 10px 16px;
|
77
|
-
text-shadow: 0 1px 0 #fff;
|
78
|
-
font-weight: bold;
|
79
|
-
}
|
80
|
-
a:hover {
|
81
|
-
background: -moz-linear-gradient(center top, #f8f8f8, #e1e1e1) repeat scroll 0 0 transparent;
|
82
|
-
background: -webkit-gradient(linear,center bottom,center top,from(#e1e1e1),to(#f8f8f8));
|
83
|
-
}
|
84
|
-
body {
|
85
|
-
font-family: arial;
|
86
|
-
margin: 50px;
|
87
|
-
font-size: 15px;
|
88
|
-
color: #666;
|
89
|
-
line-height: 21px;
|
90
|
-
background-color: #f8f8f8;
|
91
|
-
}
|
92
|
-
p {
|
93
|
-
margin: 0;
|
94
|
-
}
|
95
|
-
.blank {
|
96
|
-
line-height: 12px;
|
97
|
-
}
|
98
|
-
/* Or type some css here (to run in the browser) */
|
99
|
-
h1 {
|
100
|
-
color: #000;
|
101
|
-
font-family: arial;
|
102
|
-
font-size: 16px;
|
103
|
-
font-weight: bold;
|
104
|
-
margin: 11px 0 7px;
|
105
|
-
}
|
106
|
-
.save {
|
107
|
-
margin: 0 20px 10px 20px;
|
108
|
-
font-size: 15px;
|
109
|
-
}
|
110
|
-
form {
|
111
|
-
margin: 0;
|
112
|
-
}
|
113
|
-
textarea {
|
114
|
-
border: solid #ccc 1px;
|
115
|
-
margin: 2px 20px 13px 20px;
|
116
|
-
padding: 7px;
|
117
|
-
width: 80%;
|
118
|
-
font-size: 15px;
|
119
|
-
color: #555;
|
120
|
-
height: 150px;
|
121
|
-
line-height: 20px;
|
122
|
-
}
|
123
|
-
.toggle {
|
124
|
-
font-size: 13px;
|
125
|
-
margin: 15px 20px 0px 20px;
|
126
|
-
font-weight: bold;
|
127
|
-
}
|
128
|
-
.toggle a {
|
129
|
-
color: #aaa;
|
130
|
-
}
|
131
|
-
.info {
|
132
|
-
margin: 0 0 6px;
|
133
|
-
}
|
134
|
-
pre {
|
135
|
-
font-weight: bold;
|
136
|
-
}
|
137
|
-
|
138
|
-
</style>
|
139
|
-
`
|
140
|
-
|
141
|
-
puts %`<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>`
|
142
|
-
|
143
|
-
if ! options[:no_keys]
|
144
|
-
print %`
|
145
|
-
<script>
|
146
|
-
filter_pattern = "";
|
147
|
-
started_searching = false;
|
148
|
-
$(function(){
|
149
|
-
|
150
|
-
$(window).focus(function () {
|
151
|
-
filter_pattern = "";
|
152
|
-
|
153
|
-
$('body').css("opacity", 1.0);
|
154
|
-
$('p, h1, a').show();
|
155
|
-
$('a').removeClass("selected");
|
156
|
-
});
|
157
|
-
|
158
|
-
$('body').keypress(function(e){
|
159
|
-
if(e.ctrlKey || e.altKey || e.metaKey) return;
|
160
|
-
var char = e.which;
|
161
|
-
var letter = String.fromCharCode(char).toLowerCase();
|
162
|
-
//console.log(char)
|
163
|
-
if(char == 13){
|
164
|
-
$("a:visible:eq(0)").click();
|
165
|
-
e.stopPropagation();
|
166
|
-
return false;
|
167
|
-
}
|
168
|
-
|
169
|
-
if(letter == " "){
|
170
|
-
if(started_searching) filter_pattern = "";
|
171
|
-
else window.location = "/";
|
172
|
-
e.stopPropagation();
|
173
|
-
return false;
|
174
|
-
}
|
175
|
-
|
176
|
-
if(! letter.match(/[0-9a-z]/)) return true;
|
177
|
-
|
178
|
-
started_searching = true;
|
179
|
-
filter_pattern += letter;
|
180
|
-
|
181
|
-
//console.log(filter_pattern);
|
182
|
-
|
183
|
-
// If more than 100, don't use fade
|
184
|
-
var count = $('p, h1, a').filter(':visible').length;
|
185
|
-
var fade = count < 50;
|
186
|
-
|
187
|
-
$('p, h1, a').each(function(i, e){
|
188
|
-
e = $(e);
|
189
|
-
if(e.is(":hidden")) return;
|
190
|
-
var html = e.html().replace(/<.+?>/g, '');
|
191
|
-
//console.log(html);
|
192
|
-
if(html.toLowerCase().indexOf(filter_pattern) == -1)
|
193
|
-
fade ? e.slideUp(400) : e.hide();
|
194
|
-
// Get content
|
195
|
-
// Remove tags
|
196
|
-
// Hide if remaining doesn't match regex (/on/)
|
197
|
-
})
|
198
|
-
|
199
|
-
});
|
200
|
-
|
201
|
-
$('a').click(function(e){
|
202
|
-
var target = $(e.target);
|
203
|
-
target.toggleClass("selected");
|
204
|
-
|
205
|
-
$('body').animate({opacity: 0.0}, {easing: 'swing', duration: 150});
|
206
|
-
window.setTimeout(function(){ window.location = target.attr('href'); }, 150);
|
207
|
-
return false;
|
208
|
-
});
|
209
|
-
|
210
|
-
})
|
211
|
-
</script>
|
212
|
-
`
|
213
|
-
end
|
214
|
-
|
215
|
-
"<div class='content'>#{txt}</div>"
|
216
|
-
end
|
217
|
-
|
218
|
-
|
219
|
-
def self.usage
|
220
|
-
txt = "
|
221
|
-
> Summary
|
222
|
-
This url displays xiki menus, which come from simple files found in ~/menus/.
|
223
|
-
|
224
|
-
> Show all menus
|
225
|
-
all/
|
226
|
-
|
227
|
-
> Examples
|
228
|
-
ip/
|
229
|
-
animals/
|
230
|
-
sharks/
|
231
|
-
tables/
|
232
|
-
|
233
|
-
> Create menu
|
234
|
-
Just go to the url of a menu that doesn't exist yet:
|
235
|
-
unicorn/
|
236
|
-
|
237
|
-
> Docs
|
238
|
-
docs/
|
239
|
-
".sub("\n", '').gsub(/^ /, '')
|
240
|
-
|
241
|
-
print WebServer.htmlify txt
|
242
|
-
|
243
|
-
end
|
244
3
|
|
245
4
|
def self.index
|
246
|
-
|
247
5
|
no_keys = false
|
248
6
|
|
249
7
|
if ENV['REQUEST_METHOD'] == "POST"
|
@@ -268,16 +26,8 @@ class WebServer
|
|
268
26
|
|
269
27
|
txt = `#{command}`
|
270
28
|
|
271
|
-
# rescue e=>Exception
|
272
|
-
# puts "<pre>#{e.message}\n#{e.backtrace}</pre>"
|
273
|
-
# Ol << "e: #{e.message}"
|
274
|
-
# Ol << "e: #{e.backtrace}"
|
275
|
-
# Ol << "If we get the permission problem, provide .notes file that will run command to run xiki command once (message explaining it first)!"
|
276
|
-
# end
|
277
|
-
|
278
29
|
# TODO: return different string when the service is down
|
279
30
|
|
280
|
-
# Ol << "Extract to new method: suggest_creating!!"
|
281
31
|
if txt.empty?
|
282
32
|
menu = menu.sub /\/$/, ''
|
283
33
|
|
@@ -339,8 +89,6 @@ class WebServer
|
|
339
89
|
txt = self.htmlify txt, :no_keys=>no_keys
|
340
90
|
print txt
|
341
91
|
|
342
|
-
# print "<pre>#{ENV.keys.map{|k| "#{k}: #{ENV[k]}"}.join("\n")}</pre>"
|
343
|
-
|
344
92
|
rescue Exception=>e
|
345
93
|
puts "<pre>#{e.message}\n#{e.backtrace}</pre>"
|
346
94
|
end
|
data/lib/xiki.rb
CHANGED
@@ -1,33 +1,38 @@
|
|
1
|
-
|
2
|
-
Dir.chdir
|
1
|
+
xiki_dir = File.expand_path "#{File.dirname(__FILE__)}/.."
|
2
|
+
Dir.chdir xiki_dir
|
3
3
|
|
4
4
|
# Used by a lot of classes
|
5
5
|
class Xiki
|
6
6
|
@@dir = "#{Dir.pwd}/" # Store current dir when xiki first launches
|
7
7
|
|
8
|
-
# TODO Just use
|
8
|
+
# TODO Just use XIKI_DIR from above?
|
9
9
|
|
10
10
|
def self.dir
|
11
11
|
@@dir
|
12
12
|
end
|
13
|
-
|
14
13
|
end
|
15
14
|
|
16
15
|
$el.el4r_lisp_eval '(ignore-errors (kill-buffer "Issues Loading Xiki"))' if $el
|
16
|
+
$el.set_process_query_on_exit_flag($el.get_buffer_process("*el4r:process*"), nil) if $el
|
17
|
+
|
17
18
|
|
19
|
+
# $LOAD_PATH << "#{xiki_dir}/lib"
|
18
20
|
# Require some of the core files
|
19
|
-
require 'trouble_shooting'
|
20
21
|
require 'rubygems'
|
21
|
-
require '
|
22
|
-
require '
|
23
|
-
require '
|
24
|
-
|
25
|
-
|
26
|
-
require '
|
27
|
-
require '
|
22
|
+
require 'xiki/trouble_shooting'
|
23
|
+
require 'xiki/ol'
|
24
|
+
require 'xiki/requirer'
|
25
|
+
require 'xiki/text_util'
|
26
|
+
Requirer.require_classes ['xiki/notes']
|
27
|
+
require 'xiki/launcher'
|
28
|
+
require 'xiki/mode'
|
29
|
+
require 'xiki/menu'
|
28
30
|
|
29
31
|
# Launcher.add_class_launchers classes
|
30
32
|
class Xiki
|
33
|
+
|
34
|
+
$el.elvar.xiki_loaded_once = nil if $el && ! $el.boundp(:xiki_loaded_once)
|
35
|
+
|
31
36
|
def self.menu
|
32
37
|
%`
|
33
38
|
- .tests/
|
@@ -73,6 +78,20 @@ class Xiki
|
|
73
78
|
- start/
|
74
79
|
- stop/
|
75
80
|
- restart/
|
81
|
+
- log/
|
82
|
+
- el4r/
|
83
|
+
> Configure
|
84
|
+
@#{Xiki.dir}
|
85
|
+
% sudo bash etc/install/el4r_setup.sh
|
86
|
+
|
87
|
+
- docs/
|
88
|
+
| This will create/update files in your home directory, which make el4r
|
89
|
+
| point to the version of ruby currently active.
|
90
|
+
|
|
91
|
+
| You can run this multiple times.
|
92
|
+
- .misc/
|
93
|
+
- .dont show welcome/
|
94
|
+
@web interface/
|
76
95
|
- api/
|
77
96
|
> Summary
|
78
97
|
Here are some functions that will always be available to menu classes,
|
@@ -92,7 +111,7 @@ class Xiki
|
|
92
111
|
|
93
112
|
def self.install_icon arg
|
94
113
|
|
95
|
-
emacs_dir = "/Applications/Emacs.app"
|
114
|
+
emacs_dir = "/Applications/Aquamacs Emacs.app"
|
96
115
|
|
97
116
|
return "- Couldn't find #{emacs_dir}!" if ! File.exists?("#{emacs_dir}")
|
98
117
|
|
@@ -112,12 +131,42 @@ class Xiki
|
|
112
131
|
# if change was already made, say so
|
113
132
|
|
114
133
|
# TODO
|
115
|
-
# icon
|
116
|
-
# copy over
|
117
|
-
# cp "#{Xiki.dir}etc/shark.icns"
|
118
134
|
|
119
|
-
|
120
|
-
"
|
135
|
+
# 1. Copy icon into app
|
136
|
+
# cp "#{Xiki.dir}etc/shark.icns" "/Applications/Aquamacs Emacs.app/Contents/Resources/"
|
137
|
+
# - /Applications/Aquamacs Emacs.app/
|
138
|
+
# - Contents/Resources/
|
139
|
+
# + shark.icns
|
140
|
+
# + emacs-document.icns
|
141
|
+
|
142
|
+
# 2. Update Info.plist
|
143
|
+
# /Applications/Aquamacs Emacs.app/Contents/
|
144
|
+
# - Info.plist
|
145
|
+
# |+ <dict>
|
146
|
+
# |+ <key>CFBundleTypeExtensions</key>
|
147
|
+
# |+ <array>
|
148
|
+
# |+ <string>notes</string>
|
149
|
+
# |+ <string>menu</string>
|
150
|
+
# |+ <string>xiki</string>
|
151
|
+
# |+ </array>
|
152
|
+
# |+ <key>CFBundleTypeIconFile</key>
|
153
|
+
# |+ <string>shark.icns</string>
|
154
|
+
# |+ <key>CFBundleTypeName</key>
|
155
|
+
# |+ <string>Xiki File</string>
|
156
|
+
# |+ <key>CFBundleTypeOSTypes</key>
|
157
|
+
# |+ <array>
|
158
|
+
# |+ <string>TEXT</string>
|
159
|
+
# |+ <string>utxt</string>
|
160
|
+
# |+ </array>
|
161
|
+
# |+ <key>CFBundleTypeRole</key>
|
162
|
+
# |+ <string>Editor</string>
|
163
|
+
# |+ </dict>
|
164
|
+
|
165
|
+
# 3. Tell user to drag the .app icon out of the "Applications" folder and back in
|
166
|
+
# - Or google to find a command that will do the same thing
|
167
|
+
|
168
|
+
|
169
|
+
"- TODO: finish implementing!"
|
121
170
|
end
|
122
171
|
|
123
172
|
def self.insert_menu
|
@@ -341,13 +390,15 @@ class Xiki
|
|
341
390
|
end
|
342
391
|
|
343
392
|
def self.init
|
393
|
+
|
344
394
|
# Get rest of files to require
|
345
395
|
|
346
|
-
classes = Dir["lib/*.rb"]
|
347
|
-
|
396
|
+
classes = Dir["./lib/xiki/*.rb"]
|
397
|
+
|
348
398
|
classes = classes.select{|i|
|
349
|
-
i !~
|
350
|
-
i !~
|
399
|
+
i !~ /\/ol.rb$/ && # Don't load Ol twice
|
400
|
+
i !~ /\/xiki.rb$/ && # Remove self
|
401
|
+
i !~ /\/key_bindings.rb$/ && # Remove key_bindings
|
351
402
|
i !~ /__/ # Remove __....rb files
|
352
403
|
}
|
353
404
|
|
@@ -362,15 +413,13 @@ Ol << "classes: #{classes.inspect}"
|
|
362
413
|
|
363
414
|
classes.map!{|i| i.sub(/\.rb$/, '')}.sort!
|
364
415
|
|
365
|
-
Ol << "classes: #{classes.inspect}"
|
366
|
-
|
367
416
|
# Require classes
|
368
417
|
Requirer.require_classes classes
|
369
418
|
|
370
419
|
# key_bindings has many dependencies, require it last
|
371
|
-
Requirer.require_classes ['lib/key_bindings.rb']
|
420
|
+
Requirer.require_classes ['./lib/xiki/key_bindings.rb']
|
372
421
|
|
373
|
-
Launcher.add_class_launchers classes.map{|o| o[
|
422
|
+
Launcher.add_class_launchers classes.map{|o| o[/.*\/(.+)/, 1]}
|
374
423
|
Launcher.reload_menu_dirs
|
375
424
|
|
376
425
|
Launcher.add "xiki"
|
@@ -380,6 +429,16 @@ Ol << "classes: #{classes.inspect}"
|
|
380
429
|
Mode.define(:xiki, ".xiki") do
|
381
430
|
Xiki.on_open
|
382
431
|
end
|
432
|
+
|
433
|
+
if $el
|
434
|
+
# If the first time we've loaded
|
435
|
+
if ! $el.elvar.xiki_loaded_once && ! Menu.line_exists?("misc config", /^- dont show welcome$/) && ! View.buffer_visible?("Issues Loading Xiki")
|
436
|
+
Launcher.open("welcome/", :no_search=>1)
|
437
|
+
end
|
438
|
+
|
439
|
+
$el.elvar.xiki_loaded_once = true
|
440
|
+
end
|
441
|
+
|
383
442
|
end
|
384
443
|
|
385
444
|
def self.process action
|
@@ -395,10 +454,19 @@ Ol << "classes: #{classes.inspect}"
|
|
395
454
|
response = `xiki restart`
|
396
455
|
response = "apparently it wasn't running" if response.blank?
|
397
456
|
response.gsub /^/, '- '
|
457
|
+
when "log"
|
458
|
+
"@/tmp/xiki_process.rb.output"
|
398
459
|
when "start"
|
399
460
|
result = `xiki`
|
400
461
|
"- started!"
|
401
462
|
end
|
402
463
|
end
|
403
464
|
|
465
|
+
def self.dont_show_welcome
|
466
|
+
Menu.append_line "misc config", "- dont show welcome"
|
467
|
+
end
|
468
|
+
|
469
|
+
def self.finished_loading?
|
470
|
+
@@finished_loading
|
471
|
+
end
|
404
472
|
end
|