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

cli.rb:175: syntax error, unexpected ')', expecting '=' (SyntaxError) #10

Closed
PhilETaylor opened this issue Apr 17, 2013 · 9 comments
Closed

Comments

@PhilETaylor
Copy link
Contributor

Here is my complete (short) journey with tugboat that came to a very quick and immediate end :-(

sudo gem install tugboat
Password:
Building native extensions. This could take a while...
Successfully installed thor-0.18.1
Successfully installed multipart-post-1.2.0
Successfully installed faraday-0.8.7
Successfully installed faraday_middleware-0.9.0
Successfully installed json-1.7.7
Successfully installed hashie-2.0.3
Successfully installed rash-0.4.0
Successfully installed digital_ocean-1.0.1
Successfully installed middleware-0.1.0
Successfully installed tugboat-0.0.3
10 gems installed
Installing ri documentation for thor-0.18.1...
Installing ri documentation for multipart-post-1.2.0...
Installing ri documentation for faraday-0.8.7...
Installing ri documentation for faraday_middleware-0.9.0...
Installing ri documentation for json-1.7.7...
Installing ri documentation for hashie-2.0.3...
Installing ri documentation for rash-0.4.0...
Installing ri documentation for digital_ocean-1.0.1...
Installing ri documentation for middleware-0.1.0...
Installing ri documentation for tugboat-0.0.3...
Installing RDoc documentation for thor-0.18.1...
Installing RDoc documentation for multipart-post-1.2.0...
Installing RDoc documentation for faraday-0.8.7...
Installing RDoc documentation for faraday_middleware-0.9.0...
Installing RDoc documentation for json-1.7.7...
Installing RDoc documentation for hashie-2.0.3...
Installing RDoc documentation for rash-0.4.0...
Installing RDoc documentation for digital_ocean-1.0.1...
Installing RDoc documentation for middleware-0.1.0...
Installing RDoc documentation for tugboat-0.0.3...
phils-imac-2012:~ phil$ tugboat authorize
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require': /Library/Ruby/Gems/1.8/gems/tugboat-0.0.3/lib/tugboat/cli.rb:175: syntax error, unexpected ')', expecting '=' (SyntaxError) /Library/Ruby/Gems/1.8/gems/tugboat-0.0.3/lib/tugboat/cli.rb:184: syntax error, unexpected kEND, expecting $end from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:inrequire'
from /Library/Ruby/Gems/1.8/gems/tugboat-0.0.3/lib/tugboat.rb:1
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:inrequire'
from /Library/Ruby/Gems/1.8/gems/tugboat-0.0.3/bin/tugboat:2
from /usr/bin/tugboat:19:in `load'
from /usr/bin/tugboat:19

pearkes added a commit that referenced this issue Apr 18, 2013
This is related to #10. Although I was unable to reproduce this
error on my system, I assume that providing a required argument
after a non-required argument was breaking Thor in some way.

Either way, this is a saner way to do it.
@pearkes
Copy link
Collaborator

pearkes commented Apr 18, 2013

Thanks for the report and pull request! I looked into this, and although I was unable to reproduce it, I think I was doing something rather strange by asking for a required argument after a non-required argument.

I made changes in 723a73f to address this issue - unfortunately the pull request (#11) would break the tugboat snapshot error handling. If someone were to not provide a snapshot_name it would continue on without minding, and raise a messier error further down the line. Trying to keep the CLI argument errors up front in Thor's hands.

Do you mind pulling the latest from GitHub and trying to run authorize again?

$ git clone ...
$ cd tugboat/
$ bundle
$ bundle exec tugboat authorize

Appreciate your help.

@PhilETaylor
Copy link
Contributor Author

I can confim this is fixed for me when running through your instructions to bundle exec tugboat authorize

I assume I can use that until the next gem updatable release?

@pearkes
Copy link
Collaborator

pearkes commented Apr 18, 2013

Yup! You can install and use it with:

bundle exec rake install

Good to hear this fixed it. Thanks for reporting!

@pearkes pearkes closed this as completed Apr 18, 2013
@PhilETaylor
Copy link
Contributor Author

DOH!

phils-imac-2012:tugboat phil$ sudo bundle exec rake install
tugboat 0.0.3 built to pkg/tugboat-0.0.3.gem.
tugboat (0.0.3) installed.
phils-imac-2012:tugboat phil$ cd
phils-imac-2012:~ phil$ tugboat dro
/Library/Ruby/Gems/1.8/gems/json-1.7.7/lib/json/common.rb:155:in parse': 757: unexpected token at '<html><body>You are being <a href="https://www.digitalocean.com/api/fault">redirected</a>.</body></html>' (Faraday::Error::ParsingError) from /Library/Ruby/Gems/1.8/gems/json-1.7.7/lib/json/common.rb:155:inparse'
from /Library/Ruby/Gems/1.8/gems/faraday_middleware-0.9.0/lib/faraday_middleware/response/parse_json.rb:11
from /Library/Ruby/Gems/1.8/gems/faraday_middleware-0.9.0/lib/faraday_middleware/response_middleware.rb:48:in call' from /Library/Ruby/Gems/1.8/gems/faraday_middleware-0.9.0/lib/faraday_middleware/response_middleware.rb:48:inparse'
from /Library/Ruby/Gems/1.8/gems/faraday_middleware-0.9.0/lib/faraday_middleware/response_middleware.rb:39:in process_response' from /Library/Ruby/Gems/1.8/gems/faraday_middleware-0.9.0/lib/faraday_middleware/response_middleware.rb:32:incall'
from /Library/Ruby/Gems/1.8/gems/faraday-0.8.7/lib/faraday/response.rb:63:in on_complete' from /Library/Ruby/Gems/1.8/gems/faraday_middleware-0.9.0/lib/faraday_middleware/response_middleware.rb:30:incall'
from /Library/Ruby/Gems/1.8/gems/faraday-0.8.7/lib/faraday/response.rb:8:in call' from /Library/Ruby/Gems/1.8/gems/faraday-0.8.7/lib/faraday/request/url_encoded.rb:14:incall'
from /Library/Ruby/Gems/1.8/gems/digital_ocean-1.0.1/lib/digital_ocean/authentication_middleware.rb:18:in call' from /Library/Ruby/Gems/1.8/gems/faraday-0.8.7/lib/faraday/connection.rb:247:inrun_request'
from /Library/Ruby/Gems/1.8/gems/faraday-0.8.7/lib/faraday/connection.rb:100:in get' from /Library/Ruby/Gems/1.8/gems/digital_ocean-1.0.1/lib/digital_ocean/resource/droplet.rb:6:inlist'
from /Library/Ruby/Gems/1.8/gems/tugboat-0.0.3/lib/tugboat/middleware/list_droplets.rb:8:in call' from /Library/Ruby/Gems/1.8/gems/tugboat-0.0.3/lib/tugboat/middleware/inject_client.rb:14:incall'
from /Library/Ruby/Gems/1.8/gems/tugboat-0.0.3/lib/tugboat/middleware/check_configuration.rb:13:in call' from /Library/Ruby/Gems/1.8/gems/tugboat-0.0.3/lib/tugboat/middleware/inject_configuration.rb:11:incall'
from /Library/Ruby/Gems/1.8/gems/middleware-0.1.0/lib/middleware/runner.rb:31:in call' from /Library/Ruby/Gems/1.8/gems/middleware-0.1.0/lib/middleware/builder.rb:102:incall'
from /Library/Ruby/Gems/1.8/gems/tugboat-0.0.3/lib/tugboat/cli.rb:37:in droplets' from /Library/Ruby/Gems/1.8/gems/thor-0.18.1/lib/thor/command.rb:27:insend'
from /Library/Ruby/Gems/1.8/gems/thor-0.18.1/lib/thor/command.rb:27:in run' from /Library/Ruby/Gems/1.8/gems/thor-0.18.1/lib/thor/invocation.rb:120:ininvoke_command'
from /Library/Ruby/Gems/1.8/gems/thor-0.18.1/lib/thor.rb:363:in dispatch' from /Library/Ruby/Gems/1.8/gems/thor-0.18.1/lib/thor/base.rb:439:instart'
from /Library/Ruby/Gems/1.8/gems/tugboat-0.0.3/bin/tugboat:4
from /usr/bin/tugboat:19:in `load'
from /usr/bin/tugboat:19

@pearkes
Copy link
Collaborator

pearkes commented Apr 18, 2013

Ha. Can you tell me what version of ruby you're using?

ruby --version

@pearkes pearkes reopened this Apr 18, 2013
@PhilETaylor
Copy link
Contributor Author

phils-imac-2012:~ phil$ ruby --version
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

Hang on I'm checking my credentials - I have a feeling a DigitalOcean iPhone app created a new API key for access because DigitalOcean pathetic doesnt allow you to view your old key, only to create a new one... testing now...

@PhilETaylor
Copy link
Contributor Author

Yes that was the problem. I have edited my API key in ~/.tugboat and now everything is fine again. Sorry about that.

Maybe you could add better handling for access denied issues :-) :-)

@pearkes
Copy link
Collaborator

pearkes commented Apr 18, 2013

Ah, good! No problem.

I agree. Right now, the API issues a 302 redirect and the client lib throws an error trying to parse the response, so outside of wrapping every request in rescue blocks (try, except) I don't have much to work with.

You're right though, it should be better.

@PhilETaylor
Copy link
Contributor Author

No worries! Keep up the great work - this will make my life easier :-) Especially as my cloud app (myJoomla.com) already has a command line interface for most tasks, I'll just be integrating tugboat to allow me to scale quickly without writing more code to integrate the DO api :) Thanks again.

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

2 participants