I had to push a new update to Localio a few days ago, and it was one with breaking changes. The version number left the 0.0.x era, and now welcomes the 0.1.x family.

The offender was Google Drive: Google announced a while ago that its Documents List API was going to be deprecated in April 20th 2015. What that means for local is that the very handy login with login/pass will be no more, so things get a bit more complicated to set up. Now we have to use OAuth2 for this, therefore we need to deal with some other stuff that you will find familiar if you already worked with other Google APIs in the past.

I have written some basic instructions in the README file about how to set it up:

  1. You have to create a new project in Google Developers Console for using Drive API. You can do that here.
  2. After it is created you will be redirected to the credentials section (if not, just select under APIs and authentication in the sidebar the Credentials section), where you will click in the button labeled Create new client ID.
  3. Select the third option, the one that says something like Installed Application.
  4. Fill the form with whatever you want. For example, you could put Localio as the product name (the only thing required there).
  5. Select again the third option, Installed Application, and in the platform selector select the last one, Others.
  6. You will have all the necessary information in the next screen: Client ID and Client Secret.

After doing all this, you are ready to add :client_id and :client_secret fields to your Locfile source. It will look somewhat like this at this stage:

source :google_drive,  
       :spreadsheet => ‘[Localizables] My Project’,
       :client_id => ‘XXXXXXXXX-XXXXXXXX.apps.googleusercontent.com’,
       :client_secret => ‘asdFFGGhjKlzxcvbnm’

Then, the first time you run it, you will be prompted to follow some instructions. You will be asked to open a website, where you will be prompted for permission to use the Drive API. After you allow it, you will be given an authorization code, which you will have to paste in your terminal screen when prompted. A hidden file, .localio.yml will be added to your directory. It should be ignored in your source code versioning tool (.gitignore) so you don't accidentally upload it or something.

So, yes, it’s a bit more complicated now, but it’s also more secure. The trade-off is worth it, in my opinion.

Tags

ruby , gem , localio

About the author
comments powered by Disqus