pdf_info 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pdf_info might be problematic. Click here for more details.

data/.gitignore ADDED
@@ -0,0 +1,42 @@
1
+ # rcov generated
2
+ coverage
3
+
4
+ # rdoc generated
5
+ rdoc
6
+
7
+ # yard generated
8
+ doc
9
+ .yardoc
10
+
11
+ # bundler
12
+ .bundle
13
+
14
+ # jeweler generated
15
+ pkg
16
+
17
+ # Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
18
+ #
19
+ # * Create a file at ~/.gitignore
20
+ # * Include files you want ignored
21
+ # * Run: git config --global core.excludesfile ~/.gitignore
22
+ #
23
+ # After doing this, these files will be ignored in all your git projects,
24
+ # saving you from having to 'pollute' every project you touch with them
25
+ #
26
+ # Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
27
+ #
28
+ # For MacOS:
29
+ #
30
+ #.DS_Store
31
+ #
32
+ # For TextMate
33
+ #*.tmproj
34
+ #tmtags
35
+ #
36
+ # For emacs:
37
+ #*~
38
+ #\#*
39
+ #.\#*
40
+ #
41
+ # For vim:
42
+ #*.swp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/Gemfile CHANGED
@@ -1,7 +1,2 @@
1
1
  source "http://rubygems.org"
2
-
3
- group :development do
4
- gem "rspec", "~> 2.5.0"
5
- gem "bundler", "~> 1.0.0"
6
- gem "jeweler", "~> 1.5.2"
7
- end
2
+ gemspec
data/Gemfile.lock CHANGED
@@ -1,26 +1,26 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ pdf_info (0.3.0)
5
+
1
6
  GEM
2
7
  remote: http://rubygems.org/
3
8
  specs:
4
- diff-lcs (1.1.2)
5
- git (1.2.5)
6
- jeweler (1.5.2)
7
- bundler (~> 1.0.0)
8
- git (>= 1.2.5)
9
- rake
10
- rake (0.8.7)
11
- rspec (2.5.0)
12
- rspec-core (~> 2.5.0)
13
- rspec-expectations (~> 2.5.0)
14
- rspec-mocks (~> 2.5.0)
15
- rspec-core (2.5.1)
16
- rspec-expectations (2.5.0)
9
+ diff-lcs (1.1.3)
10
+ rake (0.9.2.2)
11
+ rspec (2.8.0)
12
+ rspec-core (~> 2.8.0)
13
+ rspec-expectations (~> 2.8.0)
14
+ rspec-mocks (~> 2.8.0)
15
+ rspec-core (2.8.0)
16
+ rspec-expectations (2.8.0)
17
17
  diff-lcs (~> 1.1.2)
18
- rspec-mocks (2.5.0)
18
+ rspec-mocks (2.8.0)
19
19
 
20
20
  PLATFORMS
21
21
  ruby
22
22
 
23
23
  DEPENDENCIES
24
- bundler (~> 1.0.0)
25
- jeweler (~> 1.5.2)
26
- rspec (~> 2.5.0)
24
+ pdf_info!
25
+ rake
26
+ rspec
data/Rakefile CHANGED
@@ -1,45 +1,6 @@
1
- require 'rubygems'
2
1
  require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'rake'
2
+ Bundler::GemHelper.install_tasks
11
3
 
12
- require 'jeweler'
13
- Jeweler::Tasks.new do |gem|
14
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
15
- gem.name = "pdf_info"
16
- gem.homepage = "http://github.com/newspaperclub/pdf_info"
17
- gem.license = "MIT"
18
- gem.summary = %Q{Wraps the pdfinfo command line tool to provide a hash of metadata}
19
- gem.email = "tom@newspaperclub.com"
20
- gem.authors = ["Tom Taylor"]
21
- end
22
- Jeweler::RubygemsDotOrgTasks.new
23
-
24
- require 'rspec/core'
25
4
  require 'rspec/core/rake_task'
26
- RSpec::Core::RakeTask.new(:spec) do |spec|
27
- spec.pattern = FileList['spec/**/*_spec.rb']
28
- end
29
-
30
- RSpec::Core::RakeTask.new(:rcov) do |spec|
31
- spec.pattern = 'spec/**/*_spec.rb'
32
- spec.rcov = true
33
- end
34
-
5
+ RSpec::Core::RakeTask.new('spec')
35
6
  task :default => :spec
36
-
37
- require 'rake/rdoctask'
38
- Rake::RDocTask.new do |rdoc|
39
- version = File.exist?('VERSION') ? File.read('VERSION') : ""
40
-
41
- rdoc.rdoc_dir = 'rdoc'
42
- rdoc.title = "pdf_info #{version}"
43
- rdoc.rdoc_files.include('README*')
44
- rdoc.rdoc_files.include('lib/**/*.rb')
45
- end
@@ -0,0 +1,6 @@
1
+ module PDF
2
+ class Info
3
+ VERSION = "0.3.0"
4
+ end
5
+ end
6
+
data/lib/pdf/info.rb CHANGED
@@ -56,11 +56,22 @@ module PDF
56
56
  metadata[:page_count] = pair.last.to_i
