Rubymine has an error when trying to create a new rails project.

Here is the output after trying to create a new rails project titled 'blog':

/usr/bin/ruby -e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift) /usr/bin/rails _2.3.5_ /home/aaron/RubymineProjects/blog --skip --database=sqlite3
-e:1:in `load': /usr/bin/rails:4: syntax error, unexpected '=', expecting ']' (SyntaxError)
if [ "x$1" = "x" ]; then
            ^
/usr/bin/rails:4: syntax error, unexpected ']', expecting $end
if [ "x$1" = "x" ]; then
                  ^
from -e:1


Process finished with exit code 1



I haven't done anything with RM yet. I'm really disappointed. This creates a folder under RubymineProjects but thats about it. No code or initial rails stuff. I'm running Ubuntu 9.10 and RM 2.0 that I downloaded today from the site. Is it possible that this is a nightly build and there is a bug? Why on earth is it doing this? If I'm going to purchase this product, I would require that it works out of the box.

Thanks.
14 comments
Comment actions Permalink

Update: If I create a rails project via command line and open the folder through Rubymine, it looks like it works (I see files... haven't added anything to the project yet) but thats really unacceptable. This needs to be working out-of-the-box.

0
Comment actions Permalink

Hi,

What ruby version do you use? We need this information to try reproduce this.
We've tested creating Rails application with rails 2.3.5 and everything was fine.

Regards,
Oleg

0
Comment actions Permalink

Oleg,

Thanks for the reply. I'm using:

ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux]

and rails 2.3.5

Thanks!
0
Comment actions Permalink

Hi,

Thanks for the reply. I'm using:

ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux]

and rails 2.3.5

I've just checked Rails project creation on Ubuntu Karmic 64, ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux], rails (2.3.5) and everything worked fine for me.
Do you have only single version of ruby installed on your machine?
Please have a look at rails script itself and ensure it first line points to your ruby1.8 installation.

Regards,
Oleg

0
Comment actions Permalink

Also please create 'empty project' and invoke Tools | Show Gem Environment action.

0
Comment actions Permalink

i have this trouble too

This is my RubyGems Env.

RubyGems Environment:
RUBYGEMS VERSION: 1.3.6
RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
INSTALLATION DIRECTORY: /var/lib/gems/1.8
RUBY EXECUTABLE: /usr/bin/ruby1.8
EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
RUBYGEMS PLATFORMS:
  ruby
  x86-linux
GEM PATHS:
   /var/lib/gems/1.8
   /home/dmitry/.gem/ruby/1.8
GEM CONFIGURATION:
   :update_sources => true
   :verbose => true
   :benchmark => false
   :backtrace => false
   :bulk_threshold => 1000
REMOTE SOURCES:
   http://rubygems.org/
----------------------
RubyMine SDK Environment:
Sdk: Ruby SDK 1.8.7 (/usr/bin/ruby)
Sdk Version: ver.1.8.7
Ruby Interpreter: /usr/bin/ruby
RVM Sdk: no
Sdk Language Level: 1.8
Sdk Load Path:
     /usr/local/lib/site_ruby/1.8
     /usr/local/lib/site_ruby/1.8/i486-linux
     /usr/local/lib/site_ruby
     /usr/lib/ruby/1.8
     /usr/lib/ruby/1.8/i486-linux
     /home/dmitry/rubymine93.190/rubystubs18
Sdk Gem paths:
     file:///home/dmitry/.gem/ruby/1.8/gems
     file:///var/lib/gems/1.8/gems

0
Comment actions Permalink

Dmitry,

Please also attach content of a /usr/bin/rails script

0
Comment actions Permalink

syntax error, unexpected '=', expecting ']' (SyntaxError

New RubyMne 2.0.02 install  Ubunto 10.04 64 bit

Ruby SDK 1.8.7


Rails 2.3.9 gem installed


Please Help -w e just bought 8 of these licences - works fine for Windows!


Generating Rails Application for module....


usr/bin/ruby -e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift) /usr/bin/rails _2.3.9_ /home/broomie/RubymineProjects/NoteBook --skip --database=sqlite3
-e:1:in `load': /usr/bin/rails:4: syntax error, unexpected '=', expecting ']' (SyntaxError)
if [ "x$1" = "x" ]; then
            ^
