GithubHelp home page GithubHelp logo

txgh's Introduction

Transifex Txgh

Build Status

Description

A lightweight web server that integrates Transifex with Github. Txgh acts as an agent for developers by automatically uploading source files to Transifex. It also acts as an agent for translators by pushing translation files to GitHub that have been 100% translated in Transifex.

Installation

To setup locally, clone this repository and install the dependencies from the Gemfile. You can place a txgh.yml file in your home directory to bootstrap configuration of the server. The quickest way to get started is to clone the repository, update your configuration, and then run the puma web server on a specific port.

puma -p 9292

Other platforms:

Directory Layout

.
|-- config
|   |-- tx.config   # sample config file
|   `-- txgh.yml    # ERB template for flexible config
|-- lib
|   |-- txgh
|   |   |-- handlers # Logic specific to endpoint hooks
|   |   |   |-- ...
|   |   |
|   |   |-- app.rb  # the main Sinatra app, includes both web service endpoints
|   |   |-- category_support.rb
|   |   |-- config.rb
|   |   |-- errors.rb
|   |   |-- github_api.rb               # Wrapper for GitHub REST API
|   |   |-- github_repo.rb              # GitHub repository object
|   |   |-- github_request_auth.rb      # GitHub webhook Auth
|   |   |-- handlers.rb
|   |   |-- key_manager.rb              # Loads configuration
|   |   |-- parse_config.rb
|   |   |-- transifex_api.rb            # Wrapper for Tx REST API
|   |   |-- transifex_project.rb        # Tx Project Object
|   |   |-- transifex_request_auth.rb   # Tx webhook auth
|   |   |-- tx_branch_resource.rb       # Support for branches
|   |   |-- tx_config.rb                # Loads tx.config
|   |   |-- tx_logger.rb
|   |   |-- tx_resource.rb              #Tx resource Object
|   |   `-- utils.rb
|   `-- txgh.rb     # includes for app dependencies
|-- spec # spec unit and integration tests
|   |-- ...
|
|-- Dockerfile      # DIY Docker base
|-- Rakefile        # rake tasks to run tests
|-- bootstrap.rb    # includes for application paths
`-- config.ru       # bootstrap for web server

How it works

You configure a service hook in Github and point it to this server. The URL path to the service hook endpoint: /hooks/github You do the same for Transifex, in your project settings page, and point it to the service hook endpoint: /hooks/transifex

Currently there are 4 use cases that are supported:

  1. When a resource (configured in this service) in Transifex reaches 100% translated, the Txgh service will pull the translations and commit them to the target repository.

  2. When a source file (configured in this service) is pushed to a specific Github branch (also configured in this service), the Txgh service will update the source resource (configured in this service) with the new file.

  3. When a source file (configured in this service) is pushed to a specific Github tag (also configured in this service), the Txgh service will update the source resource (configured in this service) with the new file.

  4. EXPERIMENTAL - When a source file (configured in this service) is pushed to a specific Github tag called 'L10N', Txgh will create a new branch called 'L10N' and new resources where the slug is prefixed with 'L10N'.

Txgh Use Cases

Notes

We recommend running it using Ruby 2.2.2 and installing dependencies via bundler.

There are 2 important configuration files.

txgh.yml - This is the base configuration for the service. To avoid needing to checkin sensitive password information, this file should pull it's settings from the Ruby ENV in production. Additionally, this file can be located in the users HOME directory to support running the server with local values.

txgh:
  github:
    repos:
      # This name should be org/repo
      MyOrg/frontend:
        api_username: "github_username"
        api_token: "github_token"
        # Transifex project name, as below
        push_source_to: "my-frontend" 
        # The branch to watch. Set to 'all' to listen to all pushes.
        branch: "i18n"
        # Create a repo webhook. The secret is any string of your choosing,
        # and is input during webhook creation. TXGH uses this to validate
        # messages are really coming from GitHub.
        webhook_secret: "..." 
  transifex:
    projects:
      # This name should match the transifex project name, without org name
      my-frontend:
        tx_config: "./config/tx.config"
        api_username: "transifex_user"
        api_password: "transifex_password"
        # This is the GitHub project name, as above.
        push_translations_to: "MyOrg/frontend" 
        # This can be 'translated' or 'reviewed'. To catch both actions,
        # simply remove this key.
        push_trigger: "translated"
        # This works similarly to the GitHub webhook_secret above.
        webhook_secret: "..."

tx.config - This is a configuration which maps the source file, languages, and target translation files. It is based on this specification: http://docs.transifex.com/client/config/#txconfig


