Ruby ã® bundler ã 1.13 ãã 1.15 ã«ã¢ãããã¼ããããä»ã¾ã§åããããã°ã©ã ãåããªããªãã¾ããã
ãããªæã:
% bundle _1.13.7_ exec ruby -r./hoge.rb -e Hoge.new % % bundle _1.15.4_ exec ruby -r./hoge.rb -e Hoge.new hoge.rb:3:in `initialize': uninitialized constant Hoge::Timeout (NameError) Did you mean? Time from -e:1:in `new' from -e:1:in `<main>'
ãã® hoge.rb ã®ä¸å³ã¯ãããªæãã§ã
class Hoge def initialize Timeout.timeout(5){sleep 1} end end
æ¬æ¥ require "timeout"
ããªãã¨ä½¿ããªã Timeout ã使ã£ã¦ããã®ã§ã¨ã©ã¼ã«ãªãã®ãæ£ãããã§ããã©ãä»ã¾ã§ã¯ bundler ãæé»çã« timeout ã©ã¤ãã©ãªãèªã¿è¾¼ãã§ããã®ã§æ°ãã¤ããªãã£ãã¨ãã話ã§ããã
bundler 1.13 ã§ã¯æå¹ã ã£ããã© 1.14 ã§ã¯æå¹ã§ãªããããã¬ãã«å®æ°(âã¯ã©ã¹)ãæ½åºãã¦ã¿ã¾ããã
% comm -23 <(bundle _1.13.7_ exec ruby -e 'puts Object.constants.sort') <(bundle _1.14.6_ exec ruby -e 'puts Object.constants.sort') Addrinfo BasicSocket CGI Date DateTime IPSocket Net OpenSSL Resolv ScanError SecureRandom Socket SocketError StringScanner TCPServer TCPSocket Timeout TimeoutError UDPSocket UNIXServer UNIXSocket Zlib
1.14 㨠1.15 ã®éãã¯ãããªæãã
% comm -23 <(bundle _1.14.6_ exec ruby -e 'puts Object.constants.sort') <(bundle _1.15.4_ exec ruby -e 'puts Object.constants.sort') BundlerVendoredPostIt OptParse OptionParser Tempfile
RSpecã¨ãã®èªåãã¹ãã§ã¯ã1ããã»ã¹ã§å ¨ãã¡ã¤ã«ããã¹ããã¦ãã¾ããä»ã®ãã¡ã¤ã«ã§ require ãããã®ãæå¹ã«ãªã£ã¦ãã¾ã£ã¦ãä»åã®ç¾è±¡ã¯è¦ã¤ãããã¾ããã§ããããã¹ãã©ã¤ãã©ãªã require ãã¦ãå ´åãããã§ããããã
ä¸å¿ãä»åè¦ã¤ãããã¡ã¤ã«ä»¥å¤ã«ã¤ãã¦ã require ãæ¼ãã¦ããªããã©ãã調ã¹ã¦ã¿ã¾ããã
èªåãä½ãã©ã¤ãã©ãªã¯ãä¸ã§ä½¿ç¨ãã¦ããå¤é¨ã¯ã©ã¹ã«ã¤ãã¦åé 㧠require ããããã«ãã¦ããã®ã§ãã©ã¤ãã©ãªãèªã¿è¾¼ãã å¾ã§ãã®ã¯ã©ã¹ãåç §ãã¦ã¨ã©ã¼ã«ãªããã©ããã確èªããã°è¯ãããã§ãã
for class in $(<class.txt); do # class.txt ã¯ä¸ã§æ½åºããã¯ã©ã¹ä¸è¦§ echo "== $class ==" for rb in **/*.rb; do grep -qw $class $rb && (ruby -r $rb -e $class 2> /dev/null || echo $rb) done done
ãã ããã ã¨æååãªãã©ã«ãã³ã¡ã³ãå ã®æååã«ãå¼ã£ããã£ã¦ãã¾ãã®ã§ãããããã¡ãã¡ç®ã§ç¢ºèªããã®ãé¢åã§ããã
Ripperã¨ãã使ã£ã¦Rubyããã°ã©ã ã¨ãã¦ãã¼ã¹ãã¦ããã®ä¸ã§åç §ãã¦ããå®æ°ããã¹ã¦æ½åºãã¦ã使ãããã©ããã確èªããã°ããã®ããããã¾ãããâ¦ã