/usr/bin/rails:4: syntax error, unexpected ']', expecting $end
if [ "x$1" = "x" ]; then
                  ^
 from -e:1

Process finished with exit code 1



Many thanks


Paul
0
Comment actions Permalink

Paul,

Please attach content of a /usr/bin/rails script. We expected that it is a ruby script (as it always is), but seems in your case it is a bash script.

0
Comment actions Permalink

Thanks for being so prompt:

Right here is my rubymine .sh

However it resides in my home (;home/broomie/rubymine93.202/bin directory not usr/bin  is this the issue - I think I followed the Rubymine advice on installing for Linux!

Paul




#!/bin/sh
RUBYMINE_JDK=/usr
#
# ------------------------------------------------------
#  RubyMine Startup Script for Unix
# ------------------------------------------------------
#

# ---------------------------------------------------------------------
# Before you run RubyMine specify the location of the
# JDK 1.6 installation directory which will be used for running RUBYMINE
# ---------------------------------------------------------------------
if [ -z "$RUBYMINE_JDK" ]; then
  RUBYMINE_JDK=$JDK_HOME
  if [ -z "$RUBYMINE_JDK" ]; then
    echo ERROR: cannot start RubyMine.
    echo No JDK found to run RubyMine. Please validate either RUBYMINE_JDK or JDK_HOME points to valid JDK installation
  fi
fi

#--------------------------------------------------------------------------
#   Ensure the RUBYMINE_HOME var for this script points to the
#   home directory where RubyMine is installed on your system.

SCRIPT_LOCATION=$0
# Step through symlinks to find where the script really is
while [ -L $SCRIPT_LOCATION ]; do
  SCRIPT_LOCATION=`readlink -e $SCRIPT_LOCATION`
done

RUBYMINE_HOME=`dirname $SCRIPT_LOCATION`/..
RUBYMINE_BIN_HOME=`dirname $SCRIPT_LOCATION`

export JAVA_HOME
export RUBYMINE_HOME

if [ -n "$RUBYMINE_PROPERTIES" ]; then
  RUBYMINE_PROPERTIES_PROPERTY=-Didea.properties.file=$RUBYMINE_PROPERTIES
fi

if [ -z "$RUBYMINE_MAIN_CLASS_NAME" ]; then
  RUBYMINE_MAIN_CLASS_NAME="com.intellij.idea.Main"
fi

if [ -z "$RUBYMINE_VM_OPTIONS" ]; then
  RUBYMINE_VM_OPTIONS="$RUBYMINE_HOME/bin/rubymine.vmoptions"
fi

REQUIRED_JVM_ARGS="-Xbootclasspath/a:../lib/boot.jar -Didea.platform.prefix=Ruby -Didea.no.jre.check=true $RUBYMINE_PROPERTIES_PROPERTY $REQUIRED_JVM_ARGS"
JVM_ARGS=`tr '\n' ' ' < "$RUBYMINE_VM_OPTIONS"`
JVM_ARGS="$JVM_ARGS $REQUIRED_JVM_ARGS"

CLASSPATH=../lib/bootstrap.jar
CLASSPATH=$CLASSPATH:../lib/util.jar
CLASSPATH=$CLASSPATH:../lib/jdom.jar
CLASSPATH=$CLASSPATH:../lib/log4j.jar
CLASSPATH=$CLASSPATH:../lib/extensions.jar
CLASSPATH=$CLASSPATH:../lib/trove4j.jar
CLASSPATH=$CLASSPATH:$RUBYMINE_CLASSPATH

export CLASSPATH

LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

cd "$RUBYMINE_BIN_HOME"
exec $RUBYMINE_JDK/bin/java $JVM_ARGS $RUBYMINE_MAIN_CLASS_NAME $*

0
Comment actions Permalink

Paul,

I asked content of /usr/bin/rails not, rubymine.sh. Obviously problem is in rails script

>  /usr/bin/rails:4: syntax error, unexpected '=', expecting ']' (SyntaxError)

0
Comment actions Permalink

Hi  there you go

#!/bin/bash

# On no parameters, we display the manpage
if [ "x$1" = "x" ]; then
 exec man rails
fi

TEMP=`getopt -o dCFD:I: --long no-docs,copy,force-overwrite,database:,internal: -- "$@"`
if [ $? != 0 ]; then
 echo "Terminating..." >&2
 exit 1
fi

eval set -- "$TEMP"
COPY="false"
DOCUMENTATION="true"
OVERWRITE_OPTION=""
DATABASE="sqlite3"
INTERNAL_OPTIONS=""

while true; do
    case "$1" in
        -d|--no-docs)
            DOCUMENTATION="false"
            ;;
        -C|--copy)
            COPY="true"
            ;;
        -F|--force-overwrite)
            OVERWRITE_OPTION="--force"
            ;;
        -D|--database)
            case "$2" in
                mysql|oracle|postgresql|sqlite3|frontbase|ibm_db)
                   DATABASE=$2
                   ;;
                *)
                   echo "Bad database name. Supported values are mysql, oracle, postgresql, sqlite3, frontbase and ibm_db"
                   exit 1
                   ;;
            esac
            shift
            ;;
        -I|--internal)
            INTERNAL_OPTIONS="$2"
            shift
            ;;
        --)
            shift
            break
            ;;
        *)
            echo "Internal error"
            exit 1
            ;;
 esac
 shift
