-
-
Save webmat/2652838 to your computer and use it in GitHub Desktop.
Revisions
-
webmat revised this gist
May 10, 2012 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,11 @@ #!/usr/bin/env ruby # Temporarily add this dir to your path # export PATH=~/gists/bundle_benchmark:$PATH # cd to any of your project and run the benchmark # cd ~/my-project # benchmark.rb require 'benchmark' require 'bundler' -
webmat revised this gist
May 10, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
Empty file. -
webmat revised this gist
May 10, 2012 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,6 +11,7 @@ ] def pull(dep) required_file = nil # Make sure var is still in scope in rescue block begin # Loop through all the specified autorequires for the # dependency. If there are none, use the dependency's name @@ -21,6 +22,7 @@ def pull(dep) end rescue LoadError => e if dep.autorequire.nil? && dep.name.include?('-') namespaced_file = nil # Make sure var is still in scope in rescue block begin namespaced_file = dep.name.gsub('-', '/') Kernel.require namespaced_file -
webmat revised this gist
May 10, 2012 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ #!/usr/bin/env ruby require 'benchmark' require 'bundler' REGEXPS = [ /^no such file to load -- (.+)$/i, @@ -44,4 +45,4 @@ def pull(dep) pull(dependency) end end end -
panthomakos created this gist
May 3, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,47 @@ #!/usr/bin/env ruby require 'benchmark' REGEXPS = [ /^no such file to load -- (.+)$/i, /^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i, /^Missing API definition file in (.+)$/i, /^cannot load such file -- (.+)$/i, ] def pull(dep) begin # Loop through all the specified autorequires for the # dependency. If there are none, use the dependency's name # as the autorequire. Array(dep.autorequire || dep.name).each do |file| required_file = file Kernel.require file end rescue LoadError => e if dep.autorequire.nil? && dep.name.include?('-') begin namespaced_file = dep.name.gsub('-', '/') Kernel.require namespaced_file rescue LoadError REGEXPS.find { |r| r =~ e.message } raise if dep.autorequire || $1.gsub('-', '/') != namespaced_file end else REGEXPS.find { |r| r =~ e.message } raise if dep.autorequire || $1 != required_file end end end require 'rails/all' $VERBOSE = nil Benchmark.bm do |x| Bundler.setup.dependencies.each do |dependency| x.report(dependency.name[0..20].ljust(21)) do pull(dependency) end end end