[rspec-users] HTML Story Formatter

Jonathan Leighton j at jonathanleighton.com
Thu Jul 24 12:45:11 EDT 2008


Thanks for both your answers. The copying rake task was pretty useful as
I was basically intending to write the same thing after I read David's
message :)

Jon

On Thu, 2008-07-24 at 09:29 -0700, Christopher Bailey wrote:
> For another variant, with my CC.rb setup, I have a rake task as follows:
> 
>   desc "Copy RSpec Story HTML includes"
>   task :copy_story_html_includes do
>     if ENV['CC_BUILD_ARTIFACTS']
>       stories_output_dir = File.join(ENV['CC_BUILD_ARTIFACTS'], 'Stories')
>       system "mkdir #{stories_output_dir}"
>       system("/bin/cp -r
> #{RAILS_ROOT}/vendor/plugins/rspec/story_server/prototype/stylesheets/
> #{stories_output_dir}")
>       system("/bin/cp -r
> #{RAILS_ROOT}/vendor/plugins/rspec/story_server/prototype/javascripts/
> #{stories_output_dir}")
>     end
>   end
> 
> And then I just have that as a pre-requisite to my regular
> spec:stories rake task (since it'll only do something if we're in the
> CC.rb environment):
> 
>   desc "Run all spec stories"
>   task :stories => [ :copy_story_html_includes ] do
>     if ENV['CC_BUILD_ARTIFACTS']
>       ruby "stories/all.rb --format html >
> #{File.join(ENV['CC_BUILD_ARTIFACTS'], 'Stories', 'index.html')}"
>     else
>       ruby "stories/all.rb --format plain --colour"
>     end
>   end
> 
> 
> On Thu, Jul 24, 2008 at 5:44 AM, David Chelimsky <dchelimsky at gmail.com> wrote:
> > On Thu, Jul 24, 2008 at 7:32 AM, Jonathan Leighton
> > <j at jonathanleighton.com> wrote:
> >> Hiya,
> >>
> >> I am trying to use the HTML Story Formatter in conjunction with
> >> CruiseControl.rb. I have got it outputting the stories to a file, but I
> >> notice there are CSS and JS files linked in the head, which don't appear
> >> to be anywhere in the rspec repository. Are these files available and if
> >> so where?
> >
> > They're in the story_server directory. We haven't automated this yet,
> > so what I do is just copy them to a logical place and set up a rake
> > task to put the stories in the same place. On Rails projects, I've
> > gotten into the habit of putting them in
> > public/doc/[javascripts|stylesheets] (or similar) and then use this
> > rake task.
> >
> > namespace :stories do
> >
> >  desc "Run all the stories (HTML)"
> >  task :html do
> >    sh "ruby stories/all.rb -fh:public/doc/index.html"
> >  end
> >
> > end
> >
> > Now the customers can see the story output at /docs. Of course, so can
> > anybody else, so that might come down before releasing or move to a
> > controller that can manage who gets to see it. But this should give
> > you an idea.
> >
> > Also note that the javascript is 1/2 baked at this point and includes
> > an "add step" (non) feature (which you'll see in the browser) that
> > doesn't really do anything.
> >
> > Maybe it's time to get rid of that for now and standardize on where
> > this stuff goes :)
> >
> > HTH,
> > David
> >
> >
> >>
> >> Cheers,
> >> Jon
> >>
> >> _______________________________________________
> >> rspec-users mailing list
> >> rspec-users at rubyforge.org
> >> http://rubyforge.org/mailman/listinfo/rspec-users
> >>
> > _______________________________________________
> > rspec-users mailing list
> > rspec-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-users
> >
> 
> 
> 
-- 
Jonathan Leighton
http://jonathanleighton.com/



More information about the rspec-users mailing list