Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Tenderness driven development for Redmine plugin

3140de70ab04d8f9fc979447b0b4fb16?s=47 pinzolo
July 12, 2014

Tenderness driven development for Redmine plugin

This slide has been published in RxTstudy 11th on 2014-07-12 at Osaka, Japan

3140de70ab04d8f9fc979447b0b4fb16?s=128

pinzolo

July 12, 2014
Tweet

Transcript

  1. ༏͍͠ϓϥάΠϯ։ൃ

  2. ࣗݾ঺հ 4 ໺ా ੣ਓ 4 גࣜձࣾ ۭ 4 Engineer 4

    @pinzolo 4 https://github.com/pinzolo
  3. Rubygems 4 detox 4 formup 4 logdup 4 mastar 4

    rails-flog 4 rails-render_hooks 4 tekido
  4. Redmine plugins 4 redmine_bx 4 Redmine ্Ͱςʔϒϧఆٛ΍ϦιʔεఆٛΛ؅ཧ͢Δ ʢ࡞Γͳ͓͢༧ఆʣ 4 redmine_persist_wfmt

    4 Wiki ͷϑΥʔϚοτอଘͱબ୒ 4 redmine_reminderz 4 Reminder λεΫΛͪΐͬͱ͚֦ͩுͨ͠΋ͷ
  5. How use Redmine ओʹ৘ใ؅ཧ λεΫ؅ཧͱͯ͠͸͋Μ·Γ

  6. ϓϥάΠϯͱ͸ 4 Զͷཉ͍͠ػೳ͕ͳ͍ 4 ͜ͷॲཧ͸͜͏ͨ͠΄͏͕͍͍ 4 λεΫ؅ཧҎ֎΋؅ཧͰ͖ͨΒ͍͍ͷʹ

  7. ϓϥάΠϯͱ͸ 4 Զͷཉ͍͠ػೳ͕ͳ͍ 4 ͜ͷॲཧ͸͜͏ͨ͠΄͏͕͍͍ 4 λεΫ؅ཧҎ֎΋؅ཧͰ͖ͨΒ͍͍ͷʹ →ཁ͢ΔʹΤΰͷմ

  8. ͔͠͠ɻɻɻ 4 ͔ͤͬ͘࡞ͬͨϓϥάΠϯɺ࢖ͬͯཉ͍͠ 4 ಉ͜͡ͱͰ೰ΜͰ͍Δਓ͸͍Δʂ 4 ΑΓྑ͘͢ΔͨΊʹଞͷਓͷҙݟ͕΄͍͠ ͔ͩΒɺਓʹ༏͘͠ϓϥάΠϯΛ։ൃ͠Α͏ʂʂ

  9. ։ൃऀʹ༏͘͠

  10. ։ൃऀʹ༏͘͠(1) ࢖༻͢ΔϥΠϒϥϦͷόʔδϣϯ͸࠷৽Λ࢖༻͢Δ ಛʹ ~> Λ࢖༻͢ΔͱϓϥάΠϯಉ࢜Ͱͷিಥ͕͍͔ͭඞͣى ͖Δ

  11. ։ൃऀʹ༏͘͠(2) ൓ରʹ Ruby ͸Ͱ͖Δ͚ͩ 1.9.3 Λϕʔεʹ͢Δ Redmine ͷಈ࡞؀ڥΛϓϥάΠϯ͕ࠨӈͯ͠͠·͏ͷ͸޷· ͍͜͠ͱͰ͸ͳ͍

  12. ։ൃऀʹ༏͘͠(3) Redmine ͷόʔδϣϯΞοϓʹ͸ඞͣ௥ਵ͢Δ ʮRedmine ͷόʔδϣϯΞοϓΛ͍͚ͨ͠Ͳɺ͜ͷϓϥάΠ ϯ͕ະରԠ͔ͩΒରԠ଴ͪʯͳΜͯࣄଶ͸ΠΧϯ

  13. ։ൃऀʹ༏͘͠(4) γϯϘϧΛܾΊ͓ͯ͘ ςʔϒϧ΍Ϋϥεͷॏෳ͕͸ආ͚͓͖ͯ·͠ΐ͏

  14. ։ൃऀʹ༏͘͠(5) ࣗ෼ͷϓϥάΠϯͷػೳɺӨڹΛ໌ࣔԽ͓͖͍ͯͨ͠ gem ΍ Redmine ͷόʔδϣϯΞοϓʹૉૣ͘௥ਵ͢Δʹ͸Ͳ ͏ͨ͠Βʁ

  15. ։ൃऀʹ༏͘͠(5) ࣗ෼ͷϓϥάΠϯͷػೳɺӨڹΛ໌ࣔԽ͓͖͍ͯͨ͠ gem ΍ Redmine ͷόʔδϣϯΞοϓʹૉૣ͘௥ਵ͢Δʹ͸Ͳ ͏ͨ͠Βʁ → ςετΛॻ͜͏

  16. ςετΛॻ͜͏ Redmine ʹ͸͢Ͱʹ૬౰ྔͷςετίʔυ͕͋ΔͷͰɺ Fixture ΍ϔϧύʔϝιουΛྲྀ༻Ͱ͖Δ RSpec ΍ FactoryGirl ͳͲ͕࢖͍͍ͨਓ͸ͦͪΒΛ࢖͑͹͍ ͍ɻڞଘ͸Ͱ͖Δ

    CI ΋ͲΜͲΜ΍͍ͬͯ͜͏
  17. ؅ཧऀʹ༏͘͠

  18. ؅ཧऀʹ༏͘͠(1) ΤϯδχΞ͕໌ه͢Δ͜ͱ 4 Πϯετʔϧํ๏ 4 Πϯετʔϧ͢ΔͱԿΛղܾ͢Δͷ͔ʁԿ͕Ͱ͖Δͷ͔ʁ 4 όʔδϣϯ্͕ͬͨΒԿ͕มΘͬͨʁ

  19. ؅ཧऀʹ༏͘͠(2) ؾͷར͍ͨΤϯδχΞ͕໌ه͢Δ͜ͱ 4 ΞϯΠϯετʔϧํ๏ 4 αϙʔτ͍ͯ͠Δόʔδϣϯ 4 ຊମͷػೳʹӨڹΛ༩͑Δ৔߹ͷ before ->

    after
  20. ؅ཧऀʹ༏͘͠(3) ؅ཧऀ͕ؾʹ͢ΔͰ͋Ζ͏͜ͱ 4 Redmine ͷػೳΛյ͞ͳ͍͔Ͳ͏͔ 4 Redmine ͕஗͘ͳΒͳ͍͔ 4 ଞͷϓϥάΠϯͱ૬ੑ͕ѱ͘ແ͍͔

  21. ؅ཧऀʹ༏͘͠(4) ຊମͷػೳʹӨڹΛ༩͑ͳ͍΋ͱΛɺग़དྷΔݶΓͦΕΛূ໌͠ ͍ͨ ຊਓͷؾʹ͍ͯ͠ͳ͍ͱ͜ΖͰো֐͸ى͖Δ ϓϥάΠϯͷςετ͚ͩͰ͸ϨΞέʔεͰͷຊମτϥϒϧ͕ൃ ݟͰ͖ͳ͍

  22. ؅ཧऀʹ༏͘͠(4) ຊମͷػೳʹӨڹΛ༩͑ͳ͍΋ͱΛɺग़དྷΔݶΓͦΕΛূ໌͠ ͍ͨ ຊਓͷؾʹ͍ͯ͠ͳ͍ͱ͜ΖͰো֐͸ى͖Δ ϓϥάΠϯͷςετ͚ͩͰ͸ϨΞέʔεͰͷຊମτϥϒϧ͕ൃ ݟͰ͖ͳ͍ → rake ci Λར༻͠Α͏

  23. rake ci Redmine ʹ͋Δ΄ͱΜͲશͯͷςετΛ࣮ߦ͠·͢ ϓϥάΠϯͷࢥΘ͵όάΛݟ͚ͭͨΓɺશ෦௨ͬͨΒ҆৺ͨ͠ Γग़དྷ·͢ จࣈ௨Γ CI ͠·͠ΐ͏

  24. How CI σϑΝΫτͷ Jenkins ΋͍͍͚ͲɺCI αʔϏε͕खܰͰศར 4 Travis CI 4

    Drone.io 4 Wercker 4 Circle CI etc.
  25. How CI σϑΝΫτͷ Jenkins ΋͍͍͚ͲɺCI αʔϏε͕खܰͰศར 4 Travis CI ←

    ͓͢͢Ί 4 Drone.io 4 Wercker 4 Circle CI etc.
  26. Travis CI ͷϝϦοτ (1) ϏϧυϚτϦΫε Ruby: 1.9.3, 2.0.0, 2.1.2 Redmine:

    2.3.x, 2.4.x, 2.5.x ςετର৅: Redmineຊମ, ϓϥάΠϯ ͜ΕΒΛ૊Έ߹Θͤͨ؀ڥͷςετ͕؆୯ʹͰ͖Δ
  27. Travis CI ͷϝϦοτ (2) apt ͕࢖༻Մೳ apt ͕࢖͑ΔͷͰ CVS, Subversion,

    Mercurial ͳͲΛ࢖༻͠ ͨςετ͕Մೳ ͨͩ͠ɺDarcs ͸ඍົ ※ͪͳΈʹ Travis CI ͷ OS ͸ Ubuntu Server 12.04 LTS
  28. Travis CI ͷϝϦοτ (3) firefox ͕ಈ͘ JavaScript Λ༻͍ͨ UI ܦ༝ͷςετ΋Մೳ

    poltergeist ΋΋ͪΖΜಈ͘
  29. Travis CI ͷϝϦοτ (4) push Ҏ֎ͰͷϏϧυ Travis-CI Ͱ͸ Pull Request

    ΍ Release(λά)ʹରͯ͠΋Ϗ ϧυΛͯ͘͠ΕΔ
  30. Travis CI ͷ஫ҙ఺ Gemfile ͕ϦϙδτϦʹଘࡏ͞ΕΔͱϩοΫΦϯ͞Εͯ͠·͏ ςετΛ࣮ߦ͢Δ·Ͱʹগʑ޻෉͕ඞཁ → ࢲͷϦϙδτϦͷ .travis.yml Λࢀর

  31. ϓϥάΠϯ։ൃ֎Ͱͷ CI (1) ࣮ࡍʹӡ༻͍ͯ͠Δ Redmine ͷ؀ڥΛ CI ͱͯ͠༻ҙ͓ͯ͠ ͘ͱศར

  32. ϓϥάΠϯ։ൃ֎Ͱͷ CI (2) ͜Μͳ࣌ͷૣظ໰୊ൃݟʹ໾ཱͭ 4 Ruby ͷόʔδϣϯ্͕͕ͬͨ࣌ 4 Redmine ͷόʔδϣϯ্͕͕ͬͨ࣌

    4 ϓϥάΠϯͷόʔδϣϯ্͕͕ͬͨ࣌ 4 ৽ͨͳϓϥάΠϯΛಋೖ͢Δ࣌
  33. ϓϥάΠϯ։ൃ֎Ͱͷ CI (3) ͜ͷ৔߹͸ Jenkins ͷΑ͏ʹࣗ༝ʹϏϧυ؀ڥΛ࡞੒Ͱ͖Δ ΋ͷ͕ྑ͍ vagrant, docker ͱ͍ͬͨԾ૝Խٕज़΋ซ༻͢Δͱߋʹྑ͍

  34. ϓϥάΠϯ։ൃ֎Ͱͷ CI (4) ͦͷͨΊʹ΋ ςετΛॻ͜͏

  35. TEST, CI ͕ਁಁ͢Ε͹ 4 ϓϥάΠϯͷ඼࣭޲্ 4 ίϯϑϦΫτ͠ͳ͍ϓϥάΠϯ։ൃͷϊ΢ϋ΢ͷ஝ੵ 4 ҆৺ײʹΑΔϓϥάΠϯར༻ͷଅਐ 4

    ͔ͬ͠Γϝϯς͞Εɺਓؾͱ࣮੷ͷ͋ΔϓϥάΠϯ͸ຊՈ ʹऔΓࠐ·ΕΔ͔΋ʁ
  36. TEST, CI ͕ਁಁ͢Ε͹ 4 ϓϥάΠϯͷ඼࣭޲্ 4 ίϯϑϦΫτ͠ͳ͍ϓϥάΠϯ։ൃͷϊ΢ϋ΢ͷ஝ੵ 4 ҆৺ײʹΑΔϓϥάΠϯར༻ͷଅਐ 4

    ͔ͬ͠Γϝϯς͞Εɺਓؾͱ࣮੷ͷ͋ΔϓϥάΠϯ͸ຊՈ ʹऔΓࠐ·ΕΔ͔΋ʁ → ͍͍͜ͱͩΒ͚
  37. ͜͜·Ͱ͸ཧ૝ͷ࿩

  38. ݱ࣮ (1) ςετͷͳ͍ϓϥάΠϯ ଟ͍ɻςετͷ͋ΔϓϥάΠϯͷ΄͏͕গͳ͍Μ͡Όͳ͍͔ʁ ʢݸਓత؍ଌʣ

  39. ݱ࣮ (2) ϥΠϒϥϦͷόʔδϣϯ໰୊ 4 ϓϥάΠϯಉ࢜ͷόʔδϣϯিಥ 4 ຊମͱͷόʔδϣϯিಥ 4 ྫ͑͹ RSpec3

    ΛϓϥάΠϯͷςετʹར༻͢Δ͜ͱ͸ Ͱ͖·ͤΜ ʢࢀߟ: tail -f pinzo.log: Redmine ͷϓϥάΠϯΛ RSpec3 Ͱςετग़དྷͳ͍ʣ
  40. ݱ࣮ (3) Redmine ຊମͷςετ 4 ࠷ۙͷ Darcs Ͱ͸όʔδϣϯ͕৽ͯ͘͠ rake ci

    ͕ίέΔ 4 ൺֱతݹ͍όʔδϣϯΛϗετ͍ͯ͠Δ apt Ͱ΋μϝ 4 ࢖༻͢Δ SCM Λࢦఆͯ͠ςετΛ૸ΒͤΔ͜ͱ͕Ͱ͖ ΔΑ͏ʹͳͬͨͷ͸ Redmine 2.5 Ҏ߱
  41. ݱ࣮ (3) Redmine ຊମͷςετ 4 UI ͷςετ͸ issues_test.rb ͷ 10

    ςετέʔεͷΈ 4 Ϣχοτςετ͸໿2000݅ 4 ϑΝϯΫγϣφϧςετ͕1300݅ 4 ΠϯςάϨʔγϣϯςετ͕໿1000݅ 4 ci λεΫͰ͸࣮ߦ͞Εͳ͍
  42. ݱ࣮ (3) ͭ·Γ JavaScript Λ༻͍ͨςετ͸ظ଴Ͱ͖ͳ͍ JavaScript Λଟ༻͢ΔϓϥάΠϯͷ৔߹ɺຊମͷςετΛ௨ ͨ͢Ίͷ༨ܭͳ࣮૷Λڧ͍ΒΕΔ͜ͱ΋͋Δ ςϯγϣϯԼ͕Δ

  43. ݱ࣮ (4) ܾͯ͠खް͍ͱ͸ݴ͑ͳ͍ Redmine ͷϓϥάΠϯαϙʔτ 4 View hook গͳ͍ &

    ภ͍ͬͯΔ 4 ը໘্͔ΒΠϯετʔϧ͢Δखஈ͕ͳ͍ 4 Α͏΍͘࠷৽͔Ͳ͏͔ΛνΣοΫ͢Δػೳ͕௥Ճ͞Εͨ (2.5.2ʙ) 4 Github ͳͲͷ SCM αʔϏεͱͷ࿈ܞ͕ແ͍ͨΊɺ໺ྑϓ ϥάΠϯ͕ଟ͍
  44. ݁ہ Redmine ϓϥάΠϯ͸࡞Γ΍͘͢ɺRedmine ࣗମ֦ு͸͠қ ͍ ͔͠͠ɺ஌ݟͷڞ༗΍ΤίγεςϜ͕ॆ෼Ͱͳ͍ͨΊ Redmine ͷ஍ҐɾೳྗΛఈ্͛͢Δྗͱ࣮ͯ͠ྗ͕଍Γ͍ͯ ͳ͍ ΋͍ͬͨͳ͍

    # ͳΜ͔࿩ͷํ޲ੑ͕มΘ͍ͬͯΔ͕ؾʹ͠ͳ͍
  45. Redmine ͷݱঢ় ։ൃऀ޲͚πʔϧͱͯ͠͸ଞͷΞδϟΠϧܥ։ൃπʔϧͷํ͕ ਓؾ λεΫ؅ཧϝΠϯͰ͸ͳ͘ɺλεΫ؅ཧΛओͱͨ͠৘ใ؅ཧπ ʔϧͷଆ໘͕େ͖͍ ·ͨɺϓϥάΠϯ΍ Redmine ͷཁ๬ɾ࣭໰΋؅ཧऀͷཱ৔ͷ ऀ͕ଟ͍ؾ͕͢Δ

    → ITʹૄ͍ਓͨͪʹ΋༏͍͠πʔϧ͕ٻΊΒΕ͍ͯΔ
  46. Ϣʔβʹ༏͍͠ Redmine ͷͨΊʹ 4 ͲΜͲΜ࡞ΔɺͲΜͲΜศརʹ͢Δ

  47. Ϣʔβʹ༏͍͠ Redmine ͷͨΊʹ 4 ͲΜͲΜ࡞ΔɺͲΜͲΜศརʹ͢Δ 4 ΠϚυΩͷ։ൃख๏Λ Redmine ϓϥάΠϯʹ΋ద༻͢Δ ʢ҆৺ײʣ

  48. Ϣʔβʹ༏͍͠ Redmine ͷͨΊʹ 4 ͲΜͲΜ࡞ΔɺͲΜͲΜศརʹ͢Δ 4 ΠϚυΩͷ։ൃख๏Λ Redmine ϓϥάΠϯʹ΋ద༻͢Δ ʢ҆৺ײʣ

    4 ͲΜͲΜ৘ใΛൃ৴͢Δʢଟ਺੎ྗʣ
  49. Ϣʔβʹ༏͍͠ Redmine ͷͨΊʹ 4 ͲΜͲΜ࡞ΔɺͲΜͲΜศརʹ͢Δ 4 ΠϚυΩͷ։ൃख๏Λ Redmine ϓϥάΠϯʹ΋ద༻͢Δ ʢ҆৺ײʣ

    4 ͲΜͲΜ৘ใΛൃ৴͢Δʢଟ਺੎ྗʣ 4 ຊՈΛר͖ࠐΉʢΤίγεςϜͷڧԽʣ
  50. େ੾ͳͷ͸ɺ͍͍΋ͷΛ ࡞Δ͚ͩͰ͸ͳ͘ɺ͍͍ ॥؀Λ࡞Δ͜ͱ