Skip to content

Commit 319cfc2

Browse files
committed
Optimize our requires
Avoid requiring things that are already defined. Rubygems is very slow at traversing the filesystem. Signed-off-by: Tim Smith <[email protected]>
1 parent 9e9d28e commit 319cfc2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bin/chef-vault

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# See the License for the specific language governing permissions and
1919
# limitations under the License.
2020

21-
require "optparse"
21+
require "optparse" unless defined?(OptionParser)
2222

2323
options_config = {
2424
chef: {
@@ -82,7 +82,7 @@ options_config.each do |option, config|
8282
options[option] = options[option] ? options[option] : config[:default]
8383
end
8484

85-
require "rubygems"
85+
require "rubygems" unless defined?(Gem)
8686
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
8787
require "chef-vault"
8888

0 commit comments

Comments
 (0)