57
57
  when "Encrypted"
58
58
  metadata[:encrypted] = pair.last == 'yes'
59
+ when "Optimized"
60
+ metadata[:optimized] = pair.last == 'yes'
59
61
  when "PDF version"
60
62
  metadata[:version] = pair.last.to_f
63
+ when "Title"
64
+ metadata[:title] = pair.last.to_s.strip
65
+ when "Creator"
66
+ metadata[:creator] = pair.last.to_s.strip
67
+ when "Producer"
68
+ metadata[:producer] = pair.last.to_s.strip
69
+ when "Subject"
70
+ metadata[:subject] = pair.last.to_s.strip
61
71
  when /^Page.*size$/
62
72
  metadata[:pages] ||= []
63
73
  metadata[:pages] << pair.last.scan(/[\d.]+/).map(&:to_f)
74
+ metadata[:format] = pair.last.scan(/.*\(\w+\)$/).to_s
64
75
  end
65
76
  end
66
77
  return metadata
data/pdf_info.gemspec CHANGED
@@ -1,63 +1,24 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "pdf/info/version"
5
4
 
6
5
  Gem::Specification.new do |s|
7
6
  s.name = %q{pdf_info}
8
- s.version = "0.2.0"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
7
+ s.version = PDF::Info::VERSION
8
+ s.platform = Gem::Platform::RUBY
11
9
  s.authors = ["Tom Taylor"]
