Error on Update Generators

Issue #1 resolved
Jon Arrien created an issue
#!

Traceback (most recent call last):
  File "./generators.py", line 16, in on_selected
  File "./QuickRails.py", line 81, in run_quick_command
OverflowError: bad numeric conversion: positive overflow
  • System = Mac OSX 10.8.4
  • Using RVM = YES

Comments (21)

  1. Dan Peleg repo owner
    1. Can you tell me which generator did you choose?
    2. Did you have more than 1 generator available or only the "Update..." feature ?
    3. Did you run it when a folder is opened in you Sublime?
  2. Jon Arrien reporter

    I didn't choose any generator, I only have "Update" feature. The error raises when I choose "Update".

    I have a RoR project root folder added to ST2. If I select to generate rake tasks the same error raises. But if I select bundle install it looks fine.

  3. Jon Arrien reporter

    I only have 1 project added. On the other hand in generators.py you get the first folder: self.window.folders()[0]

    I think the problem is with RVM, because Sublime doesn't get rvm-auto-ruby. For example in RubyTest package, there is an option for RVM and RBENV.

    Could be that?

  4. Dan Peleg repo owner

    It can be an RVM problam, but lets try debugging it first. You can open the plugin folder located at

    #!
    
    ~/.config/sublime-text-2/Packages/QuickRails
    

    And add a print for both

    self.window.folders()[0]
    

    And

    print working_dir
    self.window.run_command("quick_exec", {
          "cmd": [command],
          "shell": True,
          "listenerid": id(listener),
          "working_dir": working_dir
        })
    

    And lets see if it prints your project root folder

  5. Jon Arrien reporter

    output for self.window.folder()[0] /Users/jon/Dropbox/Bilbomatica/Code/bise.catalogue

    working_dir is undefined so I use self.get_working_dir(): /Users/jon/Dropbox/Bilbomatica/Code/bise.catalogue/app/models

  6. Dan Peleg repo owner

    Try in generators.py the following:

    from QuickRails import QuickRailsWindowCommand, get_idea, rails_root
    
    def on_selected(self, selected):
        if selected == 0:
          root = rails_root(self.window.folders()[0])
          self.run_quick_command("rails g", root, self)
        elif selected > 0:
          self.generate(self.generators[selected])
    

    Let me know if you still get the error.

  7. Jon Arrien reporter

    Hi, the error persists. I try to debug it but no success. In muy opinion is not a path problem.

    I think it can't find rails command because is under RVM. It is probably getting systems 1.8 ruby version without rails gem installed. Are you a Mac and RVM user?

  8. Dan Peleg repo owner

    I think you are right! I'm using Linux with RVM. Try running

    #!
    
    source "$HOME/.rvm/scripts/rvm"
    

    On the terminal before running sublime. Let me know if it works :)

  9. Jon Arrien reporter

    I have it in my .bash_profile. Every time I use the terminal is already loaded.

    I have been looking to RubyTest plugin because it has an option to run Rspec tests with RVM. In this plugin they pass "~/.rvm/bin/rvm-auto-ruby -S" before the command they want to execute if RVM is detected.

    I will let you know if I get any other clue.

  10. Dan Peleg repo owner

    I can't reproduce the error in my environment. Can you try and tell me if it works when you pass this rvm -S ?

  11. Jon Arrien reporter

    I tried yesterday passing rvm-auto-ruby before the command but didn't work. Getting a bit deeper it looks a listener problem.

    In QuickRails.py when is going to launch run_command('quick_exec', ...) is never getting inside QuickExecCommand#run method. But if I don't pass id(listener) is getting inside the method.

    My listener id is '4629225936' for example, and the error says "bad numeric conversion" so I think is related.

    Any idea how I can solve it? Thanks

  12. Dan Peleg repo owner

    Nice idea, try in QuickRails.py line 80:

    self.window.run_command("quick_exec", {
          "cmd": [command],
          "shell": True,
          "listenerid": str(id(listener)),
          "working_dir": working_dir
        })
    

    Let me know if it's getting inside the QuickExecCommand method.

  13. Jon Arrien reporter

    I´ve tried to pass it as string, and later on parse again to an integer to seach for the object in gc. I already updated the rails list, but is not working smooth yet. Rake tasks are still not working.

    Don't worry about it, when I've time I will fork your project and try to solve it. Thanks for everything.

  14. Jon Arrien reporter

    Hi Dan,

    I don't use Bitbucket, so I decided to clone your project in GitHub and added support for RVM/RBENV and also added support for Capistrano Tasks. https://github.com/jonarrien/sublime-rails

    You can have a look, any opinion is appreciated. I've changed the plugin's name because I would like to include other useful features for me in the future.

  15. Dan Peleg repo owner

    Hey,

    First of all thanks I really appriciate your contribution,I wanted to move my projec to github as well. I will appriciate if after i'll move my repo to github you will fork it and post pull requests with my repo instead of openning a new one.

    Let me know if it's ok by you and if so i will move this repo to github.

    Thanks, Dan

  16. Jon Arrien reporter

    It will depend how busy I am, but no problem. Count me in.

    Anyway, I would like to mantain the project I created because I would like to inlclude all my rails snippets and other stuff in the same repo. It will be only for personal purpose.

    Let me know when you migrate to Github. Great job! Is a plesure to create EC2 instantes from ST2!! :D

  17. Log in to comment