Skip to content

Commit

Permalink
Merge fbf46f6 into 916558b
Browse files Browse the repository at this point in the history
  • Loading branch information
knapo committed Mar 11, 2020
2 parents 916558b + fbf46f6 commit a001a99
Show file tree
Hide file tree
Showing 11 changed files with 115 additions and 188 deletions.
11 changes: 10 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
---
sudo: false
language: ruby
cache: bundler
rvm:
- 1.9.3
- 2.4
- 2.5
- 2.6
- 2.7
before_install: gem install bundler
script:
- bundle exec rake
11 changes: 1 addition & 10 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
source 'https://rubygems.org'

group :development do
gem 'rspec'
gem "jeweler", ">= 1.5.2"
end

group :test do
gem 'rake'
gem 'coveralls', require: false
end

gemspec
107 changes: 63 additions & 44 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,59 +1,78 @@
PATH
remote: .
specs:
certificate_authority (0.2.0)

GEM
remote: https://rubygems.org/
specs:
coveralls (0.7.0)
multi_json (~> 1.3)
rest-client
simplecov (>= 0.7)
term-ansicolor
thor
diff-lcs (1.2.5)
docile (1.1.2)
git (1.2.5)
jeweler (1.8.4)
bundler (~> 1.0)
git (>= 1.2.5)
rake
rdoc
json (1.8.1)
mime-types (2.0)
multi_json (1.7.4)
rake (10.0.4)
rdoc (4.0.1)
json (~> 1.4)
rest-client (1.6.7)
mime-types (>= 1.16)
rspec (3.4.0)
rspec-core (~> 3.4.0)
rspec-expectations (~> 3.4.0)
rspec-mocks (~> 3.4.0)
rspec-core (3.4.3)
rspec-support (~> 3.4.0)
rspec-expectations (3.4.0)
ast (2.4.0)
coderay (1.1.2)
coveralls (0.8.23)
json (>= 1.8, < 3)
simplecov (~> 0.16.1)
term-ansicolor (~> 1.3)
thor (>= 0.19.4, < 2.0)
tins (~> 1.6)
diff-lcs (1.3)
docile (1.3.2)
jaro_winkler (1.5.4)
json (2.3.0)
method_source (0.9.2)
parallel (1.19.1)
parser (2.7.0.4)
ast (~> 2.4.0)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
rainbow (3.0.0)
rake (13.0.1)
rexml (3.2.4)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.1)
rspec-support (~> 3.9.1)
rspec-expectations (3.9.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-mocks (3.4.1)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-support (3.4.1)
simplecov (0.8.2)
docile (~> 1.1.0)
multi_json
simplecov-html (~> 0.8.0)
simplecov-html (0.8.0)
term-ansicolor (1.2.2)
tins (~> 0.8)
thor (0.18.1)
tins (0.13.1)
rspec-support (~> 3.9.0)
rspec-support (3.9.2)
rubocop (0.80.1)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.7.0.1)
rainbow (>= 2.2.2, < 4.0)
rexml
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
ruby-progressbar (1.10.1)
simplecov (0.16.1)
docile (~> 1.1)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
sync (0.5.0)
term-ansicolor (1.7.1)
tins (~> 1.0)
thor (1.0.1)
tins (1.24.1)
sync
unicode-display_width (1.6.1)

PLATFORMS
ruby

DEPENDENCIES
certificate_authority!
coveralls
jeweler (>= 1.5.2)
pry
rake
rspec
rubocop

BUNDLED WITH
1.11.2
2.1.4
40 changes: 6 additions & 34 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,50 +1,22 @@
require 'rubygems'
require 'bundler'
require 'rspec'
require 'rspec/core/rake_task'
require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "rubocop/rake_task"

begin
Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end

require 'rake'

desc 'Default: run specs.'
desc "Default: run specs."
task :default => :spec