12
- s.date = %q{2011-04-15}
13
- s.email = %q{tom@newspaperclub.com}
14
- s.extra_rdoc_files = [
15
- "LICENSE.txt",
16
- "README.md"
17
- ]
18
- s.files = [
19
- ".document",
20
- "Gemfile",
21
- "Gemfile.lock",
22
- "LICENSE.txt",
23
- "README.md",
24
- "Rakefile",
25
- "VERSION",
26
- "lib/pdf/info.rb",
27
- "lib/pdf/info/exceptions.rb",
28
- "pdf_info.gemspec",
29
- "spec/output/successful.txt",
30
- "spec/pdf_info_spec.rb",
31
- "spec/spec_helper.rb",
32
- "spec/support/output_helper.rb"
33
- ]
34
- s.homepage = %q{http://github.com/newspaperclub/pdf_info}
35
- s.licenses = ["MIT"]
36
- s.require_paths = ["lib"]
37
- s.rubygems_version = %q{1.6.2}
10
+ s.email = ["tom@tomtaylor.co.uk"]
11
+ s.homepage = "https://github.com/newspaperclub/pdf_info"
38
12
  s.summary = %q{Wraps the pdfinfo command line tool to provide a hash of metadata}
39
- s.test_files = [
40
- "spec/pdf_info_spec.rb",
41
- "spec/spec_helper.rb",
42
- "spec/support/output_helper.rb"
43
- ]
13
+ s.licenses = ["MIT"]
44
14
 
45
- if s.respond_to? :specification_version then
46
- s.specification_version = 3
15
+ s.rubyforge_project = "pdf_info"
47
16
 
48
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
- s.add_development_dependency(%q<rspec>, ["~> 2.5.0"])
50
- s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
51
- s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
52
- else
53
- s.add_dependency(%q<rspec>, ["~> 2.5.0"])
54
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
55
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
56
- end
57
- else
58
- s.add_dependency(%q<rspec>, ["~> 2.5.0"])
59
- s.add_dependency(%q<bundler>, ["~> 1.0.0"])
60
- s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
61
- end
62
- end
17
+ s.files = `git ls-files`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ s.require_paths = ["lib"]
63
21
 
22
+ s.add_development_dependency "rake"
23
+ s.add_development_dependency "rspec"
24
+ end
Binary file
@@ -87,4 +87,20 @@ describe PDF::Info do
87
87
  end
88
88
  end
89
89
 
90
+ describe "running on sample.pdf" do
91
+ subject do
92
+ PDF::Info.command_path = "pdfinfo"
93
+ PDF::Info.new(File.join(File.dirname(__FILE__), 'assets', 'sample.pdf')).metadata
94
+ end
95
+
96
+ its([:page_count]) { should == 1 }
97
+ its([:creator]) { should == "PScript5.dll Version 5.2.2" }
98
+ its([:version]) { should == 1.4 }
99
+ its([:title]) { should == "Microsoft Word - sample.pdf.docx" }
100
+ its([:encrypted]) { should == false }
101
+ its([:optimized]) { should == false }
102
+ its([:producer]) { should == "GPL Ghostscript 8.15" }
103
+ its([:subject]) { should be_nil }
104
+ end
105
+
90
106
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,5 @@
1
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
- $LOAD_PATH.unshift(File.dirname(__FILE__))
3
- require 'rspec'
1
+ require 'rubygems'
2
+ require 'bundler/setup'
4
3
  require 'pdf/info'
5
4
 
6
5
  # Requires supporting files with custom matchers and macros, etc,
metadata CHANGED
@@ -1,130 +1,96 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: pdf_info
3
- version: !ruby/object:Gem::Version
4
- hash: 23
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 0
10
- version: 0.2.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Tom Taylor
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-04-15 00:00:00 +01:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- prerelease: false
23
- type: :development
24
- requirement: &id001 !ruby/object:Gem::Requirement
12
+ date: 2012-02-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: &70234940118020 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ~>
28
- - !ruby/object:Gem::Version
29
- hash: 27
30
- segments:
31
- - 2
32
- - 5
33
- - 0
34
- version: 2.5.0
35
- name: rspec
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- prerelease: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
39
22
  type: :development
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ~>
44
- - !ruby/object:Gem::Version
45
- hash: 23
46
- segments:
47
- - 1
48
- - 0
49
- - 0
50
- version: 1.0.0
51
- name: bundler
52
- version_requirements: *id002
53
- - !ruby/object:Gem::Dependency
54
23
  prerelease: false
55
- type: :development
56
- requirement: &id003 !ruby/object:Gem::Requirement
24
+ version_requirements: *70234940118020
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &70234940117100 !ruby/object:Gem::Requirement
57
28
  none: false
58
- requirements:
59
- - - ~>
60
- - !ruby/object:Gem::Version
61
- hash: 7
62
- segments:
63
- - 1
64
- - 5
65
- - 2
66
- version: 1.5.2
67
- name: jeweler
68
- version_requirements: *id003
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70234940117100
69
36
  description:
70
- email: tom@newspaperclub.com
37
+ email:
38
+ - tom@tomtaylor.co.uk
71
39
  executables: []
72
-
73
40
  extensions: []
74
-
75
- extra_rdoc_files:
76
- - LICENSE.txt
77
- - README.md
78
- files:
41
+ extra_rdoc_files: []
42
+ files:
79
43
  - .document
44
+ - .gitignore
45
+ - .rspec
80
46
  - Gemfile
81
47
  - Gemfile.lock
82
48
  - LICENSE.txt
83
49
  - README.md
84
50
  - Rakefile
85
- - VERSION
86
51
  - lib/pdf/info.rb
87
52
  - lib/pdf/info/exceptions.rb
53
+ - lib/pdf/info/version.rb
88
54
  - pdf_info.gemspec
55
+ - spec/assets/sample.pdf
89
56
  - spec/output/successful.txt
90
57
  - spec/pdf_info_spec.rb
91
58
  - spec/spec_helper.rb
92
59
  - spec/support/output_helper.rb
93
- has_rdoc: true
94
- homepage: http://github.com/newspaperclub/pdf_info
95
- licenses:
60
+ homepage: https://github.com/newspaperclub/pdf_info
61
+ licenses:
96
62
  - MIT
97
63
  post_install_message:
98
64
  rdoc_options: []
99
-
100
- require_paths:
65
+ require_paths:
101
66
  - lib
102
- required_ruby_version: !ruby/object:Gem::Requirement
67
+ required_ruby_version: !ruby/object:Gem::Requirement
103
68
  none: false
104
- requirements:
105
- - - ">="
106
- - !ruby/object:Gem::Version
107
- hash: 3
108
- segments:
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ segments:
109
74
  - 0
110
- version: "0"
111
- required_rubygems_version: !ruby/object:Gem::Requirement
75
+ hash: -1781697912224154655
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
112
77
  none: false
113
- requirements:
114
- - - ">="
115
- - !ruby/object:Gem::Version
116
- hash: 3
117
- segments:
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ segments:
118
83
  - 0
119
- version: "0"
84
+ hash: -1781697912224154655
120
85
  requirements: []
121
-
122
- rubyforge_project:
123
- rubygems_version: 1.6.2
86
+ rubyforge_project: pdf_info
87
+ rubygems_version: 1.8.11
124
88
  signing_key:
125
89
  specification_version: 3
126
90
  summary: Wraps the pdfinfo command line tool to provide a hash of metadata
127
- test_files:
91
+ test_files:
92
+ - spec/assets/sample.pdf
93
+ - spec/output/successful.txt
128
94
  - spec/pdf_info_spec.rb
129
95
  - spec/spec_helper.rb
130
96
  - spec/support/output_helper.rb
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.2.0