From 6d443e008a94f842799f30d15aacb754439fe101 Mon Sep 17 00:00:00 2001 From: elijah Date: Tue, 28 Oct 2014 11:23:55 -0700 Subject: better solution to activesupport dependency problem --- leap_cli.gemspec | 1 - lib/leap_cli.rb | 1 - lib/override/json.rb | 2 +- lib/override/to_json.rb | 20 -------------------- .../lib/certificate_authority/certificate.rb | 6 ++---- .../lib/certificate_authority/extensions.rb | 4 ++-- 6 files changed, 5 insertions(+), 29 deletions(-) delete mode 100644 lib/override/to_json.rb diff --git a/leap_cli.gemspec b/leap_cli.gemspec index cbf0674..d0b9a99 100644 --- a/leap_cli.gemspec +++ b/leap_cli.gemspec @@ -78,5 +78,4 @@ spec = Gem::Specification.new do |s| # certificate_authority s.add_runtime_dependency("activemodel", ">= 3.0.6") - s.add_runtime_dependency("activesupport", ">= 3.0.6") end diff --git a/lib/leap_cli.rb b/lib/leap_cli.rb index baff32f..e8f7ecf 100644 --- a/lib/leap_cli.rb +++ b/lib/leap_cli.rb @@ -6,7 +6,6 @@ end $ruby_version = RUBY_VERSION.split('.').collect{ |i| i.to_i }.extend(Comparable) # ensure leap_cli/lib/overrides has the highest priority -# (these files override bad behavior in gems that overrides JSON) $:.unshift(File.expand_path('../override',__FILE__)) require 'leap/platform' diff --git a/lib/override/json.rb b/lib/override/json.rb index 8857a22..a7ae328 100644 --- a/lib/override/json.rb +++ b/lib/override/json.rb @@ -8,4 +8,4 @@ # This trick only works if this directory is early in the # include path. # -require 'json/pure' +require 'json/pure' \ No newline at end of file diff --git a/lib/override/to_json.rb b/lib/override/to_json.rb deleted file mode 100644 index 73fbe5c..0000000 --- a/lib/override/to_json.rb +++ /dev/null @@ -1,20 +0,0 @@ -# -# activesupport/lib/core_ext/object/to_json.rb overrides to_json for -# most core objects like so: -# -# [Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass].each do |klass| -# klass.class_eval do -# # Dumps object in JSON (JavaScript Object Notation). See www.json.org for more info. -# def to_json(options = nil) -# ActiveSupport::JSON.encode(self, options) -# end -# end -# end -# -# We cannot tolerate this. We need the normal to_json to be called, not -# ActiveSupport's custom version. -# -# This file exists to override the behavior of ActiveSupport. This file will get included -# instead of the normal to_json.rb. -# - diff --git a/vendor/certificate_authority/lib/certificate_authority/certificate.rb b/vendor/certificate_authority/lib/certificate_authority/certificate.rb index f096c5a..3fcae90 100644 --- a/vendor/certificate_authority/lib/certificate_authority/certificate.rb +++ b/vendor/certificate_authority/lib/certificate_authority/certificate.rb @@ -1,5 +1,3 @@ -require 'active_support/all' - module CertificateAuthority class Certificate include ActiveModel::Validations @@ -34,8 +32,8 @@ module CertificateAuthority self.distinguished_name = DistinguishedName.new self.serial_number = SerialNumber.new self.key_material = MemoryKeyMaterial.new - self.not_before = Time.now.change(:min => 0).utc - self.not_after = Time.now.change(:min => 0).utc + 1.year + self.not_before = Time.now + self.not_after = Time.now + 60 * 60 * 24 * 365 # One year self.parent = self self.extensions = load_extensions() diff --git a/vendor/certificate_authority/lib/certificate_authority/extensions.rb b/vendor/certificate_authority/lib/certificate_authority/extensions.rb index 89de032..7bc4fab 100644 --- a/vendor/certificate_authority/lib/certificate_authority/extensions.rb +++ b/vendor/certificate_authority/lib/certificate_authority/extensions.rb @@ -282,11 +282,11 @@ module CertificateAuthority return obj if value.nil? obj.critical = critical value.split("\n").each do |v| - if v.starts_with?("OCSP") + if v =~ /^OCSP/ obj.ocsp << v.split.last end - if v.starts_with?("CA Issuers") + if v =~ /^CA Issuers/ obj.ca_issuers << v.split.last end end -- cgit v1.2.3