Join us

Command line interface for hoptoad

Last updated August 16, 2021 1 min read

We are trying to build a better development workflow in Railsware by connecting all our tools together.
So, this time we tried to connect HopToad Application with git commits. This idea was resulted in the command line interface for hoptoad api with a little git integration – Shelltoad.

Currently when the new error arrives, we do the following:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter

# Check the list of errors

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ shelltoad [#3374331] production ActionController::MethodNotAllowed: Only put requests are allowed [#4023713] production ActiveRecord::StatementInvalid: PGError: ERROR: duplicate key value violates unique constraint "index_companies_on_slug" : INSERT INTO "companies" .....
$ shelltoad [#3374331] production ActionController::MethodNotAllowed: Only put requests are allowed [#4023713] production ActiveRecord::StatementInvalid: PGError: ERROR: duplicate key value violates unique constraint "index_companies_on_slug" : INSERT INTO "companies" .....
 $ shelltoad [#3374331] production ActionController::MethodNotAllowed: Only put requests are allowed [#4023713] production ActiveRecord::StatementInvalid: PGError: ERROR: duplicate key value violates unique constraint "index_companies_on_slug" : INSERT INTO "companies" ..... 

# View the information on the required error. # ‘713’ is automatically guess for 4023713

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ shelltoad 713 ActiveRecord::StatementInvalid: PGError: ERROR: duplicate key value violates unique constraint "index_companies_on_slug" : INSERT INTO "companies" ("slug", "created_at", "title", "updated_at", "external_url", "logo_id", "custom") VALUES('abbott-associates /var/data/www/apps/startwire/shared/bundle/ruby/1.8/gems/activerecord- 2.3.8/lib/active_record/connection_adapters/abstract_adapter.rb:221 /var/data/www/apps/startwire/releases/20110218113457/app/models/company.rb:50 /var/data/www/apps/startwire/releases/20110218113457/app/utils/network_map/populate.rb:9 /var/data/www/apps/startwire/releases/20110218113457/app/utils/network_map/populate.rb:74 /var/data/www/apps/startwire/releases/20110218113457/app/utils/network_map/populate.rb:70 ....
$ shelltoad 713 ActiveRecord::StatementInvalid: PGError: ERROR: duplicate key value violates unique constraint "index_companies_on_slug" : INSERT INTO "companies" ("slug", "created_at", "title", "updated_at", "external_url", "logo_id", "custom") VALUES('abbott-associates /var/data/www/apps/startwire/shared/bundle/ruby/1.8/gems/activerecord- 2.3.8/lib/active_record/connection_adapters/abstract_adapter.rb:221 /var/data/www/apps/startwire/releases/20110218113457/app/models/company.rb:50 /var/data/www/apps/startwire/releases/20110218113457/app/utils/network_map/populate.rb:9 /var/data/www/apps/startwire/releases/20110218113457/app/utils/network_map/populate.rb:74 /var/data/www/apps/startwire/releases/20110218113457/app/utils/network_map/populate.rb:70 ....
 $ shelltoad 713 ActiveRecord::StatementInvalid: PGError: ERROR: duplicate key value violates unique constraint "index_companies_on_slug" : INSERT INTO "companies" ("slug", "created_at", "title", "updated_at", "external_url", "logo_id", "custom") VALUES('abbott-associates /var/data/www/apps/startwire/shared/bundle/ruby/1.8/gems/activerecord- 2.3.8/lib/active_record/connection_adapters/abstract_adapter.rb:221 /var/data/www/apps/startwire/releases/20110218113457/app/models/company.rb:50 /var/data/www/apps/startwire/releases/20110218113457/app/utils/network_map/populate.rb:9 /var/data/www/apps/startwire/releases/20110218113457/app/utils/network_map/populate.rb:74 /var/data/www/apps/startwire/releases/20110218113457/app/utils/network_map/populate.rb:70 .... 

# Fix the error in the code …

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter

# Prepare git commit

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ git add .
$ git add .
 $ git add . 

# Commit the fix to git with connection to hoptoad issue id

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ shelltoad commit 713 [dev 47f09ec] http://xxx.hoptoadapp.com//errors/4023713 1 files changed, 1 insertions(+), 1 deletions(-)
$ shelltoad commit 713 [dev 47f09ec] http://xxx.hoptoadapp.com//errors/4023713 1 files changed, 1 insertions(+), 1 deletions(-)
 $ shelltoad commit 713 [dev 47f09ec] http://xxx.hoptoadapp.com//errors/4023713 1 files changed, 1 insertions(+), 1 deletions(-) 

Commit message will look like this:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
http://startdatelabs.hoptoadapp.com//errors/4023713 ActiveRecord::StatementInvalid: PGError: ERROR: duplicate key value violates unique constraint "index_companies_on_slug" : INSERT INTO "companies" ("slug", "created_at", "title", "updated_at", "external_url", "logo_id", "custom") VALUES('abbott-associates
http://startdatelabs.hoptoadapp.com//errors/4023713 ActiveRecord::StatementInvalid: PGError: ERROR: duplicate key value violates unique constraint "index_companies_on_slug" : INSERT INTO "companies" ("slug", "created_at", "title", "updated_at", "external_url", "logo_id", "custom") VALUES('abbott-associates
http://startdatelabs.hoptoadapp.com//errors/4023713 ActiveRecord::StatementInvalid: PGError: ERROR: duplicate key value violates unique constraint "index_companies_on_slug" : INSERT INTO "companies" ("slug", "created_at", "title", "updated_at", "external_url", "logo_id", "custom") VALUES('abbott-associates

This help us maintain the links between git and hoptoad automatically.