]> gitweb.fluxo.info Git - leap/leap_cli.git/commitdiff
better solution to activesupport dependency problem
authorelijah <elijah@riseup.net>
Tue, 28 Oct 2014 18:23:55 +0000 (11:23 -0700)
committerelijah <elijah@riseup.net>
Tue, 28 Oct 2014 18:23:55 +0000 (11:23 -0700)
leap_cli.gemspec
lib/leap_cli.rb
lib/override/json.rb
lib/override/to_json.rb [deleted file]
vendor/certificate_authority/lib/certificate_authority/certificate.rb
vendor/certificate_authority/lib/certificate_authority/extensions.rb

index cbf0674df44ef7bb47403ae74d4169d18bab1d15..d0b9a998c4b3052f65fe98e324e23eeab60d9a74 100644 (file)
@@ -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
index baff32fc4d73b8efa364172a029d97ff153d897b..e8f7ecff73549648f6f5e8e077f2f1cb6e2e53cf 100644 (file)
@@ -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'
index 8857a22d02051c70916a903ea13f5c14e6786576..a7ae32875297f16e4062bfab3dabaaca1857123b 100644 (file)
@@ -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 (file)
index 73fbe5c..0000000
+++ /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.
-#
-
index f096c5afed4745046f08bc5370f8c1343ef5d762..3fcae90373e56e0bdbd65d190a62d67f1303e168 100644 (file)
@@ -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()
 
index 89de0321749ae4cbdb5617b4dd0603e722e289fb..7bc4fabc9163e607434c41e9e34cea5b8c83ab0a 100644 (file)
@@ -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