spreeのrails updateの戦いの歴史と github上のPR作成時の工夫

spreeのrails updateの戦いの歴史と github上のPR作成時の工夫

弊社ではspree( https://github.com/spree/spree )を使っています。
spreeは2007年から開発されているRails::Engineを活用したEコマースのプラットフォームであり、そのupdate作業はmigrationを伴います。
最近spree2.4->spree3.0にupdateしたので(rails4.1->rails4.2)、その際に得た知見・レビューに置いての知見等を発表します。

B122e77de860c4307034f0a041dabc8e?s=128

hoshino tsuyoshi

November 08, 2018
Tweet

Transcript

  1. 13.
  2. 14.

    # ίΞ gem 'spree', '~> 3.6.4’ # ೝূ gem 'spree_auth_devise',

    '~> 3.3’ # ܾࡁ gem 'spree_gateway', '~> 3.3' Gemfileʹ `gem ‘spree’`౳Λ௥Ճ
  3. 16.

    # ϢʔβʔΫϥε $ rails g spree:install -—user_class=Spree::User # ೝূ $

    rails g spree:auth:install # ܾࡁ $ rails g spree_gateway:install generatorͰඞཁΫϥε࡞੒
  4. 18.

    $ rake railties:install:migrations Copied migration 20181105025753_create_spree_taxons_promotion_rules.spree.rb from spree Copied migration

    20181105025754_create_spree_refunds.spree.rb from spree Copied migration 20181105025755_create_spree_return_authorization_inventory_unit.s pree.rb from spree Copied migration 20181105025756_rename_return_authorization_inventory_unit_to_retu rn_items.spree.rb from spree Copied migration 20181105025757_backfill_line_item_pre_tax_amount.spree.rb from spree $ rake railties:install:migrations -> ଍Γͳ͍db/migrate/*.rb͕͍ͬͺ͍Ͱ͖Δ
  5. 21.

    # ྫ $ less db/migrate/ 20181105030028_create_spree_taxons_promotion_rules.spree.rb # This migration comes

    from spree (originally 20140318191500) class CreateSpreeTaxonsPromotionRules < ActiveRecord::Migration def change … $ rake railties:install:migrations -> ଍Γͳ͍db/migrate/*.rb͕͍ͬͺ͍Ͱ͖Δ engine໊͕֦ுࢠʹೖΔ
  6. 22.

    # ྫ $ less db/migrate/ 20181105030028_create_spree_taxons_promotion_rules.spree.rb # This migration comes

    from spree (originally 20140318191500) class CreateSpreeTaxonsPromotionRules < ActiveRecord::Migration def change … $ rake railties:install:migrations -> ଍Γͳ͍db/migrate/*.rb͕͍ͬͺ͍Ͱ͖Δ engineଆͷݩͷmigration file engine໊͕֦ுࢠʹೖΔ
  7. 28.

    spreeͷόʔδϣχϯά • railsͷόʔδϣϯݻఆ͕ݫ͍͠ • = ʮઌʹยํΛ্͛ͯʙ͔ΒͷʙʯΈ͍ͨͳΏΔ͍Ҡߦ͕Ͱ͖ͳ͍ • spree v2.4.10 •

    s.add_dependency 'rails', '~> 4.1.11’ • spree v3.0.0 • s.add_dependency 'rails', '~> 4.2.0’ • ɹ •
  8. 29.

    spreeͷόʔδϣχϯά • railsͷόʔδϣϯݻఆ͕ݫ͍͠ • = ʮઌʹยํΛ্͛ͯʙ͔ΒͷʙʯΈ͍ͨͳΏΔ͍Ҡߦ͕Ͱ͖ͳ͍ • spree v2.4.10 •

    s.add_dependency 'rails', '~> 4.1.11’ • spree v3.0.0 • s.add_dependency 'rails', '~> 4.2.0’ • spree v2.4 -> v3.0Ͱ͸౰વεΩʔϚͷมߋ΋͋Δ •
  9. 30.

    spreeͷόʔδϣχϯά • railsͷόʔδϣϯݻఆ͕ݫ͍͠ • = ʮઌʹยํΛ্͛ͯʙ͔ΒͷʙʯΈ͍ͨͳΏΔ͍Ҡߦ͕Ͱ͖ͳ͍ • spree v2.4.10 •

    s.add_dependency 'rails', '~> 4.1.11’ • spree v3.0.0 • s.add_dependency 'rails', '~> 4.2.0’ • spree v2.4 -> v3.0Ͱ͸౰વεΩʔϚͷมߋ΋͋Δ • rake db:migrateͱrails update͕ಉ࣌ʹඞཁ
  10. 31.

    spreeͷόʔδϣχϯά • railsͷόʔδϣϯݻఆ͕ݫ͍͠ • = ʮઌʹยํΛ্͛ͯʙ͔ΒͷʙʯΈ͍ͨͳΏΔ͍Ҡߦ͕Ͱ͖ͳ͍ • spree v2.4.10 •

    s.add_dependency 'rails', '~> 4.1.11’ • spree v3.0.0 • s.add_dependency 'rails', '~> 4.2.0’ • spree v2.4 -> v3.0Ͱ͸౰વεΩʔϚͷมߋ΋͋Δ • rake db:migrateͱrails update͕ಉ࣌ʹඞཁ
  11. 33.

    spreeΞϓϦͷΞοϓσʔτ 1. $ bundle update rails 2. $ rake railties:install:migrations

    <- ͜ΕཁΔ 3. $ rake rails:update(rails4ܥ) 4.ςετΛ௨͢ • ίʔυͷमਖ਼
  12. 35.
  13. 36.
  14. 59.
  15. 62.
  16. 63.
  17. 88.

    ίϛοτIDௐ΂Δͷʹʮ$ git log -Sʯ΋΂ΜΓ!! • `$ git log -S` ஌ͬͯΔਓ??

    • `$ git log -S “୳͍ͨ͠จࣈྻ” - - /path/to/seek` • `$ git log -S “୳͍ͨ͠จࣈྻ” ίϛοτ1..ίϛοτ2 - - /path/to/seek` • `$ git log -S “୳͍ͨ͠จࣈྻ” ίϛοτ1..ίϛοτ2
  18. 89.

    ίϛοτIDௐ΂Δͷʹʮ$ git log -Sʯ΋΂ΜΓ!! • `$ git log -S` ஌ͬͯΔਓ??

    • `$ git log -S “୳͍ͨ͠จࣈྻ” - - /path/to/seek` • `$ git log -S “୳͍ͨ͠จࣈྻ” ίϛοτ1..ίϛοτ2 - - /path/to/seek` • `$ git log -S “୳͍ͨ͠จࣈྻ” ίϛοτ1..ίϛοτ2 • ਖ਼نදݱ࢖͍͍ͨͱ͖͸ `-S —pickaxe-regex` ͱ͔ `-G` ͱ͔࢖͏ͱྑ͍ • (ҧ͍͸๨ΕͨͷͰάά͍ͬͯͩ͘͞)