sup 0.13.0 → 0.13.1

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 (54) hide show
  1. data.tar.gz.sig +2 -1
  2. data/History.txt +4 -0
  3. data/ReleaseNotes +4 -0
  4. data/bin/sup +3 -1
  5. data/bin/sup-add +3 -1
  6. data/bin/sup-config +11 -6
  7. data/bin/sup-dump +2 -0
  8. data/bin/sup-import-dump +3 -1
  9. data/bin/sup-recover-sources +2 -0
  10. data/bin/sup-sync +3 -1
  11. data/bin/sup-sync-back +3 -1
  12. data/bin/sup-tweak-labels +3 -1
  13. data/lib/sup.rb +31 -64
  14. data/lib/sup/buffer.rb +2 -2
  15. data/lib/sup/colormap.rb +1 -0
  16. data/lib/sup/hook.rb +10 -0
  17. data/lib/sup/{horizontal-selector.rb → horizontal_selector.rb} +10 -1
  18. data/lib/sup/index.rb +27 -26
  19. data/lib/sup/{interactive-lock.rb → interactive_lock.rb} +0 -0
  20. data/lib/sup/logger.rb +1 -1
  21. data/lib/sup/logger/singleton.rb +10 -0
  22. data/lib/sup/{message-chunks.rb → message_chunks.rb} +2 -2
  23. data/lib/sup/modes/{buffer-list-mode.rb → buffer_list_mode.rb} +0 -0
  24. data/lib/sup/modes/{completion-mode.rb → completion_mode.rb} +3 -3
  25. data/lib/sup/modes/{compose-mode.rb → compose_mode.rb} +0 -0
  26. data/lib/sup/modes/{console-mode.rb → console_mode.rb} +14 -3
  27. data/lib/sup/modes/{contact-list-mode.rb → contact_list_mode.rb} +0 -0
  28. data/lib/sup/modes/{edit-message-async-mode.rb → edit_message_async_mode.rb} +0 -0
  29. data/lib/sup/modes/{edit-message-mode.rb → edit_message_mode.rb} +8 -3
  30. data/lib/sup/modes/{file-browser-mode.rb → file_browser_mode.rb} +0 -0
  31. data/lib/sup/modes/{forward-mode.rb → forward_mode.rb} +0 -0
  32. data/lib/sup/modes/{help-mode.rb → help_mode.rb} +0 -0
  33. data/lib/sup/modes/{inbox-mode.rb → inbox_mode.rb} +0 -0
  34. data/lib/sup/modes/{label-list-mode.rb → label_list_mode.rb} +0 -0
  35. data/lib/sup/modes/{label-search-results-mode.rb → label_search_results_mode.rb} +0 -0
  36. data/lib/sup/modes/{line-cursor-mode.rb → line_cursor_mode.rb} +2 -2
  37. data/lib/sup/modes/{log-mode.rb → log_mode.rb} +0 -0
  38. data/lib/sup/modes/{person-search-results-mode.rb → person_search_results_mode.rb} +0 -0
  39. data/lib/sup/modes/{poll-mode.rb → poll_mode.rb} +0 -0
  40. data/lib/sup/modes/{reply-mode.rb → reply_mode.rb} +0 -0
  41. data/lib/sup/modes/{resume-mode.rb → resume_mode.rb} +0 -0
  42. data/lib/sup/modes/{scroll-mode.rb → scroll_mode.rb} +4 -4
  43. data/lib/sup/modes/{search-list-mode.rb → search_list_mode.rb} +0 -0
  44. data/lib/sup/modes/{search-results-mode.rb → search_results_mode.rb} +0 -0
  45. data/lib/sup/modes/{text-mode.rb → text_mode.rb} +0 -0
  46. data/lib/sup/modes/{thread-index-mode.rb → thread_index_mode.rb} +6 -6
  47. data/lib/sup/modes/{thread-view-mode.rb → thread_view_mode.rb} +0 -0
  48. data/lib/sup/poll.rb +22 -7
  49. data/lib/sup/service/label_service.rb +45 -0
  50. data/lib/sup/util/path.rb +9 -0
  51. data/lib/sup/util/uri.rb +15 -0
  52. data/lib/sup/version.rb +1 -1
  53. metadata +158 -78
  54. metadata.gz.sig +0 -0
