Hi, I often create integration programs in Ruby that utilize ActiveRecord without the full Rails stack. So I wonder what the best way would be to fully utilize Cucumber and RSpec for BDD in this context. 1. Should I still include rspec-rails so hopefully at least the Model support is available? 2. If so do I need to (or should I) create a similar directory structure to a Rails app? 3. Would it make any sense to use a generator to create the directory structure if not using views and a web server? ----------------------------- Of less importance: Actually I have considered creating/converting these integration applications as full blown Rails applications since they definitely have a model and controller aspect and the Rails framework provides so many built-in features and extensions. But I can?t find a way to run a Rails app without the use of a server which I really don?t need. Eventually it might be desirable that some or all of the integration logic be exposed as web services and if so perhaps a traditional Rails app deployed on a server to provide the web services would trump the overhead of requiring a server. ------------------------------ Thanks, Carl
On Tue, Sep 1, 2009 at 1:51 PM, Carl Graff<carl.graff at cox.net> wrote:> Of less importance: > > Actually I have considered creating/converting these integration > applications as full blown Rails applications since they definitely have a > model and controller aspect and the Rails framework provides so many > built-in features and extensions. But I can?t find a way to run a Rails app > without the use of a server which I really don?t need.What''s your development platform? There''s really nothing special about a server. I run personal rails apps on my laptop, in my case under OS X, using passenger and apache, but I''ve done similar things on a linux development machine before. On OS X, the passenger preference pane makes this dead easy, and passenger runs the rails app on demand, and shuts it down when it''s been idle. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale
On 1 Sep 2009, at 19:44, Rick DeNatale wrote:> On Tue, Sep 1, 2009 at 1:51 PM, Carl Graff<carl.graff at cox.net> wrote: > > >> Of less importance: >> >> Actually I have considered creating/converting these integration >> applications as full blown Rails applications since they definitely >> have a >> model and controller aspect and the Rails framework provides so many >> built-in features and extensions. But I can?t find a way to run a >> Rails app >> without the use of a server which I really don?t need. > > What''s your development platform? There''s really nothing special > about a server. I run personal rails apps on my laptop, in my case > under OS X, using passenger and apache, but I''ve done similar things > on a linux development machine before. > > On OS X, the passenger preference pane makes this dead easy, and > passenger runs the rails app on demand, and shuts it down when it''s > been idle.I think the OP means he doesn''t know how to run his code in the rails app without firing up a web server. Carl, You need to take a look at script/runner which will show you how to do it. I personally would build my own app from a blank slate as I''d prefer it to be less cluttered, but if you''re used to running in the rails environment, then go for it.> > -- > Rick DeNatale > > Blog: http://talklikeaduck.denhaven2.com/ > Twitter: http://twitter.com/RickDeNatale > WWR: http://www.workingwithrails.com/person/9021-rick-denatale > LinkedIn: http://www.linkedin.com/in/rickdenatale > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
Matt Wynne wrote:> > On 1 Sep 2009, at 19:44, Rick DeNatale wrote: > >> On Tue, Sep 1, 2009 at 1:51 PM, Carl Graff<carl.graff at cox.net> wrote: >> >> >>> Of less importance: >>> >>> Actually I have considered creating/converting these integration >>> applications as full blown Rails applications since they definitely >>> have a >>> model and controller aspect and the Rails framework provides so many >>> built-in features and extensions. But I can?t find a way to run a >>> Rails app >>> without the use of a server which I really don?t need. >> >> What''s your development platform? There''s really nothing special >> about a server. I run personal rails apps on my laptop, in my case >> under OS X, using passenger and apache, but I''ve done similar things >> on a linux development machine before. >> >> On OS X, the passenger preference pane makes this dead easy, and >> passenger runs the rails app on demand, and shuts it down when it''s >> been idle. > > I think the OP means he doesn''t know how to run his code in the rails > app without firing up a web server. > > Carl, You need to take a look at script/runner which will show you how > to do it. I personally would build my own app from a blank slate as > I''d prefer it to be less cluttered, but if you''re used to running in > the rails environment, then go for it. > >> >> -- >> Rick DeNatale >> >> Blog: http://talklikeaduck.denhaven2.com/ >> Twitter: http://twitter.com/RickDeNatale >> WWR: http://www.workingwithrails.com/person/9021-rick-denatale >> LinkedIn: http://www.linkedin.com/in/rickdenatale >> _______________________________________________ >> 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 >My company only uses Windows so deployment is probably Apache/Mongrel or Glassfish with JRuby. Creating my own app by just including ActiveRecord is what I have done in the past, but while reading the RSpec book I noticed all the nice support using rpec-rails and wondered if I could use that and if so the rpec-rails functionality "seems" somewhat dependent on Rails convention and directory structure. I think I will abandon the idea of running a rails app outside of a app server - while it probably can be done I would be out on an island. I''m still debating whether to make this a Rails app with a server for reasons stated above or just a ruby app with activerecord and hopefully the use of some of the features offered by rpec-rails. I guess this all seems rather confusing but such is the world of integration.
> I often create integration programs in Ruby that utilize ActiveRecord without the full Rails stack. So I wonder what the best way would be to fully utilize Cucumber and RSpec for BDD in this context. > > 1. Should I still include rspec-rails so hopefully at least the Model support is available?I''d say no. All you get is "Model.should have(3).records" and "model.should have(3).errors_on(:attribute)" which is easy enough to live without or to copy and paste into your world.> 2. If so do I need to (or should I) create a similar directory structure to a Rails app?No need. I have my models in a "domain" subdirectory and it works just fine. You need to make sure they''re ''require''d since Rails autoload magic is gone but that''s not a big deal.> 3. Would it make any sense to use a generator to create the directory structure if not using views and a web server?Good Lord, no :-)> Actually I have considered creating/converting these integration applications as full blown Rails applications since they definitely have a model and controller aspect and the Rails framework provides so many built-in features and extensions. But I can?t find a way to run a Rails app without the use of a server which I really don?t need. >script/runner -e production ''puts User.count''> Eventually it might be desirable that some or all of the integration logic be exposed as web services and if so perhaps a traditional Rails app deployed on a server to provide the web services would trump the overhead of requiring a server.Check out Sinatra. You can use ActiveRecord inside a minimalist web server+router without all the Rails baggage. - A
Alex Chaffee wrote:>> I often create integration programs in Ruby that utilize ActiveRecord without the full Rails stack. So I wonder what the best way would be to fully utilize Cucumber and RSpec for BDD in this context. >> >> 1. Should I still include rspec-rails so hopefully at least the Model support is available? >> > > I''d say no. All you get is "Model.should have(3).records" and > "model.should have(3).errors_on(:attribute)" which is easy enough to > live without or to copy and paste into your world. > > >> 2. If so do I need to (or should I) create a similar directory structure to a Rails app? >> > > No need. I have my models in a "domain" subdirectory and it works just > fine. You need to make sure they''re ''require''d since Rails autoload > magic is gone but that''s not a big deal. > > >> 3. Would it make any sense to use a generator to create the directory structure if not using views and a web server? >> > > Good Lord, no :-) > > >> Actually I have considered creating/converting these integration applications as full blown Rails applications since they definitely have a model and controller aspect and the Rails framework provides so many built-in features and extensions. But I can?t find a way to run a Rails app without the use of a server which I really don?t need. >> >> > > script/runner -e production ''puts User.count'' > > >> Eventually it might be desirable that some or all of the integration logic be exposed as web services and if so perhaps a traditional Rails app deployed on a server to provide the web services would trump the overhead of requiring a server. >> > > Check out Sinatra. You can use ActiveRecord inside a minimalist web > server+router without all the Rails baggage. > > - A > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > >Wow you seem to have already been down this path and this is excellent advice - thanks!!!