Amit Kulkarni
2010-Jan-15 11:06 UTC
[Cruisecontrolrb-users] Problem in configuring a project
Hello all, I am new to use cruisecontrol and want some help about configuring a project. Following are the things which i have done. 1:I have added a project named testproject 2:I had configured the mail address. 3:It starts building when somebody checks in. I had written some Rspec testcases and i want to run them as soon as the build starts This is how my cruise_config.rb looks like which is under .cruise/projects/testproject Project.configure do |project| project.email_notifier.emails = ["abc at gmail.com <amit at joshsoftware.com>"] project.email_notifier.from = ["testing at gmail.com<testing at joshsoftware.com> "] case project.name when ''testproject'' then testproject.rake_task = ''spec:controllers'' else raise "Don''t know what to build for project #{project.name.inspect}" end end When i run the build i am getting error as : BUILD LOG --------- Could not load project configuration: uninitialized constant testproject in ./lib/cruise_control/../../ script/../config/../vendor/rails/actionpack/lib/../../activesupport/lib/active_support/dependencies.rb:267:in `load_missing_constant'' PROJECT SETTINGS ---------------- # Project-specific configuration for CruiseControl.rb Project.configure do |project| project.email_notifier.emails = ["amit at joshsoftware.com"] project.email_notifier.from = ["testing at joshsoftware.com"] case project.name when ''testproject.Quick'' then testproject.rake_task = ''spec:controllers'' else raise "Don''t know what to build for project #{project.name.inspect}" end end -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/cruisecontrolrb-users/attachments/20100115/4152b9d5/attachment.html>
Chad Woolley
2010-Jan-15 11:27 UTC
[Cruisecontrolrb-users] Problem in configuring a project
On Fri, Jan 15, 2010 at 4:06 AM, Amit Kulkarni <amitkkulkarni.84 at gmail.com> wrote:> Project.configure do |project| > ? project.email_notifier.emails = ["abc at gmail.com"] > ? project.email_notifier.from = ["testing at gmail.com"] > ? case project.name > ??? when ''testproject'' then testproject.rake_task = ''spec:controllers'' > ???? else raise "Don''t know what to build for project > #{project.name.inspect}" > ??? end > end > > Could not load project configuration: uninitialized constant testproject inThe error is Ruby telling you have not defined ''testproject''. However, you shouldn''t be doing this in cruise config anyway. Remove the case statement from cruise config, and it should just work. This is because cruise will run your default rake task by default, which in Rails should run your tests. If you want to do something other than the default rake task, create a ''cruise'' rake task and cruise will run that automatically. -- Chad
Amit Kulkarni
2010-Jan-15 12:13 UTC
[Cruisecontrolrb-users] Problem in configuring a project
Thanks a lot.It worked. But i got some error in migrations which i will figure it out. Also i have some queries which are as follows: 1: How do i point it to my Rspec test cases? 2: By default it takes production environment?Can we change this to test environment?Or should we run the cruise control always in production environment? Since Rspec uses test environment how can we do this in cruisecontrol? 3: If the build is failed we get mail.Can we get mail if the build is passed along with all the tests? Thanks & Regards, Amit K Kulkarni On Fri, Jan 15, 2010 at 4:57 PM, Chad Woolley <thewoolleyman at gmail.com>wrote:> On Fri, Jan 15, 2010 at 4:06 AM, Amit Kulkarni > <amitkkulkarni.84 at gmail.com> wrote: > > Project.configure do |project| > > project.email_notifier.emails = ["abc at gmail.com"] > > project.email_notifier.from = ["testing at gmail.com"] > > case project.name > > when ''testproject'' then testproject.rake_task = ''spec:controllers'' > > else raise "Don''t know what to build for project > > #{project.name.inspect}" > > end > > end > > > > Could not load project configuration: uninitialized constant testproject > in > > The error is Ruby telling you have not defined ''testproject''. > > However, you shouldn''t be doing this in cruise config anyway. Remove > the case statement from cruise config, and it should just work. This > is because cruise will run your default rake task by default, which in > Rails should run your tests. If you want to do something other than > the default rake task, create a ''cruise'' rake task and cruise will run > that automatically. > > -- Chad > _______________________________________________ > Cruisecontrolrb-users mailing list > Cruisecontrolrb-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/cruisecontrolrb-users/attachments/20100115/5054ccfd/attachment-0001.html>
Chad Woolley
2010-Jan-15 16:15 UTC
[Cruisecontrolrb-users] Problem in configuring a project
On Fri, Jan 15, 2010 at 5:13 AM, Amit Kulkarni <amitkkulkarni.84 at gmail.com> wrote:> Thanks a lot.It worked. > But i got some error in migrations which i will figure it out. > Also i have some queries which are as follows: > 1: How do i point it to my Rspec test cases?Your project''s default rake task should run your rspec tests, if that is what you want. If that isn''t happening, fix it in your project - it has nothing to do with ccrb.> 2: By default it takes production environment?Can we change this to test > environment?Or should we run the cruise control always in production > environment? > Since Rspec uses test environment how can we do this in cruisecontrol?Cruise itself runs in production environment. Your project''s default rake task should run your rspec tests in the test environment.> 3: If the build is failed we get mail.Can we get mail if the build is passed > along with all the tests?You will get a mail on the first successful build after a failed build. There''s really no point to getting one for every successful build, that''s just noise.
Amit Kulkarni
2010-Jan-18 10:44 UTC
[Cruisecontrolrb-users] Problem in configuring a project
Hi Chad, Everything is working fine except the Rspec thing. What i have done is as follows: Under cruisecontrol.rb/tasks/cc_build.rake i had added the following code desc "Task to do some preparations for CruiseControl" task :prepare do RAILS_ENV = ''test'' end desc "Task for CruiseControl.rb, automatically picked up" task :cruise => [:prepare, "spec"] do puts "THis is a cruise" end which suggest that it should take the test environment and should execute spec test.Here it is working fine but i am not able to get whether it is executing or not.So i added a logger file i.e. puts "THis is a cruise" to check whether it is entering this task or not. But it is not. I am not getting whats going wrong. Also i tried another stunt: i wrote only CruiseControl::invoke_rake_task ''spec:all'' Now when i run the command it says rake aborted. Don''t know how to build task ''spec:all'' Please help. Also please suggest how i can add only spec controller or spec models while running CI On Fri, Jan 15, 2010 at 9:45 PM, Chad Woolley <thewoolleyman at gmail.com>wrote:> On Fri, Jan 15, 2010 at 5:13 AM, Amit Kulkarni > <amitkkulkarni.84 at gmail.com> wrote: > > Thanks a lot.It worked. > > But i got some error in migrations which i will figure it out. > > Also i have some queries which are as follows: > > 1: How do i point it to my Rspec test cases? > > Your project''s default rake task should run your rspec tests, if that > is what you want. If that isn''t happening, fix it in your project - > it has nothing to do with ccrb. > > > 2: By default it takes production environment?Can we change this to test > > environment?Or should we run the cruise control always in production > > environment? > > Since Rspec uses test environment how can we do this in cruisecontrol? > > Cruise itself runs in production environment. Your project''s default > rake task should run your rspec tests in the test environment. > > > 3: If the build is failed we get mail.Can we get mail if the build is > passed > > along with all the tests? > > You will get a mail on the first successful build after a failed > build. There''s really no point to getting one for every successful > build, that''s just noise. > _______________________________________________ > Cruisecontrolrb-users mailing list > Cruisecontrolrb-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/cruisecontrolrb-users/attachments/20100118/87140574/attachment.html>
Chad Woolley
2010-Jan-18 18:16 UTC
[Cruisecontrolrb-users] Problem in configuring a project
On Mon, Jan 18, 2010 at 3:44 AM, Amit Kulkarni <amitkkulkarni.84 at gmail.com> wrote:> Also please suggest how i can add only spec controller or spec models while > running CIPlease try my previous suggestion and get your default rake task working independent of CCRB, on the same machine you are using to run CCRB.
Amit Kulkarni
2010-Jan-19 12:24 UTC
[Cruisecontrolrb-users] Problem in configuring a project
Hi, I tried your sugesstion but something is going wrong.I am missing something. In "./cruise/projects/testproject/cruise_config.rb " i have define custom rake task as: project.rake_task = ''spec:conrollers'' Now after building the project again it is saying me that i have some pending migrations remaing but if i checked my database then those fields are already present.Is there any way to comment this line temporary so that i can check whether it is executing controller spec or not. Also second thing which i tried is that under cruisecontrol.rb/tasks/cc_build.rake i have added the line # invoke ''test'' or ''default'' task if Rake.application.lookup(''spec:controllers'') CruiseControl::invoke_rake_task ''spec:controllers'' elsif Rake.application.lookup(''default'') CruiseControl::invoke_rake_task ''default'' else raise "''cruise'', test'' or ''default'' tasks not found. CruiseControl doesn''t know what to build." end I commented the project.rake_task = ''spec:conrollers'' under ./cruise/projects/testproject/cruise_config.rb ".When i build then i get an error Mysql::Error: No database selected: SHOW TABLES. Any suggestions.. On Fri, Jan 15, 2010 at 9:45 PM, Chad Woolley <thewoolleyman at gmail.com>wrote:> On Fri, Jan 15, 2010 at 5:13 AM, Amit Kulkarni > <amitkkulkarni.84 at gmail.com> wrote: > > Thanks a lot.It worked. > > But i got some error in migrations which i will figure it out. > > Also i have some queries which are as follows: > > 1: How do i point it to my Rspec test cases? > > Your project''s default rake task should run your rspec tests, if that > is what you want. If that isn''t happening, fix it in your project - > it has nothing to do with ccrb. > > > 2: By default it takes production environment?Can we change this to test > > environment?Or should we run the cruise control always in production > > environment? > > Since Rspec uses test environment how can we do this in cruisecontrol? > > Cruise itself runs in production environment. Your project''s default > rake task should run your rspec tests in the test environment. > > > 3: If the build is failed we get mail.Can we get mail if the build is > passed > > along with all the tests? > > You will get a mail on the first successful build after a failed > build. There''s really no point to getting one for every successful > build, that''s just noise. > _______________________________________________ > Cruisecontrolrb-users mailing list > Cruisecontrolrb-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/cruisecontrolrb-users/attachments/20100119/0ccd3565/attachment.html>
Amit Kulkarni
2010-Jan-19 13:10 UTC
[Cruisecontrolrb-users] Problem in configuring a project
Hi Chad, Finally got my rspec test cases run. Thanks a lot for your guidance. What i did is i followed the first point.i run the pending migrations and just build the project. It succeeded. On Tue, Jan 19, 2010 at 5:54 PM, Amit Kulkarni <amitkkulkarni.84 at gmail.com>wrote:> Hi, > I tried your sugesstion but something is going wrong.I am missing > something. > In "./cruise/projects/testproject/cruise_config.rb " i have define custom > rake task as: > project.rake_task = ''spec:conrollers'' > > Now after building the project again it is saying me that i have some > pending migrations remaing but if i checked my database then those fields > are already present.Is there any way to comment this line temporary so that > i can check whether it is executing controller spec or not. > > Also second thing which i tried is that under > cruisecontrol.rb/tasks/cc_build.rake i have added the line > # invoke ''test'' or ''default'' task > if Rake.application.lookup(''spec:controllers'') > CruiseControl::invoke_rake_task ''spec:controllers'' > elsif Rake.application.lookup(''default'') > CruiseControl::invoke_rake_task ''default'' > else > raise "''cruise'', test'' or ''default'' tasks not found. CruiseControl > doesn''t know what to build." > end > > I commented the project.rake_task = ''spec:conrollers'' under > ./cruise/projects/testproject/cruise_config.rb ".When i build then i get an > error Mysql::Error: No database selected: SHOW TABLES. > Any suggestions.. > > > On Fri, Jan 15, 2010 at 9:45 PM, Chad Woolley <thewoolleyman at gmail.com>wrote: > >> On Fri, Jan 15, 2010 at 5:13 AM, Amit Kulkarni >> <amitkkulkarni.84 at gmail.com> wrote: >> > Thanks a lot.It worked. >> > But i got some error in migrations which i will figure it out. >> > Also i have some queries which are as follows: >> > 1: How do i point it to my Rspec test cases? >> >> Your project''s default rake task should run your rspec tests, if that >> is what you want. If that isn''t happening, fix it in your project - >> it has nothing to do with ccrb. >> >> > 2: By default it takes production environment?Can we change this to test >> > environment?Or should we run the cruise control always in production >> > environment? >> > Since Rspec uses test environment how can we do this in cruisecontrol? >> >> Cruise itself runs in production environment. Your project''s default >> rake task should run your rspec tests in the test environment. >> >> > 3: If the build is failed we get mail.Can we get mail if the build is >> passed >> > along with all the tests? >> >> You will get a mail on the first successful build after a failed >> build. There''s really no point to getting one for every successful >> build, that''s just noise. >> _______________________________________________ >> Cruisecontrolrb-users mailing list >> Cruisecontrolrb-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/cruisecontrolrb-users/attachments/20100119/6d692648/attachment-0001.html>
Chad Woolley
2010-Jan-19 16:30 UTC
[Cruisecontrolrb-users] Problem in configuring a project
On Tue, Jan 19, 2010 at 5:24 AM, Amit Kulkarni <amitkkulkarni.84 at gmail.com> wrote:> Any suggestions..CCRB will run your migrations automatically. I would suggest you start over by generating a fresh rails project and database. Create a single scaffold and spec, and make sure it runs the specs via the default task. Then add the project to cruise. You should not need to edit cruise config at all. Once you get the test project working, compare it to your actual project and see what is different. -- Chad