require 'jeweler'
Jeweler::Tasks.new do |gem|
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
gem.name = "certificate_authority"
gem.homepage = "https://github.com/cchandler/certificate_authority"
gem.license = "MIT"
gem.summary = 'Ruby gem for managing the core functions outlined in RFC-3280 for PKI'
# gem.description = ''
gem.email = "squanderingtime@gmail.com"
gem.authors = ["Chris Chandler"]
end
Jeweler::RubygemsDotOrgTasks.new

task :spec do
Rake::Task["spec:units"].invoke
end

namespace :spec do
desc "Run unit specs."
RSpec::Core::RakeTask.new(:units) do |t|
t.rspec_opts = ['--colour --format progress --tag ~pkcs11']
t.rspec_opts = ["--colour --format progress --tag ~pkcs11"]
end

desc "Run integration specs."
RSpec::Core::RakeTask.new(:integrations) do |t|
t.rspec_opts = ['--colour --format progress']
t.rspec_opts = ["--colour --format progress"]
end
end

RSpec::Core::RakeTask.new(:doc) do |t|
t.rspec_opts = ['--format specdoc ']
end
5 changes: 0 additions & 5 deletions VERSION.yml

This file was deleted.

105 changes: 22 additions & 83 deletions certificate_authority.gemspec
Original file line number Diff line number Diff line change
@@ -1,89 +1,28 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
# stub: certificate_authority 0.2.0 ruby lib
require File.expand_path("lib/certificate_authority/version", __dir__)

Gem::Specification.new do |s|
s.name = "certificate_authority"
s.version = "0.2.0"
Gem::Specification.new do |spec|
spec.name = "certificate_authority"
spec.version = CertificateAuthority::VERSION
spec.authors = ["Chris Chandler"]
spec.email = ["squanderingtime@gmail.com"]

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.require_paths = ["lib"]
s.authors = ["Chris Chandler"]
s.date = "2016-06-21"
s.email = "squanderingtime@gmail.com"
s.extra_rdoc_files = [
"README.rdoc"
]
s.files = [
".travis.yml",
"Gemfile",
"Gemfile.lock",
"README.rdoc",
"Rakefile",
"VERSION.yml",
"certificate_authority.gemspec",
"lib/certificate_authority.rb",
"lib/certificate_authority/certificate.rb",
"lib/certificate_authority/certificate_revocation_list.rb",
"lib/certificate_authority/core_extensions.rb",
"lib/certificate_authority/distinguished_name.rb",
"lib/certificate_authority/extensions.rb",
"lib/certificate_authority/key_material.rb",
"lib/certificate_authority/ocsp_handler.rb",
"lib/certificate_authority/pkcs11_key_material.rb",
"lib/certificate_authority/revocable.rb",
"lib/certificate_authority/serial_number.rb",
"lib/certificate_authority/signing_entity.rb",
"lib/certificate_authority/signing_request.rb",
"lib/certificate_authority/validations.rb",
"lib/tasks/certificate_authority.rake",
"spec/samples/certs/DigiCertHighAssuranceEVCA-1.pem",
"spec/samples/certs/apple_wwdr_issued_cert.pem",
"spec/samples/certs/apple_wwdr_issuer.pem",
"spec/samples/certs/ca.crt",
"spec/samples/certs/ca.key",
"spec/samples/certs/client.crt",
"spec/samples/certs/client.csr",
"spec/samples/certs/client.key",
"spec/samples/certs/github.com.pem",
"spec/samples/certs/server.crt",
"spec/samples/certs/server.csr",
"spec/samples/certs/server.key",
"spec/spec_helper.rb",
"spec/units/certificate_authority_spec.rb",
"spec/units/certificate_revocation_list_spec.rb",
"spec/units/certificate_spec.rb",
"spec/units/distinguished_name_spec.rb",
"spec/units/extensions_spec.rb",
"spec/units/key_material_spec.rb",
"spec/units/ocsp_handler_spec.rb",
"spec/units/pkcs11_key_material_spec.rb",
"spec/units/serial_number_spec.rb",
"spec/units/signing_entity_spec.rb",
"spec/units/signing_request_spec.rb",
"spec/units/units_helper.rb",
"spec/units/working_with_openssl_spec.rb"
]
s.homepage = "https://github.com/cchandler/certificate_authority"
s.licenses = ["MIT"]
s.rubygems_version = "2.2.2"
s.summary = "Ruby gem for managing the core functions outlined in RFC-3280 for PKI"
spec.summary = "Ruby gem for managing the core functions outlined in RFC-3280 for PKI"
spec.homepage = "https://github.com/cchandler/certificate_authority"
spec.license = "MIT"