data.tar.gz.sig CHANGED
@@ -1 +1,2 @@
1
- �bznJ��a�dzQZ9�>@?I����ceG
1
+ N��_B���O��TX����=��NW��Cn��l��2�K1�}��;��T:Ć����{�i;f�V���Ĵ+*X��X���Y�K�e�D��oEl|D����m.��I��2?i>E A�E��ػ"2h���u�R4�8a#*/�6�� �2�f`� ��߁��ЪT~y;go����Ā�Oc��9��i$�����t�I��_�8U��~y&�S��9�W_n
2
+ "~��q�"�`�
@@ -1,3 +1,7 @@
1
+ == 0.13.1 / 2013-06-21
2
+
3
+ * Bugfixes
4
+
1
5
  == 0.13.0 / 2013-05-15
2
6
 
3
7
  * Bugfixes
@@ -1,3 +1,7 @@
1
+ Release 0.13.1:
2
+
3
+ Another ruby 1.8 compatible release, various fixes.
4
+
1
5
  Release 0.13.0:
2
6
 
3
7
  Collection of bugfixes and stability fixes since 0.12.1. We now depend on our
data/bin/sup CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
+
3
5
  require 'rubygems'
4
6
 
5
7
  require 'ncursesw'
@@ -15,7 +17,7 @@ end
15
17
 
16
18
  require 'fileutils'
17
19
  require 'trollop'
18
- require "sup"; Redwood::check_library_version_against "0.13.0"
20
+ require "sup"
19
21
 
20
22
  if ENV['SUP_PROFILE']
21
23
  require 'ruby-prof'
@@ -1,10 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
+
3
5
  require 'uri'
4
6
  require 'rubygems'
5
7
  require 'highline/import'
6
8
  require 'trollop'
7
- require "sup"; Redwood::check_library_version_against "0.13.0"
9
+ require "sup"
8
10
 
9
11
  $opts = Trollop::options do
10
12
  version "sup-add (sup #{Redwood::VERSION})"
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
+
3
5
  require 'rubygems'
4
6
  require 'highline/import'
5
7
  require 'trollop'
@@ -19,11 +21,12 @@ EOS
19
21
  end
20
22
 
21
23
  def axe q, default=nil
22
- ans = if default && !default.empty?
23
- ask "#{q} (enter for \"#{default}\"): "
24
- else
25
- ask "#{q}: "
26
- end
24
+ question = if default && !default.empty?
25
+ "#{q} (enter for \"#{default}\"): "
26
+ else
27
+ "#{q}: "
28
+ end
29
+ ans = ask question
27
30
  ans.empty? ? default : ans.to_s
28
31
  end
29
32
 
@@ -36,6 +39,8 @@ def build_cmd cmd
36
39
  end
37
40
 
38
41
  def add_source
42
+ require "sup/util/uri"
43
+
39
44
  type = nil
40
45
 
41
46
  say "Ok, adding a new source."
@@ -69,7 +74,7 @@ def add_source
69
74
  end
70
75
 
71
76
  uri = begin
72
- URI::Generic.build components
77
+ Redwood::Util::Uri.build components
73
78
  rescue URI::Error => e
74
79
  say "Whoopsie! I couldn't build a URI from that: #{e.message}"
75
80
  if axe_yes("Try again?") then next else return end
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
+
3
5
  require 'rubygems'
4
6
  require 'xapian'
5
7
  require 'trollop'
@@ -1,9 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
+
3
5
  require 'uri'
4
6
  require 'rubygems'
5
7
  require 'trollop'
6
- require "sup"; Redwood::check_library_version_against "0.13.0"
8
+ require "sup"
7
9
 
8
10
  PROGRESS_UPDATE_INTERVAL = 15 # seconds
9
11
 
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
+
3
5
  require 'optparse'
4
6
 
5
7
  $opts = {
@@ -1,9 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
+
3
5
  require 'uri'
4
6
  require 'rubygems'
5
7
  require 'trollop'
6
- require "sup"; Redwood::check_library_version_against "0.13.0"
8
+ require "sup"
7
9
 
8
10
  PROGRESS_UPDATE_INTERVAL = 15 # seconds
9
11
 
@@ -1,10 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
+
3
5
  require 'rubygems'
4
6
  require 'uri'
5
7
  require 'tempfile'
6
8
  require 'trollop'
7
- require "sup"; Redwood::check_library_version_against "0.13.0"
9
+ require "sup"
8
10
 
9
11
  fail "not working yet"
10
12
 
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
+
3
5
  require 'rubygems'
4
6
  require 'trollop'
5
- require "sup"; Redwood::check_library_version_against "0.13.0"
7
+ require "sup"
6
8
 
7
9
  class Float
8
10
  def to_s; sprintf '%.2f', self; end
data/lib/sup.rb CHANGED
@@ -9,7 +9,7 @@ end
9
9
  require 'zlib'
10
10
  require 'thread'
11
11
  require 'fileutils'
12
- require 'gettext'
12
+ require 'locale'
13
13
  require 'curses'
14
14
  require 'rmail'
15
15
  begin
@@ -234,36 +234,6 @@ EOM
234
234
  end
235
235
  end
236
236
 
237
- ## to be called by entry points in bin/, to ensure that
238
- ## their versions match up against the library versions.
239
- ##
240
- ## this is a perennial source of bug reports from people
241
- ## who both use git and have a gem version installed.
242
- def check_library_version_against v
243
- unless Redwood::VERSION == v
244
- $stderr.puts <<EOS
245
- Error: version mismatch!
246
- The sup executable is at version #{v.inspect}.
247
- The sup libraries are at version #{Redwood::VERSION.inspect}.
248
-
249
- Your development environment may be picking up code from a
250
- rubygems installation of sup.
251
-
252
- If you're running from git with a commandline like
253
-
254
- ruby -Ilib #{$0}
255
-
256
- try this instead:
257
-
258
- RUBY_INVOCATION="ruby -Ilib" ruby -Ilib #{$0}
259
-
260
- You can also try `gem uninstall sup` and removing all Sup rubygems.
261
-
262
- EOS
263
- #' duh!
264
- abort
265
- end
266
- end
267
237
 
268
238
  ## set up default configuration file
269
239
  def load_config filename
@@ -330,8 +300,7 @@ EOS
330
300
  end
331
301
 
332
302
  module_function :save_yaml_obj, :load_yaml_obj, :start, :finish,
333
- :report_broken_sources, :check_library_version_against,
334
- :load_config, :managers
303
+ :report_broken_sources, :load_config, :managers
335
304
  end
336
305
 
337
306
  require 'sup/version'
@@ -340,9 +309,7 @@ require "sup/hook"
340
309
  require "sup/time"
341
310
 
342
311
  ## everything we need to get logging working
343
- require "sup/logger"
344
- Redwood::Logger.init.add_sink $stderr
345
- include Redwood::LogsStuff
312
+ require "sup/logger/singleton"
346
313
 
347
314
  ## determine encoding and character set
348
315
  $encoding = Locale.current.charset
@@ -357,11 +324,11 @@ end
357
324
  require "sup/buffer"
358
325
  require "sup/keymap"
359
326
  require "sup/mode"
360
- require "sup/modes/scroll-mode"
361
- require "sup/modes/text-mode"
362
- require "sup/modes/log-mode"
327
+ require "sup/modes/scroll_mode"
328
+ require "sup/modes/text_mode"
329
+ require "sup/modes/log_mode"
363
330
  require "sup/update"
364
- require "sup/message-chunks"
331
+ require "sup/message_chunks"
365
332
  require "sup/message"
366
333
  require "sup/source"
367
334
  require "sup/mbox"
@@ -369,7 +336,7 @@ require "sup/maildir"
369
336
  require "sup/person"
370
337
  require "sup/account"
371
338
  require "sup/thread"
372
- require "sup/interactive-lock"
339
+ require "sup/interactive_lock"
373
340
  require "sup/index"
374
341
  require "sup/textfield"
375
342
  require "sup/colormap"
@@ -380,31 +347,31 @@ require "sup/draft"
380
347
  require "sup/poll"
381
348
  require "sup/crypto"
382
349
  require "sup/undo"
383
- require "sup/horizontal-selector"
384
- require "sup/modes/line-cursor-mode"
385
- require "sup/modes/help-mode"
386
- require "sup/modes/edit-message-mode"
387
- require "sup/modes/edit-message-async-mode"
388
- require "sup/modes/compose-mode"
389
- require "sup/modes/resume-mode"
390
- require "sup/modes/forward-mode"
391
- require "sup/modes/reply-mode"
392
- require "sup/modes/label-list-mode"
393
- require "sup/modes/contact-list-mode"
394
- require "sup/modes/thread-view-mode"
395
- require "sup/modes/thread-index-mode"
396
- require "sup/modes/label-search-results-mode"
397
- require "sup/modes/search-results-mode"
398
- require "sup/modes/person-search-results-mode"
399
- require "sup/modes/inbox-mode"
400
- require "sup/modes/buffer-list-mode"
401
- require "sup/modes/poll-mode"
402
- require "sup/modes/file-browser-mode"
403
- require "sup/modes/completion-mode"
404
- require "sup/modes/console-mode"
350
+ require "sup/horizontal_selector"
351
+ require "sup/modes/line_cursor_mode"
352
+ require "sup/modes/help_mode"
353
+ require "sup/modes/edit_message_mode"
354
+ require "sup/modes/edit_message_async_mode"
355
+ require "sup/modes/compose_mode"
356
+ require "sup/modes/resume_mode"
357
+ require "sup/modes/forward_mode"
358
+ require "sup/modes/reply_mode"
359
+ require "sup/modes/label_list_mode"
360
+ require "sup/modes/contact_list_mode"
361
+ require "sup/modes/thread_view_mode"
362
+ require "sup/modes/thread_index_mode"
363
+ require "sup/modes/label_search_results_mode"
364
+ require "sup/modes/search_results_mode"
365
+ require "sup/modes/person_search_results_mode"
366
+ require "sup/modes/inbox_mode"
367
+ require "sup/modes/buffer_list_mode"
368
+ require "sup/modes/poll_mode"
369
+ require "sup/modes/file_browser_mode"
370
+ require "sup/modes/completion_mode"
371
+ require "sup/modes/console_mode"
405
372
  require "sup/sent"
406
373
  require "sup/search"
407
- require "sup/modes/search-list-mode"
374
+ require "sup/modes/search_list_mode"
408
375
  require "sup/idle"
409
376
 
410
377
  $:.each do |base|
@@ -267,7 +267,7 @@ EOS
267
267
 
268
268
  def handle_input c
269
269
  if @focus_buf
270
- if @focus_buf.mode.in_search? && c != CONTINUE_IN_BUFFER_SEARCH_KEY[0]
270
+ if @focus_buf.mode.in_search? && c != CONTINUE_IN_BUFFER_SEARCH_KEY.ord
271
271
  @focus_buf.mode.cancel_search!
272
272
  @focus_buf.mark_dirty
273
273
  end
@@ -709,7 +709,7 @@ EOS
709
709
  end
710
710
 
711
711
  Ncurses.mutex.lock unless opts[:sync] == false
712
- Ncurses.attrset Colormap.color_for(:none)
712
+ Ncurses.attrset Colormap.color_for(:text_color)
713
713
  adj = @asking ? 2 : 1
714
714
  m.each_with_index do |s, i|
715
715
  Ncurses.mvaddstr Ncurses.rows - i - adj, 0, s + (" " * [Ncurses.cols - s.length, 0].max)
@@ -26,6 +26,7 @@ class Colormap
26
26
  @@instance = nil
27
27
 
28
28
  DEFAULT_COLORS = {
29
+ :text => { :fg => "white", :bg => "black" },
29
30
  :status => { :fg => "white", :bg => "blue", :attrs => ["bold"] },
30
31
  :index_old => { :fg => "white", :bg => "default" },
31
32
  :index_new => { :fg => "white", :bg => "default", :attrs => ["bold"] },
@@ -1,3 +1,5 @@
1
+ require "sup/util"
2
+
1
3
  module Redwood
2
4
 
3
5
  class HookManager
@@ -17,6 +19,14 @@ class HookManager
17
19
  end
18
20
  end
19
21
 
22
+ def flash s
23
+ if BufferManager.instantiated?
24
+ BufferManager.flash s
25
+ else
26
+ log s
27
+ end
28
+ end
29
+
20
30
  def log s
21
31
  info "hook[#@__name]: #{s}"
22
32
  end
@@ -1,6 +1,8 @@
1
1
  module Redwood
2
2
 
3
3
  class HorizontalSelector
4
+ class UnknownValue < StandardError; end
5
+
4
6
  attr_accessor :label, :changed_by_user
5
7
 
6
8
  def initialize label, vals, labels, base_color=:horizontal_selector_unselected_color, selected_color=:horizontal_selector_selected_color
@@ -13,7 +15,14 @@ class HorizontalSelector
13
15
  @changed_by_user = false
14
16
  end
15
17
 
16
- def set_to val; @selection = @vals.index(val) end
18
+ def set_to val
19
+ raise UnknownValue, val.inspect unless can_set_to? val
20
+ @selection = @vals.index(val)
21
+ end
22
+
23
+ def can_set_to? val
24
+ @vals.include? val
25
+ end
17
26
 
18
27
  def val; @vals[@selection] end
19
28
 
@@ -4,14 +4,12 @@ require 'xapian'
4
4
  require 'set'
5
5
  require 'fileutils'
6
6
  require 'monitor'
7
+ require 'chronic'
8
+
9
+ require "sup/interactive_lock"
10
+ require "sup/hook"
11
+ require "sup/logger/singleton"
7
12
 
8
- begin
9
- require 'chronic'
10
- $have_chronic = true
11
- rescue LoadError => e
12
- debug "No 'chronic' gem detected. Install it for date/time query restrictions."
13
- $have_chronic = false
14
- end
15
13
 
16
14
  if ([Xapian.major_version, Xapian.minor_version, Xapian.revision] <=> [1,2,1]) < 0
17
15
  fail "Xapian version 1.2.1 or higher required"
@@ -261,6 +259,11 @@ EOS
261
259
  end
262
260
  end
263
261
 
262
+ # Search messages. Returns an Enumerator.
263
+ def find_messages query_expr
264
+ enum_for :each_message, parse_query(query_expr)
265
+ end
266
+
264
267
  # wrap all future changes inside a transaction so they're done atomically
265
268
  def begin_transaction
266
269
  synchronize { @xapian.begin_transaction }
@@ -388,27 +391,25 @@ EOS
388
391
  end
389
392
  end
390
393
 
391
- if $have_chronic
392
- lastdate = 2<<32 - 1
393
- firstdate = 0
394
- subs = subs.gsub(/\b(before|on|in|during|after):(\((.+?)\)\B|(\S+)\b)/) do
395
- field, datestr = $1, ($3 || $4)
396
- realdate = Chronic.parse datestr, :guess => false, :context => :past
397
- if realdate
398
- case field
399
- when "after"
400
- debug "chronic: translated #{field}:#{datestr} to #{realdate.end}"
401
- "date:#{realdate.end.to_i}..#{lastdate}"
402
- when "before"
403
- debug "chronic: translated #{field}:#{datestr} to #{realdate.begin}"
404
- "date:#{firstdate}..#{realdate.end.to_i}"
405
- else
406
- debug "chronic: translated #{field}:#{datestr} to #{realdate}"
407
- "date:#{realdate.begin.to_i}..#{realdate.end.to_i}"
408
- end
394
+ lastdate = 2<<32 - 1
395
+ firstdate = 0
396
+ subs = subs.gsub(/\b(before|on|in|during|after):(\((.+?)\)\B|(\S+)\b)/) do
397
+ field, datestr = $1, ($3 || $4)
398
+ realdate = Chronic.parse datestr, :guess => false, :context => :past
399
+ if realdate
400
+ case field
401
+ when "after"
402
+ debug "chronic: translated #{field}:#{datestr} to #{realdate.end}"
403
+ "date:#{realdate.end.to_i}..#{lastdate}"
404
+ when "before"
405
+ debug "chronic: translated #{field}:#{datestr} to #{realdate.begin}"
406
+ "date:#{firstdate}..#{realdate.end.to_i}"
409
407
  else
410
- raise ParseError, "can't understand date #{datestr.inspect}"
408
+ debug "chronic: translated #{field}:#{datestr} to #{realdate}"
409
+ "date:#{realdate.begin.to_i}..#{realdate.end.to_i}"
411
410
  end
411
+ else
412
+ raise ParseError, "can't understand date #{datestr.inspect}"
412
413
  end
413
414
  end
414
415