rakeã®ã¨ã©ã¼è¡¨ç¤ºãã¡ãã£ã¨ã ã便å©ã«ãªãã¾ããã
rake v13.1.0ããªãªã¼ã¹ããã¾ãã ð
https://rubygems.org/gems/rake/versions/13.1.0
ãã®ãªãªã¼ã¹ã«ã¯ç§ãå®è£ ããæ¹åãå«ã¾ãã¦ããã®ã§ç´¹ä»ãã¾ãã ã¨ãããæ¸ããªãã¨ç°å¢å¤æ°ã¨ã誰ã«ãæ°ã¥ãããªãããã
Support `#detailed_message` when task failed by ksss · Pull Request #486 · ruby/rake · GitHub
rake taskå®è¡æã«ä½ããã®ã¨ã©ã¼ã«ãã£ã¦å¤±æããã¨ããerror_highlightãdid_you_meanãå¹ãããã«ãªãã¾ããã
before
$ bundle exec rake demo rake aborted! NoMethodError: undefined method `opject_id' for main:Object
after
$ bundle exec rake demo rake aborted! NoMethodError: undefined method `opject_id' for main:Object (NoMethodError) p self.opject_id ^^^^^^^^^^ Did you mean? object_id
ããã¾ã§ã¯çºçããã¨ã©ã¼ã¯ã©ã¹ã®#message
ã¡ã½ããã表示ãã¦ããã®ã§ããã#detailed_message
ã¨ããã¡ã½ãããå¼ã¹ããªããã£ã¡ãå¼ã³åºãããã«ãªãã¾ãã
ruby v3.2.0ããException#detailed_message
ãå°å
¥ããã¦ããããããå©ç¨ãã¦ãã¾ãã
ã¨ã©ã¼ã¯ã©ã¹ã«#detailed_message
ã¡ã½ããããããã°v3.1以åã®rubyã§ãåãã£ã¡ãåãã®ã§ãããç¨ãªã±ã¼ã¹ã ã¨æããã¾ãã
rbsã¯v.3.1ã§ã#detailed_message
ãå¼ã¹ãããã«ããã®ã§ãã®æ½çã¯æå¹ã§ãã
Debug at stop when task fail by ksss · Pull Request #489 · ruby/rake · GitHub
ç°å¢å¤æ°RAKE_DEBUG
ã«ä½ãããã®å¤ãå
¥ã£ã¦ããã¨ãrake taskã失æããã¨ãã«debug gemã«ãããããã¬ã¼ãèµ·åãã¾ãã
$ RAKE_DEBUG=1 bundle exec rake demo undefined local variable or method `aaa' for main:Object [30, 36] in ~/src/github.com/ksss/rake/Rakefile 30| end 31| 32| task default: :test 33| 34| task :demo do => 35| aaa 36| end =>#0 block in <top (required)> at ~/src/github.com/ksss/rake/Rakefile:35 #1 [C] Kernel.load at ~/.rbenv/versions/3.2.1/lib/ruby/3.2.0/bundler/cli/exec.rb:58 # and 14 frames (use `bt' command for all frames) (rdbg:postmortem)
ããã¾ã§rdbgã³ãã³ãã§rakeã¿ã¹ã¯ã«å¯¾ãã¦ãã¬ã¤ã¯ãã¤ã³ããä»è¾¼ãäºã¯ã§ãã¾ããããã¨ã©ã¼çºçæã«ãããã¬ã¼ãèµ·åããpostmortemæ©è½ã使ã£ã¦ãæå¾ã«èµ·ããexceptionã«å¯¾ãã¦ãããã¬ã¼ãèµ·åããã®ã§ãæ¬æ¥èª¿ã¹ããã£ãã³ã³ããã¹ãã失ãããç¶æ ã«ãªã£ã¦ãã¾ããã
ãã㧠rspec-debug gemããã³ãã«Rake::Task#execute
å®è¡ä¸ã«çºçããã¨ã©ã¼ã«å¯¾ãã¦postmortemãèµ·åãããã¨ã§ãæ¬æ¥å¾ããã£ãã³ã³ããã¹ããå¾ããã¨ãã§ããããã«ãªãã¾ããã
ãã¡ããdebug gemã使ããç¶æ³ã§ãªããã°ç°å¢å¤æ°ãã¤ãã¦ãèµ·åããªãã®ã§ã注æãã ããã
ãªã«ãåé¡ãããã°ç´ãã®ã§æãã¦ä¸ããã
ã¾ã¨ã
rake便å©ã