Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuring exercism on MacOS seems broken #971

Open
niloct opened this issue Nov 21, 2020 · 1 comment
Open

Configuring exercism on MacOS seems broken #971

niloct opened this issue Nov 21, 2020 · 1 comment

Comments

@niloct
Copy link

niloct commented Nov 21, 2020

I'm on MacOs Mojave, and things used to work months ago when I was using this cli.

Now, it seems that, when you set an workspace, and execute exercism troubleshoot, it only recognizes the token when you are in the directory that you issued the exercism configure command. See:

~ $  exercism configure --token=*************** --workspace=/Users/teixeira/Exercism

You have configured the Exercism command-line client:

Config dir:                       ~/.config/exercism
Token:         (-t, --token)      ***********
Workspace:     (-w, --workspace)  /Users/teixeira/Exercism
API Base URL:  (-a, --api)        https://api.exercism.io/v1

~ $ exercism troubleshoot

Troubleshooting Information
===========================

Version
----------------
Current: 3.0.13
Latest:  3.0.13


Operating System
----------------
OS:           darwin
Architecture: amd64


Configuration
----------------
Home:      /Users/teixeira
Workspace: /Users/teixeira/Exercism
Config:    ~/.config/exercism
API key:   4358*****************************657

API Reachability
----------------

GitHub:
    * https://api.github.com
    * [connected]
    * 155.35934ms

Exercism:
    * https://api.exercism.io/v1/ping
    * [connected]
    * 1.224142255s


If you are having trouble please file a GitHub issue at
https://github.com/exercism/exercism.io/issues and include
this information.

So token was recognized ok. Now if I cd into a subdir:

~ $ cd Exercism/python/
~/Exercism/python $ ls
acronym  grade-school  hello-world  isogram		 luhn	   matrix     scrabble-score	 twelve-days  word-count
clock	 hamming       high-scores  kindergarten-garden  markdown  raindrops  teste_markdown.py  two-fer
~/Exercism/python $ exercism troubleshoot

Troubleshooting Information
===========================

Version
----------------
Current: 3.0.13
Latest:  3.0.13


Operating System
----------------
OS:           darwin
Architecture: amd64


Configuration
----------------
Home:      /Users/teixeira
Workspace: /Users/teixeira/Exercism (default)
Config:    ~/.config/exercism
API key:   <not configured>
Find your API key at https://exercism.io/my/settings

API Reachability
----------------

GitHub:
    * https://api.github.com
    * [connected]
    * 148.12741ms

Exercism:
    * https://api.exercism.io/v1/ping
    * [connected]
    * 1.101968641s


If you are having trouble please file a GitHub issue at
https://github.com/exercism/exercism.io/issues and include
this information.

Not configured!

The workaround is to call exercism configure inside EVERY single challenge directory, so it creates a ~/.config structure and recognizes the token, but this is broken and didn't work like that before.....

Thanks for your attention.

@niloct
Copy link
Author

niloct commented Nov 22, 2020

Well I've figured the parts out.

TL;DR: you have to set an environment variable called EXERCISM_CONFIG_HOME to value ~/.config/exercism before you use the exercism configure command.

In the end it doesn't matter if you have or not an existing workspace.

As said above, to fix this you have to define an environment variable with an appropriate value. Then exercism recognizes your token no matter in which directory you use exercism.

If you don't do this, there is a current behavior which seems a bug: it creates a ~/.config/exercism directory inside the current directory in which you called exercism configure.

So this leads to DOZENS of replications of the configuration directory, placed on each challenge directory every time you need to interact with the API. Let's see:


First we destroy the env variable and configuration dir previously set here

~ $ export
[...]
declare -x EXERCISM_CONFIG_HOME="/Users/teixeira/.config/exercism/"
~ $ unset EXERCISM_CONFIG_HOME
~ $ rm -rf ~/.config/exercism/
~ $ cd '~'
-bash: cd: ~: No such file or directory

(There is no extraneous '~' directory inside our home directory)

Then we "configure" exercism

~ $ exercism configure --token 435****************7 --workspace=/Users/teixeira/Exercism/

You have configured the Exercism command-line client:

Config dir:                       ~/.config/exercism
Token:         (-t, --token)      435****************7
Workspace:     (-w, --workspace)  /Users/teixeira/Exercism
API Base URL:  (-a, --api)        https://api.exercism.io/v1

Now the bad behavior: it created a whole nested duplicated structure inside our home directory

~ $ cd '~'
~/~ $ find .
.
./.config
./.config/exercism
./.config/exercism/user.json

Let's delete this structure, create the environment variable, and resolve

~ $ rm -rf '~'
~ $ export EXERCISM_CONFIG_HOME=~/.config/exercism

Then we configure exercism exactly like before (above)

Then it works!

~ $ cd .config/exercism/
~/.config/exercism $ find .
.
./user.json
~/.config/exercism $ exercism troubleshoot

Troubleshooting Information
===========================

Version
----------------
Current: 3.0.13
Latest:  3.0.13


Operating System
----------------
OS:           darwin
Architecture: amd64


Configuration
----------------
Home:      /Users/teixeira
Workspace: /Users/teixeira/Exercism
Config:    /Users/teixeira/.config/exercism
API key:   4358*****************************657

API Reachability
----------------

GitHub:
    * https://api.github.com
    * [connected]
    * 174.561378ms

Exercism:
    * https://api.exercism.io/v1/ping
    * [connected]
    * 1.055849818s


If you are having trouble please file a GitHub issue at
https://github.com/exercism/exercism.io/issues and include
this information.

@niloct niloct changed the title Configuring exercism on an existing directory is broken Configuring exercism on MacOS seems broken Nov 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant