SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Dec 2006
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Ruby Noob Needs Help

    I'm a noob to Ruby on Rails.

    I'm getting this error when I'm running a rake command. The below is the output from the terminal using a "rake --trace"

    Terminal Output:
    rake --trace
    (in /Users/homeaccount/work/MyProject)
    ** Invoke default (first_time)
    ** Invoke test (first_time)
    ** Execute test
    ** Invoke test:units (first_time)
    ** Invoke db:testrepare (first_time)
    ** Invoke environment (first_time)
    ** Execute environment
    ** Invoke test:functionals (first_time)
    ** Invoke db:testrepare
    ** Execute test:functionals
    /usr/local/bin/ruby -Ilib:test "/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb" "test/functional/friends_controller_test.rb"
    /usr/local/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 17, col 2: ` host: localhost' (ArgumentError)
    from /usr/local/lib/ruby/1.8/yaml.rb:133:in `load'
    from /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/initializer.rb:459:in `database_configuration'
    from /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/initializer.rb:181:in `initialize_database'
    from /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/initializer.rb:84:in `process'
    from /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/initializer.rb:42:in `run'
    from /Users/bingebook/work/MyProject/config/environment.rb:13
    from ./test/functional/../test_helper.rb:2
    from ./test/functional/friends_controller_test.rb:1
    from /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb:5
    from /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb:5
    ** Invoke test:integration (first_time)
    ** Invoke db:testrepare
    ** Execute test:integration
    /usr/local/bin/ruby -Ilib:test "/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb"
    rake aborted!
    Test failures
    /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/tasks/testing.rake:35
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in `execute'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in `invoke'
    /usr/local/lib/ruby/1.8/thread.rb:135:in `synchronize'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:364:in `invoke_prerequisites'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:999:in `each'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:363:in `invoke_prerequisites'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:356:in `invoke'
    /usr/local/lib/ruby/1.8/thread.rb:135:in `synchronize'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run'
    /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7
    /usr/local/bin/rake:18

    I have no idea why this is happening. I heard there might be some kind of but that is preventing the load to complete.

    Any feeback would be great!

  2. #2
    SitePoint Member
    Join Date
    Dec 2006
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is the line where the error is generated:

    /usr/local/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 17, col 2: ` host: localhost' (ArgumentError)

  3. #3
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sounds like there is a problem with your database.yml file - make sure you've only used spaces and not tabs.

  4. #4
    SitePoint Member
    Join Date
    Dec 2006
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks I seem to have moved a step forward. I didn't notice and tabs but I removed some spaces in my database.yml file.

    database.yml contents:
    # MySQL (default setup). Versions 4.1 and 5.0 are recommended.
    #
    # Install the MySQL driver:
    # gem install mysql
    # On MacOS X:
    # gem install mysql -- --include=/usr/local/lib
    # On Windows:
    # There is no gem for Windows. Install mysql.so from RubyForApache.
    # http://rubyforge.org/projects/rubyforapache
    #
    # And be sure to use new-style password hashing:
    # http://dev.mysql.com/doc/refman/5.0/en/old-client.html
    development:
    adapter:mysql
    database:MyProject_development
    username:root
    password:**********
    host: localhost

    # Warning: The database defined as 'test' will be erased and
    # re-generated from your development database when you run 'rake'.
    # Do not set this db to the same as development or production.
    test:
    adapter:mysql
    database:MyProject_test
    username:root
    password:**********
    host: localhost

    production:
    adapter:mysql
    database:MyProject_production
    username:root
    password:*********
    host:localhost

    Here is the new output from my rake:
    (in /Users/*********/work/MyProject)
    /usr/local/bin/ruby -Ilib:test "/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb" "test/functional/friends_controller_test.rb"
    /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:198:in `establish_connection': database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)
    from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:192:in `establish_connection'
    from /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/connection_specification.rb:185:in `establish_connection'
    from /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/initializer.rb:182:in `initialize_database'
    from /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/initializer.rb:84:in `process'
    from /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/initializer.rb:42:in `run'
    from /Users/********/work/MyProject/config/environment.rb:13
    from ./test/functional/../test_helper.rb:2
    from ./test/functional/friends_controller_test.rb:1
    from /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb:5
    from /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb:5
    /usr/local/bin/ruby -Ilib:test "/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake/rake_test_loader.rb"
    rake aborted!
    Test failures

  5. #5
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, you need the two spaces for nesting of attributes - just make sure you are using spaces and not tabs.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •