defunkt / github-gem

`github` command line helper for simplifying your GitHub experience.
http://github.com
MIT License
1.12k stars 188 forks source link

Ruby 1.9 support. #3

Closed dpc closed 13 years ago

dpc commented 15 years ago
$ github
/var/lib/gems/1.9.0/gems/defunkt-github-0.3.4/lib/github/extensions.rb:11: warning: undefining `object_id' may cause serious problem
/var/lib/gems/1.9.0/gems/defunkt-github-0.3.4/lib/github.rb:149:in `module_eval': /var/lib/gems/1.9.0/gems/defunkt-github-0.3.4/lib/commands/commands.rb:40: syntax error, unexpected ')' (SyntaxError)
  helper.tracking.sort { |(a,),(b,)| a == helper.origin ? -...
                              ^
/var/lib/gems/1.9.0/gems/defunkt-github-0.3.4/lib/commands/commands.rb:40: syntax error, unexpected '|', expecting '='
...per.tracking.sort { |(a,),(b,)| a == helper.origin ? -1 : b ...
...                               ^
/var/lib/gems/1.9.0/gems/defunkt-github-0.3.4/lib/commands/commands.rb:40: syntax error, unexpected '}', expecting keyword_end
...rigin ? 1 : a.to_s <=> b.to_s }.each do |(name,user_or_url)|
...                               ^
    from /var/lib/gems/1.9.0/gems/defunkt-github-0.3.4/lib/github.rb:149:in `load'
    from /var/lib/gems/1.9.0/gems/defunkt-github-0.3.4/lib/github.rb:66:in `block in activate'
    from /var/lib/gems/1.9.0/gems/defunkt-github-0.3.4/lib/github.rb:65:in `each'
    from /var/lib/gems/1.9.0/gems/defunkt-github-0.3.4/lib/github.rb:65:in `activate'
    from /var/lib/gems/1.9.0/gems/defunkt-github-0.3.4/bin/github:8:in `'
    from /var/lib/gems/1.9.0/bin/github:19:in `load'
    from /var/lib/gems/1.9.0/bin/github:19:in `
'
rkh commented 15 years ago

Anybody working on that one?

Daenyth commented 15 years ago

I'd really like to see this fixed soon... Arch has moved to ruby 1.9, which means that this app no longer works without installing 1.8 alongside, which is rather ugly.

wfarr commented 15 years ago

I've made fixes in my fork which work for me. Whether or not they maintain complete 1.8.6 and 1.8.7 compatibility, I'm not sure.

Daenyth commented 15 years ago

Would those be the 5 commits from your 1.9.x branch? Probably for packaging purposes I'll format-patch those commits and apply them onto the main branch for now.

wfarr commented 15 years ago

Yes. And I've confirmed the test-suite runs 100% on 1.8.7.

Daenyth commented 15 years ago

Awesome. I'll look into it.

sunaku commented 15 years ago

Here's an update on Ruby 1.9 status with the github 0.4.0 gem: simply running the github command fails with ruby 1.9.1p243 (2009-07-16 revision 24175) [i686-linux].

% github
/usr/lib/ruby/gems/1.9.1/gems/github-0.4.0/lib/github/extensions.rb:11: warning: undefining `object_id' may cause serious problem
/usr/lib/ruby/gems/1.9.1/gems/github-0.4.0/lib/github.rb:151:in `module_eval': /usr/lib/ruby/gems/1.9.1/gems/github-0.4.0/lib/commands/helpers.rb:5: syntax error, unexpected ':', expecting keyword_then or ',' or ';' or '\n' (SyntaxError)
  when %r|^git://github\.com/([^/]+/[^/]+)$|: $1.split('/')
                                             ^
/usr/lib/ruby/gems/1.9.1/gems/github-0.4.0/lib/commands/helpers.rb:6: syntax error, unexpected keyword_when, expecting keyword_end
  when %r|^(?:ssh://)?(?:git@)?gith...
      ^
/usr/lib/ruby/gems/1.9.1/gems/github-0.4.0/lib/commands/helpers.rb:6: syntax error, unexpected ':', expecting keyword_end
...@)?github\.com:([^/]+/[^/]+)$|: $1.split('/')
...                               ^
/usr/lib/ruby/gems/1.9.1/gems/github-0.4.0/lib/commands/helpers.rb:8: syntax error, unexpected keyword_end, expecting $end
  from /usr/lib/ruby/gems/1.9.1/gems/github-0.4.0/lib/github.rb:151:in `load'
  from /usr/lib/ruby/gems/1.9.1/gems/github-0.4.0/lib/github.rb:68:in `block in activate'
  from /usr/lib/ruby/gems/1.9.1/gems/github-0.4.0/lib/github.rb:67:in `each'
  from /usr/lib/ruby/gems/1.9.1/gems/github-0.4.0/lib/github.rb:67:in `activate'
  from /usr/lib/ruby/gems/1.9.1/gems/github-0.4.0/bin/github:8:in `<top (required)>'
  from /usr/bin/github:19:in `load'
  from /usr/bin/github:19:in `<main>'
wfarr commented 15 years ago

This is a known issue which I've fixed in my branch. It's because ruby1.9 no longer supports the when cond: blah syntax. You need to use newlines or when cond then blah.

sunaku commented 15 years ago

Thanks for the update. I will use your fork for now and I hope your changes are pulled into upstream soon. :-)

