view_components icon indicating copy to clipboard operation
view_components copied to clipboard

component status migrator can't migrate out of alpha or beta subfolders

Open mxriverlynn opened this issue 3 years ago • 0 comments

problem

the component_status_migrator.thor script is unable to migrate any component status if the files exist in any folder other than the root components/primer folder.

for example, Primer::Alpha::ButtonMarketing currently exists in the components/primer/alpha folder. if the migration script is run to try and move this folder it will fail because the files don't currently exist in the root folder.

example: migrating ButtonMarketing from alpha to beta

running the migrator script on ButtonMarketing results in errors because the files are not in the currently expected root components/primer folder:

> bundle exec thor component_status_migrator ButtonMarketing --status beta

bundler: failed to load command: thor (/Users/riverlynn/dev/github/view_components/vendor/bundle/ruby/3.0.0/bin/thor)
/Users/riverlynn/dev/github/view_components/component_status_migrator.thor:30:in `move_controller': unhandled exception
	from /Users/riverlynn/dev/github/view_components/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
	from /Users/riverlynn/dev/github/view_components/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/riverlynn/dev/github/view_components/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:134:in `block in invoke_all'
	from /Users/riverlynn/dev/github/view_components/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:134:in `each'
	from /Users/riverlynn/dev/github/view_components/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:134:in `map'
	from /Users/riverlynn/dev/github/view_components/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:134:in `invoke_all'
	from /Users/riverlynn/dev/github/view_components/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/lib/thor/group.rb:232:in `dispatch'
	from /Users/riverlynn/dev/github/view_components/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/lib/thor/base.rb:485:in `start'
	from /Users/riverlynn/dev/github/view_components/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/lib/thor/runner.rb:43:in `method_missing'
	from /Users/riverlynn/dev/github/view_components/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/lib/thor/command.rb:29:in `run'
	from /Users/riverlynn/dev/github/view_components/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/lib/thor/command.rb:135:in `run'
	from /Users/riverlynn/dev/github/view_components/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/riverlynn/dev/github/view_components/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
	from /Users/riverlynn/dev/github/view_components/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/lib/thor/base.rb:485:in `start'
	from /Users/riverlynn/dev/github/view_components/vendor/bundle/ruby/3.0.0/gems/thor-1.1.0/bin/thor:6:in `<top (required)>'
	from /Users/riverlynn/dev/github/view_components/vendor/bundle/ruby/3.0.0/bin/thor:25:in `load'
	from /Users/riverlynn/dev/github/view_components/vendor/bundle/ruby/3.0.0/bin/thor:25:in `<top (required)>'
	from /Users/riverlynn/.rbenv/versions/3.0.4/lib/ruby/3.0.0/bundler/cli/exec.rb:58:in `load'
	from /Users/riverlynn/.rbenv/versions/3.0.4/lib/ruby/3.0.0/bundler/cli/exec.rb:58:in `kernel_load'
	from /Users/riverlynn/.rbenv/versions/3.0.4/lib/ruby/3.0.0/bundler/cli/exec.rb:23:in `run'
	from /Users/riverlynn/.rbenv/versions/3.0.4/lib/ruby/3.0.0/bundler/cli.rb:479:in `exec'
	from /Users/riverlynn/.rbenv/versions/3.0.4/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /Users/riverlynn/.rbenv/versions/3.0.4/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/riverlynn/.rbenv/versions/3.0.4/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /Users/riverlynn/.rbenv/versions/3.0.4/lib/ruby/3.0.0/bundler/cli.rb:31:in `dispatch'
	from /Users/riverlynn/.rbenv/versions/3.0.4/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /Users/riverlynn/.rbenv/versions/3.0.4/lib/ruby/3.0.0/bundler/cli.rb:25:in `start'
	from /Users/riverlynn/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/bundler-2.2.33/libexec/bundle:49:in `block in <top (required)>'
	from /Users/riverlynn/.rbenv/versions/3.0.4/lib/ruby/3.0.0/bundler/friendly_errors.rb:103:in `with_friendly_errors'
	from /Users/riverlynn/.rbenv/versions/3.0.4/lib/ruby/gems/3.0.0/gems/bundler-2.2.33/libexec/bundle:37:in `<top (required)>'
	from /Users/riverlynn/.rbenv/versions/3.0.4/bin/bundle:23:in `load'
	from /Users/riverlynn/.rbenv/versions/3.0.4/bin/bundle:23:in `<main>'

expected behavior

i can think of two possible options for correcting this:

  1. the script should locate the existing files for the specified component, no matter what folder they are in

or

  1. the script should correctly handle adding the current status vs the target status. maybe this looks like thor component_status_migrator Alpha::ButtonMarketing --status beta or thor component_status_migrator ButtonMarketing --from-status alpha --to-status beta or similar

mxriverlynn avatar Aug 02 '22 17:08 mxriverlynn