tender_import 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
1
  module TenderImport
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
4
4
 
@@ -5,13 +5,11 @@ require 'fileutils'
5
5
  require 'logger'
6
6
 
7
7
  # Produce a Tender import archive from a ZenDesk site using the ZenDesk API.
8
+ #
9
+ # You can set TenderImport::ZendeskApiImport::Exporter.html2text_bin to the full
10
+ # path of your html2text binary if you don't want it in your shell PATH.
8
11
  class TenderImport::ZendeskApiImport
9
12
  class Error < StandardError; end
10
- #class ResponseJSON < Faraday::Response::Middleware
11
- # def parse(body)
12
- # Yajl::Parser.parse(body)
13
- # end
14
- #end
15
13
 
16
14
  module Log # {{{
17
15
  attr_reader :logger
@@ -150,6 +148,13 @@ class TenderImport::ZendeskApiImport
150
148
  end # }}}
151
149
 
152
150
  class Exporter # {{{
151
+ class << self
152
+ attr_accessor :html2text_bin
153
+ end
154
+ def html2text_bin
155
+ self.class.html2text_bin
156
+ end
157
+
153
158
  attr_reader :logger, :client
154
159
  include Log
155
160
  include FileUtils
@@ -159,8 +164,10 @@ class TenderImport::ZendeskApiImport
159
164
  @author_email = {}
160
165
  @logger = client.logger
161
166
  @archive = TenderImport::Archive.new(client.subdomain)
162
- if `which html2text.py`.empty?
163
- raise Error, 'missing prerequisite: html2text.py is not in your PATH'
167
+ unless html2text_bin
168
+ if `which html2text.py`.empty?
169
+ raise Error, 'missing prerequisite: html2text.py is not in your PATH'
170
+ end
164
171
  end
165
172
  end
166
173
 
@@ -280,7 +287,11 @@ class TenderImport::ZendeskApiImport
280
287
  end
281
288
 
282
289
  def load_body entry
283
- `html2text.py /$PWD/tmp/#{entry['id']}_body.html`
290
+ if html2text_bin
291
+ `#{html2text_bin} /$PWD/tmp/#{entry['id']}_body.html`
292
+ else
293
+ `html2text.py /$PWD/tmp/#{entry['id']}_body.html`
294
+ end
284
295
  end
285
296
 
286
297
  end # }}}
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tender_import
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Zack Hobson
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-09 00:00:00 -07:00
18
+ date: 2011-09-27 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency