zenhob / hcl

Command-line tool for manipulating Harvest timesheets
http://zenhob.github.io/hcl
MIT License
223 stars 45 forks source link

Runtime Error on setup #56

Closed panozzaj closed 10 years ago

panozzaj commented 10 years ago

When I invoke hcl tasks and put in my information, when I get done (and then on subsequent runs until I remove ~/.hcl/config.yml), I get the following error:

/Users/me/.rvm/gems/ruby-1.9.3-p448/gems/hcl-0.4.11/lib/hcl/timesheet_resource.rb:42:in `block in resources': wrong number of arguments (0 for 1) (ArgumentError)
    from /Users/me/.rvm/gems/ruby-1.9.3-p448/gems/hcl-0.4.11/lib/hcl/commands.rb:21:in `tasks'
    from /Users/me/.rvm/gems/ruby-1.9.3-p448/gems/hcl-0.4.11/lib/hcl/app.rb:44:in `run'
    from /Users/me/.rvm/gems/ruby-1.9.3-p448/gems/hcl-0.4.11/lib/hcl/app.rb:27:in `command'
    from /Users/me/.rvm/gems/ruby-1.9.3-p448/gems/hcl-0.4.11/bin/hcl:4:in `<top (required)>'
    from /Users/me/.rvm/gems/ruby-1.9.3-p448/bin/hcl:23:in `load'
    from /Users/me/.rvm/gems/ruby-1.9.3-p448/bin/hcl:23:in `<main>'

This happens when using hcl v0.4.11. I tried all permutations of SSL on/off and subdomain long/short (see below). I get a different error with v0.4.10 related to "undefined method `register_middleware' for #Faraday::Connection:0x007fa384869118 (NoMethodError)". v0.4.9 seems to work without any issues.

Side note: I wasn't sure what to put in for the subdomain (mysubdomain vs. mysubdomain.harvestapp.com), we might clarify that in the instructions. It seems like the former works just fine.

zenhob commented 10 years ago

Thanks for the detailed report! If you're up for it, I could use some more help tracking this down. I've been unable to reproduce this so far using 1.9.3 with either 0.4.11 or master. Could I persuade you to install HCl from the latest source and see if that addresses your problem? Just rake install from a fresh checkout with bundle;bundle exec rake install. I'd also be keen to know if the tests pass for you, run them with bundle exec rake test.

Let me know what errors you get from this process. Not sure what the issue is yet, I am hoping it's some sort of gem version mismatch. I added detailed version requirements to the gemspec a couple of releases ago to avoid this sort of problem...

panozzaj commented 10 years ago
[9:45] github ◊ git clone https://github.com/zenhob/hcl
Cloning into 'hcl'...
remote: Reusing existing pack: 1540, done.
remote: Counting objects: 40, done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 1580 (delta 18), reused 0 (delta 0)
Receiving objects: 100% (1580/1580), 254.63 KiB | 309.00 KiB/s, done.
Resolving deltas: 100% (848/848), done.
Checking connectivity... done.
No git modules, so will not try to update submodules.

[9:45] github ◊ cd hcl

[9:46] hcl ◊ bundle; bundle exec rake install
Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Installing rake (10.1.1)
Installing chronic (0.10.2)
Using coderay (1.1.0)
Installing docile (1.1.2)
Installing escape_utils (1.0.1)
Installing fakeweb (1.3.0)
Installing multipart-post (2.0.0)
Installing faraday (0.9.0)
Using highline (1.6.20)
Using method_source (0.8.2)
Installing slop (3.4.7)
Installing pry (0.9.12.4)
Installing trollop (2.0)
Using yajl-ruby (1.1.0)
Using hcl (0.4.12) from source at .
hcl at /Users/me/Documents/dev/github/hcl did not have a valid gemspec.
This prevents bundler from installing bins or native extensions, but that may not affect its functionality.
The validation message from Rubygems was:
  ["man/hcl.1"] are not files

Using hpricot (0.8.6)
Installing metaclass (0.0.2)
Installing minitest (5.2.2)
Installing mocha (1.0.0)
Installing multi_json (1.8.4)
Installing mustache (0.99.5)
Installing rdiscount (2.1.7)
Installing ronn (0.7.3)
Installing rubygems-tasks (0.2.4)
Installing simplecov-html (0.8.0)
Installing simplecov (0.8.2)
Installing yard (0.8.7.3)
Using bundler (1.3.5)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
Writing manual page...done.
>>> Building hcl-0.4.12.gem ...
  Successfully built RubyGem
  Name: hcl
  Version: 0.4.12
  File: hcl-0.4.12.gem
>>> Installing hcl-0.4.12.gem ...
Successfully installed hcl-0.4.12
1 gem installed

[9:46] hcl ◊ which hcl
/Users/me/.rvm/gems/ruby-1.9.3-p448/bin/hcl

[9:47] hcl ◊ hcl -v
HCl version 0.4.12

[9:47] hcl ◊ hcl tasks
# <snip> ... lists out all of the the tasks

I hypothesize that this is due to things being cached, so I run from scratch:

[9:47] hcl ◊ rm -rf ~/.hcl

[9:47] hcl ◊ hcl tasks
Please specify your Harvest credentials.
Email Address: test@example.com
Password:
Subdomain: mysubdomain
Use SSL? (y/n): y
Writing configuration to /Users/me/.hcl/config.yml.
/Users/me/.rvm/gems/ruby-1.9.3-p448/gems/hcl-0.4.12/lib/hcl/timesheet_resource.rb:42:in `block in resources': wrong number of arguments (0 for 1) (ArgumentError)
    from /Users/me/.rvm/gems/ruby-1.9.3-p448/gems/hcl-0.4.12/lib/hcl/commands.rb:31:in `tasks'
    from /Users/me/.rvm/gems/ruby-1.9.3-p448/gems/hcl-0.4.12/lib/hcl/app.rb:49:in `run'
    from /Users/me/.rvm/gems/ruby-1.9.3-p448/gems/hcl-0.4.12/lib/hcl/app.rb:28:in `command'
    from /Users/me/.rvm/gems/ruby-1.9.3-p448/gems/hcl-0.4.12/bin/hcl:4:in `<top (required)>'
    from /Users/me/.rvm/gems/ruby-1.9.3-p448/bin/hcl:23:in `load'
    from /Users/me/.rvm/gems/ruby-1.9.3-p448/bin/hcl:23:in `<main>'

[9:48] hcl ◊ hcl -v
HCl version 0.4.12

[9:48] hcl ◊ bundle exec rake test
Run options: --seed 38800

# Running:

security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
.security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
.security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
.security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
.security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
.security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
.security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.
.....................................

Finished in 1.241338s, 34.6400 runs/s, 61.2243 assertions/s.

43 runs, 76 assertions, 0 failures, 0 errors, 0 skips
Coverage report generated for Unit Tests to /Users/me/Documents/dev/github/hcl/coverage. 355 / 420 LOC (84.52%) covered.

I poked around for a bit trying to inspect values in the failing function, but nothing seemed to be the smoking gun. Maybe there is a Ruby/RVM config somewhere that I need to set? Hope this helps!

zenhob commented 10 years ago

This helps a lot, thanks so much! The reason I was unable to reproduce was because I'd forgotten to delete the task cache, d'oh. This is very helpful, I'll get a fix out ASAP. Sorry you've been having issues!

zenhob commented 10 years ago

This should be fixed, I still need to write a better test, then I'll release this as 0.4.12. Thanks again for catching this, it was a pretty serious bug!

panozzaj commented 10 years ago

Confirmed that master works as expected. Thanks for the quick fix!