sup 0.9.1 → 0.10

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of sup might be problematic. Click here for more details.

Files changed (46) hide show
  1. data/CONTRIBUTORS +10 -6
  2. data/History.txt +11 -0
  3. data/ReleaseNotes +10 -0
  4. data/bin/sup +55 -19
  5. data/bin/sup-add +18 -8
  6. data/bin/sup-config +2 -2
  7. data/bin/sup-convert-ferret-index +84 -0
  8. data/bin/sup-dump +4 -3
  9. data/bin/sup-sync +4 -3
  10. data/bin/sup-sync-back +3 -2
  11. data/bin/sup-tweak-labels +3 -3
  12. data/lib/sup.rb +35 -4
  13. data/lib/sup/buffer.rb +12 -6
  14. data/lib/sup/colormap.rb +1 -0
  15. data/lib/sup/crypto.rb +76 -55
  16. data/lib/sup/ferret_index.rb +6 -1
  17. data/lib/sup/index.rb +62 -8
  18. data/lib/sup/logger.rb +2 -1
  19. data/lib/sup/maildir.rb +4 -2
  20. data/lib/sup/mbox/loader.rb +4 -3
  21. data/lib/sup/message-chunks.rb +9 -7
  22. data/lib/sup/message.rb +29 -27
  23. data/lib/sup/mode.rb +11 -4
  24. data/lib/sup/modes/buffer-list-mode.rb +5 -0
  25. data/lib/sup/modes/console-mode.rb +4 -0
  26. data/lib/sup/modes/edit-message-mode.rb +4 -2
  27. data/lib/sup/modes/file-browser-mode.rb +1 -1
  28. data/lib/sup/modes/inbox-mode.rb +18 -1
  29. data/lib/sup/modes/label-list-mode.rb +44 -3
  30. data/lib/sup/modes/text-mode.rb +1 -1
  31. data/lib/sup/modes/thread-index-mode.rb +63 -52
  32. data/lib/sup/modes/thread-view-mode.rb +68 -7
  33. data/lib/sup/poll.rb +20 -5
  34. data/lib/sup/source.rb +1 -0
  35. data/lib/sup/thread.rb +1 -1
  36. data/lib/sup/util.rb +49 -11
  37. data/lib/sup/xapian_index.rb +151 -112
  38. metadata +4 -10
  39. data/lib/sup/hook.rb.BACKUP.8625.rb +0 -158
  40. data/lib/sup/hook.rb.BACKUP.8681.rb +0 -158
  41. data/lib/sup/hook.rb.BASE.8625.rb +0 -155
  42. data/lib/sup/hook.rb.BASE.8681.rb +0 -155
  43. data/lib/sup/hook.rb.LOCAL.8625.rb +0 -142
  44. data/lib/sup/hook.rb.LOCAL.8681.rb +0 -142
  45. data/lib/sup/hook.rb.REMOTE.8625.rb +0 -145
  46. data/lib/sup/hook.rb.REMOTE.8681.rb +0 -145
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: "0.10"
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Morgan
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-11 10:02:24 -05:00
12
+ date: 2010-01-24 11:59:28 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -123,6 +123,7 @@ executables:
123
123
  - sup-sync
124
124
  - sup-sync-back
125
125
  - sup-tweak-labels
126
+ - sup-convert-ferret-index
126
127
  extensions: []
127
128
 
128
129
  extra_rdoc_files: []
@@ -141,17 +142,15 @@ files:
141
142
  - bin/sup-sync
142
143
  - bin/sup-sync-back
143
144
  - bin/sup-tweak-labels
145
+ - bin/sup-convert-ferret-index
144
146
  - lib/sup.rb
145
147
  - lib/ncurses.rb
146
- - lib/sup/hook.rb.REMOTE.8625.rb
147
148
  - lib/sup/poll.rb
148
- - lib/sup/hook.rb.BASE.8625.rb
149
149
  - lib/sup/source.rb
150
150
  - lib/sup/crypto.rb
151
151
  - lib/sup/horizontal-selector.rb
152
152
  - lib/sup/mode.rb
153
153
  - lib/sup/interactive-lock.rb
154
- - lib/sup/hook.rb.BACKUP.8681.rb
155
154
  - lib/sup/account.rb
156
155
  - lib/sup/imap.rb
157
156
  - lib/sup/maildir.rb
@@ -160,17 +159,14 @@ files:
160
159
  - lib/sup/label.rb
161
160
  - lib/sup/index.rb
162
161
  - lib/sup/keymap.rb
163
- - lib/sup/hook.rb.LOCAL.8681.rb
164
162
  - lib/sup/rfc2047.rb
165
163
  - lib/sup/tagger.rb
166
164
  - lib/sup/util.rb
167
165
  - lib/sup/textfield.rb
168
166
  - lib/sup/xapian_index.rb
169
- - lib/sup/hook.rb.BACKUP.8625.rb
170
167
  - lib/sup/sent.rb
171
168
  - lib/sup/undo.rb
172
169
  - lib/sup/mbox.rb
173
- - lib/sup/hook.rb.LOCAL.8625.rb
174
170
  - lib/sup/person.rb
175
171
  - lib/sup/ferret_index.rb
176
172
  - lib/sup/thread.rb
@@ -180,8 +176,6 @@ files:
180
176
  - lib/sup/colormap.rb
181
177
  - lib/sup/buffer.rb
182
178
  - lib/sup/logger.rb
183
- - lib/sup/hook.rb.REMOTE.8681.rb
184
- - lib/sup/hook.rb.BASE.8681.rb
185
179
  - lib/sup/draft.rb
186
180
  - lib/sup/modes/label-search-results-mode.rb
187
181
  - lib/sup/modes/completion-mode.rb
@@ -1,158 +0,0 @@
1
- module Redwood
2
-
3
- class HookManager
4
- class HookContext
5
- def initialize name
6
- @__say_id = nil
7
- @__name = name
8
- <<<<<<< HEAD:lib/sup/hook.rb
9
- @__cache = {}
10
- =======
11
- @__locals = {}
12
- end
13
-
14
- attr_writer :__locals
15
- def method_missing m, *a
16
- case @__locals[m]
17
- when Proc
18
- @__locals[m] = @__locals[m].call(*a) # only call the proc once
19
- when nil
20
- super
21
- else
22
- @__locals[m]
23
- end
24
- >>>>>>> custom-search-hook:lib/sup/hook.rb
25
- end
26
-
27
- def say s
28
- if BufferManager.instantiated?
29
- @__say_id = BufferManager.say s, @__say_id
30
- BufferManager.draw_screen
31
- else
32
- log s
33
- end
34
- end
35
-
36
- def log s
37
- info "hook[#@__name]: #{s}"
38
- end
39
-
40
- def ask_yes_or_no q
41
- if BufferManager.instantiated?
42
- BufferManager.ask_yes_or_no q
43
- else
44
- print q
45
- gets.chomp.downcase == 'y'
46
- end
47
- end
48
-
49
- def get tag
50
- HookManager.tags[tag]
51
- end
52
-
53
- def set tag, value
54
- HookManager.tags[tag] = value
55
- end
56
-
57
- def __run __hook, __filename, __locals
58
- __binding = binding
59
- __lprocs, __lvars = __locals.partition { |k, v| v.is_a?(Proc) }
60
- eval __lvars.map { |k, v| "#{k} = __locals[#{k.inspect}];" }.join, __binding
61
- ## we also support closures for delays evaluation. unfortunately
62
- ## we have to do this via method calls, so you don't get all the
63
- ## semantics of a regular variable. not ideal.
64
- __lprocs.each do |k, v|
65
- self.class.instance_eval do
66
- define_method k do
67
- @__cache[k] ||= v.call
68
- end
69
- end
70
- end
71
- ret = eval __hook, __binding, __filename
72
- BufferManager.clear @__say_id if @__say_id
73
- @__cache = {}
74
- ret
75
- end
76
- end
77
-
78
- include Singleton
79
-
80
- def initialize dir
81
- @dir = dir
82
- @hooks = {}
83
- @descs = {}
84
- @contexts = {}
85
- @tags = {}
86
-
87
- Dir.mkdir dir unless File.exists? dir
88
- end
89
-
90
- attr_reader :tags
91
-
92
- def run name, locals={}
93
- hook = hook_for(name) or return
94
- context = @contexts[hook] ||= HookContext.new(name)
95
-
96
- result = nil
97
- begin
98
- result = context.__run hook, fn_for(name), locals
99
- rescue Exception => e
100
- log "error running hook: #{e.message}"
101
- log e.backtrace.join("\n")
102
- @hooks[name] = nil # disable it
103
- BufferManager.flash "Error running hook: #{e.message}" if BufferManager.instantiated?
104
- end
105
- result
106
- end
107
-
108
- def register name, desc
109
- @descs[name] = desc
110
- end
111
-
112
- def print_hooks f=$stdout
113
- puts <<EOS
114
- Have #{@descs.size} registered hooks:
115
-
116
- EOS
117
-
118
- @descs.sort.each do |name, desc|
119
- f.puts <<EOS
120
- #{name}
121
- #{"-" * name.length}
122
- File: #{fn_for name}
123
- #{desc}
124
- EOS
125
- end
126
- end
127
-
128
- def enabled? name; !hook_for(name).nil? end
129
-
130
- def clear; @hooks.clear; end
131
-
132
- private
133
-
134
- def hook_for name
135
- unless @hooks.member? name
136
- @hooks[name] = begin
137
- returning IO.read(fn_for(name)) do
138
- debug "read '#{name}' from #{fn_for(name)}"
139
- end
140
- rescue SystemCallError => e
141
- #debug "disabled hook for '#{name}': #{e.message}"
142
- nil
143
- end
144
- end
145
-
146
- @hooks[name]
147
- end
148
-
149
- def fn_for name
150
- File.join @dir, "#{name}.rb"
151
- end
152
-
153
- def log m
154
- info("hook: " + m)
155
- end
156
- end
157
-
158
- end
@@ -1,158 +0,0 @@
1
- module Redwood
2
-
3
- class HookManager
4
- class HookContext
5
- def initialize name
6
- @__say_id = nil
7
- @__name = name
8
- <<<<<<< HEAD:lib/sup/hook.rb
9
- @__cache = {}
10
- =======
11
- @__locals = {}
12
- end
13
-
14
- attr_writer :__locals
15
- def method_missing m, *a
16
- case @__locals[m]
17
- when Proc
18
- @__locals[m] = @__locals[m].call(*a) # only call the proc once
19
- when nil
20
- super
21
- else
22
- @__locals[m]
23
- end
24
- >>>>>>> custom-search-hook:lib/sup/hook.rb
25
- end
26
-
27
- def say s
28
- if BufferManager.instantiated?
29
- @__say_id = BufferManager.say s, @__say_id
30
- BufferManager.draw_screen
31
- else
32
- log s
33
- end
34
- end
35
-
36
- def log s
37
- info "hook[#@__name]: #{s}"
38
- end
39
-
40
- def ask_yes_or_no q
41
- if BufferManager.instantiated?
42
- BufferManager.ask_yes_or_no q
43
- else
44
- print q
45
- gets.chomp.downcase == 'y'
46
- end
47
- end
48
-
49
- def get tag
50
- HookManager.tags[tag]
51
- end
52
-
53
- def set tag, value
54
- HookManager.tags[tag] = value
55
- end
56
-
57
- def __run __hook, __filename, __locals
58
- __binding = binding
59
- __lprocs, __lvars = __locals.partition { |k, v| v.is_a?(Proc) }
60
- eval __lvars.map { |k, v| "#{k} = __locals[#{k.inspect}];" }.join, __binding
61
- ## we also support closures for delays evaluation. unfortunately
62
- ## we have to do this via method calls, so you don't get all the
63
- ## semantics of a regular variable. not ideal.
64
- __lprocs.each do |k, v|
65
- self.class.instance_eval do
66
- define_method k do
67
- @__cache[k] ||= v.call
68
- end
69
- end
70
- end
71
- ret = eval __hook, __binding, __filename
72
- BufferManager.clear @__say_id if @__say_id
73
- @__cache = {}
74
- ret
75
- end
76
- end
77
-
78
- include Singleton
79
-
80
- def initialize dir
81
- @dir = dir
82
- @hooks = {}
83
- @descs = {}
84
- @contexts = {}
85
- @tags = {}
86
-
87
- Dir.mkdir dir unless File.exists? dir
88
- end
89
-
90
- attr_reader :tags
91
-
92
- def run name, locals={}
93
- hook = hook_for(name) or return
94
- context = @contexts[hook] ||= HookContext.new(name)
95
-
96
- result = nil
97
- begin
98
- result = context.__run hook, fn_for(name), locals
99
- rescue Exception => e
100
- log "error running hook: #{e.message}"
101
- log e.backtrace.join("\n")
102
- @hooks[name] = nil # disable it
103
- BufferManager.flash "Error running hook: #{e.message}" if BufferManager.instantiated?
104
- end
105
- result
106
- end
107
-
108
- def register name, desc
109
- @descs[name] = desc
110
- end
111
-
112
- def print_hooks f=$stdout
113
- puts <<EOS
114
- Have #{@descs.size} registered hooks:
115
-
116
- EOS
117
-
118
- @descs.sort.each do |name, desc|
119
- f.puts <<EOS
120
- #{name}
121
- #{"-" * name.length}
122
- File: #{fn_for name}
123
- #{desc}
124
- EOS
125
- end
126
- end
127
-
128
- def enabled? name; !hook_for(name).nil? end
129
-
130
- def clear; @hooks.clear; end
131
-
132
- private
133
-
134
- def hook_for name
135
- unless @hooks.member? name
136
- @hooks[name] = begin
137
- returning IO.read(fn_for(name)) do
138
- debug "read '#{name}' from #{fn_for(name)}"
139
- end
140
- rescue SystemCallError => e
141
- #debug "disabled hook for '#{name}': #{e.message}"
142
- nil
143
- end
144
- end
145
-
146
- @hooks[name]
147
- end
148
-
149
- def fn_for name
150
- File.join @dir, "#{name}.rb"
151
- end
152
-
153
- def log m
154
- info("hook: " + m)
155
- end
156
- end
157
-
158
- end
@@ -1,155 +0,0 @@
1
- module Redwood
2
-
3
- class HookManager
4
- ## there's probably a better way to do this, but to evaluate a hook
5
- ## with a bunch of pre-set "local variables" i define a function
6
- ## per variable and then instance_evaluate the code.
7
- ##
8
- ## how does rails do it, when you pass :locals into a partial?
9
- ##
10
- ## i don't bother providing setters, since i'm pretty sure the
11
- ## charade will fall apart pretty quickly with respect to scoping.
12
- ## "fail-fast", we'll call it.
13
- class HookContext
14
- def initialize name
15
- @__say_id = nil
16
- @__name = name
17
- @__locals = {}
18
- end
19
-
20
- attr_writer :__locals
21
-
22
- def method_missing m, *a
23
- case @__locals[m]
24
- when Proc
25
- @__locals[m] = @__locals[m].call(*a) # only call the proc once
26
- when nil
27
- super
28
- else
29
- @__locals[m]
30
- end
31
- end
32
-
33
- def say s
34
- if BufferManager.instantiated?
35
- @__say_id = BufferManager.say s, @__say_id
36
- BufferManager.draw_screen
37
- else
38
- log s
39
- end
40
- end
41
-
42
- def log s
43
- Redwood::log "hook[#@__name]: #{s}"
44
- end
45
-
46
- def ask_yes_or_no q
47
- if BufferManager.instantiated?
48
- BufferManager.ask_yes_or_no q
49
- else
50
- print q
51
- gets.chomp.downcase == 'y'
52
- end
53
- end
54
-
55
- def get tag
56
- HookManager.tags[tag]
57
- end
58
-
59
- def set tag, value
60
- HookManager.tags[tag] = value
61
- end
62
-
63
- def __binding
64
- binding
65
- end
66
-
67
- def __cleanup
68
- BufferManager.clear @__say_id if @__say_id
69
- end
70
- end
71
-
72
- include Singleton
73
-
74
- def initialize dir
75
- @dir = dir
76
- @hooks = {}
77
- @descs = {}
78
- @contexts = {}
79
- @tags = {}
80
-
81
- Dir.mkdir dir unless File.exists? dir
82
-
83
- self.class.i_am_the_instance self
84
- end
85
-
86
- attr_reader :tags
87
-
88
- def run name, locals={}
89
- hook = hook_for(name) or return
90
- context = @contexts[hook] ||= HookContext.new(name)
91
- context.__locals = locals
92
-
93
- result = nil
94
- begin
95
- result = context.instance_eval @hooks[name], fn_for(name)
96
- rescue Exception => e
97
- log "error running hook: #{e.message}"
98
- log e.backtrace.join("\n")
99
- @hooks[name] = nil # disable it
100
- BufferManager.flash "Error running hook: #{e.message}" if BufferManager.instantiated?
101
- end
102
- context.__cleanup
103
- result
104
- end
105
-
106
- def register name, desc
107
- @descs[name] = desc
108
- end
109
-
110
- def print_hooks f=$stdout
111
- puts <<EOS
112
- Have #{@descs.size} registered hooks:
113
-
114
- EOS
115
-
116
- @descs.sort.each do |name, desc|
117
- f.puts <<EOS
118
- #{name}
119
- #{"-" * name.length}
120
- File: #{fn_for name}
121
- #{desc}
122
- EOS
123
- end
124
- end
125
-
126
- def enabled? name; !hook_for(name).nil? end
127
-
128
- private
129
-
130
- def hook_for name
131
- unless @hooks.member? name
132
- @hooks[name] =
133
- begin
134
- returning IO.read(fn_for(name)) do
135
- log "read '#{name}' from #{fn_for(name)}"
136
- end
137
- rescue SystemCallError => e
138
- #log "disabled hook for '#{name}': #{e.message}"
139
- nil
140
- end
141
- end
142
-
143
- @hooks[name]
144
- end
145
-
146
- def fn_for name
147
- File.join @dir, "#{name}.rb"
148
- end
149
-
150
- def log m
151
- Redwood::log("hook: " + m)
152
- end
153
- end
154
-
155
- end