summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2014-10-28 11:21:21 -0700
committerelijah <elijah@riseup.net>2014-10-28 11:21:21 -0700
commitdddbaa40ed9abb1031ccdce21c3d6769dbc5b112 (patch)
treeadec8224af0906c291cd7daa63f1dc1c359851fd
parent8067a244be533aac273725bef70618bae6f557cc (diff)
autoload some of the external dependencies that are rarely used, so that we don't need to load them every time.
-rw-r--r--lib/leap_cli/commands/ca.rb6
-rw-r--r--lib/leap_cli/commands/node.rb4
-rw-r--r--lib/leap_cli/commands/user.rb2
-rw-r--r--lib/leap_cli/commands/vagrant.rb2
-rw-r--r--lib/leap_cli/remote/rsync_plugin.rb2
-rw-r--r--lib/leap_cli/util/secret.rb2
-rw-r--r--lib/leap_cli/util/x509.rb5
7 files changed, 11 insertions, 12 deletions
diff --git a/lib/leap_cli/commands/ca.rb b/lib/leap_cli/commands/ca.rb
index ecc324b..579e305 100644
--- a/lib/leap_cli/commands/ca.rb
+++ b/lib/leap_cli/commands/ca.rb
@@ -1,6 +1,6 @@
-require 'openssl'
-require 'certificate_authority'
-require 'date'
+autoload :OpenSSL, 'openssl'
+autoload :CertificateAuthority, 'certificate_authority'
+autoload :Date, 'date'
require 'digest/md5'
module LeapCli; module Commands
diff --git a/lib/leap_cli/commands/node.rb b/lib/leap_cli/commands/node.rb
index 304d86b..ba637f8 100644
--- a/lib/leap_cli/commands/node.rb
+++ b/lib/leap_cli/commands/node.rb
@@ -1,6 +1,4 @@
-require 'net/ssh/known_hosts'
-require 'tempfile'
-require 'ipaddr'
+autoload :IPAddr, 'ipaddr'
module LeapCli; module Commands
diff --git a/lib/leap_cli/commands/user.rb b/lib/leap_cli/commands/user.rb
index d7c21db..a1b4c43 100644
--- a/lib/leap_cli/commands/user.rb
+++ b/lib/leap_cli/commands/user.rb
@@ -1,4 +1,4 @@
-require 'gpgme'
+autoload :GPGME, 'gpgme'
#
# perhaps we want to verify that the key files are actually the key files we expect.
diff --git a/lib/leap_cli/commands/vagrant.rb b/lib/leap_cli/commands/vagrant.rb
index 24310e2..6227ece 100644
--- a/lib/leap_cli/commands/vagrant.rb
+++ b/lib/leap_cli/commands/vagrant.rb
@@ -1,4 +1,4 @@
-require 'ipaddr'
+autoload :IPAddr, 'ipaddr'
require 'fileutils'
module LeapCli; module Commands
diff --git a/lib/leap_cli/remote/rsync_plugin.rb b/lib/leap_cli/remote/rsync_plugin.rb
index 48f82d3..a6708f4 100644
--- a/lib/leap_cli/remote/rsync_plugin.rb
+++ b/lib/leap_cli/remote/rsync_plugin.rb
@@ -3,7 +3,7 @@
# (see RemoteCommand::new_capistrano)
#
-require 'rsync_command'
+autoload :RsyncCommand, 'rsync_command'
module LeapCli; module Remote; module RsyncPlugin
diff --git a/lib/leap_cli/util/secret.rb b/lib/leap_cli/util/secret.rb
index a6bd7a3..837a0af 100644
--- a/lib/leap_cli/util/secret.rb
+++ b/lib/leap_cli/util/secret.rb
@@ -4,7 +4,7 @@
#
# Uses OpenSSL random number generator instead of Ruby's rand function
#
-require 'openssl'
+autoload :OpenSSL, 'openssl'
module LeapCli; module Util
class Secret
diff --git a/lib/leap_cli/util/x509.rb b/lib/leap_cli/util/x509.rb
index 9ecd92d..787fdfa 100644
--- a/lib/leap_cli/util/x509.rb
+++ b/lib/leap_cli/util/x509.rb
@@ -1,5 +1,6 @@
-require 'openssl'
-require 'certificate_authority'
+autoload :OpenSSL, 'openssl'
+autoload :CertificateAuthority, 'certificate_authority'
+
require 'digest'
require 'digest/md5'
require 'digest/sha1'