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

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)、その際に得た知見・レビューに置いての知見等を発表します。

hoshino tsuyoshi

November 08, 2018
Tweet

More Decks by hoshino tsuyoshi

Other Decks in Technology

Transcript

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

    '~> 3.3’ # ܾࡁ gem 'spree_gateway', '~> 3.3' Gemfileʹ `gem ‘spree’`౳Λ௥Ճ
  2. # ϢʔβʔΫϥε $ rails g spree:install -—user_class=Spree::User # ೝূ $

    rails g spree:auth:install # ܾࡁ $ rails g spree_gateway:install generatorͰඞཁΫϥε࡞੒
  3. $ 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͕͍ͬͺ͍Ͱ͖Δ
  4. # ྫ $ 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໊͕֦ுࢠʹೖΔ
  5. # ྫ $ 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໊͕֦ுࢠʹೖΔ
  6. spreeͷόʔδϣχϯά • railsͷόʔδϣϯݻఆ͕ݫ͍͠ • = ʮઌʹยํΛ্͛ͯʙ͔ΒͷʙʯΈ͍ͨͳΏΔ͍Ҡߦ͕Ͱ͖ͳ͍ • spree v2.4.10 •

    s.add_dependency 'rails', '~> 4.1.11’ • spree v3.0.0 • s.add_dependency 'rails', '~> 4.2.0’ • ɹ •
  7. 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Ͱ͸౰વεΩʔϚͷมߋ΋͋Δ •
  8. 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͕ಉ࣌ʹඞཁ
  9. 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. spreeΞϓϦͷΞοϓσʔτ 1. $ bundle update rails 2. $ rake railties:install:migrations

    <- ͜ΕཁΔ 3. $ rake rails:update(rails4ܥ) 4.ςετΛ௨͢ • ίʔυͷमਖ਼
  11. ίϛοτ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
  12. ίϛοτ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` ͱ͔࢖͏ͱྑ͍ • (ҧ͍͸๨ΕͨͷͰάά͍ͬͯͩ͘͞)