Permalink
Browse files

Merge branch 'release/0.1' into develop

  • Loading branch information...
2 parents fbce1e8 + ce1c2bb commit 527ae2b9a21e877ff8bb99c7fab7e263babcad64 @scizo committed Jan 25, 2012
Showing with 265 additions and 238 deletions.
  1. +1 −1 .rspec
  2. +1 −2 .rvmrc
  3. +26 −6 jpdfer.gemspec
  4. +12 −8 lib/jpdfer.rb
  5. +18 −14 lib/jpdfer/key_store.rb
  6. +190 −186 lib/jpdfer/pdf.rb
  7. +3 −0 lib/jpdfer/version.rb
  8. +10 −8 spec/acceptance/jpdfer/pdf_acceptance_spec.rb
  9. +4 −7 spec/lib/jpdfer/pdf_spec.rb
  10. +0 −6 spec/spec_helper.rb
View
@@ -1 +1 @@
-color=true
+--colour
View
@@ -4,7 +4,7 @@
# development environment upon cd'ing into the directory
# First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
-environment_id="jruby-1.6.2@jpdfer"
+environment_id="jruby-1.6.4@jpdfer"
#
# First we attempt to load the desired environment directly from the environment
@@ -21,4 +21,3 @@ else
fi
# ======================================================================
-export JRUBY_OPTS=--1.9
View
@@ -1,14 +1,22 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "jpdfer/version"
+
Gem::Specification.new do |s|
s.name = "jpdfer"
- s.version = "0.9.0"
- s.date = "2011-07-27"
- s.summary = "Ruby-style wrapper in JRuby for reading and writing PDF forms"
+ s.version = Jpdfer::VERSION
+ s.authors = ["Scott Nielsen", "David Brady"]
s.email = "scottnielsen5@gmail.com"
s.homepage = "http://github.com/scizo/jpdfer"
- s.description = "Read and write PDF forms in JRuby"
- s.authors = ["Scott Nielsen", "David Brady"]
+ s.summary = "Read and write PDF forms in JRuby"
+ s.description = "Ruby-style wrapper in JRuby for reading and writing PDF forms"
+
+ s.add_runtime_dependency "nokogiri"
+ s.add_runtime_dependency "json-jruby"
- # ruby -rpp -e "pp (['README.rdoc'] + Dir['{{examples,jars,lib,protocol,spec}/**/*.{jar,rdoc,json,rb,txt,xml,yml}}'] + Dir['bin/*']).sort"
+ s.add_development_dependency "rspec"
+
+ # ruby -rpp -e "pp (['README.rdoc'] + Dir['{{jars,lib,spec}/**/*.{jar,rdoc,,rb}}']).sort"
s.files = [
"README.rdoc",
"jars/bcmail-jdk16-146.jar",
@@ -18,10 +26,22 @@ Gem::Specification.new do |s|
"lib/jpdfer.rb",
"lib/jpdfer/key_store.rb",
"lib/jpdfer/pdf.rb",
+ "lib/jpdfer/version.rb"
+ ]
+ # ruby -rpp -e "pp (Dir['{{spec}/**/*.{rb,ks,pdf}}']).sort"
+ s.test_files = [
"spec/acceptance/jpdfer/pdf_acceptance_spec.rb",
+ "spec/data/flattened.pdf",
+ "spec/data/keystore.ks",
+ "spec/data/simple_form.pdf",
+ "spec/data/simple_form_flattened.pdf",
+ "spec/data/simple_form_flattened_signed.pdf",
+ "spec/data/simple_form_signed_by_someone_else.pdf",
"spec/lib/jpdfer/pdf_spec.rb",
"spec/spec_helper.rb"
]
+ s.require_paths = ["lib"]
+
s.has_rdoc = true
s.rdoc_options = ["--main", "README.rdoc"]
s.extra_rdoc_files = []
View
@@ -1,13 +1,17 @@
-JPDFER_ROOT=File.expand_path(File.join(File.dirname(__FILE__), '..'))
-
require 'java'
require 'stringio'
require 'json'
require 'nokogiri'
-require File.join(JPDFER_ROOT, 'jars', 'itextpdf-5.1.1.jar')
-require File.join(JPDFER_ROOT, 'jars', 'bcprov-jdk16-146.jar')
-require File.join(JPDFER_ROOT, 'jars', 'bctsp-jdk16-146.jar')
-require File.join(JPDFER_ROOT, 'jars', 'bcmail-jdk16-146.jar')
-require File.join(JPDFER_ROOT, 'lib', 'jpdfer', 'pdf')
-require File.join(JPDFER_ROOT, 'lib', 'jpdfer', 'key_store')
+module Jpdfer
+ ROOT = File.expand_path('..', File.dirname(__FILE__))
+end
+
+require File.expand_path('jars/itextpdf-5.1.1.jar', Jpdfer::ROOT)
+require File.expand_path('jars/bcprov-jdk16-146.jar', Jpdfer::ROOT)
+require File.expand_path('jars/bctsp-jdk16-146.jar', Jpdfer::ROOT)
+require File.expand_path('jars/bcmail-jdk16-146.jar', Jpdfer::ROOT)
+
+require 'jpdfer/pdf'
+require 'jpdfer/key_store'
+require 'jpdfer/version'
@@ -1,19 +1,23 @@
-class KeyStore
- JavaFileInputStream = java.io.FileInputStream
- JavaKeyStore = java.security.KeyStore
- JavaString = java.lang.String
+module Jpdfer
- def initialize(keystore_path, _alias, password)
- @alias, @password = _alias, password
- @keystore = JavaKeyStore::getInstance(JavaKeyStore::getDefaultType())
- @keystore.load(JavaFileInputStream.new(keystore_path), JavaString.new(@password).toCharArray)
- end
+ class KeyStore
+ JavaFileInputStream = java.io.FileInputStream
+ JavaKeyStore = java.security.KeyStore
+ JavaString = java.lang.String
- def private_key
- @keystore.getKey(@alias, java.lang.String.new(@password).toCharArray)
- end
+ def initialize(keystore_path, _alias, password)
+ @alias, @password = _alias, password
+ @keystore = JavaKeyStore::getInstance(JavaKeyStore::getDefaultType())
+ @keystore.load(JavaFileInputStream.new(keystore_path), JavaString.new(@password).toCharArray)
+ end
- def certificate_chain
- @keystore.getCertificateChain(@alias)
+ def private_key
+ @keystore.getKey(@alias, java.lang.String.new(@password).toCharArray)
+ end
+
+ def certificate_chain
+ @keystore.getCertificateChain(@alias)
+ end
end
+
end
Oops, something went wrong.

0 comments on commit 527ae2b

Please sign in to comment.