There is a check for both V1 and V2 Transifex webhook signatures, but the V1 signature implementation is no logger maintain. Changes in the webhook response may cause V1 signature calculation to be wrong. Make sure you use the latest master that include both checks.

Getting Help

You can always get additional help via GitHub Issues or Transifex support email

License

Txgh is primarily distributed under the terms of the Apache License (Version 2.0).

See LICENSE for details.

Development

In order to test and debug a local instance of TXGH you can do the following:

  1. Run TXGH with:
puma -p 9292
  1. Use https://ngrok.com to expose the local server
./ngrok http 9292
  1. Take the host name ngrok generated, something like http://f61da052.ngrok.io and setup the following webhooks:

Make sure the secret you have used in each case are the same as the ones that are configured in txgh.yml.

txgh's People

Contributors

adrieankhisbe avatar alexpsi avatar camertron avatar cheesegrits avatar jamesgmorgan avatar jsilland avatar lizkrznarich avatar mjumbewu avatar nsallembien avatar rigaspapas avatar romw avatar sofiamargariti avatar strml avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

txgh's Issues

Add settings option to enable force pushing to Github

Some workflows might want the flexibility to force push translations. Since git commits can happen outside of Txgh (an important component of Txgh is supporting parallel workflows)...Txgh commits could become blocked by conflicts. Force pushing 'solves' this only in the case where someone has 'designed' this to work and understands the implications.
Therefore by default force push should always be = false.

With great power comes great responsibility. - Spiderman

Untrack txgh.yml

Can you untrack the txgh.yml config? Maybe change to a txgh.dist.yml or some such. Makes it a pain to merge / pull to a running install.

Multiproject from transifex to one github repo.

I have been trying to set txgh up for many projects on transifex to one github repo.
I can't find a way to to this does txgh support this?

What I find logical is setting this up in txgh.yml

txgh:
github:
repos:
yy/xx.mm
api_username: "<%= ENV['GITHUB_USERNAME'] %>"
api_token: "<%= ENV['GITHUB_TOKEN'] %>"
webhook_secret: "<%= ENV['GITHUB_WEBHOOK_SECRET'] %>"
branch: "develop"
push_source_to: "xx-project,yy-project"
transifex:
projects:
xx-project:
tx_config: "config/txxx.config"
api_username: "<%= ENV['TX_USERNAME'] %>"
api_password: "<%= ENV['TX_PASSWORD'] %>"
push_translations_to: "yy/xx.mm"
yy-project:
tx_config: "config/txyy.config"
api_username: "<%= ENV['TX_USERNAME'] %>"
api_password: "<%= ENV['TX_PASSWORD'] %>"
push_translations_to: "yy/xx.mm"

support for multiple repos

I'm not sure if this is worthwhile, but having multiple repos that can be configured for a single instance of txgh (each repo would be mapped to a transifex project) would enable a larger organization to not have to run multiple instances of the txgh bridge.

Heroku one-click deploy?

I know very little about how the whole thing works so maybe it's not applicable in this situation, but the other day I came across Slackin, which has a very convenient one-click deploy for Heroku.

So I just wanted to suggest maybe doing the same kind of thing for txgh. It could come in pretty handy :)

cannot load such file -- faraday_middleware

I had to reboot my server, and now when trying to run txgh I get this:

