1. #1
    Sencha Premium Member
    Join Date
    Apr 2009
    Posts
    178
    Vote Rating
    7
    jhoweaa is on a distinguished road

      0  

    Default Problem with Compass

    Problem with Compass


    I'm trying to use the latest build of Sencha Cmd, 3.1.0.256, and when I try to build my app it fails when it gets to the -sass section. I get the following error:

    Code:
    .../rubygems/dependency.rb:247:in `to_specs': Could
    
    not find compass (>= 0) amongst [] (Gem::LoadError)
            from .../rubygems/dependency.rb:256:in `to_s
    
    pec'
            from .../rubygems.rb:1231:in `gem'
    
            from .../Sencha/Cmd/3.1.0.256/extensions/sencha-compass/gems/bin/compass:22:in `<main>'
    
    .../.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could
    not find compass (>= 0) amongst [] (Gem::LoadError)
            from .../.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:256:in `to_s
    pec'
            from.../.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems.rb:1231:in `gem'
            from .../Sencha/Cmd/3.1.0.256/extensions/sencha-compass/gems/bin/compass:22:in `<main>'
    The thing is, I can run Compass just fine outside of Sencha Cmd. I initially had a problem where I could only run Compass in my Cygwin environment but not my normal Windows terminal environment, but I fixed that so now Compass runs everywhere, except in Sencha Cmd. Also, I've been using the earlier version of Sencha Cmd on a different project (3.0.2.288) without any problems.

    I'm running Ruby 1.9.3-p194 under Windows 7/Cygwin. Any ideas on things to look for/change would be greatly appreciated.

    I do have one other question. If I run 'sencha compass' it never seems to do anything other than to write out the list of options. It never acts like it does any work. It doesn't complain, or say anything, it just lists the options. What is it supposed to be doing?

    Thanks.

    Jim

  2. #2
    Sencha Premium Member
    Join Date
    Apr 2009
    Posts
    178
    Vote Rating
    7
    jhoweaa is on a distinguished road

      0  

    Default


    Quote Originally Posted by jhoweaa View Post
    I do have one other question. If I run 'sencha compass' it never seems to do anything other than to write out the list of options. It never acts like it does any work. It doesn't complain, or say anything, it just lists the options. What is it supposed to be doing?
    Ok, I still have my compile problem but I did manage to figure out my issue with the 'sencha compass' command. It finally dawned on me that this was just a way to invoke the compass code that comes with sencha rather than running the compass that I have installed in my system. It might be nice if the documentation for Sencha Cmd just had a simple blurb indicating that the 'sencha compass' command takes the same runtime parameters are regular 'compass'

  3. #3
    Sencha Premium Member
    Join Date
    Apr 2009
    Posts
    178
    Vote Rating
    7
    jhoweaa is on a distinguished road

      0  

    Default


    I still have no solution, but I do have more information. The problem I'm having seems to stem from when Sencha Cmd executes a 'set GEM_HOME = C:\<path to sencha cmd>\extensions\sencha-compass\gems'. I tried executing this command in a shell and then ran irb. While in irb, I executed:

    Gem::Specification.all_names

    which returned an empty array. I then executed:

    Gem::Specification.dirs and got back an array something like this:

    [["C:\\path\\to\\senchacmd\\extensions\\sencha-compass\\gems]]

    I found it very odd that the slashes were doubled. For kicks, I set my GEM_HOME to the same path, but using my cygwin path:

    set GEM_HOME =\cygdrive\c\path\to\senchacmd\extensions\sencha-compass\gems

    and redid my test in irb. This time I saw the list of gems which I would expect to find from the sencha-compass collection.

    To verify that running the real Sencha Cmd would produce the same results, I modified my Gem::Specification file to output the directories it was searching when it tried to find the gem. I then ran sencha --debug compass compile and watched the results. During the run it set the GEM_HOME to c:\path\to\senchacmd\..., it failed trying to locate the gems in Gem::Specification.all_names and the directories it was searching had the funny double slash in the search path.

    I'm going to consult with another Ruby guy here at work to see if he can help me figure out why this may be happening, but I thought I would add this information to my original post in case someone else has any ideas.

    The key things about my environment are that I'm running Windows 7 and cygwin. I have ruby installed via rvm under cygwin. My Windows environment is configured to reference the ruby and gems that were installed by rvm. My command line ruby works fine in both a regular Windows terminal shell as well as the cygwin shell. The only problem I'm having involves Sencha Cmd.

    Thanks in advance for any help.

    Jim

  4. #4
    Sencha Premium Member
    Join Date
    Apr 2009
    Posts
    178
    Vote Rating
    7
    jhoweaa is on a distinguished road

      0  

    Default


    After much pain I have at least found a working solution. I typically run in a Cygwin environment and my Windows box was configured to use a ruby installed by rvm. This ruby is a cygwin ruby (i386-cygwin). No matter what I did, I could not get Sencha Cmd to run compass (sencha compass compile). Whenever I ran this command I was told that the compass gem was not found. I finally decided to install a native Windows version of ruby (i386-mingw32). Running with this version of Ruby, I was finally able to get the Sencha version of Compass to run. It seems, and this is just a guess, that the Cygwin version of ruby doesn't like it when the GEM_HOME is set to something like

    C:\Users\me\Sencha\Cmd\bin\....

    which is what Sencha Cmd does when it runs compass. When running the cygwin ruby, if I manually set the GEM_HOME to the way Sencha Cmd sets it, I would get the error telling me that compass wasn't found in the available gems. However, if I set the GEM_HOME to

    /users/me/Sencha/Cmd/bin/...

    it worked just fine.

    I'm wondering if the Cygwin Ruby doesn't entirely like the windows path strings. It's also possible that I have some other configuration issue which is causing the problem.

    The upshot for me, at least, was that I could only get Sencha Cmd to work on Windows if I run the mingw32 version and not the cygwin version.

    Jim

  5. #5
    Sencha Premium Member
    Join Date
    Mar 2013
    Location
    NJ
    Posts
    35
    Vote Rating
    0
    neilw is on a distinguished road

      0  

    Default


    Thanks for your persistence in figuring this out, you just saved me a load of time. I've installed ruby 1.9.3 using rubyinstaller, and now cmd is working properly for me.

    However, I cannot get it to work from within a Cygwin shell. Rather, I have to open a DOS command window to run it. That works but is pretty painful. Looks like a problem with DOS-style paths. I get this error when I try to run GEM:
    C:\Ruby193\bin\ruby.exe: No such file or directory -- /cygdrive/c/Ruby193/bin/gem (LoadError)
    Any thoughts?

  6. #6
    Sencha Premium Member
    Join Date
    Apr 2009
    Posts
    178
    Vote Rating
    7
    jhoweaa is on a distinguished road

      0  

    Default


    Quote Originally Posted by neilw View Post
    However, I cannot get it to work from within a Cygwin shell. Rather, I have to open a DOS command window to run it. That works but is pretty painful. Looks like a problem with DOS-style paths. I get this error when I try to run GEM:
    C:\Ruby193\bin\ruby.exe: No such file or directory -- /cygdrive/c/Ruby193/bin/gem (LoadError)
    Any thoughts?
    That's the same error I get and I haven't found a solution. Like you, I launch a DOS command window to run sencha cmd. I'd certainly be happier with a better solution, but I can live with this for the time being at least.

  7. #7
    Sencha Premium Member
    Join Date
    Mar 2013
    Location
    NJ
    Posts
    35
    Vote Rating
    0
    neilw is on a distinguished road

      0  

    Default


    OK, will post back here if I figure anything out.

  8. #8
    Sencha Premium Member
    Join Date
    Mar 2013
    Location
    NJ
    Posts
    35
    Vote Rating
    0
    neilw is on a distinguished road

      0  

    Default


    This is weird. I can now run Sencha command from Cygwin shell, but I don't know what I did to make it work. Perhaps it always worked, but I was fooled because *gems* won't run from Cygwin.

    Actually, I've figured out how to run gems from Cygwin. Instead of
    gem
    say
    C:/Ruby193/bin/gem
    Of course, substitute your path for gem. The problem seems to be something like this: mingw Ruby is gagging on the Cygwin-style path given in $0. By providing $0 in DOS format, Ruby is happy.

    But again, sencha command itself seems to be working OK for me, and that clearly includes parts where it is calling Compass (I'm building themes right now). There are many aspects to this mess that I don't really understand, but most of it boils down to trying to use UNIX-style tools on Windows. It's all very fragile.

  9. #9
    Sencha Premium Member
    Join Date
    Aug 2012
    Posts
    1
    Vote Rating
    0
    j-squared is on a distinguished road

      0  

    Default Workaround Found

    Workaround Found


    My coworker and I encountered this same problem while running Sencha Cmd v3.1.2.342 under Cygwin, using Cygwin's Ruby v1.9.3p392.

    Since we prefer Cygwin/bash over cmd.exe, I came up with the following workaround, which allows Sencha Cmd to be used from a Cygwin bash prompt, without getting an error due to the compass gem not being found.

    The key turns out to be that while Cmd uses the system-installed (Cygwin) Ruby, it installs and uses its own version of the compass command and gem, regardless of whether or not the compass command and gem exist in the Cygwin environment - many thanks to earlier posters for point this out.

    The workaround involves editing one of Sencha Cmd’s files - its compass command - so unless Sencha chooses to address this issue in a future version of Cmd, you'll need to re-apply the workaround in any new version of Cmd that you upgrade to. It should be safe to use and easy to re-apply, though, as all we do is detect when we're running compass under Cygwin, and translate the GEM_PATH environment variable from DOS style to Cygwin/Unix style.

    To apply the workaround, open your C:\Users\your_name\bin\Sencha\Cmd\3.1.2.342\extensions\sencha-compass\gems\bin\compass file (or local equivalent, if you installed Cmd somewhere other than the default) in a text editor. Below the comment block at the top, add this Ruby code:

    Code:
    if ENV['PATH'].include? "cygdrive"
      if ENV['GEM_PATH'].index(':') == 1
        drive = ENV['GEM_PATH'][0]
        path = ENV['GEM_PATH'][2..-1]
        ENV['GEM_PATH'] = "/cygdrive/" + drive.downcase + path.gsub('\\', '/')
      end
    end
    The first line detects Cygwin by checking the PATH environment variable for any folder containing "cygdrive", and the second line ensures that GEM_PATH is currently in DOS style, like "C:\folder\subfolder". The rest of the code just translates that to Cygwin/Unix style, like "/cygdrive/c/folder/subfolder", and puts it back in the environment.

    There may be a more elegant way of going about this, but Ruby is not my primary language. :)

    Note that Cygwin may still generate warning output about having detected a DOS style path, but it doesn't impede Sencha Cmd's build process. If you want to suppress those warnings, you can set the CYGWIN environment variable to "nodosfilewarning" (no quotes); note that you need to do this in Windows' environment variable settings, not in your .bash_profile.

    Anyway, I hope this helps somebody out there use Sencha Cmd under Cygwin. :)

Thread Participants: 2

Tags for this Thread