Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Changes required to be compatible with the pivot extensible discount scripts #1678

Merged
merged 2 commits into from
Oct 26, 2021

Conversation

DuncanUszkay1
Copy link
Contributor

Two issues that we had to resolve to use the Shopify CLI's scripts features with pivot

WHY are these changes introduced?

The migrator doesn't properly load with ruby 2.5, I'm not sure why. I get a consistent syntax error:

/Users/david/src/github.com/Shopify/shopify-cli/lib/shopify_cli.rb:28:in `require_relative': /Users/david/src/github.com/Shopify/shopify-cli/lib/shopify_cli/migrator.rb:38: syntax error, unexpected ']' (SyntaxError) ...me = file_name_components[1...].join("_") ... ^ ✗ command failed. Command:printf '%s

The package name for discounts was pointing at the checkout package when it actually should have been the discount package, this causes script deploys with discount-types to fail.

WHAT is this pull request doing?

  • Change [1...] to the equivalent drop(1). drop(1) is stable over versions since 1.8.6. I would have assumed the same about the array range syntax, but couldn't quite get it to work. I'd like to get this in since it's blocking our local dev environment.
  • Change the package name for the discount-types package to discounts

How to test your changes?

The fastest way is to use pivot, which will automatically deploy a script for you: https://github.com/Shopify/pivot.

Note that this won't work until https://github.com/Shopify/pivot/pull/12 is merged.

Post-release steps

This is just to unblock our dev team, shouldn't require any special release procedures

Update checklist

  • I've added a CHANGELOG entry for this PR (if the change is public-facing) Not public facing.
  • I've considered possible cross-platform impacts (Mac, Linux, Windows).
  • I've left the version number as is (we'll handle incrementing this when releasing).
  • I've included any post-release steps in the section above.

@DuncanUszkay1 DuncanUszkay1 requested a review from a team October 22, 2021 22:40
@DuncanUszkay1 DuncanUszkay1 requested a review from a team as a code owner October 22, 2021 22:40
@DuncanUszkay1 DuncanUszkay1 requested review from pepicrft and jesalerno84 and removed request for a team October 22, 2021 22:40
@@ -35,7 +35,7 @@ def self.migrations(migrations_directory:)
file_name = File.basename(file_path).gsub(".rb", "")
file_name_components = file_name.split("_")
date_timestamp = file_name_components[0].to_i
migration_name = file_name_components[1...].join("_")
migration_name = file_name_components.drop(1).join("_")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[1,2,3].drop(1) == [1,2,3][1...]

@DuncanUszkay1
Copy link
Contributor Author

https://github.com/Shopify/shopify-cli/runs/3981041402?check_suite_focus=true This is failing, but appears unrelated to my changes

Copy link
Contributor

@andrewhassan andrewhassan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM from the Experience side

@pepicrft
Copy link
Contributor

Thanks for fixing this @DuncanUszkay1. I pushed a CHANGELOG.md update to list the changes and ran rubocop to fix some linting issues. I'll merge once CI is ✅

@pepicrft pepicrft merged commit 14b276f into main Oct 26, 2021
@pepicrft pepicrft deleted the pivot-dev-changes branch October 26, 2021 10:16
@shopify-shipit shopify-shipit bot temporarily deployed to rubygems November 1, 2021 21:38 Inactive
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants