File tree Expand file tree Collapse file tree 5 files changed +24
-6
lines changed Expand file tree Collapse file tree 5 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ File format | Supported? | Dependencies
2222.docx | x |
2323.pdf | x | Poppler-utils
2424.txt | x |
25- .sketch | x |
25+ .sketch | x | Sqlite3
2626
2727## Quickstart
2828
@@ -63,3 +63,4 @@ File format | Supported? | Dependencies
6363 - Ruby version >= 1.9.2
6464 - [ Poppler-utils/(pdftotext)] ( http://poppler.freedesktop.org/ ) (PDF)
6565 - [ Antiword] ( http://www.winfield.demon.nl/ ) (docx) more info: http://linux.die.net/man/1/antiword
66+ - Sketch support requires sqlite3 and the [ sqlite3 gem] ( https://rubygems.org/gems/sqlite3 ) gem
Original file line number Diff line number Diff line change @@ -21,8 +21,8 @@ Gem::Specification.new do |spec|
2121 spec . requirements << 'Antiword'
2222 spec . requirements << "pdftotext/poppler"
2323
24- spec . add_dependency "sqlite3" , "~> 1.3.11"
2524 spec . add_dependency "CFPropertyList" , '~> 2.3'
25+ spec . add_dependency 'colored' , '~> 1.2'
2626
2727 spec . add_development_dependency "bundler" , "~> 1.6"
2828 spec . add_development_dependency "rake" , "~> 10.0"
Original file line number Diff line number Diff line change 11require 'shellwords'
2- require "sqlite3"
32require "doc_ripper/version"
43require "doc_ripper/base"
54require "doc_ripper/text_ripper"
@@ -21,4 +20,4 @@ def rip!(path)
2120 text || raise ( FileNotFound )
2221 end
2322 end
24- end
23+ end
Original file line number Diff line number Diff line change 11require 'cfpropertylist'
2+ require 'colored'
3+
4+ SQLITE_LOAD_WARNING = 'SQLite3 optional dependency not found. Sketch files are not supported in this mode.' . yellow
5+
6+ begin
7+ # gem 'sqlite3'
8+ require 'sqlite3'
9+ rescue LoadError
10+ warn SQLITE_LOAD_WARNING
11+ end
212
313module DocRipper
414 module Formats
515 class SketchRipper < Ripper ::Base
616
17+ class Sqlite3NotFound < StandardError
18+ end
19+
720 class CFPropertyList ::CFString
821 def to_s
922 value
@@ -33,6 +46,11 @@ def sketch_page?
3346 end
3447 end
3548
49+ def initialize ( file_path , options = { } )
50+ raise Sqlite3NotFound if !defined? ( SQLite3 )
51+ super
52+ end
53+
3654 def read_type
3755 :mem
3856 end
@@ -79,4 +97,4 @@ def text_objects(data)
7997 end
8098 end
8199 end
82- end
100+ end
Original file line number Diff line number Diff line change 11module DocRipper
2- VERSION = "0.0.7.1 "
2+ VERSION = "0.0.7.2 "
33end
44
55
You can’t perform that action at this time.
0 commit comments