pdf_scrap 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +30 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/Guardfile +40 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +7 -0
- data/lib/pdf_scrap.rb +12 -0
- data/lib/pdf_scrap/command.rb +4 -0
- data/lib/pdf_scrap/command/pdftotext.rb +95 -0
- data/lib/pdf_scrap/command/raw_command.rb +63 -0
- data/lib/pdf_scrap/error.rb +3 -0
- data/lib/pdf_scrap/error/command_not_defined_error.rb +5 -0
- data/lib/pdf_scrap/error/method_not_implemented_error.rb +5 -0
- data/lib/pdf_scrap/version.rb +3 -0
- data/pdf_scrap.gemspec +28 -0
- data/spec/lib/pdf_scrap/command/pdftotext_spec.rb +123 -0
- data/spec/lib/pdf_scrap/command/raw_command_spec.rb +77 -0
- data/spec/lib/pdf_scrap/command_spec.rb +4 -0
- data/spec/lib/pdf_scrap_spec.rb +8 -0
- data/spec/spec_helper.rb +2 -0
- metadata +155 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bdb00dbcfbe221af6d476442b3e71c0248a7e501
|
4
|
+
data.tar.gz: 4bc58c19c211b1b8b940c7dac631ff762f488858
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 915847834f9657ed8813a63989aad71019e83ca12d53482c81610b9720dbbda6f782daffe1a99000f30534846c43bc459da921d6c168b1cba188d231c9eb3dfc
|
7
|
+
data.tar.gz: 558dd421c584d996c111c51a88ed251a002373c2a3ddee1575bc050a04767042b3ede8b310b633c25a3d24d016d0fabbb3ab6d1ca7b8db88888c5745ba532e2f
|
data/.gitignore
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
.tmp
|
19
|
+
*.bundle
|
20
|
+
*.so
|
21
|
+
*.o
|
22
|
+
*.a
|
23
|
+
mkmf.log
|
24
|
+
.project
|
25
|
+
private
|
26
|
+
private.*
|
27
|
+
vendor/bundle
|
28
|
+
.DS_Store
|
29
|
+
._*
|
30
|
+
spec/sample
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
# Add files and commands to this file, like the example:
|
5
|
+
# watch(%r{file/path}) { `command(s)` }
|
6
|
+
#
|
7
|
+
guard :shell do
|
8
|
+
# watch(/(.*).txt/) {|m| `tail #{m[0]}` }
|
9
|
+
end
|
10
|
+
|
11
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
12
|
+
# rspec may be run, below are examples of the most common uses.
|
13
|
+
# * bundler: 'bundle exec rspec'
|
14
|
+
# * bundler binstubs: 'bin/rspec'
|
15
|
+
# * spring: 'bin/rsspec' (This will use spring if running and you have
|
16
|
+
# installed the spring binstubs per the docs)
|
17
|
+
# * zeus: 'zeus rspec' (requires the server to be started separetly)
|
18
|
+
# * 'just' rspec: 'rspec'
|
19
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
20
|
+
watch(%r{^spec/.+_spec\.rb$})
|
21
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
22
|
+
watch('spec/spec_helper.rb') { "spec" }
|
23
|
+
|
24
|
+
# Rails example
|
25
|
+
#watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
26
|
+
#watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
27
|
+
#watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
28
|
+
#watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
29
|
+
#watch('config/routes.rb') { "spec/routing" }
|
30
|
+
#watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
31
|
+
#watch('spec/rails_helper.rb') { "spec" }
|
32
|
+
|
33
|
+
# Capybara features specs
|
34
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
|
35
|
+
|
36
|
+
# Turnip features and steps
|
37
|
+
watch(%r{^spec/acceptance/(.+)\.feature$})
|
38
|
+
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
|
39
|
+
end
|
40
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 sekizo
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# PdfScrap
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'pdf_scrap'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install pdf_scrap
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( https://github.com/[my-github-username]/pdf_scrap/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/lib/pdf_scrap.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require "pdf_scrap/version"
|
2
|
+
|
3
|
+
PdfScrap::LIB = File.dirname(File.expand_path(__FILE__))
|
4
|
+
PdfScrap::ROOT = File.dirname(PdfScrap::LIB)
|
5
|
+
|
6
|
+
Dir.glob(File.join(PdfScrap::LIB, "**/*.rb")).each do |f|
|
7
|
+
require f
|
8
|
+
end
|
9
|
+
|
10
|
+
module PdfScrap
|
11
|
+
# Your code goes here...
|
12
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
require "pdf_scrap/command/raw_command"
|
3
|
+
|
4
|
+
class PdfScrap::Command::Pdftotext < PdfScrap::Command::RawCommand
|
5
|
+
COMMAND = "pdftotext"
|
6
|
+
TMP_DIR = ".tmp"
|
7
|
+
PWD = `pwd`.gsub(/\n/, "")
|
8
|
+
|
9
|
+
def build
|
10
|
+
command = [super]
|
11
|
+
command << "\"#{self.pdf}\""
|
12
|
+
command << "\"#{self.export_path}\""
|
13
|
+
command.join(" ")
|
14
|
+
end
|
15
|
+
|
16
|
+
def execute(*args, &block)
|
17
|
+
if block_given?
|
18
|
+
yield(self)
|
19
|
+
nil
|
20
|
+
else
|
21
|
+
self.text
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def execute!(*args, &block)
|
26
|
+
self.make_tmp_dir
|
27
|
+
|
28
|
+
`#{self.build}`
|
29
|
+
|
30
|
+
result = File.open(export_path, "r") do |f|
|
31
|
+
f.read
|
32
|
+
end.sub(/\f$/, "")
|
33
|
+
|
34
|
+
FileUtils.rm_f(export_path)
|
35
|
+
result
|
36
|
+
end
|
37
|
+
|
38
|
+
def text(*args)
|
39
|
+
self.execute!(*args)
|
40
|
+
end
|
41
|
+
|
42
|
+
def region=(value)
|
43
|
+
value = [value].flatten
|
44
|
+
self[:x] = value.shift
|
45
|
+
self[:y] = value.shift
|
46
|
+
self[:W] = value.shift
|
47
|
+
self[:H] = value.shift
|
48
|
+
end
|
49
|
+
|
50
|
+
def x1=(value)
|
51
|
+
self[:x] = value
|
52
|
+
end
|
53
|
+
|
54
|
+
def y1=(value)
|
55
|
+
self[:y] = value
|
56
|
+
end
|
57
|
+
|
58
|
+
def x2=(value)
|
59
|
+
self[:W] = value - (self[:x]||0)
|
60
|
+
end
|
61
|
+
|
62
|
+
def y2=(value)
|
63
|
+
self[:H] = value - (self[:y]||0)
|
64
|
+
end
|
65
|
+
|
66
|
+
def height=(value)
|
67
|
+
self[:H] = value
|
68
|
+
end
|
69
|
+
|
70
|
+
def width=(value)
|
71
|
+
self[:W] = value
|
72
|
+
end
|
73
|
+
|
74
|
+
#--------------------#
|
75
|
+
protected
|
76
|
+
|
77
|
+
def make_tmp_dir
|
78
|
+
FileUtils.mkdir_p(tmp_dir)
|
79
|
+
end
|
80
|
+
|
81
|
+
def export_path
|
82
|
+
File.join(tmp_dir, "#{self.object_id.to_i}")
|
83
|
+
end
|
84
|
+
|
85
|
+
#--------------------#
|
86
|
+
private
|
87
|
+
|
88
|
+
def pwd
|
89
|
+
PWD
|
90
|
+
end
|
91
|
+
|
92
|
+
def tmp_dir
|
93
|
+
File.join(pwd, TMP_DIR)
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require "pdf_scrap/error"
|
2
|
+
require "pdf_scrap/command"
|
3
|
+
|
4
|
+
module PdfScrap
|
5
|
+
module Command
|
6
|
+
class RawCommand
|
7
|
+
COMMAND = ""
|
8
|
+
|
9
|
+
def self.command
|
10
|
+
raise CommandNotDefinedError if self::COMMAND.empty?
|
11
|
+
self::COMMAND
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.exist?
|
15
|
+
! self.path.nil?
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.path
|
19
|
+
`which #{self.command}`.scan(/(.+)\n/).flatten.first
|
20
|
+
end
|
21
|
+
|
22
|
+
#--------------------#
|
23
|
+
# instance method
|
24
|
+
|
25
|
+
attr_accessor :x1, :y1, :x2, :y2
|
26
|
+
attr_accessor :pdf
|
27
|
+
|
28
|
+
def initialize
|
29
|
+
super()
|
30
|
+
@path = self.class.path
|
31
|
+
@params = {}
|
32
|
+
end
|
33
|
+
|
34
|
+
def [](param)
|
35
|
+
@params[param]
|
36
|
+
end
|
37
|
+
|
38
|
+
def []=(param, value)
|
39
|
+
@params[param] = value
|
40
|
+
end
|
41
|
+
|
42
|
+
def build
|
43
|
+
command = "#{@path}"
|
44
|
+
@params.each do |param, value|
|
45
|
+
command << " -#{param} #{value}"
|
46
|
+
end
|
47
|
+
command
|
48
|
+
end
|
49
|
+
|
50
|
+
def execute(*args, &block)
|
51
|
+
raise MethodNotImplementedError
|
52
|
+
end
|
53
|
+
|
54
|
+
def rect=(value)
|
55
|
+
value = [value].flatten
|
56
|
+
self.x1 = value.shift
|
57
|
+
self.y1 = value.shift
|
58
|
+
self.x2 = value.shift
|
59
|
+
self.y2 = value.shift
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/pdf_scrap.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'pdf_scrap/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "pdf_scrap"
|
8
|
+
spec.version = PdfScrap::VERSION
|
9
|
+
spec.authors = ["sekizo"]
|
10
|
+
spec.email = ["sekizoworld@mac.com"]
|
11
|
+
spec.summary = %q{Scrap text from pdf file.}
|
12
|
+
spec.description = %q{Scrap text from pdf file.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
|
25
|
+
spec.add_development_dependency "guard"
|
26
|
+
spec.add_development_dependency "guard-shell"
|
27
|
+
spec.add_development_dependency "guard-rspec"
|
28
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe PdfScrap::Command::Pdftotext do
|
4
|
+
let(:pdf) { File.join(PdfScrap::ROOT, "spec/sample/sample.pdf") }
|
5
|
+
let(:command) { described_class.new }
|
6
|
+
|
7
|
+
describe ".path" do
|
8
|
+
example "exist command" do
|
9
|
+
expect(described_class.path).to be_include(described_class::COMMAND)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe ".new"
|
14
|
+
|
15
|
+
describe "#[param]=value" do
|
16
|
+
example "update raw parameter" do
|
17
|
+
expect do
|
18
|
+
command[:x] = 10
|
19
|
+
end.to change{ command[:x] }.from(nil).to(10)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "#region=" do
|
24
|
+
before(:each) do
|
25
|
+
@x, @y, @w, @h = 50, 100, 10, 20
|
26
|
+
|
27
|
+
command.region = [@x, @y, @w, @h]
|
28
|
+
end
|
29
|
+
|
30
|
+
example "update region" do
|
31
|
+
expect(command[:x]).to be @x
|
32
|
+
expect(command[:y]).to be @y
|
33
|
+
expect(command[:W]).to be @w
|
34
|
+
expect(command[:H]).to be @h
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "#build" do
|
39
|
+
let(:built) { command.build }
|
40
|
+
|
41
|
+
context "no params" do
|
42
|
+
example("start with path") { expect(command.build).to match(/^#{described_class.path}/) }
|
43
|
+
end
|
44
|
+
|
45
|
+
context "specify params" do
|
46
|
+
before(:each) do
|
47
|
+
@x1, @y1, @x2, @y2 = 10, 20, 30, 40
|
48
|
+
|
49
|
+
command.x1 = @x1
|
50
|
+
command.y1 = @y1
|
51
|
+
command.x2 = @x2
|
52
|
+
command.y2 = @y2
|
53
|
+
command.pdf = pdf
|
54
|
+
end
|
55
|
+
|
56
|
+
example "normalized command" do
|
57
|
+
expect(built).to match(/-x #{@x1}/)
|
58
|
+
expect(built).to match(/-y #{@y1}/)
|
59
|
+
expect(built).to match(/-W #{@x2 - @x1}/)
|
60
|
+
expect(built).to match(/-H #{@y2 - @y1}/)
|
61
|
+
expect(built).to match(/sample\.pdf\"/)
|
62
|
+
end
|
63
|
+
|
64
|
+
context "specify width" do
|
65
|
+
before(:each) do
|
66
|
+
@width = @x2 - @x1 + 10
|
67
|
+
command.width = @width
|
68
|
+
end
|
69
|
+
|
70
|
+
example("update width") { expect(built).to match(/-W #{@width}/) }
|
71
|
+
end
|
72
|
+
|
73
|
+
context "specify height" do
|
74
|
+
before(:each) do
|
75
|
+
@height = @y2 - @y1 + 10
|
76
|
+
command.height = @height
|
77
|
+
end
|
78
|
+
|
79
|
+
example("update height") { expect(built).to match(/-H #{@height}/) }
|
80
|
+
end
|
81
|
+
|
82
|
+
end # context "specify params"
|
83
|
+
end # describe "#build"
|
84
|
+
|
85
|
+
describe "#execute" do
|
86
|
+
let(:result) { command.execute }
|
87
|
+
before(:each) do
|
88
|
+
command.pdf = pdf
|
89
|
+
|
90
|
+
@lines = 12
|
91
|
+
|
92
|
+
@x = 50
|
93
|
+
@y = 36
|
94
|
+
@w = 120
|
95
|
+
@h = 32
|
96
|
+
|
97
|
+
@step = 31
|
98
|
+
end
|
99
|
+
|
100
|
+
example "convert to text" do
|
101
|
+
expect(result).to be_a(String)
|
102
|
+
end
|
103
|
+
|
104
|
+
example "block given" do
|
105
|
+
texts = []
|
106
|
+
|
107
|
+
command.execute do |com|
|
108
|
+
(1.. @lines).each do |m|
|
109
|
+
com.x1 = @x
|
110
|
+
com.y1 = @y
|
111
|
+
com.x2 = @x + @w
|
112
|
+
com.y2 = @y + @h
|
113
|
+
|
114
|
+
texts << com.text
|
115
|
+
|
116
|
+
@y += @step
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
expect(texts.size).to be @lines
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe PdfScrap::Command::RawCommand do
|
4
|
+
describe ".exist?" do
|
5
|
+
example "raise error" do
|
6
|
+
expect do
|
7
|
+
described_class.exist?
|
8
|
+
end.to raise_error(CommandNotDefinedError)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
describe ".command" do
|
13
|
+
example "raise error" do
|
14
|
+
expect do
|
15
|
+
described_class.command
|
16
|
+
end.to raise_error(CommandNotDefinedError)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context "instance method" do
|
21
|
+
let(:command) { described_class.new }
|
22
|
+
let(:rect) { [1, 2, 3, 4] }
|
23
|
+
|
24
|
+
before :each do
|
25
|
+
allow(described_class).to receive(:command).and_return(" ")
|
26
|
+
allow(described_class).to receive(:exist?).and_return(true)
|
27
|
+
allow(described_class).to receive(:path).and_return("stub_command")
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#[param]=value" do
|
31
|
+
example "update raw parameter" do
|
32
|
+
expect do
|
33
|
+
command[:x] = 10
|
34
|
+
end.to change{ command[:x] }.from(nil).to(10)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "#rect=" do
|
39
|
+
example "update params" do
|
40
|
+
expect { command.rect = rect }.to change { command.y2 }.from(nil).to(rect[3])
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "#build" do
|
45
|
+
context "no params" do
|
46
|
+
example "get path" do
|
47
|
+
expect(command.build).to eq "#{described_class.path}"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context "specify params" do
|
52
|
+
before(:each) do
|
53
|
+
command[:x1] = 10
|
54
|
+
command[:y1] = 20
|
55
|
+
command[:x2] = 30
|
56
|
+
command[:y2] = 40
|
57
|
+
end
|
58
|
+
|
59
|
+
example "build options" do
|
60
|
+
built = command.build
|
61
|
+
expect(built).to match(/-x1 10/)
|
62
|
+
expect(built).to match(/-y1 20/)
|
63
|
+
expect(built).to match(/-x2 30/)
|
64
|
+
expect(built).to match(/-y2 40/)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end # describe "#build"
|
68
|
+
|
69
|
+
describe "#execute" do
|
70
|
+
example("raise error") do
|
71
|
+
expect do
|
72
|
+
command.execute
|
73
|
+
end.to raise_error(MethodNotImplementedError)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end # context "instance method"
|
77
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pdf_scrap
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- sekizo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-21 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.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
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
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard-shell
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Scrap text from pdf file.
|
98
|
+
email:
|
99
|
+
- sekizoworld@mac.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".rspec"
|
106
|
+
- ".travis.yml"
|
107
|
+
- Gemfile
|
108
|
+
- Guardfile
|
109
|
+
- LICENSE.txt
|
110
|
+
- README.md
|
111
|
+
- Rakefile
|
112
|
+
- lib/pdf_scrap.rb
|
113
|
+
- lib/pdf_scrap/command.rb
|
114
|
+
- lib/pdf_scrap/command/pdftotext.rb
|
115
|
+
- lib/pdf_scrap/command/raw_command.rb
|
116
|
+
- lib/pdf_scrap/error.rb
|
117
|
+
- lib/pdf_scrap/error/command_not_defined_error.rb
|
118
|
+
- lib/pdf_scrap/error/method_not_implemented_error.rb
|
119
|
+
- lib/pdf_scrap/version.rb
|
120
|
+
- pdf_scrap.gemspec
|
121
|
+
- spec/lib/pdf_scrap/command/pdftotext_spec.rb
|
122
|
+
- spec/lib/pdf_scrap/command/raw_command_spec.rb
|
123
|
+
- spec/lib/pdf_scrap/command_spec.rb
|
124
|
+
- spec/lib/pdf_scrap_spec.rb
|
125
|
+
- spec/spec_helper.rb
|
126
|
+
homepage: ''
|
127
|
+
licenses:
|
128
|
+
- MIT
|
129
|
+
metadata: {}
|
130
|
+
post_install_message:
|
131
|
+
rdoc_options: []
|
132
|
+
require_paths:
|
133
|
+
- lib
|
134
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
requirements: []
|
145
|
+
rubyforge_project:
|
146
|
+
rubygems_version: 2.2.2
|
147
|
+
signing_key:
|
148
|
+
specification_version: 4
|
149
|
+
summary: Scrap text from pdf file.
|
150
|
+
test_files:
|
151
|
+
- spec/lib/pdf_scrap/command/pdftotext_spec.rb
|
152
|
+
- spec/lib/pdf_scrap/command/raw_command_spec.rb
|
153
|
+
- spec/lib/pdf_scrap/command_spec.rb
|
154
|
+
- spec/lib/pdf_scrap_spec.rb
|
155
|
+
- spec/spec_helper.rb
|