pharrington / Solitairey

full-featured JavaScript solitaire
44 stars 26 forks source link

Won't work #1

Open iKJames opened 12 years ago

iKJames commented 12 years ago

I noticed right off the bat it does work unmodified, but as soon as you modify the code of index.html OR index-dev.html it ends up screwing up and no longer works. I did some digging and noticed a erb file which I tried getting to work via the means of Ruby (on Rails). So, it didn't work. Any ideas? I badly want to play around with this and experiment. This is the only game out there that fits what I need. Below is my list of output via 'rake' and then 'rake --trace'

Note: Why does modifying it via index.html mess it up and yet you have to go through index.erb/rakefile which isn't even working right...

rake; rm -f js/all.js js/all-min.js js/combined-min.js index.html index-dev.html rake aborted! Don't know how to build task 'js/yui-all-min.js'

(See full trace by running task with --trace)

rake --trace; * Invoke default (first_time) * Invoke clean (first_time) * Execute clean rm -f js/all.js js/all-min.js js/combined-min.js index.html index-dev.html * Invoke index-dev.html (first_time) * Invoke index.erb (first_time, not_needed) * Execute index-dev.html * Invoke index.html (first_time) * Invoke index.erb (not_needed) \ Invoke js/combined-min.js (first_time) rake aborted! Don't know how to build task 'js/yui-all-min.js' /usr/lib/ruby/1.8/rake.rb:1704:in []' /usr/lib/ruby/1.8/rake.rb:586:ininvoke_prerequisites' /usr/lib/ruby/1.8/rake.rb:585:in each' /usr/lib/ruby/1.8/rake.rb:585:ininvoke_prerequisites' /usr/lib/ruby/1.8/rake.rb:577:in invoke_with_call_chain' /usr/lib/ruby/1.8/monitor.rb:242:insynchronize' /usr/lib/ruby/1.8/rake.rb:571:in invoke_with_call_chain' /usr/lib/ruby/1.8/rake.rb:588:ininvoke_prerequisites' /usr/lib/ruby/1.8/rake.rb:585:in each' /usr/lib/ruby/1.8/rake.rb:585:ininvoke_prerequisites' /usr/lib/ruby/1.8/rake.rb:577:in invoke_with_call_chain' /usr/lib/ruby/1.8/monitor.rb:242:insynchronize' /usr/lib/ruby/1.8/rake.rb:571:in invoke_with_call_chain' /usr/lib/ruby/1.8/rake.rb:588:ininvoke_prerequisites' /usr/lib/ruby/1.8/rake.rb:585:in each' /usr/lib/ruby/1.8/rake.rb:585:ininvoke_prerequisites' /usr/lib/ruby/1.8/rake.rb:577:in invoke_with_call_chain' /usr/lib/ruby/1.8/monitor.rb:242:insynchronize' /usr/lib/ruby/1.8/rake.rb:571:in invoke_with_call_chain' /usr/lib/ruby/1.8/rake.rb:564:ininvoke' /usr/lib/ruby/1.8/rake.rb:2027:in invoke_task' /usr/lib/ruby/1.8/rake.rb:2005:intop_level' /usr/lib/ruby/1.8/rake.rb:2005:in each' /usr/lib/ruby/1.8/rake.rb:2005:intop_level' /usr/lib/ruby/1.8/rake.rb:2044:in standard_exception_handling' /usr/lib/ruby/1.8/rake.rb:1999:intop_level' /usr/lib/ruby/1.8/rake.rb:1977:in run' /usr/lib/ruby/1.8/rake.rb:2044:instandard_exception_handling' /usr/lib/ruby/1.8/rake.rb:1974:in `run' /usr/bin/rake:28

pharrington commented 12 years ago

YUI Compressor[1] is needed to build yui-all-min.js. Since I've been treating this as a personal-ish project I had this sitting in some random external directory on my drive, but I just added it to the local source tree and updated the rakefile accordingly.

index.html and index-dev.html are files generated by the rakefile, using index.erb as the template. index.html is the file that www.solitiarey.com loads, while index-dev.html is what I use on personal development/use. The distinction is because there are some things in index.html (HTML5 offline cache, Google analytics, cached and minified javascript via yui-all-min.js) that are inappropriate for development.

That being the case, when developing, edit the index.erb file as you see fit, and run "rake index-dev.html" to generate the new development file. This avoids actually calling YUI Compressor (since index-dev.html doesn't use the compressed JS). Also, when you go to edit existing JS, there's no need to invoke the makefile at all as index-dev.html just loads the existing plain source files.

In short, for development, edit index.erb, then run "rake index-dev.html". To build what you see on www.solitairey.com, run rake.

Does this help at all? Also please ask about anything else that doesn't make sense. There's no documentation at all (yet, I'll get on changing that) and I've been the only person working on this code, so there are bound to be things that are unclear or just outright bad code design. Thanks for you feedback!

[1]http://developer.yahoo.com/yui/compressor/

iKJames commented 12 years ago

It seems to work now thanks to what you've said, but is it possible to not need to use the rakefile in order to edit index-dev.html? Everything works until I do major edits that way (without the rakefile/index.erb process), and I don't get why that'd even happen when I notice index.erb is pretty close to being just plain ol' HTML except the if-related statements.

pharrington commented 12 years ago

Well you're right; you shouldn't -need- the rakefile to edit index-dev.html; normal edits to the file will work and appear fine, they'll just get overwritten everytime you run rake. May I ask exactly how you tried editing index-dev.html and the resulting problem?

iKJames commented 12 years ago

I'm either adding or removing some stuff in index-dev.html itself, but to work around for it at this time I'm using the rake file method. Otherwise... the resulting problem ends up being where Solitaire itself fails to work, like dragging cards around will place them anywhere and double clicking resets the entire game back to the start like as if you did nothing.