done

CWD="`pwd`"
if [ "x$1" = "x" ]; then
 exec man rails
fi
while [ "x$1" != "x" ]; do
 if [ "${1:0:1}" = "/" ]; then
 RAILS_PKG_DESTINATION="$1"
 else
 RAILS_PKG_DESTINATION="$CWD/$1"
 fi
 
 # Install/upgrade core rails
        /usr/bin/ruby /usr/share/rails/railties/bin/rails ${OVERWRITE_OPTION} "${RAILS_PKG_DESTINATION}" "${INTERNAL_OPTIONS}" -d $DATABASE

 # Create/update the vendor directory
        if [ "x${COPY}" = "xtrue" ]; then
            rm -rf "${RAILS_PKG_DESTINATION}"/vendor/*
            cp -a /usr/share/rails/* "${RAILS_PKG_DESTINATION}/vendor/"

            # We need a rails -> . link in the vendor directory - breaks eclipse
            ln -s . "${RAILS_PKG_DESTINATION}/vendor/rails"
        else
            rm -rf ${RAILS_PKG_DESTINATION}/vendor/*
            ln -s /usr/share/rails/* "${RAILS_PKG_DESTINATION}/vendor/"

            # We need a rails -> . link in the vendor directory
            ln -s /usr/share/rails "${RAILS_PKG_DESTINATION}/vendor/rails"
        fi

 ## We need a rails -> . link in the vendor directory
 # ln -s . "${RAILS_PKG_DESTINATION}/vendor/rails"

 # link to docs, if needed
        if [ "x${DOCUMENTATION}" = "xtrue" ]; then
            rm -rf "${RAILS_PKG_DESTINATION}/doc/api"
            if [ "x${COPY}" = "xtrue" ]; then
                mkdir "${RAILS_PKG_DESTINATION}/doc/api"
                cp -a /usr/share/doc/rails/html/* "${RAILS_PKG_DESTINATION}/doc/api/"
            else
                ln -s /usr/share/doc/rails/html "${RAILS_PKG_DESTINATION}/doc/api"
            fi
        fi

 shift
done
exit 0

0
Comment actions Permalink

Yes, they changed content of "rails" script. It's not a "ruby" script any more. Please file an issue - http://youtrack.jetbrains.net/issues/RUBY

0

Please sign in to leave a comment.