kristin 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +38 -0
- data/Rakefile +1 -0
- data/kristin.gemspec +23 -0
- data/lib/kristin/version.rb +3 -0
- data/lib/kristin.rb +46 -0
- data/spec/fixtures/image.png +0 -0
- data/spec/fixtures/multi.pdf +0 -0
- data/spec/fixtures/one.pdf +13044 -13
- data/spec/kristin_spec.rb +38 -0
- data/spec/spec_helper.rb +12 -0
- metadata +93 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Kristin do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
@one_page_pdf = file_path("one.pdf")
|
7
|
+
@multi_page_pdf = file_path("multi.pdf")
|
8
|
+
@no_pdf = file_path("image.png")
|
9
|
+
@target_path = "tmp/kristin"
|
10
|
+
FileUtils.mkdir_p @target_path
|
11
|
+
end
|
12
|
+
|
13
|
+
after(:all) do
|
14
|
+
FileUtils.rm_rf @target_path
|
15
|
+
end
|
16
|
+
|
17
|
+
describe ".convert" do
|
18
|
+
it "should raise error if source file does not exists" do
|
19
|
+
lambda { Kristin.convert("nonsense.pdf", "nonsense.html") }.should raise_error(IOError)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should convert a one page pdf to one html file" do
|
23
|
+
target = @target_path + "/one.html"
|
24
|
+
Kristin.convert(@one_page_pdf, target)
|
25
|
+
File.exists?(target).should == true
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should convert a multi page pdf to one html file" do
|
29
|
+
target = @target_path + "/multi.html"
|
30
|
+
Kristin.convert(@multi_page_pdf, target)
|
31
|
+
File.exists?(target).should == true
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should raise error if pdf is not a real pdf" do
|
35
|
+
lambda { Kristin.convert(@no_pdf, "nonsense.html") }.should raise_error(IOError)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'kristin'
|
2
|
+
|
3
|
+
def file_path( *paths )
|
4
|
+
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', *paths))
|
5
|
+
end
|
6
|
+
|
7
|
+
RSpec.configure do |config|
|
8
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
9
|
+
config.run_all_when_everything_filtered = true
|
10
|
+
config.filter_run :focus
|
11
|
+
config.order = 'random'
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: kristin
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Richard Nyström
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-03-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: ' Convert PDF docs to beautiful HTML files without losing text or format.
|
42
|
+
This gem uses pdf2htmlEX to do the conversion.'
|
43
|
+
email:
|
44
|
+
- ricny046@gmail.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- .gitignore
|
50
|
+
- .rspec
|
51
|
+
- Gemfile
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- kristin.gemspec
|
56
|
+
- lib/kristin.rb
|
57
|
+
- lib/kristin/version.rb
|
58
|
+
- spec/fixtures/image.png
|
59
|
+
- spec/fixtures/multi.pdf
|
60
|
+
- spec/fixtures/one.pdf
|
61
|
+
- spec/kristin_spec.rb
|
62
|
+
- spec/spec_helper.rb
|
63
|
+
homepage: https://github.com/ricn/kristin
|
64
|
+
licenses:
|
65
|
+
- MIT
|
66
|
+
metadata: {}
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - '>='
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
requirements: []
|
82
|
+
rubyforge_project:
|
83
|
+
rubygems_version: 2.0.0
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: Convert PDF docs to beautiful HTML files without losing text or format. This
|
87
|
+
gem uses pdf2htmlEX to do the conversion.
|
88
|
+
test_files:
|
89
|
+
- spec/fixtures/image.png
|
90
|
+
- spec/fixtures/multi.pdf
|
91
|
+
- spec/fixtures/one.pdf
|
92
|
+
- spec/kristin_spec.rb
|
93
|
+
- spec/spec_helper.rb
|