Migrate www.transifex.com to app.transifex.com in local and root config #187
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit handles various flaws with
tx migrate
and improves the tests for the migration script. For example, it was previously possible to provide the API token and have it saved to~/.transifexrc
yettx
commands continue prompting for it each time due towww.transifex.com
not being changed toapp.transifex.com
.I'll demonstrate my fix for these issues in each case below:
I.
~/.transifexrc
does not existInitial state:
Running the migration script:
Final state:
II.
~/.transifexrc
exists but it still has deprecatedwww.transifex.com
config (initial.tx/config
same as above), andwww.transifex.com
was not getting updated toapp.transifex.com
Initial state:
Running the migration script:
Final state:
In this case, the
.tx/config
is migrated properly as expected (I didn't include the output, it's the same as above).NOTE:
~/.transifexrc
has the addition of therest_hostname
andtoken
like we expect, and also had[https://www.transifex.com]
changed to[https://api.transifex.com]
as required. As of this time, thehostname
,username
, andpassword
are unchanged (but we could remove these as well, as they are no longer needed, and we created a backup of the original~/.transifexrc
file anyway)III. We also now properly handle the case where
~/.transifexrc
has already been fully updated to use the new configuration (i.e. the user already updated their config when working on a different repository) but the local.tx/config
still needs migration... previously this would also continue prompting for API token each time because local config still hashost = https://www.transifex.com
soGetActiveHost
always returnednil
.Initial state:
(Again, the initial
.tx/config
is the same as in the above cases)Running the migration script:
Final state:
~/.transifexrc
is unchanged from the initial state (although we created a backup anyway) and.tx/config
is properly migratedIV. In addition to fixing the migration script to better handle all of the above cases, I also improved the tests for the migration script in the following ways:
www.transifex.com
to the pre-migration configs in the testwww.transifex.com
becomesapp.transifex.com
after running the migration~/.transifexrc
gets moved prior toTestNoTransifexRcFile
so that it doesn't interfere with the test; following the test, the newly created~/.transifexrc
gets deleted and the developer's original~/.transifexrc
gets restored~/.transifexrc
functionality oftx migrate