/home/ec2-user/transifex/txgh/lib/strava/l10n/transifex_api.rb:2:in `require': cannot load such file -- faraday_middleware (LoadError)

I'm up to date with the devel branch.

I'm sure it's something to do with ruby's load paths, but I'm such a ruby noob I can't for the life of me work out how to fix it. I had rather hoped bundler would sort it out, but apparently not.

-- hugh

Potential race condition causing commits to fail

I don't know Ruby, and I'm not entirely familiar with how everything in this app works, so this is a bit of a shot in the dark.

I will use a simplified version of my current setup to try to describe what I suspect is happening.

I have 3 files, en.pot, es.pot, and fr.pot.

  • I make a change to en.pot and commit/push directly to master
  • That updated file is sent to Transifex via Txgh.
  • es.pot and fr.pot are updated in Transifex to have this new entry
  • Transifex fires off 2 webhook requests to Txgh, one for es.pot and one for fr.pot, both very close to each other in terms of timing
  • Txgh creates a new commit for es.pot, using the current base_commit as the parent commit.
  • At roughly the same time, Txgh creates a new commit for fr.pot, also using this same base_commit as the parent commit.
  • The first commit is successfully pushed to master, but the 2nd commit fails with the error:
- Update is not a fast forward // See: https://developer.github.com/v3/git/refs/#update-a-reference:

To debug this a bit further, I modified the source code to enable force pushing. With force pushing turned on, I was able to see a commit from Txgh come through (in our example, it would be es.pot being updated), and then that commit was wiped from the repo's history a moment later when fr.pot was updated, meaning fr.pot was a force push.

I don't know how to fix this behavior (nor am I 100% certain I am right, although I am confident I'm at least on the right path). The only suggestion off the top of my head is switching to using this much simpler api for updating a file - https://developer.github.com/v3/repos/contents/#update-a-file

Any suggestions on possible work-around for this?

README clarification

Does MyOrg/frontend in:

# This name should be org/repo
      MyOrg/frontend:

refer to the github organization name or a transifex organization name?

Merge devel branch into master

Hi there,
Is there a plan to merge the devel branch with master?

I sadly just burned a bunch of time rewriting auth to work with transifex v2 only to notice it in the devel branch when I went to submit a PR :(

Txgh Config YAML files to be 'runtime loadable'

Currently configuration is read in to Txgh when the app starts and held in memory for the life of the app. However only a small amount of configuration is actually required on startup (mainly security creds). We should add support for a 'runtime' config that loads while Txgh is running.

Allow tx.config file to be located in GitHub

The file containing details of your translatable resources (i.e. the one along these lines: http://docs.transifex.com/client/config/) currently has to be located along with the TXGH deployment.

In my opinion, intuitively this file belongs with the resources themselves - i.e. in GitHub. In fact, it took me some time staring at the following stacktrace in TXGH before I realised that it wasn't looking in GitHub!

2016-10-27T09:04:00.175359+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/parseconfig-1.0.8/lib/parseconfig.rb:47:in `validate_config'
2016-10-27T09:04:00.175362+00:00 app[web.1]: /app/lib/txgh/parse_config.rb:20:in `new'
2016-10-27T09:04:00.175359+00:00 app[web.1]: #<Errno::EACCES: Permission denied - .tx/config is not readable>
2016-10-27T09:04:00.175360+00:00 app[web.1]: /app/vendor/bundle/ruby/2.2.0/gems/parseconfig-1.0.8/lib/parseconfig.rb:39:in `initialize'
2016-10-27T09:04:00.175363+00:00 app[web.1]: /app/lib/txgh/parse_config.rb:20:in `load_file'
2016-10-27T09:04:00.175363+00:00 app[web.1]: /app/lib/txgh/tx_config.rb:5:in `load_file'
2016-10-27T09:04:00.175365+00:00 app[web.1]: /app/lib/txgh/key_manager.rb:19:in `config_from_repo'
2016-10-27T09:04:00.175365+00:00 app[web.1]: /app/lib/txgh/app.rb:95:in `block in <class:Hooks>'

I wonder if it might be possible to make an enhancement such that (optionally) TXGH gets this config from a file in the project's GitHub repository?

If this proposal is acceptable, I'd be happy to look into implementing this (probably by starting with looking at the KeyManager.config_from_repo() method.

Please let me know your thoughts.

Unable to push to TX while on Github the deliveries are successful

Hi there,

I followed the doc to build txgh on Heroku. When I push commits with updated English files. On Github I can see the delivery was successful, but I don't see any update on TX side. Also when I submit a translation on TX, I don't get anything on GitHub. Since TX doesn't pop up any error, it's a little hard to figure out what the issue is. Any suggestion would be appreciated:)

BTW the doc was a bit outdated. The var key names listed in the doc was not consistent with what's currently in the yaml file, which caused an error earlier for Github to send commits out.

Thanks in advance,
Saisai

Issue while updating github

Hi,
I have noticed an error in console after uptating github when I test a transifex webhook call.

web_1 | I, [Tue 26-01-2016 0816 #1]  INFO -- : Processing request at /hooks/transifex
web_1 | I, [Tue 26-01-2016 0816 #1]  INFO -- : #<Sinatra::Request:0x00559c30fc1cd8 @env={"rack.version"=>[1, 3], "rack.errors"=>#<IO:<STDERR>>, "rack.multithread"=>true, "rack.multiprocess"=>false, "rack.run_once"=>false, "SCRIPT_NAME"=>"/hooks", "QUERY_STRING"=>"", "SERVER_PROTOCOL"=>"HTTP/1.1", "SERVER_SOFTWARE"=>"2.15.3", "GATEWAY_INTERFACE"=>"CGI/1.2", "REQUEST_METHOD"=>"POST", "REQUEST_PATH"=>"/hooks/transifex", "REQUEST_URI"=>"/hooks/transifex", "HTTP_VERSION"=>"HTTP/1.1", "HTTP_HOST"=>"localhost:8080", "HTTP_CONNECTION"=>"keep-alive", "CONTENT_LENGTH"=>"76", "HTTP_AUTHORIZATION"=>"Basic xxxxxxxxx==", "HTTP_CACHE_CONTROL"=>"no-cache", "HTTP_ORIGIN"=>"chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop", "CONTENT_TYPE"=>"application/x-www-form-urlencoded", "HTTP_USER_AGENT"=>"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36", "HTTP_POSTMAN_TOKEN"=>"540316de-9e81-67b8-0cab-500336c6c317", "HTTP_ACCEPT"=>"*/*", "HTTP_ACCEPT_ENCODING"=>"gzip, deflate", "HTTP_ACCEPT_LANGUAGE"=>"fr-FR,fr;q=0.8,en;q=0.6", "SERVER_NAME"=>"localhost", "SERVER_PORT"=>"8080", "PATH_INFO"=>"/transifex", "REMOTE_ADDR"=>"10.0.2.2", "puma.socket"=>#<TCPSocket:fd 12>, "rack.hijack?"=>true, "rack.hijack"=>#<Puma::Client:0x2ace187e1a88 @ready=true>, "rack.input"=>#<StringIO:0x00559c30fc2ca0>, "rack.url_scheme"=>"http", "rack.after_reply"=>[], "rack.request.query_string"=>"", "rack.request.query_hash"=>{}, "rack.request.form_hash"=>{"project"=>"coorpacademy/mooc-core", "resource"=>"account", "language"=>"it", "translated"=>"100"}, "rack.request.form_vars"=>"project=coorpacademy%2Fmooc-core&resource=account&language=it&translated=100", "rack.request.form_input"=>#<StringIO:0x00559c30fc2ca0>, "sinatra.route"=>"POST /transifex"}, @params={"project"=>"coorpacademy/mooc-core", "resource"=>"account", "language"=>"it", "translated"=>"100"}>
web_1 | I, [Tue 26-01-2016 0816 #1]  INFO -- : account
web_1 | I, [Tue 26-01-2016 0816 #1]  INFO -- : request language matches resource
web_1 | I, [2016-01-26T08:16:10.082753 #1]  INFO -- : get https://www.transifex.com/api/2/project/mooc-core/resource/account/translation/it/
web_1 | D, [2016-01-26T08:16:10.083611 #1] DEBUG -- request: User-Agent: "Faraday v0.9.2"
web_1 | Authorization: "Basic xxxxxxxxxxx"
web_1 | Accept: "application/json"
web_1 | I, [2016-01-26T08:16:10.321601 #1]  INFO -- Status: 200
web_1 | D, [2016-01-26T08:16:10.322363 #1] DEBUG -- response: server: "nginx"
web_1 | vary: "Accept-Encoding, Authorization, Host, Accept-Language, Cookie"
web_1 | cache-control: "max-age=0"
web_1 | content-type: "application/json; charset=utf-8"
web_1 | date: "Tue, 26 Jan 2016 08:16:10 GMT"
web_1 | expires: "Tue, 26 Jan 2016 08:16:10 GMT"
web_1 | transfer-encoding: "chunked"
web_1 | content-language: "en"
web_1 | x-content-type-options: "nosniff"
web_1 | connection: "close"
web_1 | set-cookie: "X-Mapping-fjhppofk=B8558B7BB369B761FC4CE03884ACF0F5; path=/"
web_1 | last-modified: "Tue, 26 Jan 2016 08:16:10 GMT"
web_1 | x-frame-options: "SAMEORIGIN"
web_1 | I, [Tue 26-01-2016 0816 #1]  INFO -- : request language is in lang_map and is in request or is nil
web_1 | I, [Tue 26-01-2016 0816 #1]  INFO -- : make github commit for branch: heads/txgh
web_1 | 2016-01-26 08:16:13 +0000: Read error: #<NoMethodError: undefined method `bytesize' for [:ref, "refs/heads/txgh"]:Array>
web_1 | /usr/local/bundle/gems/puma-2.15.3/lib/puma/server.rb:668:in `block in handle_request'
web_1 | /usr/local/bundle/gems/sawyer-0.6.0/lib/sawyer/resource.rb:125:in `each'
web_1 | /usr/local/bundle/gems/sawyer-0.6.0/lib/sawyer/resource.rb:125:in `each'
web_1 | /usr/local/bundle/gems/puma-2.15.3/lib/puma/server.rb:666:in `handle_request'
web_1 | /usr/local/bundle/gems/puma-2.15.3/lib/puma/server.rb:388:in `process_client'
web_1 | /usr/local/bundle/gems/puma-2.15.3/lib/puma/server.rb:270:in `block in run'
web_1 | /usr/local/bundle/gems/puma-2.15.3/lib/puma/thread_pool.rb:106:in `call'
web_1 | /usr/local/bundle/gems/puma-2.15.3/lib/puma/thread_pool.rb:106:in `block in spawn_thread'

You can reproduce on this Docker image, https://hub.docker.com/r/coorpacademy/txgh/

  • Ruby 2.18
  • Git 2.1.4
  • Puma 2.15.3

Github seems to have been updated and there is no response from txgh.

What does file_filter refer to in tx.config?

Hi, great work with txgh!

I have a question:

I'm trying to set up txgh for this github repo:

https://github.com/timothyylim/h5p-greeting-card

and this transfiex project:

https://www.transifex.com/joubel/h5p-greeting-card/

Let's say I just have a single resource that I need translated called en.json. Does this tx.config make sense:

[main]
host = https://www.transifex.com
lang_map =

# Create one such section per resource
[h5p-greeting-card.ensjon]
file_filter = language/<lang>.json
source_file = language/en.json
source_lang = en
type = json

And do I place this tx.config in my txgh directory or in my github repo?

Any help would be very much appreciated.

Completion percentage

Not specifically a txgh issue, but (pursuant to our email exchange) something I wanted to get on the radar.

At the moment, the Transifex hook only fires once a translation is at 100%. While I can see some logic to this, I think it is essential to make this a configurable setting in either Transifex or txgh, so we can specify the percentage. This is after all a tool for continuous integration of Github and TX, so it seems a shame not to be able to actually use it to fully do that.

So either Transifex should fire the hook on every change and txgh decides what completion percentage it wants on a per-project basis, or the hook at Transifex should be configurable with the trigger percentage. Or both, really.

Thanks for listening. :)

Support special 'Transifex' branch

Have a special git branch for interacting with Transifex*
We could merge everything to a 'transifex' branch and wait for translations before merging that to the release branch but this causes a delay and introduces coordination difficulties (what if some of the pieces are ready to go but others aren't? what if we need to roll back a piece?).

could not find configuration for resource "kycerrors_enjson"

when I update my transifex project, the txgh server's log show me some infomation,
some key hint is as below:
"
INFO: processing payload from request.body
TxghError: Could not find configuration for resource 'kycerrors_enjson'
"
Can your team support the issue? I have try many different ways to solve the problem, but it's still not work. Thanks!

Txgh not working on Heroku

I tried to setup a Txgh instance on Heroku using this guide: https://www.transifex.com/blog/2015/bridging-github-and-transifex-with-txgh/ but it doesn't seems to be working.

When github tries to call the webhook, it fails with a HTTP 500. Here's the log on the Heroku side.

As a side note, the "Add Environment Variables Using txgh_config.rb" part of the doc doesn't works anymore. It seems the rake task was removed by this commit: 7880492

I tried the other option using the Heroku dashboard but without no more luck...

Need to support 'easy' and secure configuration

Currently this repository has been used to build local services, services on AWS and Heroku. There needs to be an easier way to run and test the service but still support multiple cloud configurations.

'Branchable' project support

I think a solution to this problem is for Transifex projects to be branchable, so when we make a git branch we also make a Transifex project branch for the translation and push and pull to that, when we merge the git branches back together we also merge the Transifex project branches.

Empty push_trigger should count as "translated" and "reviewed"

From the readme:

        # This can be 'translated' or 'reviewed'. To catch both actions,
        # simply remove this key.
        push_trigger: "translated"

From my logs:

 INFO -- : did not process changes because trigger was 'translated' and push trigger was set to ''

My txgh.yml:

push_trigger: "<%= ENV['TX_PUSH_TRIGGER_REVIEWED_OR_TRANSLATED'] %>"

And that^ environment variable is unset in Heroku.

Could not import file: The file has a syntax error

Getting

`2016-08-10 15:26:10 - Txgh::TransifexApiError - Failed Transifex API call - returned status code: 400, body: Could not import file: The file has a syntax error.:

Even though when I upload the resource directly to transifex myself there are no issues.

The file I am trying to import is

https://github.com/pubpub/pubpub/blob/master/translations/en/en3.json

the type is keyvaluejson

The full stack trace:

2016-08-10 15:34:45 - Txgh::TransifexApiError - Failed Transifex API call - returned status code: 400, body: Could not import file: The file has a syntax error.:
/root/txgh/lib/txgh/transifex_api.rb:119:in raise_error!' /root/txgh/lib/txgh/transifex_api.rb:71:inupdate_content'
/root/txgh/lib/txgh/transifex_api.rb:46:in create_or_update' /root/txgh/lib/txgh/handlers/github_hook_handler.rb:81:inupload'
/root/txgh/lib/txgh/handlers/github_hook_handler.rb:71:in block (2 levels) in update_resources' /root/txgh/lib/txgh/handlers/github_hook_handler.rb:60:ineach'
/root/txgh/lib/txgh/handlers/github_hook_handler.rb:60:in block in update_resources' /root/txgh/lib/txgh/handlers/github_hook_handler.rb:54:ineach'
/root/txgh/lib/txgh/handlers/github_hook_handler.rb:54:in update_resources' /root/txgh/lib/txgh/handlers/github_hook_handler.rb:45:inexecute'
/root/txgh/lib/txgh/app.rb:114:in block in <class:Hooks>' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1611:incall'
/root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1611:in block in compile!' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in[]'
/root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in block (3 levels) in route!' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:994:inroute_eval'
/root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in block (2 levels) in route!' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1015:inblock in process_route'
/root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1013:in catch' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1013:inprocess_route'
/root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:973:in block in route!' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:972:ineach'
/root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:972:in route!' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1085:inblock in dispatch!'
/root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in block in invoke' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:incatch'
/root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in invoke' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1082:indispatch!'
/root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:907:in block in call!' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:inblock in invoke'
/root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in catch' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:ininvoke'
/root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:907:in call!' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:895:incall'
/root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in call' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:incall'
/root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in call' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:incall'
/root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in call' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:incall'
/root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/head.rb:13:in call' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:182:incall'
/root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:2013:in call' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/urlmap.rb:66:inblock in call'
/root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/urlmap.rb:50:in each' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/urlmap.rb:50:incall'
/root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/puma-3.6.0/lib/puma/configuration.rb:225:in call' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/puma-3.6.0/lib/puma/server.rb:578:inhandle_request'
/root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/puma-3.6.0/lib/puma/server.rb:415:in process_client' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/puma-3.6.0/lib/puma/server.rb:275:inblock in run'
/root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/puma-3.6.0/lib/puma/thread_pool.rb:116:in call' /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/puma-3.6.0/lib/puma/thread_pool.rb:116:inblock in spawn_thread'

Localhost only by default

This isn't specifically a txgh issue, but something which ate a lot of time when I updated from my old fork to this one. The new gem versions have changed the default behaviour of (I think) rack, so it now defaults to only listening to localhost. The only way I found of changing that was a to set the environment variable RACK_ENV to 'production'.

I would update the README, but I'm not entirely sure if this is the correct way to handle it. Also, it would be nice to not have to run in global 'production' mode, for instance if we used Logger, as even in development mode, we still need to listen on 0.0.0.0, but would want debug output. So it would be nice to have a way of overriding the default listening IP, regardless of the run mode.

TypeError - can't convert nil into String

Hey ...

Getting this error when github fires the webhook. I know nothing about Ruby, or I'd have a go at tracking it down myself. Really hoping I can get txgh going, as I badly need CI between a large github project and TF, so would appreciate any help I can get on this one.

TypeError - can't convert nil into String:
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/json-1.8.0/lib/json/common.rb:155:in initialize' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/json-1.8.0/lib/json/common.rb:155:innew'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/json-1.8.0/lib/json/common.rb:155:in parse' /home/ec2-user/txgh/app/app.rb:61:inblock in class:Hooks'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:1541:in call' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:1541:inblock in compile!'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:950:in []' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:950:inblock (3 levels) in route!'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:966:in route_eval' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:950:inblock (2 levels) in route!'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:987:in block in process_route' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:985:incatch'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:985:in process_route' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:948:inblock in route!'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:947:in each' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:947:inroute!'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:1059:in block in dispatch!' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:inblock in invoke'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in catch' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:ininvoke'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:1056:in dispatch!' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:882:inblock in call!'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in block in invoke' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:incatch'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:1041:in invoke' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:882:incall!'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:870:in call' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/rack-protection-1.5.0/lib/rack/protection/xss_header.rb:18:incall'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/rack-protection-1.5.0/lib/rack/protection/path_traversal.rb:16:in call' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/rack-protection-1.5.0/lib/rack/protection/json_csrf.rb:18:incall'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:in call' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/rack-protection-1.5.0/lib/rack/protection/base.rb:49:incall'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/rack-protection-1.5.0/lib/rack/protection/frame_options.rb:31:in call' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/rack-1.5.2/lib/rack/nulllogger.rb:9:incall'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/rack-1.5.2/lib/rack/head.rb:11:in call' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/showexceptions.rb:21:incall'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:175:in call' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/sinatra-1.4.3/lib/sinatra/base.rb:1949:incall'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/rack-1.5.2/lib/rack/builder.rb:138:in call' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/rack-1.5.2/lib/rack/urlmap.rb:65:inblock in call'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/rack-1.5.2/lib/rack/urlmap.rb:50:in each' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/rack-1.5.2/lib/rack/urlmap.rb:50:incall'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/rack-1.5.2/lib/rack/lint.rb:49:in _call' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/rack-1.5.2/lib/rack/lint.rb:37:incall'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/rack-1.5.2/lib/rack/showexceptions.rb:24:in call' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/puma-2.5.1/lib/puma/rack_patch.rb:13:incall'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/rack-1.5.2/lib/rack/chunked.rb:43:in call' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/rack-1.5.2/lib/rack/content_length.rb:14:incall'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/puma-2.5.1/lib/puma/server.rb:472:in handle_request' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/puma-2.5.1/lib/puma/server.rb:343:inprocess_client'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/puma-2.5.1/lib/puma/server.rb:242:in block in run' /home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/puma-2.5.1/lib/puma/thread_pool.rb:92:incall'
/home/ec2-user/.rvm/gems/ruby-1.9.3-p551/gems/puma-2.5.1/lib/puma/thread_pool.rb:92:in `block in spawn_thread'

Getting an error on AWS

Hi there

I get a txgh error when the github side fires:


192.30.252.34 - - [17/Apr/2017:18:40:12 +0000] "POST /hooks/github HTTP/1.1" 500 229964 0.3245
I, [Mon 17-04-2017 1840 #16255]  INFO -- : Processing request at /hooks/github
I, [Mon 17-04-2017 1840 #16255]  INFO -- : processing payload from form
2017-04-17 18:40:12 - Psych::SyntaxError - (<unknown>): did not find expected key while parsing a block mapping at line 22 column 9:
        /home/ec2-user/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/psych.rb:370:in `parse'
        /home/ec2-user/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/psych.rb:370:in `parse_stream'
        /home/ec2-user/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/psych.rb:318:in `parse'
        /home/ec2-user/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/psych.rb:245:in `load'
        /home/ec2-user/txgh/lib/txgh/key_manager.rb:43:in `yaml'
        /home/ec2-user/txgh/lib/txgh/key_manager.rb:53:in `repo_config_for'
        /home/ec2-user/txgh/lib/txgh/key_manager.rb:17:in `config_from_repo'
        /home/ec2-user/txgh/lib/txgh/app.rb:104:in `block in <class:Hooks>'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:1611:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:1611:in `block in compile!'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:975:in `[]'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:975:in `block (3 levels) in route!'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:994:in `route_eval'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:975:in `block (2 levels) in route!'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:1015:in `block in process_route'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:1013:in `catch'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:1013:in `process_route'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:973:in `block in route!'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:972:in `each'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:972:in `route!'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:1085:in `block in dispatch!'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `block in invoke'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `catch'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `invoke'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:1082:in `dispatch!'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:907:in `block in call!'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `block in invoke'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `catch'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:1067:in `invoke'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:907:in `call!'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:895:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rack-1.6.5/lib/rack/head.rb:13:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/show_exceptions.rb:25:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:182:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:2013:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rack-1.6.5/lib/rack/urlmap.rb:66:in `block in call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rack-1.6.5/lib/rack/urlmap.rb:50:in `each'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rack-1.6.5/lib/rack/urlmap.rb:50:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rack-1.6.5/lib/rack/tempfile_reaper.rb:15:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rack-1.6.5/lib/rack/lint.rb:49:in `_call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rack-1.6.5/lib/rack/lint.rb:37:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rack-1.6.5/lib/rack/showexceptions.rb:24:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rack-1.6.5/lib/rack/commonlogger.rb:33:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/sinatra-1.4.8/lib/sinatra/base.rb:219:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rack-1.6.5/lib/rack/chunked.rb:54:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/rack-1.6.5/lib/rack/content_length.rb:15:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/puma-3.8.2/lib/puma/configuration.rb:224:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/puma-3.8.2/lib/puma/server.rb:600:in `handle_request'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/puma-3.8.2/lib/puma/server.rb:435:in `process_client'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/puma-3.8.2/lib/puma/server.rb:299:in `block in run'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/puma-3.8.2/lib/puma/thread_pool.rb:120:in `call'
        /home/ec2-user/.rvm/gems/ruby-2.2.2/gems/puma-3.8.2/lib/puma/thread_pool.rb:120:in `block in spawn_thread'

Any ideas?

Could be a configuration problem: NoMethodError - undefined method `info' for nil:NilClass:

Setting up TXGH and I am getting this error after I translate something on Transifex. Note that the Github -> TXGH post request works and updates my TXGH resource:

NoMethodError - undefined methodinfo' for nil:NilClass:

Was wondering if this is a bug or an issue with something that I am doing. I am using ruby 2.2.0 on Ubuntu 16

2016-08-09 15:20:41 - NoMethodError - undefined method `info' for nil:NilClass:
    /root/txgh/lib/txgh/handlers/transifex_hook_handler.rb:11:in `initialize'
    /root/txgh/lib/txgh/app.rb:135:in `new'
    /root/txgh/lib/txgh/app.rb:135:in `transifex_handler_for'
    /root/txgh/lib/txgh/app.rb:67:in `block in <class:Hooks>'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1611:in `call'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1611:in `block in compile!'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in `[]'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in `block (3 levels) in route!'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:994:in `route_eval'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:975:in `block (2 levels) in route!'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1015:in `block in process_route'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1013:in `catch'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1013:in `process_route'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:973:in `block in route!'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:972:in `each'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:972:in `route!'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1085:in `block in dispatch!'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `block in invoke'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `catch'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `invoke'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1082:in `dispatch!'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:907:in `block in call!'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `block in invoke'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `catch'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:1067:in `invoke'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:907:in `call!'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:895:in `call'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-protection-1.5.3/lib/rack/protection/xss_header.rb:18:in `call'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-protection-1.5.3/lib/rack/protection/path_traversal.rb:16:in `call'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-protection-1.5.3/lib/rack/protection/json_csrf.rb:18:in `call'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-protection-1.5.3/lib/rack/protection/base.rb:49:in `call'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-protection-1.5.3/lib/rack/protection/frame_options.rb:31:in `call'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:182:in `call'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/sinatra-1.4.7/lib/sinatra/base.rb:2013:in `call'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/urlmap.rb:66:in `block in call'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/urlmap.rb:50:in `each'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/rack-1.6.4/lib/rack/urlmap.rb:50:in `call'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/puma-3.6.0/lib/puma/configuration.rb:225:in `call'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/puma-3.6.0/lib/puma/server.rb:578:in `handle_request'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/puma-3.6.0/lib/puma/server.rb:415:in `process_client'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/puma-3.6.0/lib/puma/server.rb:275:in `block in run'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/puma-3.6.0/lib/puma/thread_pool.rb:116:in `call'
    /root/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/puma-3.6.0/lib/puma/thread_pool.rb:116:in `block in spawn_thread'

Better docs

Hi there, I was curious, but are there by chance any better docs on how to use this? I have the server itself setup, and my web hooks are processed going into Transifex, and I can see the webhook handled coming back to Github. However, there are no results. I added logging to the config.ru, but the output seems overly complicated with concatted HTML.

Any tips?

Commits to Github not updating in TX project

When translation files are updated and pushed to Github the changes to the files are not reflected in the TX project.

Dockerfile:

FROM mjjacko/txgh:latest

ENV RACK_ENV production
ENV GITHUB_PUSH_SOURCE_TO "icelandair-meals"
ENV GITHUB_USERNAME "VilliGunn"
ENV GITHUB_TOKEN "******"
ENV GITHUB_WEBHOOK_SECRET "******"
ENV GITHUB_BRANCH develop
ENV TX_CONFIG_PATH config/tx.config
ENV TX_USERNAME "tmsoftware"
ENV TX_PASSWORD "******"
ENV TX_PUSH_TRANSLATIONS_TO "Icelandair/micro.translations"
ENV TX_WEBHOOK_SECRET "******"

COPY /config/tx.config /usr/app/config/tx.config

EXPOSE 9292
CMD ["puma", "-p", "9292"]

tx.config:

[main]
host = https://www.transifex.com
lang_map =

# Create one such section per resource
[icelandair-meals.mealsformenglishjson]
file_filter = translations/<lang>/sample.json
source_file = sample.json
source_lang = en
type = JSON

the txgh logs:

INFO -- : Processing request at /hooks/github
INFO -- : processing payload from request.body
INFO -- : request github branch: heads/develop
INFO -- : config github branch: heads/develop
INFO -- : found branch in github request
INFO -- : processing resource
INFO -- : processing commit
INFO -- : processing modified file: translations/en_GB/sample.json

Everything works the other way around, from TX to github when everything is translated and/or reviewed.

About archive the repo

๐Ÿ‘‹ it looks like the last commit was three years back, maybe it is good to archive the repo rather than having it open? Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.