if s.respond_to? :specification_version then
s.specification_version = 4
spec.metadata["homepage_uri"] = "https://github.com/cchandler/certificate_authority"
spec.metadata["source_code_uri"] = "https://github.com/cchandler/certificate_authority"

if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
s.add_development_dependency(%q<rspec>, [">= 0"])
s.add_development_dependency(%q<jeweler>, [">= 1.5.2"])
else
s.add_dependency(%q<rspec>, [">= 0"])
s.add_dependency(%q<jeweler>, [">= 1.5.2"])
end
else
s.add_dependency(%q<rspec>, [">= 0"])
s.add_dependency(%q<jeweler>, [">= 1.5.2"])
spec.files = Dir.chdir(__dir__) do
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec/)}) }
end
end
spec.require_paths = ["lib"]

spec.required_ruby_version = ">= 2.4"

spec.add_development_dependency "coveralls"
spec.add_development_dependency "pry"
spec.add_development_dependency "rake"
spec.add_development_dependency "rspec"
spec.add_development_dependency "rubocop"
end
6 changes: 2 additions & 4 deletions lib/certificate_authority.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))

#Exterior requirements
# Exterior requirements
require 'openssl'

#Internal modules
# Internal modules
require 'certificate_authority/core_extensions'
require 'certificate_authority/signing_entity'
require 'certificate_authority/revocable'
Expand Down
2 changes: 1 addition & 1 deletion lib/certificate_authority/extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def is_ca?
end

def path_len=(value)
raise "path_len must be a non-negative integer" if value < 0 or !value.is_a?(Fixnum)
fail(ArgumentError, "path_len must be a non-negative integer") if !value.is_a?(Integer) || value < 0
@path_len = value
end

Expand Down
3 changes: 3 additions & 0 deletions lib/certificate_authority/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module CertificateAuthority
VERSION = '0.2.0'.freeze
end
9 changes: 5 additions & 4 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
require 'rubygems'
require 'rspec'
require 'bundler/setup'
require 'certificate_authority'
require 'pathname'
require 'pry'

require 'coveralls'
Coveralls.wear!

SPECDIR = Pathname(__FILE__).dirname
require SPECDIR.join('..', 'lib', 'certificate_authority').to_s
SAMPLES_DIR = Pathname.new(__dir__).join('samples').freeze

def sample_file(name)
SPECDIR.join("samples", name)
SAMPLES_DIR.join(name)
end

4 changes: 2 additions & 2 deletions spec/units/extensions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
it "should raise an error if :path_len isn't a non-negative integer" do
basic_constraints = CertificateAuthority::Extensions::BasicConstraints.new
expect {basic_constraints.path_len = "moo"}.to raise_error(ArgumentError)
expect {basic_constraints.path_len = -1}.to raise_error(RuntimeError)
expect {basic_constraints.path_len = 1.5}.to raise_error(RuntimeError)
expect {basic_constraints.path_len = -1}.to raise_error(ArgumentError)
expect {basic_constraints.path_len = 1.5}.to raise_error(ArgumentError)
end

it "should generate a proper OpenSSL extension string" do
Expand Down

0 comments on commit a001a99

Please sign in to comment.