cloudhead/toto

Toto on windows 7, works locally, app crashes on Heroku

Opened this issue · 5 comments

I've got Toto up and running on Windows 7. I can go to http://localhost:3000 and see it working.

But no matter what I try it doesn't work once I push to Heroku. I thought maybe adding the URL to config.ru was the fix, but no luck.

Am I just missing something?

Here's what heroku logs spits out:


$ heroku logs
/usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': /home/slugs/365543_a47478a_e5b6-e19bddc5-30
-4a92-ace2-570e7eeccc8a/mnt/.gems/gems/toto-0.4.8/lib/toto.rb:338: syntax error, unexpected tIDENTIFIER, expecting tAMPER (SyntaxError)
      response = @site.go(route, *(mime ? mime : []), env)
                                                         ^
        from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from config.ru:2
        from /home/heroku_rack/heroku.ru:23
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in `instance_eval'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in `initialize'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:46:in `new'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:46:in `map'
        from /home/heroku_rack/heroku.ru:18
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in `instance_eval'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in `initialize'
        from /home/heroku_rack/heroku.ru:11:in `new'
        from /home/heroku_rack/heroku.ru:11
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in `instance_eval'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in `initialize'
        from /home/heroku_rack/heroku.ru:1:in `new'
        from /home/heroku_rack/heroku.ru:1

==> dyno-3392350.log (crash) <==
/usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': /home/slugs/365543_a47478a_e5b6-e19bddc5-30
-4a92-ace2-570e7eeccc8a/mnt/.gems/gems/toto-0.4.8/lib/toto.rb:338: syntax error, unexpected tIDENTIFIER, expecting tAMPER (SyntaxError)
      response = @site.go(route, *(mime ? mime : []), env)
                                                         ^
        from /usr/ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from config.ru:2
        from /home/heroku_rack/heroku.ru:23
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in `instance_eval'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in `initialize'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:46:in `new'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:46:in `map'
        from /home/heroku_rack/heroku.ru:18
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in `instance_eval'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in `initialize'
        from /home/heroku_rack/heroku.ru:11:in `new'
        from /home/heroku_rack/heroku.ru:11
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in `instance_eval'
        from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/builder.rb:29:in `initialize'
        from /home/heroku_rack/heroku.ru:1:in `new'
        from /home/heroku_rack/heroku.ru:1

-----> An error happened during the initialization of your app.

       This may be due to a typo, wrong number of arguments, or calling a
       function that doesn't exist.

       Make sure the app is working locally in production mode, by running it
       with RAILS_ENV (for Rails apps) or RACK_ENV (for Sinatra or other rack
       apps) set to production. e.g. RAILS_ENV=production script/server.

       Examine the backtrace above this message to debug.

Try using toto 0.4.9, which I just pushed.

Thanks mate, but I don't see 0.4.9 anywhere? Its not under downloads and the source says version 0.4.8 which is the most recent update I can see from 2 days ago? Could you point me to it please?

Indeed, I forgot to push it to github. I was refering to rubygems.org. You can install it via rubygems with sudo gem install toto — it's on github too now though, so do as you please : )

I am running toto 0.4.9 locally. I can clone Dorthy and push directly to heroku and all is fine, but if I manually create a txt file in the directory or use the command "rake new" to create a new post heroku barfs the next time I publish.

Digging into it a bit, I discovered that the sample post that comes with Dorthy has unix style line endings and the generated windows file has windows line endings. I modified the local git config to have autocrlf set to true using the following statement:

git config core.autocrlf true

The problem goes away after that.

Not sure what you can do about this issue really, but now you at least know the cause.

ixti commented

NotMyself, I believe that you issue is not related to the original one, so it would be better to report it as a new. But anyway, IMHO, it's not an issue - just use "\n" line endings with your editor (but your way is even better and if my mind is not cheating - autocrlf become true by defualt not far ago). Alternatively you can monkeypatch Toto to use \r\n instead of \n, as I really believe that most of the people (at least those who are "focus group" of toto :)) are OK using UNIX-style line ending :))