Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

another fixer bug on fixing plugins. (not only fix but also some others) #83

Closed
sio4 opened this issue Dec 15, 2021 · 4 comments · Fixed by #84
Closed

another fixer bug on fixing plugins. (not only fix but also some others) #83

sio4 opened this issue Dec 15, 2021 · 4 comments · Fixed by #84
Assignees
Labels
bug Something isn't working

Comments

@sio4
Copy link
Member

sio4 commented Dec 15, 2021

buffalo fix fails on updating plugins (for buffalo-pop). It fails on removing the old one since the Remove() method is not that easy to use and the parameter cannot be easily selected by the real status of the application configuration.

Fixing only the calling parameter can be one option but I don't think the current key() mechanism is reasonable, so I am fixing it. (almost done, checking if there is any side effects.)

Steps to Reproduce the Problem

  1. prepare an old app tree (I used one created with buffalo v0.16.0
  2. run buffalo fix -y on it.
  3. additionally check config/buffalo-plugins.toml

Expected Behavior

The old version of buffalo-pop (v2) is removed, and the new one (v3@latest) is added.

Actual Behavior

Two of them are registered on the toml file, and the fix command failed.

@sio4 sio4 added the bug Something isn't working label Dec 15, 2021
@sio4 sio4 self-assigned this Dec 15, 2021
@sio4
Copy link
Member Author

sio4 commented Dec 15, 2021

Current behavior:

$ cat config/buffalo-plugins.toml 
[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop/v3@latest"
$ buffalo plugins install github.com/gobuffalo/buffalo-heroku
no required module provides package github.com/gobuffalo/buffalo-heroku; to add it:
	go get github.com/gobuffalo/buffalo-heroku
Usage:
  buffalo plugins install [flags]

Flags:
  -d, --dry-run   dry run
  -h, --help      help for install
      --vendor    will install plugin binaries into ./plugins [WINDOWS not currently supported]
  -v, --verbose   turn on verbose logging

ERRO[0000] Error: exit status 1                         
$ buffalo plugins install github.com/gobuffalo/buffalo-heroku@latest
$ cat config/buffalo-plugins.toml 
[[plugin]]
  binary = "buffalo-heroku@latest"
  go_get = "github.com/gobuffalo/buffalo-heroku@latest"

[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop/v3@latest"
$ buffalo plugins list
Bin         |Command               |Description
---         |---                   |---
buffalo-pop |buffalo db            |[DEPRECATED] please use `buffalo pop` instead.
buffalo-pop |buffalo destroy model |Destroys model files.
buffalo-pop |buffalo pop           |A tasty treat for all your database needs
$ buffalo plugins remove github.com/gobuffalo/buffalo-heroku@latest
$ cat config/buffalo-plugins.toml 
[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop/v3@latest"
$ buffalo plugins remove github.com/gobuffalo/buffalo-pop@latest
$ cat config/buffalo-plugins.toml 
[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop/v3@latest"
$ buffalo plugins install github.com/gobuffalo/buffalo-pop@latest
<...>
$ cat config/buffalo-plugins.toml 
[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop/v3@latest"

[[plugin]]
  binary = "buffalo-pop@latest"
  go_get = "github.com/gobuffalo/buffalo-pop@latest"
$ buffalo plugins install github.com/gobuffalo/buffalo-pop/v3@latest
$ cat config/buffalo-plugins.toml 
[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop/v3@latest"

[[plugin]]
  binary = "buffalo-pop@latest"
  go_get = "github.com/gobuffalo/buffalo-pop@latest"

[[plugin]]
  binary = "v3@latest"
  go_get = "github.com/gobuffalo/buffalo-pop/v3@latest"
$ buffalo plugins remove github.com/gobuffalo/buffalo-pop/v3@latest
$ cat config/buffalo-plugins.toml 
[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop/v3@latest"

[[plugin]]
  binary = "buffalo-pop@latest"
  go_get = "github.com/gobuffalo/buffalo-pop@latest"
$ buffalo plugins remove github.com/gobuffalo/buffalo-pop@latest
$ cat config/buffalo-plugins.toml 
[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop/v3@latest"
$ buffalo plugins remove github.com/gobuffalo/buffalo-pop/v3@latest
$ cat config/buffalo-plugins.toml 
[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop/v3@latest"
$ 

@sio4
Copy link
Member Author

sio4 commented Dec 15, 2021

Fixed behavior:

$ cat config/buffalo-plugins.toml 
[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop/v3@latest"
$ buffalo plugins install github.com/gobuffalo/buffalo-heroku
$ buffalo plugins list
Bin            |Command               |Description
---            |---                   |---
buffalo-pop    |buffalo db            |[DEPRECATED] please use `buffalo pop` instead.
buffalo-heroku |buffalo heroku        |helps with heroku setup and deployment for buffalo applications
buffalo-pop    |buffalo destroy model |Destroys model files.
buffalo-pop    |buffalo pop           |A tasty treat for all your database needs
$ cat config/buffalo-plugins.toml 
[[plugin]]
  binary = "buffalo-heroku"
  go_get = "github.com/gobuffalo/buffalo-heroku@latest"

[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop/v3@latest"
$ buffalo plugins remove buffalo-heroku
$ buffalo plugins list
Bin         |Command               |Description
---         |---                   |---
buffalo-pop |buffalo db            |[DEPRECATED] please use `buffalo pop` instead.
buffalo-pop |buffalo destroy model |Destroys model files.
buffalo-pop |buffalo pop           |A tasty treat for all your database needs
$ cat config/buffalo-plugins.toml
[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop/v3@latest"
$ buffalo plugins remove buffalo-pop
$ buffalo plugins list
Bin |Command |Description
--- |---     |---
$ cat config/buffalo-plugins.toml
$ buffalo plugins install github.com/gobuffalo/buffalo-pop/v3
$ buffalo plugins list
Bin         |Command               |Description
---         |---                   |---
buffalo-pop |buffalo db            |[DEPRECATED] please use `buffalo pop` instead.
buffalo-pop |buffalo destroy model |Destroys model files.
buffalo-pop |buffalo pop           |A tasty treat for all your database needs
$ cat config/buffalo-plugins.toml
[[plugin]]
  binary = "buffalo-pop"
  go_get = "github.com/gobuffalo/buffalo-pop/v3@latest"
$ 
$ git status
On branch master
nothing to commit, working tree clean
$ buffalo fix -y
! This updater will attempt to update your application to Buffalo version: v0.18.1
go: finding module for package github.com/gobuffalo/suite
go: found github.com/gobuffalo/suite in github.com/gobuffalo/suite v2.8.2+incompatible
~~~ Rewriting Imports ~~~
go: finding module for package github.com/gobuffalo/suite/v4
go: found github.com/gobuffalo/suite/v4 in github.com/gobuffalo/suite/v4 v4.0.2
go: finding module for package github.com/gobuffalo/buffalo-pop/v3/pop/popmw
go: found github.com/gobuffalo/buffalo-pop/v3/pop/popmw in github.com/gobuffalo/buffalo-pop/v3 v3.0.2
~~~ Checking webpack.config.js ~~~
~~~ Checking package.json ~~~
yarn install v1.22.11
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.3.2: The platform "linux" is incompatible with this module.
info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 10.07s.
~~~ Patching package.json to add dev and build scripts ~~~
~~~ package.json doesn't need to be patched, skipping. ~~~
~~~ Installing required tools ~~~
~~~ Checking for deprecations ~~~
~~~ Upgrading Dockerfile ~~~
~~~ Removing old plugins ~~~
~~~ Removing previous version of buffalo-pop plugin ~~~
~~~ Cleaning plugins cache ~~~
~~~ Reinstalling plugins ~~~
~~~ Adding .plush extension to .html/.js/.md files ~~~
$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   Dockerfile
	modified:   actions/actions_test.go
	modified:   actions/app.go
	modified:   config/buffalo-plugins.toml
	modified:   go.mod
	modified:   go.sum
	modified:   models/models_test.go
	modified:   package.json
	modified:   webpack.config.js
	modified:   yarn.lock

no changes added to commit (use "git add" and/or "git commit -a")
$ git diff config/buffalo-plugins.toml
diff --git a/config/buffalo-plugins.toml b/config/buffalo-plugins.toml
index 611c5b9..4defaca 100644
--- a/config/buffalo-plugins.toml
+++ b/config/buffalo-plugins.toml
@@ -1,3 +1,3 @@
 [[plugin]]
   binary = "buffalo-pop"
-  go_get = "github.com/gobuffalo/buffalo-pop/v2"
+  go_get = "github.com/gobuffalo/buffalo-pop/v3@latest"
$ 

@sio4 sio4 linked a pull request Dec 15, 2021 that will close this issue
@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions
Copy link

This issue was closed because it has been stalled for 5 days with no activity.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant