relevance / blue-ridge

Framework for JavaScript Testing (currently a Rails Plugin)
http://groups.google.com/group/blueridgejs
MIT License
480 stars 40 forks source link

Rails 3 #40

Open kristianmandrup opened 14 years ago

kristianmandrup commented 14 years ago

Update install instructions for Rails 3

jstreb commented 14 years ago

Were you able to get it working with Rails 3? When I run:

rails generate blue_ridge

I get the message of 'Could not find generator blue_ridge.' Has anyone been able to get it to work with Rails 3?

kristianmandrup commented 14 years ago

Nope. Maybe a Rails 3 fork out there? Or someone could make such a fork. I think it mostly requires a rework of the generators. I might look into it myself. I have some experience porting generators to Rails 3. Cheers!

kristianmandrup commented 14 years ago

The latest commit on the 'rails3' branch

"WIP: Rail3 support: moved Rake task & minor changes to remove Rails 3 deprecation warnings; generators seem to be broken"

I'll take a look at the Rails 3 generators ASAP ;)

jstreb commented 14 years ago

Wow, very much appreciated! Just getting started with Rails and really appreciate the help, loved how easy it was to integrate once I rolled back my rails version.

kristianmandrup commented 14 years ago

Ported the generators to Rails 3 in no time: http://github.com/kristianmandrup/blue-ridge

http://gist.github.com/427619

Now I will test it out ;)

kristianmandrup commented 14 years ago

Took a bit of rework looking at cucumber-rails generators for inspiration. Now there should be working generators for Rails 2 and 3 :)

http://github.com/kristianmandrup/blue-ridge

jstreb commented 14 years ago

Really appreciate the help thus far, but I am still unable to find my generator when I run:

rails generate blue_ridge

(note that I am installing from the rails 3 branch) Any help is greatly appreciated.

Thanks, Jesse

kristianmandrup commented 14 years ago

Check out the README. The generators are now called blue_ridge:skeleton and blue_ridge:javascript_spec I think. Try

$ rails g

To get a list of the available generators ;)

jstreb commented 14 years ago

Hi --

Thanks again for the help, its really appreciated. I've tried multiple things but am still running into problems, I will caveat that I'm a GitHub n00b so may be missing something... but --

It does not look like the rails3 branch that is checked into GitHub is working. I tried running rails g and don't see any mention of blue_ridge. If I modify the source a bit to put the blue_ridge_generator.rb file under lib/generators I can start to see something starting to work.

Also, looking at the commit history it looks like there has not been anything commited since April 9th.

Am I look at the wrong repo or branch? Cloning from: http://github.com/relevance/blue-ridge.git with branch rails3. I.e., I ranthis:

git clone http://github.com/relevance/blue-ridge.git -b rails3

kristianmandrup commented 14 years ago

Check this screencast http://pragprog.com/screencasts/v-scgithub/insider-guide-to-github

Then get the Git ebook: http://pragprog.com/titles/tsgit/pragmatic-version-control-using-git

And follow it all the way through step-by-step. What I am doing just now in fact ;)

But more to the point: $ git clone git@github.com:kristianmandrup/blue-ridge.git $ git branch $ git checkout rails3

Now you can either 1) copy the /lib and /templates directories of blue_ridge into a new rails app, and then run $ rails g in the rails app to see that the blueridge generators are there

2) or install blueridge into your app from my github directly $ rails plugin install git://github.com/kristianmandrup/blue-ridge.git Now the rails3 branch is also in my master

You were right, I had forgotten to make a forced push to my remote repo. Oops! The rails3 patch is there now! Hope it works for you.

kmandrup commented 14 years ago

Oops, that was MY git clone url, you should use: $ git clone git://github.com:kristianmandrup/blue-ridge.git blue-ridge-rails3

jstreb commented 14 years ago

Again, thanks for the quick response. Well the good news is that I am getting closer, but still hitting some issues. Here is the issue I am currently hitting and what I have been trying to do to overcome it.

I can install generate the skeleton without issue, with the following command:

jstreb-mac:server jstreb$ rails plugin install git://github.com/kristianmandrup/blue-ridge.git streb-mac:server jstreb$ rails generate blue_ridge:skeleton create spec/javascripts identical application_spec.js identical spec_helper.js create spec/javascripts/fixtures identical application.html identical screw.css

However, when I then try to run the sample test file I get the following error:

jstreb-mac:server jstreb$ rake test:javascripts TEST=application (in /Users/jstreb/katama/source/server) rake aborted! no such file to load -- /Users/jstreb/katama/source/server/vendor/plugins/blue-ridge/lib/lib/blue_ridge /Users/jstreb/katama/source/server/Rakefile:16:in `<top (required)>' (See full trace by running task with --trace)

To get past this I edited the first line in javascript_testing_tasks.rake file from:

require File.expand_path(File.dirname(FILE) + '/../lib/blue_ridge')

to:

require File.expand_path(File.dirname(FILE) + '/../blue_ridge')

After this I started getting the error message of:

"/Users/jstreb/katama/source/server/vendor/plugins/blue-ridge/lib/test_runner.js", line 101: Couldn't read source file "application_spec.js: application_spec.js (No such file or directory)".

I started changing the source to get by this but am thinking that perhaps I am missing something since I am simply trying to run the sample test.

Again, I really appreciate your quick response and help!

kristianmandrup commented 14 years ago

Do you have any application_spec.js file in your project? Where is it referenced and by what location? check test_runner.js line 101. I just fixed the generators to work with rails 3. There are others who have more knowledge about the inner workings of blueridge. Please ask them about this. Fx raise an issue or send a message describing your problem to the "main man" behind blueridge. I am sure you can find a solution ;)

jstreb commented 14 years ago

I ended up getting to work by changing the path in javascript_testing_tasks.rake file, and then some of the required files created in the xxxxx_spec.js files. It looked like it was spitting out an array of values as a single file name rather then making them multiple files. Anyway, I am able to run this correctly now, thanks for your help.

kristianmandrup commented 14 years ago

Sounds good :) If I need to fix the generators somehow so the generated files end up with the correct paths, please tell me. I just reused the paths used by the "old" Rails 2 generators.