bmaland commented 15 years ago

I'm using wfarr's fork as well, works fine on my Ruby 1.9.1p243 system. Seems safe to merge into mainline

nobu commented 14 years ago

Regarding wfarr's fork, line 45 in lib/commands/commands.rb changed the semantics from the original. It should be |(a,),(b,)| not |a,b|, I think.

dolzenko commented 14 years ago

Ok, I just went and commented the block on line 45 and replaced : with newlines in github-0.4.2/lib/commands/helpers.rb. Things seem to be working so far :)

docunext commented 14 years ago

I'd love to see the patch from wfarr's fork integrated into mainline as well, thanks!

kristianmandrup commented 14 years ago

I have a working 1.9 fork here: http://github.com/kristianmandrup/github-gem I've also added some other patches found in the network, such as a fix for $ gh network http://github.com/dominikh/github-gem/commit/3756a55c840ddbaef60d596250372e51faf07afc

http://github.com/snowblink/github-gem/commit/3726b5e0f1f1129e41550f753e1d2207a3f5063c

Also converted it into a jewel, for use with jeweler.

bronson commented 14 years ago

Dammit, forgot github had an issue tracker. Iidn't look here before spending my time porting it to 1.9.2.

Here's my tree: http://github.com/bronson/github-gem Tested and works great on 1.8.6 and 1.9.2rc2.

Could one of the maintainers PLEASE pull one of the 1.9.2 fix trees? The fixes are small and well understood. I'm bummed I duplicated other peoples' work.

kristianmandrup commented 14 years ago

Great! In my fork, I later noticed that the "create repository" command didn't work. Anyone experienced this or has a fix for it?

bronson commented 14 years ago

Hi Kristian. I don't experience that. In my fork create repository seems to work perfectly under 1.8.6 and 1.9.2. Tell me if you can find a way to break it.

millisami commented 14 years ago

Still its not pulled in to the master repo.!! Same error with me.

kristianmandrup commented 14 years ago

Hi bronson and millisami,

Here are my results after a few minutes investigation:

kristian-mandrups-macbook-pro:_clones kristianconsult$ github create blip
/Users/kristianconsult/.rvm/gems/ruby-1.9.2-p0/gems/github-0.4.5/lib/github/command.rb:131:in `run': undefined method `any?' for "":String (NoMethodError)

So I added a String extension

class String 
  def any?
    !empty?
  end
end 

Now I get another error :(

$ github create blip
ERROR: kristianmandrup/blip doesn't exist yet. Did you enter it correctly?
fatal: The remote end hung up unexpectedly

Why, WTF? Am I missing something here? I thought it would create the repo without expecting it to be present there already!?

I pushed my gem with the fix so you have the option to check it out or work on it if you like.

mdarby commented 13 years ago

A year? Really?

keithpitt commented 13 years ago

I've got a pull request which fixes all the Ruby 1.9 problems:

https://github.com/defunkt/github-gem/pull/36

drnic commented 13 years ago

I think these are all applied now.

sunaku commented 13 years ago

Hurray! Thanks for following through on this long awaited request :)