vmail 2.7.6 → 2.7.7

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.
@@ -15,7 +15,7 @@ than in any web browser or GUI program.
15
15
  * a relatively recent version of Vim (Vmail is developed against Vim 7.3)
16
16
  * Ruby 1.9.0 or higher with SSL support compiled in (Vmail is developed using Ruby 1.9.2)
17
17
  * `libsqlite3-dev` and `sqlite3` (try installing with `apt-get`, `brew`, `yum`, `emerge`, etc.)
18
- * the `lynx` text-only-mode web browser is required to view HTML mail parts in Vmail
18
+ * text-only-mode web browser (w3m, elinks, or lynx) should be available to view HTML mail parts in Vmail
19
19
 
20
20
  To install Ruby 1.9.2, I recommend using the [RVM Version Manager][rvm].
21
21
 
@@ -32,7 +32,7 @@ module Vmail
32
32
  end
33
33
 
34
34
  puts "Setting VMAIL_BROWSER to '#{ENV['VMAIL_BROWSER']}'"
35
- check_lynx
35
+ check_html_reader
36
36
 
37
37
  working_dir = ENV['VMAIL_HOME'] || "#{ENV['HOME']}/.vmail/default"
38
38
  `mkdir -p #{working_dir}`
@@ -70,7 +70,7 @@ module Vmail
70
70
  puts "INBOX polling disabled."
71
71
  end
72
72
 
73
- puts "WORKING DIR: #{Dir.pwd}"
73
+ puts "Working directory: #{Dir.pwd}"
74
74
 
75
75
  # require after the working dir is set
76
76
  require 'vmail/imap_client'
@@ -126,11 +126,15 @@ module Vmail
126
126
 
127
127
  private
128
128
 
129
- def check_lynx
129
+ def check_html_reader
130
130
  # TODO check for elinks, or firefox (how do we parse VMAIL_HTML_PART_REDAER to determine?)
131
- if `which lynx` == ''
132
- STDERR.puts "You need to install lynx on your system in order to see html-only messages"
133
- sleep 3
131
+ html_reader = %w( w3m elinks lynx ).detect {|x| `which #{x}` != ''}
132
+ if html_reader
133
+ cmd = ['w3m -dump -T text/html', 'lynx -stdin -dump', 'elinks -dump'].detect {|s| s.index(html_reader)}
134
+ STDERR.puts "Setting VMAIL_HTML_PART_READER to '#{cmd}'"
135
+ ENV['VMAIL_HTML_PART_READER'] = cmd
136
+ else
137
+ abort "You need to install w3m, elinks, or lynx on your system in order to see html-only messages"
134
138
  end
135
139
  end
136
140
 
@@ -70,10 +70,10 @@ module Vmail
70
70
  part.body.decoded.gsub("\r", '')
71
71
  end
72
72
 
73
- # depend on lynx or whatever is set by the VMAIL_HTML_PART_READER
73
+ # depend on VMAIL_HTML_PART_READER
74
74
  # variable
75
75
  def format_html_body(part)
76
- html_tool = ENV['VMAIL_HTML_PART_READER'] || 'lynx -stdin -dump'
76
+ html_tool = ENV['VMAIL_HTML_PART_READER']
77
77
  html = part.body.decoded.gsub("\r", '')
78
78
  stdin, stdout, stderr = Open3.popen3(html_tool)
79
79
  stdin.puts html
@@ -1,3 +1,3 @@
1
1
  module Vmail
2
- VERSION = '2.7.6'
2
+ VERSION = '2.7.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vmail
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.6
4
+ version: 2.7.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-20 00:00:00.000000000 Z
12
+ date: 2012-12-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mail