From =?UTF-8?Q?=22=E8=91=89=E5=BF=97=E7=AB=8B_YIP_Chi_Lap_ Sat Jan 5 23:52:52 2008 From: =?UTF-8?Q?=22=E8=91=89=E5=BF=97=E7=AB=8B_YIP_Chi_Lap_ (=?UTF-8?Q?=22=E8=91=89=E5=BF=97=E7=AB=8B_YIP_Chi_Lap_) Date: Sun, 6 Jan 2008 12:52:52 +0800 Subject: [ap4r-devel] Patch 16844 retention_history patch for activesupport 2.0.2 compatibility Message-ID: <4104F668-2753-48EB-8101-3FD8640FF18D@gmail.com> Hi, Just submitted a small patch. ??? YIP Chi Lap [Beta] Technology Officer beta at emacsian.com http://web.emacsian.com/ Patch to retention_history.rb so that activesupport 2.0.2 won't throw exception on sleep. *** retention_history-original.rb Sun Jan 6 12:31:22 2008 --- retention_history.rb Sun Jan 6 12:31:39 2008 *************** *** 29,35 **** @collector = Thread.start do loop do begin ! sleep LOOP_INTERVAL collect sweep rescue Exception => ex --- 29,35 ---- @collector = Thread.start do loop do begin ! sleep LOOP_INTERVAL.to_i collect sweep rescue Exception => ex From noreply at rubyforge.org Sat Jan 5 23:42:26 2008 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sat, 5 Jan 2008 23:42:26 -0500 (EST) Subject: [ap4r-devel] [ ap4r-Patches-16844 ] retention_history patch for activesupport 2.0.2 compatibility Message-ID: <20080106044227.076D21858697@rubyforge.org> Patches item #16844, was opened at 2008-01-06 12:42 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=6912&aid=16844&group_id=1765 Category: None Group: None Status: Open Resolution: None Priority: 3 Submitted By: Chi Lap Yip (beta) Assigned to: Nobody (None) Summary: retention_history patch for activesupport 2.0.2 compatibility Initial Comment: Patch to retention_history.rb so that activesupport 2.0.2 won't throw exception on sleep. *** retention_history-original.rb Sun Jan 6 12:31:22 2008 --- retention_history.rb Sun Jan 6 12:31:39 2008 *************** *** 29,35 **** @collector = Thread.start do loop do begin ! sleep LOOP_INTERVAL collect sweep rescue Exception => ex --- 29,35 ---- @collector = Thread.start do loop do begin ! sleep LOOP_INTERVAL.to_i collect sweep rescue Exception => ex ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=6912&aid=16844&group_id=1765 From shino at rubyforge.org Wed Jan 9 01:21:52 2008 From: shino at rubyforge.org (shino at rubyforge.org) Date: Wed, 9 Jan 2008 01:21:52 -0500 (EST) Subject: [ap4r-devel] [361] trunk/ap4r/spec/local: set the QueueManager configuration file in two spec files Message-ID: <20080109062152.B660518585DA@rubyforge.org> Revision: 361 Author: shino Date: 2008-01-09 01:21:52 -0500 (Wed, 09 Jan 2008) Log Message: ----------- set the QueueManager configuration file in two spec files Modified Paths: -------------- trunk/ap4r/spec/local/send_message_handler_spec.rb trunk/ap4r/spec/local/subscribe_message_handler_spec.rb Modified: trunk/ap4r/spec/local/send_message_handler_spec.rb =================================================================== --- trunk/ap4r/spec/local/send_message_handler_spec.rb 2007-12-26 01:36:06 UTC (rev 360) +++ trunk/ap4r/spec/local/send_message_handler_spec.rb 2008-01-09 06:21:52 UTC (rev 361) @@ -5,10 +5,13 @@ describe Ap4r::Mongrel::Ap4rSendMessageHandler, " on accepting a simple message" do - before(:each) do - @manager = ::ReliableMsg::QueueManager.new + def start_queue_manager + @manager = ::ReliableMsg::QueueManager.new(:config => "config/queues_disk.cfg") @manager.start_original + end + before(:each) do + start_queue_manager q = ::ReliableMsg::Queue.new "queue.test" while q.get; end @@ -52,7 +55,7 @@ describe Ap4r::Mongrel::Ap4rSendMessageHandler, " on accepting a message with options" do before(:each) do - @manager = ::ReliableMsg::QueueManager.new + @manager = ::ReliableMsg::QueueManager.new(:config => "config/queues_disk.cfg") @manager.start_original params = { Modified: trunk/ap4r/spec/local/subscribe_message_handler_spec.rb =================================================================== --- trunk/ap4r/spec/local/subscribe_message_handler_spec.rb 2007-12-26 01:36:06 UTC (rev 360) +++ trunk/ap4r/spec/local/subscribe_message_handler_spec.rb 2008-01-09 06:21:52 UTC (rev 361) @@ -5,10 +5,14 @@ describe Ap4r::Mongrel::Ap4rSubscribeMessageHandler, " on subscribing a simple message" do - before(:each) do - @manager = ::ReliableMsg::QueueManager.new + def start_queue_manager + @manager = ::ReliableMsg::QueueManager.new(:config => "config/queues_disk.cfg") @manager.start_original + end + before(:each) do + start_queue_manager + q = ::ReliableMsg::Queue.new "queue.test" while q.get; end q.put "hgoe" From noreply at rubyforge.org Wed Jan 9 08:35:04 2008 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Wed, 9 Jan 2008 08:35:04 -0500 (EST) Subject: [ap4r-devel] [ ap4r-Patches-16844 ] retention_history patch for activesupport 2.0.2 compatibility Message-ID: <20080109133504.33B0218585D4@rubyforge.org> Patches item #16844, was opened at 2008-01-06 13:42 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=6912&aid=16844&group_id=1765 Category: None Group: None >Status: Closed >Resolution: Rejected Priority: 3 Submitted By: Chi Lap Yip (beta) Assigned to: Nobody (None) Summary: retention_history patch for activesupport 2.0.2 compatibility Initial Comment: Patch to retention_history.rb so that activesupport 2.0.2 won't throw exception on sleep. *** retention_history-original.rb Sun Jan 6 12:31:22 2008 --- retention_history.rb Sun Jan 6 12:31:39 2008 *************** *** 29,35 **** @collector = Thread.start do loop do begin ! sleep LOOP_INTERVAL collect sweep rescue Exception => ex --- 29,35 ---- @collector = Thread.start do loop do begin ! sleep LOOP_INTERVAL.to_i collect sweep rescue Exception => ex ---------------------------------------------------------------------- >Comment By: shunichi shinohara (shino) Date: 2008-01-09 22:35 Message: Thank you for the patch and notification to the mailing list. This change was included in revision 365. Please see http://rubyforge.org/pipermail/ap4r-devel/2007-December/000205.html for its diff. Thanks again, shino ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=6912&aid=16844&group_id=1765 From noreply at rubyforge.org Wed Jan 9 08:45:53 2008 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Wed, 9 Jan 2008 08:45:53 -0500 (EST) Subject: [ap4r-devel] [ ap4r-Patches-16844 ] retention_history patch for activesupport 2.0.2 compatibility Message-ID: <20080109134553.9C66A18585D8@rubyforge.org> Patches item #16844, was opened at 2008-01-06 13:42 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=6912&aid=16844&group_id=1765 Category: None Group: None Status: Closed >Resolution: Accepted Priority: 3 Submitted By: Chi Lap Yip (beta) Assigned to: Nobody (None) Summary: retention_history patch for activesupport 2.0.2 compatibility Initial Comment: Patch to retention_history.rb so that activesupport 2.0.2 won't throw exception on sleep. *** retention_history-original.rb Sun Jan 6 12:31:22 2008 --- retention_history.rb Sun Jan 6 12:31:39 2008 *************** *** 29,35 **** @collector = Thread.start do loop do begin ! sleep LOOP_INTERVAL collect sweep rescue Exception => ex --- 29,35 ---- @collector = Thread.start do loop do begin ! sleep LOOP_INTERVAL.to_i collect sweep rescue Exception => ex ---------------------------------------------------------------------- >Comment By: shunichi shinohara (shino) Date: 2008-01-09 22:45 Message: I have set the resolution as "rejected" in error. I am very sorry. This patch is completely correct :-) shino ---------------------------------------------------------------------- Comment By: shunichi shinohara (shino) Date: 2008-01-09 22:35 Message: Thank you for the patch and notification to the mailing list. This change was included in revision 365. Please see http://rubyforge.org/pipermail/ap4r-devel/2007-December/000205.html for its diff. Thanks again, shino ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=6912&aid=16844&group_id=1765 From noreply at rubyforge.org Wed Jan 9 08:58:20 2008 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Wed, 9 Jan 2008 08:58:20 -0500 (EST) Subject: [ap4r-devel] [ ap4r-Patches-14722 ] valid_at parameter which allows to schedue message handling Message-ID: <20080109135820.AC65D18585D5@rubyforge.org> Patches item #14722, was opened at 2007-10-15 17:03 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=6912&aid=14722&group_id=1765 Category: None Group: None Status: Open >Resolution: Postponed >Priority: 4 Submitted By: Pawel Krzesniak (imo) Assigned to: Nobody (None) Summary: valid_at parameter which allows to schedue message handling Initial Comment: I added optional field messages which allows to handle specific action not before given timestamp. Such functionality allows to schedule some actions in the future, which could be nice feature. If valid_at parameter is not given ap4r process message immediately, which is old behaviour. example usage: ap4r.async_to({:action => :test}, {:id => 123}, {:valid_at => Time.now.to_i + 3, :priority => 1}) ---------------------------------------------------------------------- >Comment By: shunichi shinohara (shino) Date: 2008-01-09 22:58 Message: Nice extention! The Selector is one of useful features of reliable-msg, so I want to take advantage of that. I am anxious about the case that: large number of messages in a queue, and those are "not-valid-yet". For example, messages those should be processed at midnight. I parhaps should consider some kind of scheduling. ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=6912&aid=14722&group_id=1765 From shinohara.shunichi at future.co.jp Wed Jan 9 22:24:17 2008 From: shinohara.shunichi at future.co.jp (shinohara.shunichi at future.co.jp) Date: Thu, 10 Jan 2008 12:24:17 +0900 Subject: [ap4r-devel] Patch 16844 retention_history patch for activesupport2.0.2 compatibility In-Reply-To: <4104F668-2753-48EB-8101-3FD8640FF18D@gmail.com> References: <4104F668-2753-48EB-8101-3FD8640FF18D@gmail.com> Message-ID: <14CE73B79D552644B7CBEF0428763DF603E27807@045MAIL.future.co.jp> Hi, Thank your for the patch. I updated the patch tracker page on rubyforge. https://rubyforge.org/tracker/index.php?func=detail&aid=16844&group_id=1765&atid=6912 Regards, shino > -----Original Message----- > Just submitted a small patch. From =?UTF-8?Q?=22=E8=91=89=E5=BF=97=E7=AB=8B_YIP_Chi_Lap_ Thu Jan 10 03:24:16 2008 From: =?UTF-8?Q?=22=E8=91=89=E5=BF=97=E7=AB=8B_YIP_Chi_Lap_ (=?UTF-8?Q?=22=E8=91=89=E5=BF=97=E7=AB=8B_YIP_Chi_Lap_) Date: Thu, 10 Jan 2008 16:24:16 +0800 Subject: [ap4r-devel] Patch 16844 retention_history patch for activesupport2.0.2 compatibility In-Reply-To: <14CE73B79D552644B7CBEF0428763DF603E27807@045MAIL.future.co.jp> References: <4104F668-2753-48EB-8101-3FD8640FF18D@gmail.com> <14CE73B79D552644B7CBEF0428763DF603E27807@045MAIL.future.co.jp> Message-ID: <8A8D9CF8-36E2-4EE5-9FF6-DEB157A01298@gmail.com> Hi, On 10 Jan 2008, at 11:24, wrote: > Thank your for the patch. > I updated the patch tracker page on rubyforge. > https://rubyforge.org/tracker/index.php?func=detail&aid=16844&group_id=1765&atid=6912 Thanks for following up and the nice ap4r package to begin with. :) Regards, Beta. From shino at rubyforge.org Thu Jan 10 04:36:13 2008 From: shino at rubyforge.org (shino at rubyforge.org) Date: Thu, 10 Jan 2008 04:36:13 -0500 (EST) Subject: [ap4r-devel] [362] trunk/ap4r/Rakefile: Add: rake task to extract TODO comments. Message-ID: <20080110093613.9455918585C8@rubyforge.org> Revision: 362 Author: shino Date: 2008-01-10 04:36:12 -0500 (Thu, 10 Jan 2008) Log Message: ----------- Add: rake task to extract TODO comments. Modified Paths: -------------- trunk/ap4r/Rakefile Modified: trunk/ap4r/Rakefile =================================================================== --- trunk/ap4r/Rakefile 2008-01-09 06:21:52 UTC (rev 361) +++ trunk/ap4r/Rakefile 2008-01-10 09:36:12 UTC (rev 362) @@ -163,3 +163,26 @@ end end +desc "List TODO comments in files" +task :todos => "release:copy_plugin" do + todo_pattern = /#\s*TODO\s*:?\s*(.*)\s(\d{4}\/\d{2}\/\d{2})\s*,?(?:by)?\s*(\S+)/i + Pathname.glob("lib/**/*") do |file| + next unless file.file? + + line_no = 0 + first_time = true + file.each_line do |line| + line_no += 1 + m = todo_pattern.match(line) + if m + if first_time + puts file + first_time = false + end + puts "L.#{"%4d" % line_no}: #{m[1]} -- #{m[2].strip} by #{m[3].strip}" + end + end + puts unless first_time + end + +end From shino at rubyforge.org Thu Jan 10 21:33:17 2008 From: shino at rubyforge.org (shino at rubyforge.org) Date: Thu, 10 Jan 2008 21:33:17 -0500 (EST) Subject: [ap4r-devel] [363] trunk/ap4r/lib/ap4r/util/queue_client.rb: Misc: Add date and name for TODO comment. Message-ID: <20080111023317.5246918585C8@rubyforge.org> Revision: 363 Author: shino Date: 2008-01-10 21:33:16 -0500 (Thu, 10 Jan 2008) Log Message: ----------- Misc: Add date and name for TODO comment. Modified Paths: -------------- trunk/ap4r/lib/ap4r/util/queue_client.rb Modified: trunk/ap4r/lib/ap4r/util/queue_client.rb =================================================================== --- trunk/ap4r/lib/ap4r/util/queue_client.rb 2008-01-10 09:36:12 UTC (rev 362) +++ trunk/ap4r/lib/ap4r/util/queue_client.rb 2008-01-11 02:33:16 UTC (rev 363) @@ -7,15 +7,14 @@ # # Client class for +QueueManager+. # This class wraps DRb client and provides some helper methods. - # TODO: many drb calls are executed in a method call such as +list_queues+. - # ParseTree is perhaps needed. - # TODO: +Proc+ object cannnot be passed via DRb. ParseTree also? + # TODO: many drb calls are executed in a method call such as +list_queues+. 2006/09/22 by shino + # ParseTree is perhaps needed. Now ruby-parser is also available? class QueueClient CONFIG_DIR_DEFAULT = 'config' CONFIG_FILE_DEFAULT = 'queues.cfg' HOST_DEFAULT = 'localhost' - + DEFAULT_QUEUE_PREFIX = 'queue.test.' DEFAULT_QUEUE_SUFFIX = 'default' DEFAULT_MULTI_QUEUE = DEFAULT_QUEUE_PREFIX + '*' @@ -57,7 +56,7 @@ def list_queues qm.store.queues.keys end - + def list_messages(suffix = DEFAULT_QUEUE_SUFFIX, prefix = DEFAULT_QUEUE_PREFIX) qm.store.queues[prefix.to_s + suffix.to_s] From shino at rubyforge.org Thu Jan 10 23:21:39 2008 From: shino at rubyforge.org (shino at rubyforge.org) Date: Thu, 10 Jan 2008 23:21:39 -0500 (EST) Subject: [ap4r-devel] [364] trunk/ap4r/Rakefile: Change: create a namespace "todos" for tasks to list TODOs Message-ID: <20080111042139.4EFD818585CC@rubyforge.org> Revision: 364 Author: shino Date: 2008-01-10 23:21:38 -0500 (Thu, 10 Jan 2008) Log Message: ----------- Change: create a namespace "todos" for tasks to list TODOs Add: tasks which list todos under rails_plugin/ and spec/ Modified Paths: -------------- trunk/ap4r/Rakefile Modified: trunk/ap4r/Rakefile =================================================================== --- trunk/ap4r/Rakefile 2008-01-11 02:33:16 UTC (rev 363) +++ trunk/ap4r/Rakefile 2008-01-11 04:21:38 UTC (rev 364) @@ -163,26 +163,40 @@ end end -desc "List TODO comments in files" -task :todos => "release:copy_plugin" do - todo_pattern = /#\s*TODO\s*:?\s*(.*)\s(\d{4}\/\d{2}\/\d{2})\s*,?(?:by)?\s*(\S+)/i - Pathname.glob("lib/**/*") do |file| - next unless file.file? +todos_dirs = %w(lib rails_plugin spec) - line_no = 0 - first_time = true - file.each_line do |line| - line_no += 1 - m = todo_pattern.match(line) - if m +desc "List TODO comments in #{todos_dirs.join(", ")} directories" +task :todos => todos_dirs.map{ |dir| "todos:#{dir}" } + +namespace :todos do + todos_dirs.each do |dir| + desc "List TODO comments in #{dir} directory" + task dir => "release:copy_plugin" do + print_todos(dir) + end + end + + def print_todos(dir) + todo_pattern = /#\s*TODO\s*:?\s*(.*)\s(\d{4}\/\d{2}\/\d{2})\s*,?(?:by)?\s*(\S+)/i + exclude_file_patterns = [/~$/, /^#/] + Pathname.glob("#{dir}/**/*") do |file| + next unless file.file? + next if exclude_file_patterns.any? { |p| file.to_s =~ p } + + line_no = 0 + first_time = true + file.each_line do |line| + line_no += 1 + next unless todo_pattern.match(line) + if first_time puts file first_time = false end - puts "L.#{"%4d" % line_no}: #{m[1]} -- #{m[2].strip} by #{m[3].strip}" + puts "L.#{"%4d" % line_no}: #{$1} -- #{$2.strip} by #{$3.strip}" end + puts unless first_time end - puts unless first_time end - + end From shino at rubyforge.org Thu Jan 10 23:58:54 2008 From: shino at rubyforge.org (shino at rubyforge.org) Date: Thu, 10 Jan 2008 23:58:54 -0500 (EST) Subject: [ap4r-devel] [365] trunk/ap4r/Rakefile: Refactoring: extract methods Message-ID: <20080111045854.CD0C518585CD@rubyforge.org> Revision: 365 Author: shino Date: 2008-01-10 23:58:54 -0500 (Thu, 10 Jan 2008) Log Message: ----------- Refactoring: extract methods Modified Paths: -------------- trunk/ap4r/Rakefile Modified: trunk/ap4r/Rakefile =================================================================== --- trunk/ap4r/Rakefile 2008-01-11 04:21:38 UTC (rev 364) +++ trunk/ap4r/Rakefile 2008-01-11 04:58:54 UTC (rev 365) @@ -177,26 +177,29 @@ end def print_todos(dir) - todo_pattern = /#\s*TODO\s*:?\s*(.*)\s(\d{4}\/\d{2}\/\d{2})\s*,?(?:by)?\s*(\S+)/i - exclude_file_patterns = [/~$/, /^#/] - Pathname.glob("#{dir}/**/*") do |file| - next unless file.file? - next if exclude_file_patterns.any? { |p| file.to_s =~ p } + FileList.new("#{dir}/**/*.*").each do |file| + next unless FileTest.file?(file) + next if (results = todos(file)).empty? - line_no = 0 - first_time = true - file.each_line do |line| - line_no += 1 - next unless todo_pattern.match(line) + puts file + results.each{ |r| + puts "L.#{"%4d" % r[:line]}: #{r[:msg]} -- #{r[:date]} by #{r[:by]}" + } + puts + end + end - if first_time - puts file - first_time = false - end - puts "L.#{"%4d" % line_no}: #{$1} -- #{$2.strip} by #{$3.strip}" + def todos(file) + pattern = /TODO\s*:?\s*(.*)\s+(\d{4}\/\d{2}\/\d{2})\s*,?(?:by)?\s*(\S+)/i + + results = [] + File.open(file, "r") do |f| + f.each_line do |line| + next unless pattern.match(line) + results << {:line => f.lineno, :by => $3, :date => $2, :msg => $1.strip} end - puts unless first_time end + results end end From shino at rubyforge.org Thu Jan 17 04:24:34 2008 From: shino at rubyforge.org (shino at rubyforge.org) Date: Thu, 17 Jan 2008 04:24:34 -0500 (EST) Subject: [ap4r-devel] [366] trunk: Fix: exception in calling a class method for an instance. Message-ID: <20080117092434.7A8A118586A1@rubyforge.org> Revision: 366 Author: shino Date: 2008-01-17 04:24:32 -0500 (Thu, 17 Jan 2008) Log Message: ----------- Fix: exception in calling a class method for an instance. Add: A RSpec example for Ap4r::StoredMessage#dumped_headers Add: A RSpec example for Ap4r::StoredMessage#dumped_object Modified Paths: -------------- trunk/ap4r/lib/ap4r/stored_message.rb trunk/samples/HelloWorld/spec/models/stored_message_spec.rb Modified: trunk/ap4r/lib/ap4r/stored_message.rb =================================================================== --- trunk/ap4r/lib/ap4r/stored_message.rb 2008-01-11 04:58:54 UTC (rev 365) +++ trunk/ap4r/lib/ap4r/stored_message.rb 2008-01-17 09:24:32 UTC (rev 366) @@ -31,7 +31,7 @@ def dumped_headers # The warning occurs when putting backslash into binaly type in PostgreSQL. - if postgresql? + if self.class.postgresql? self.headers else Marshal::dump(self.headers) @@ -40,7 +40,7 @@ def dumped_object # The warning occurs when putting backslash into binaly type in PostgreSQL. - if postgresql? + if self.class.postgresql? self.object else Marshal::dump(self.object) Modified: trunk/samples/HelloWorld/spec/models/stored_message_spec.rb =================================================================== --- trunk/samples/HelloWorld/spec/models/stored_message_spec.rb 2008-01-11 04:58:54 UTC (rev 365) +++ trunk/samples/HelloWorld/spec/models/stored_message_spec.rb 2008-01-17 09:24:32 UTC (rev 366) @@ -65,4 +65,23 @@ Order.should have(:no).records end + end + +describe Ap4r::StoredMessage, "when dumping its headers" do + it "should not raise Exceptions" do + lambda { + s = Ap4r::StoredMessage.new + s.dumped_headers + }.should_not raise_error + end +end + +describe Ap4r::StoredMessage, "when dumping its object" do + it "should not raise Exceptions" do + lambda { + s = Ap4r::StoredMessage.new + s.dumped_object + }.should_not raise_error + end +end From kato-k at rubyforge.org Fri Jan 18 05:39:50 2008 From: kato-k at rubyforge.org (kato-k at rubyforge.org) Date: Fri, 18 Jan 2008 05:39:50 -0500 (EST) Subject: [ap4r-devel] [367] trunk/ap4r/spec/local/message_builder_spec.rb: Added: some tests for message_builder.rb Message-ID: <20080118103951.079AE18586B2@rubyforge.org> Revision: 367 Author: kato-k Date: 2008-01-18 05:39:49 -0500 (Fri, 18 Jan 2008) Log Message: ----------- Added: some tests for message_builder.rb Added Paths: ----------- trunk/ap4r/spec/local/message_builder_spec.rb Added: trunk/ap4r/spec/local/message_builder_spec.rb =================================================================== --- trunk/ap4r/spec/local/message_builder_spec.rb (rev 0) +++ trunk/ap4r/spec/local/message_builder_spec.rb 2008-01-18 10:39:49 UTC (rev 367) @@ -0,0 +1,128 @@ +require File.join(File.dirname(__FILE__), "../spec_helper") + +# TODO: move message_builder.rb to lib directory below. 2008/01/18 kiwamu +require File.join(File.dirname(__FILE__), "../../rails_plugin/ap4r/lib/message_builder") + +describe "When simple API is used," do + + describe Ap4r::MessageBuilder, " with empty message" do + before(:all) do + empty_message = {} + @message_builder = Ap4r::MessageBuilder.new("queue_name", empty_message, {}) + end + + it "should have right MIME header." do + pending("TODO: should modify implementation? 2008/01/18 kiwamu") + mime_type = @message_builder.message_headers["http_header_Content-type".to_sym] + mime_type.should == "application/x-www-form-urlencoded" + end + + it "should have the given message." do + @message_builder.message_body.should == {} + end + + it "should return also a empty string body after format." do + @message_builder.format_message_body.should == "" + end + + end + + describe Ap4r::MessageBuilder, " with a simple message" do + before(:all) do + message = {:foo => "bar"} + @message_builder = Ap4r::MessageBuilder.new("queue_name", message, {}) + end + + it "should have right MIME header." do + pending("TODO: should modify implementation? 2008/01/18 kiwamu") + mime_type = @message_builder.message_headers["http_header_Content-type".to_sym] + mime_type.should == "application/x-www-form-urlencoded" + end + + it "should have the given message." do + @message_builder.message_body.should == {:foo => "bar"} + end + + it "should return the urlencoded body." do + @message_builder.format_message_body.should == "foo=bar" + end + + end + + describe Ap4r::MessageBuilder, " with a nested complicated message" do + before(:all) do + message = {:foo => "bar"} # TODO + @message_builder = Ap4r::MessageBuilder.new("queue_name", message, {}) + end + + it "should have the given message." do + @message_builder.message_body.should == {:foo => "bar"} + end + + it "should return the urlencoded body." do + @message_builder.format_message_body.should == "foo=bar" + end + + end + +end + + +describe "When block style API is used, " do + + describe Ap4r::MessageBuilder, " assigned no format" do + it "should have right MIME header." do + end + + it "should have the given message." do + end + + it "should return the urlencoded body." do + end + end + + describe Ap4r::MessageBuilder, " assigned text format" do + it "should have right MIME header." do + end + + it "should have the given message." do + end + + it "should return the to_s formatted body." do + end + end + + describe Ap4r::MessageBuilder, " assigned xml format" do + it "should have right MIME header." do + end + + it "should have the given message." do + end + + it "should return the xml formatted body." do + end + end + + describe Ap4r::MessageBuilder, " assigned json format" do + it "should have right MIME header." do + end + + it "should have the given message." do + end + + it "should return the json formatted body." do + end + end + + describe Ap4r::MessageBuilder, " assigned yaml format" do + it "should have right MIME header." do + end + + it "should have the given message." do + end + + it "should return the yaml formatted body." do + end + end + +end From kato-k at rubyforge.org Fri Jan 18 05:45:07 2008 From: kato-k at rubyforge.org (kato-k at rubyforge.org) Date: Fri, 18 Jan 2008 05:45:07 -0500 (EST) Subject: [ap4r-devel] [368] trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/message_builder.rb: Fixed warning: parenthesize argument(s) for future version. Message-ID: <20080118104507.1F7C418586A5@rubyforge.org> Revision: 368 Author: kato-k Date: 2008-01-18 05:45:06 -0500 (Fri, 18 Jan 2008) Log Message: ----------- Fixed warning: parenthesize argument(s) for future version. Modified Paths: -------------- trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/message_builder.rb Modified: trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/message_builder.rb =================================================================== --- trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/message_builder.rb 2008-01-18 10:39:49 UTC (rev 367) +++ trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/message_builder.rb 2008-01-18 10:45:06 UTC (rev 368) @@ -124,7 +124,7 @@ when :text return @message_body.to_s when :xml - return @message_body.to_xml @to_xml_options + return @message_body.to_xml(@to_xml_options) when :json return @message_body.to_json when :yaml From noreply at rubyforge.org Fri Jan 18 08:58:26 2008 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Fri, 18 Jan 2008 08:58:26 -0500 (EST) Subject: [ap4r-devel] [ ap4r-Bugs-17206 ] rake: uninitialized constant CGI::Session::ActiveRecordStore Message-ID: <20080118135826.BAD2518586AF@rubyforge.org> Bugs item #17206, was opened at 2008-01-18 13:58 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=6910&aid=17206&group_id=1765 Category: None Group: None Status: Open Resolution: None Priority: 3 Submitted By: Artem Vasiliev (artemv) Assigned to: Nobody (None) Summary: rake: uninitialized constant CGI::Session::ActiveRecordStore Initial Comment: After I added ap4r plugin to my Rails project I got this exception every time I try to run rake db:migrate : {{{ C:\Programs\InstantRails\rails_apps\bmlsop>rake db:migrate --trace (in C:/Programs/InstantRails/rails_apps/bmlsop) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment rake aborted! uninitialized constant CGI::Session::ActiveRecordStore C:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:478:in `const_missing' C:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/session_management.rb:24:in `const_get' C:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/session_management.rb:24:in `session_store=' C:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-2.0.1/lib/initializer.rb:330:in `send' C:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-2.0.1/lib/initializer.rb:330:in `initialize_framework_settings' }}} I don't understand it but the solution is to remove vendor/plugins/ap4r/tasks directory. Rails: 2.0.1 Ap4r plugin: 0.3.5 ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=6910&aid=17206&group_id=1765 From kato-k at rubyforge.org Sun Jan 20 21:56:08 2008 From: kato-k at rubyforge.org (kato-k at rubyforge.org) Date: Sun, 20 Jan 2008 21:56:08 -0500 (EST) Subject: [ap4r-devel] [369] trunk: Moved message_builder.rb from rails plugin to ap4r core (ap4r/ lib directory). Message-ID: <20080121025608.9C89618586C2@rubyforge.org> Revision: 369 Author: kato-k Date: 2008-01-20 21:56:07 -0500 (Sun, 20 Jan 2008) Log Message: ----------- Moved message_builder.rb from rails plugin to ap4r core (ap4r/lib directory). Modified Paths: -------------- trunk/ap4r/spec/local/message_builder_spec.rb trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/async_helper.rb Added Paths: ----------- trunk/ap4r/lib/ap4r/message_builder.rb Removed Paths: ------------- trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/message_builder.rb Copied: trunk/ap4r/lib/ap4r/message_builder.rb (from rev 355, trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/message_builder.rb) =================================================================== --- trunk/ap4r/lib/ap4r/message_builder.rb (rev 0) +++ trunk/ap4r/lib/ap4r/message_builder.rb 2008-01-21 02:56:07 UTC (rev 369) @@ -0,0 +1,181 @@ +# Author:: Kiwamu Kato +# Copyright:: Copyright (c) 2007 Future Architect Inc. +# Licence:: MIT Licence + +require 'active_record' + +module Ap4r #:nodoc: + + # This +MessageBuilder+ is the class for formatting message body. + # Current support formats are text, xml, json and yaml, + # and the formatted messages are sent over HTTP. + # + # Using +format+ method, this class automatically changes the format of + # the given message body and adds appropriate +Content-type+ to http header. + # Or using +body_as_*+ methods, you can directly assign formatted message body. + class MessageBuilder + + def initialize(queue_name, queue_message, queue_headers) + @queue_name = queue_name + @message_body = queue_message + @message_headers = queue_headers + @format = nil + @message_body_with_format = nil + @to_xml_options = {:root => "root"} + end + + attr_accessor :queue_name, :message_body, :message_headers + attr_reader :format, :to_xml_options + + # Sets message body in async_to block. + # The first argument is key and the second one is value. + # + # options are for to_xml conversion on Array and Hash, ActiveRecord objects. + # + def body(k, v, options = { }) + k ||= v.class + if v.kind_of? ActiveRecord::Base + @message_body[k.to_sym] = v + @to_xml_options = @to_xml_options.merge(options) + else + @message_body[k.to_sym] = v + end + end + + # Sets message header in async_to block. + # The first argument is key and the second one is value. + # + # Now supports following keys: + # :expire + # :priority + # :delivery + # :max_deliveries + # :dispatch_mode + # :target_method + # :target_url + # :id + # + # For details, please refer the reliable-msg. + # + def header(k, v) + @message_headers[k.to_sym] = v + end + + # Sets http header in async_to block such as 'Content_type'. + # The first argument is key and the second one is value. + # + def http_header(k, v) + @message_headers["http_header_#{k}".to_sym] = v + end + + # Sets format message serialization. + # As to the format, automatically sets content-type. + # Unless any format, content-type is defined as "application/x-www-form-urlencoded". + # + def format(v) + case @format = v + when :text + set_content_type("text/plain") + when :xml + set_content_type("application/xml") + when :json + set_content_type("application/json") + when :yaml + set_content_type("text/plain text/yaml") + else + set_content_type("application/x-www-form-urlencoded") + end + end + + # Sets text format message. No need to use +format+. + # + def body_as_text(text) + @message_body_with_format = text + format :text + end + + # Sets xml format message. No need to use +format+. + # + def body_as_xml(xml) + @message_body_with_format = xml + format :xml + end + + # Sets json format message. No need to use +format+. + # + def body_as_json(json) + @message_body_with_format = json + format :json + end + + # Sets yaml format message. No need to use +format+. + # + def body_as_yaml(yaml) + @message_body_with_format = yaml + format :yaml + end + + # Return converted message body, as to assigned format. + # + def format_message_body + return @message_body_with_format if @message_body_with_format + + case @format + when :text + return @message_body.to_s + when :xml + return @message_body.to_xml @to_xml_options + when :json + return @message_body.to_json + when :yaml + return @message_body.to_yaml + else + @message_body.each do |k,v| + if v.kind_of? ActiveRecord::Base + @message_body[k] = v.attributes + end + end + return query_string(@message_body) + end + end + + private + def query_string(hash) + build_query_string(hash, nil, nil) + end + + def build_query_string(hash, query = nil, top = nil) + query ||= [] + top ||= "" + + _top = top.dup + + hash.each do |k,v| + top = _top + top += top == "" ? "#{urlencode(k.to_s)}" : "[#{urlencode(k.to_s)}]" + if v.kind_of? Hash + build_query_string(v, query, top) + elsif v.kind_of? Array + v.each do |e| + query << "#{top}[]=#{urlencode(e.to_s)}" + end + else + query << "#{top}=#{urlencode(v.to_s)}" + end + end + query.join('&') + end + + def simple_url_encoded_form_data(params, sep = '&') + params.map {|k,v| "#{urlencode(k.to_s)}=#{urlencode(v.to_s)}" }.join(sep) + end + + def urlencode(str) + str.gsub(/[^a-zA-Z0-9_\.\-]/n) {|s| sprintf('%%%02x', s[0]) } + end + + def set_content_type(type) + http_header("Content-type", type) + end + end +end Modified: trunk/ap4r/spec/local/message_builder_spec.rb =================================================================== --- trunk/ap4r/spec/local/message_builder_spec.rb 2008-01-18 10:45:06 UTC (rev 368) +++ trunk/ap4r/spec/local/message_builder_spec.rb 2008-01-21 02:56:07 UTC (rev 369) @@ -1,7 +1,7 @@ require File.join(File.dirname(__FILE__), "../spec_helper") - +require 'ap4r/message_builder' # TODO: move message_builder.rb to lib directory below. 2008/01/18 kiwamu -require File.join(File.dirname(__FILE__), "../../rails_plugin/ap4r/lib/message_builder") +# require File.join(File.dirname(__FILE__), "../../rails_plugin/ap4r/lib/message_builder") describe "When simple API is used," do Modified: trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/async_helper.rb =================================================================== --- trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/async_helper.rb 2008-01-18 10:45:06 UTC (rev 368) +++ trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/async_helper.rb 2008-01-21 02:56:07 UTC (rev 369) @@ -4,7 +4,7 @@ require 'reliable-msg' require 'ap4r/stored_message' -require 'message_builder' +require 'ap4r/message_builder' module Ap4r Deleted: trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/message_builder.rb =================================================================== --- trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/message_builder.rb 2008-01-18 10:45:06 UTC (rev 368) +++ trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/message_builder.rb 2008-01-21 02:56:07 UTC (rev 369) @@ -1,181 +0,0 @@ -# Author:: Kiwamu Kato -# Copyright:: Copyright (c) 2007 Future Architect Inc. -# Licence:: MIT Licence - -require 'active_record' - -module Ap4r #:nodoc: - - # This +MessageBuilder+ is the class for formatting message body. - # Current support formats are text, xml, json and yaml, - # and the formatted messages are sent over HTTP. - # - # Using +format+ method, this class automatically changes the format of - # the given message body and adds appropriate +Content-type+ to http header. - # Or using +body_as_*+ methods, you can directly assign formatted message body. - class MessageBuilder - - def initialize(queue_name, queue_message, queue_headers) - @queue_name = queue_name - @message_body = queue_message - @message_headers = queue_headers - @format = nil - @message_body_with_format = nil - @to_xml_options = {:root => "root"} - end - - attr_accessor :queue_name, :message_body, :message_headers - attr_reader :format, :to_xml_options - - # Sets message body in async_to block. - # The first argument is key and the second one is value. - # - # options are for to_xml conversion on Array and Hash, ActiveRecord objects. - # - def body(k, v, options = { }) - k ||= v.class - if v.kind_of? ActiveRecord::Base - @message_body[k.to_sym] = v - @to_xml_options = @to_xml_options.merge(options) - else - @message_body[k.to_sym] = v - end - end - - # Sets message header in async_to block. - # The first argument is key and the second one is value. - # - # Now supports following keys: - # :expire - # :priority - # :delivery - # :max_deliveries - # :dispatch_mode - # :target_method - # :target_url - # :id - # - # For details, please refer the reliable-msg. - # - def header(k, v) - @message_headers[k.to_sym] = v - end - - # Sets http header in async_to block such as 'Content_type'. - # The first argument is key and the second one is value. - # - def http_header(k, v) - @message_headers["http_header_#{k}".to_sym] = v - end - - # Sets format message serialization. - # As to the format, automatically sets content-type. - # Unless any format, content-type is defined as "application/x-www-form-urlencoded". - # - def format(v) - case @format = v - when :text - set_content_type("text/plain") - when :xml - set_content_type("application/xml") - when :json - set_content_type("application/json") - when :yaml - set_content_type("text/plain text/yaml") - else - set_content_type("application/x-www-form-urlencoded") - end - end - - # Sets text format message. No need to use +format+. - # - def body_as_text(text) - @message_body_with_format = text - format :text - end - - # Sets xml format message. No need to use +format+. - # - def body_as_xml(xml) - @message_body_with_format = xml - format :xml - end - - # Sets json format message. No need to use +format+. - # - def body_as_json(json) - @message_body_with_format = json - format :json - end - - # Sets yaml format message. No need to use +format+. - # - def body_as_yaml(yaml) - @message_body_with_format = yaml - format :yaml - end - - # Return converted message body, as to assigned format. - # - def format_message_body - return @message_body_with_format if @message_body_with_format - - case @format - when :text - return @message_body.to_s - when :xml - return @message_body.to_xml(@to_xml_options) - when :json - return @message_body.to_json - when :yaml - return @message_body.to_yaml - else - @message_body.each do |k,v| - if v.kind_of? ActiveRecord::Base - @message_body[k] = v.attributes - end - end - return query_string(@message_body) - end - end - - private - def query_string(hash) - build_query_string(hash, nil, nil) - end - - def build_query_string(hash, query = nil, top = nil) - query ||= [] - top ||= "" - - _top = top.dup - - hash.each do |k,v| - top = _top - top += top == "" ? "#{urlencode(k.to_s)}" : "[#{urlencode(k.to_s)}]" - if v.kind_of? Hash - build_query_string(v, query, top) - elsif v.kind_of? Array - v.each do |e| - query << "#{top}[]=#{urlencode(e.to_s)}" - end - else - query << "#{top}=#{urlencode(v.to_s)}" - end - end - query.join('&') - end - - def simple_url_encoded_form_data(params, sep = '&') - params.map {|k,v| "#{urlencode(k.to_s)}=#{urlencode(v.to_s)}" }.join(sep) - end - - def urlencode(str) - str.gsub(/[^a-zA-Z0-9_\.\-]/n) {|s| sprintf('%%%02x', s[0]) } - end - - def set_content_type(type) - http_header("Content-type", type) - end - end -end From kato-k at rubyforge.org Mon Jan 21 03:05:48 2008 From: kato-k at rubyforge.org (kato-k at rubyforge.org) Date: Mon, 21 Jan 2008 03:05:48 -0500 (EST) Subject: [ap4r-devel] [370] trunk/ap4r/lib/ap4r/message_builder.rb: Fixed warning: parenthesize argument(s) for future version. Message-ID: <20080121080548.3EEB2185865C@rubyforge.org> Revision: 370 Author: kato-k Date: 2008-01-21 03:05:47 -0500 (Mon, 21 Jan 2008) Log Message: ----------- Fixed warning: parenthesize argument(s) for future version. Modified Paths: -------------- trunk/ap4r/lib/ap4r/message_builder.rb Modified: trunk/ap4r/lib/ap4r/message_builder.rb =================================================================== --- trunk/ap4r/lib/ap4r/message_builder.rb 2008-01-21 02:56:07 UTC (rev 369) +++ trunk/ap4r/lib/ap4r/message_builder.rb 2008-01-21 08:05:47 UTC (rev 370) @@ -124,7 +124,7 @@ when :text return @message_body.to_s when :xml - return @message_body.to_xml @to_xml_options + return @message_body.to_xml(@to_xml_options) when :json return @message_body.to_json when :yaml From kato-k at rubyforge.org Wed Jan 23 04:57:59 2008 From: kato-k at rubyforge.org (kato-k at rubyforge.org) Date: Wed, 23 Jan 2008 04:57:59 -0500 (EST) Subject: [ap4r-devel] [371] trunk/samples/HelloWorld/vendor/plugins/ap4r: Fixed: [#17206] rake: uninitialized constant CGI::Session::ActiveRecordStore. Message-ID: <20080123095800.024D518586A2@rubyforge.org> Revision: 371 Author: kato-k Date: 2008-01-23 04:57:58 -0500 (Wed, 23 Jan 2008) Log Message: ----------- Fixed: [#17206] rake: uninitialized constant CGI::Session::ActiveRecordStore. Modified Paths: -------------- trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/ap4r/service_handler.rb trunk/samples/HelloWorld/vendor/plugins/ap4r/tasks/ap4r.rake Modified: trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/ap4r/service_handler.rb =================================================================== --- trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/ap4r/service_handler.rb 2008-01-21 08:05:47 UTC (rev 370) +++ trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/ap4r/service_handler.rb 2008-01-23 09:57:58 UTC (rev 371) @@ -5,8 +5,6 @@ require 'rubygems' require 'erb' require 'yaml' -require 'reliable-msg' -require 'ap4r' require 'timeout' module Ap4r Modified: trunk/samples/HelloWorld/vendor/plugins/ap4r/tasks/ap4r.rake =================================================================== --- trunk/samples/HelloWorld/vendor/plugins/ap4r/tasks/ap4r.rake 2008-01-21 08:05:47 UTC (rev 370) +++ trunk/samples/HelloWorld/vendor/plugins/ap4r/tasks/ap4r.rake 2008-01-23 09:57:58 UTC (rev 371) @@ -10,14 +10,14 @@ namespace :asyncs do desc "Start Rails and AP4R servers to test:asyncs:exec" - task :arrange do |t| + task :arrange => :require_dependencies do |t| ap4r_handler = Ap4r::ServiceHandler.new ap4r_handler.start_rails_service ap4r_handler.start_ap4r_service end desc "Start Rails and AP4R servers to test:asyncs:exec" - task :cleanup do |t| + task :cleanup => :require_dependencies do |t| ap4r_handler = Ap4r::ServiceHandler.new ap4r_handler.stop_ap4r_service ap4r_handler.stop_rails_service @@ -30,6 +30,14 @@ end Rake::Task['test:asyncs:run'].comment = "Run the unit tests in test/async" + # service_handler.rb needs to require the following libraries. + # If reliable-msg's rails adapter is loaded before rails initialization, + # it may cause to uninitialization error because the adapter requires ActionController. + # So, the load of the following libraries is delayed with rake task. + task :require_dependencies do + require 'reliable-msg' + require 'ap4r' + end end end From noreply at rubyforge.org Wed Jan 23 05:41:06 2008 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Wed, 23 Jan 2008 05:41:06 -0500 (EST) Subject: [ap4r-devel] [ ap4r-Bugs-17206 ] rake: uninitialized constant CGI::Session::ActiveRecordStore Message-ID: <20080123104106.8960D18586CE@rubyforge.org> Bugs item #17206, was opened at 2008-01-18 22:58 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=6910&aid=17206&group_id=1765 Category: None Group: None Status: Open Resolution: None Priority: 3 Submitted By: Artem Vasiliev (artemv) Assigned to: Nobody (None) Summary: rake: uninitialized constant CGI::Session::ActiveRecordStore Initial Comment: After I added ap4r plugin to my Rails project I got this exception every time I try to run rake db:migrate : {{{ C:\Programs\InstantRails\rails_apps\bmlsop>rake db:migrate --trace (in C:/Programs/InstantRails/rails_apps/bmlsop) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment rake aborted! uninitialized constant CGI::Session::ActiveRecordStore C:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:478:in `const_missing' C:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/session_management.rb:24:in `const_get' C:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/session_management.rb:24:in `session_store=' C:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-2.0.1/lib/initializer.rb:330:in `send' C:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-2.0.1/lib/initializer.rb:330:in `initialize_framework_settings' }}} I don't understand it but the solution is to remove vendor/plugins/ap4r/tasks directory. Rails: 2.0.1 Ap4r plugin: 0.3.5 ---------------------------------------------------------------------- >Comment By: kiwamu kato (kato-k) Date: 2008-01-23 19:41 Message: Hi, Artem Thank you for this information. As you said, this problem is caused by vendor/plugin/ap4r/tasks/ap4r.rake . (And probably you use active_record_store in your rails application ?) When ap4r.rake is loaded, ActiveRecord is not required yet. So, it leads to this uninitialized constant error in case that active_record_store is configured as a session store. I fixed it by revision 371. Regards, kiwamu ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=6910&aid=17206&group_id=1765 From noreply at rubyforge.org Thu Jan 24 09:10:07 2008 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Thu, 24 Jan 2008 09:10:07 -0500 (EST) Subject: [ap4r-devel] [ ap4r-Bugs-17206 ] rake: uninitialized constant CGI::Session::ActiveRecordStore Message-ID: <20080124141008.208D71858710@rubyforge.org> Bugs item #17206, was opened at 2008-01-18 13:58 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=6910&aid=17206&group_id=1765 Category: None Group: None Status: Open Resolution: None Priority: 3 Submitted By: Artem Vasiliev (artemv) Assigned to: Nobody (None) Summary: rake: uninitialized constant CGI::Session::ActiveRecordStore Initial Comment: After I added ap4r plugin to my Rails project I got this exception every time I try to run rake db:migrate : {{{ C:\Programs\InstantRails\rails_apps\bmlsop>rake db:migrate --trace (in C:/Programs/InstantRails/rails_apps/bmlsop) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment rake aborted! uninitialized constant CGI::Session::ActiveRecordStore C:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:478:in `const_missing' C:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/session_management.rb:24:in `const_get' C:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/session_management.rb:24:in `session_store=' C:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-2.0.1/lib/initializer.rb:330:in `send' C:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-2.0.1/lib/initializer.rb:330:in `initialize_framework_settings' }}} I don't understand it but the solution is to remove vendor/plugins/ap4r/tasks directory. Rails: 2.0.1 Ap4r plugin: 0.3.5 ---------------------------------------------------------------------- >Comment By: Artem Vasiliev (artemv) Date: 2008-01-24 14:10 Message: Thanks Kiwamu, yes I use active_record_store. ---------------------------------------------------------------------- Comment By: kiwamu kato (kato-k) Date: 2008-01-23 10:41 Message: Hi, Artem Thank you for this information. As you said, this problem is caused by vendor/plugin/ap4r/tasks/ap4r.rake . (And probably you use active_record_store in your rails application ?) When ap4r.rake is loaded, ActiveRecord is not required yet. So, it leads to this uninitialized constant error in case that active_record_store is configured as a session store. I fixed it by revision 371. Regards, kiwamu ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=6910&aid=17206&group_id=1765 From kato-k at rubyforge.org Thu Jan 24 21:54:57 2008 From: kato-k at rubyforge.org (kato-k at rubyforge.org) Date: Thu, 24 Jan 2008 21:54:57 -0500 (EST) Subject: [ap4r-devel] [372] trunk/samples/HelloWorld/vendor/plugins/ap4r: Fixed: [#17206] once again. Message-ID: <20080125025457.1EBB7185866A@rubyforge.org> Revision: 372 Author: kato-k Date: 2008-01-24 21:54:56 -0500 (Thu, 24 Jan 2008) Log Message: ----------- Fixed: [#17206] once again. service_handler.rb requires reliable-msg and ap4r. Modified Paths: -------------- trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/ap4r/service_handler.rb trunk/samples/HelloWorld/vendor/plugins/ap4r/tasks/ap4r.rake Modified: trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/ap4r/service_handler.rb =================================================================== --- trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/ap4r/service_handler.rb 2008-01-23 09:57:58 UTC (rev 371) +++ trunk/samples/HelloWorld/vendor/plugins/ap4r/lib/ap4r/service_handler.rb 2008-01-25 02:54:56 UTC (rev 372) @@ -5,6 +5,8 @@ require 'rubygems' require 'erb' require 'yaml' +require 'reliable-msg' +require 'ap4r' require 'timeout' module Ap4r Modified: trunk/samples/HelloWorld/vendor/plugins/ap4r/tasks/ap4r.rake =================================================================== --- trunk/samples/HelloWorld/vendor/plugins/ap4r/tasks/ap4r.rake 2008-01-23 09:57:58 UTC (rev 371) +++ trunk/samples/HelloWorld/vendor/plugins/ap4r/tasks/ap4r.rake 2008-01-25 02:54:56 UTC (rev 372) @@ -1,5 +1,3 @@ -require File.expand_path(File.dirname(__FILE__) + "/../lib/ap4r/service_handler.rb") - namespace :test do # task :asyncs do @@ -35,8 +33,7 @@ # it may cause to uninitialization error because the adapter requires ActionController. # So, the load of the following libraries is delayed with rake task. task :require_dependencies do - require 'reliable-msg' - require 'ap4r' + require File.expand_path(File.dirname(__FILE__) + "/../lib/ap4r/service_handler.rb") end end From shinohara.shunichi at future.co.jp Sun Jan 27 19:40:12 2008 From: shinohara.shunichi at future.co.jp (shinohara.shunichi at future.co.jp) Date: Mon, 28 Jan 2008 09:40:12 +0900 Subject: [ap4r-devel] FW: ap4r-devel added to Gmane Message-ID: <14CE73B79D552644B7CBEF0428763DF60403753A@045MAIL.future.co.jp> Hi All, The archive of this list is on Gmane from now on (as well as The Mail Archive). Regards, shino -----Original Message----- From: Gmane Administrator [mailto:admin at m.gmane.org] Sent: Sunday, January 27, 2008 5:26 PM To: ap4r-devel-admin at rubyforge.org Subject: ap4r-devel added to Gmane We have received a request for adding the ap4r-devel at rubyforge.org mailing list to the Gmane mail-to-news gateway/archive. A subscription request message has been sent. If this is contrary to your wishes, please send a mail to admin at gmane.org saying so, and the list will be removed from Gmane. Gmane is a mail-to-news portal that never expires its messages. It therefore also functions as a mailing list archive. It's a bi-directional gateway, but Gmane verifies that its users' email addresses are valid before passing the messages through the news-to-mail gateway. (Groups can also be made "read-only", which means that Gmane won't forward any messages at all to the mailing list.) Gmane can encrypt addresses to make address harvesting difficult, and heeds X-No-Archive and related headers. If you wish to import older archives into Gmane, send a message to the Gmane administrators with the URL of a Unix mbox archive of the mailing list. In partnership with The Mail Archive, messages will be archived on that service as well. This provides redundancy across two archival services. The following parameters are set for this mailing list: * Newsgroup name: gmane.comp.lang.ruby.ap4r.devel * Mailing list address: ap4r-devel at rubyforge.org * The gateway is bi-directional * Address encryption is on * Spam detection is on * The list is described as: "Discussions for AP4R developers, Commit Logs, etc." * News URL: news://news.gmane.org/gmane.comp.lang.ruby.ap4r.devel * Web URL: http://dir.gmane.org/gmane.comp.lang.ruby.ap4r.devel This newsgroup will be created when the first message from the mailing list arrives. For more information about the Gmane project, go to . For more information about The Mail Archive, go to . This request was handled by wosc at wosc.de. From noreply at rubyforge.org Sun Jan 27 20:13:10 2008 From: noreply at rubyforge.org (noreply at rubyforge.org) Date: Sun, 27 Jan 2008 20:13:10 -0500 (EST) Subject: [ap4r-devel] [ ap4r-Bugs-17206 ] rake: uninitialized constant CGI::Session::ActiveRecordStore Message-ID: <20080128011310.55A8C185862F@rubyforge.org> Bugs item #17206, was opened at 2008-01-18 22:58 You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=6910&aid=17206&group_id=1765 Category: None Group: None >Status: Closed >Resolution: Accepted Priority: 3 Submitted By: Artem Vasiliev (artemv) >Assigned to: kiwamu kato (kato-k) Summary: rake: uninitialized constant CGI::Session::ActiveRecordStore Initial Comment: After I added ap4r plugin to my Rails project I got this exception every time I try to run rake db:migrate : {{{ C:\Programs\InstantRails\rails_apps\bmlsop>rake db:migrate --trace (in C:/Programs/InstantRails/rails_apps/bmlsop) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment rake aborted! uninitialized constant CGI::Session::ActiveRecordStore C:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.1/lib/active_support/dependencies.rb:478:in `const_missing' C:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/session_management.rb:24:in `const_get' C:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/actionpack-2.0.1/lib/action_controller/session_management.rb:24:in `session_store=' C:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-2.0.1/lib/initializer.rb:330:in `send' C:/Programs/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-2.0.1/lib/initializer.rb:330:in `initialize_framework_settings' }}} I don't understand it but the solution is to remove vendor/plugins/ap4r/tasks directory. Rails: 2.0.1 Ap4r plugin: 0.3.5 ---------------------------------------------------------------------- >Comment By: kiwamu kato (kato-k) Date: 2008-01-28 10:13 Message: This tracker item is closed. ---------------------------------------------------------------------- Comment By: Artem Vasiliev (artemv) Date: 2008-01-24 23:10 Message: Thanks Kiwamu, yes I use active_record_store. ---------------------------------------------------------------------- Comment By: kiwamu kato (kato-k) Date: 2008-01-23 19:41 Message: Hi, Artem Thank you for this information. As you said, this problem is caused by vendor/plugin/ap4r/tasks/ap4r.rake . (And probably you use active_record_store in your rails application ?) When ap4r.rake is loaded, ActiveRecord is not required yet. So, it leads to this uninitialized constant error in case that active_record_store is configured as a session store. I fixed it by revision 371. Regards, kiwamu ---------------------------------------------------------------------- You can respond by visiting: http://rubyforge.org/tracker/?func=detail&atid=6910&aid=17206&group_id=1765 From kato-k at rubyforge.org Mon Jan 28 01:02:27 2008 From: kato-k at rubyforge.org (kato-k at rubyforge.org) Date: Mon, 28 Jan 2008 01:02:27 -0500 (EST) Subject: [ap4r-devel] [373] trunk/ap4r: Added tests for message_build.rb. Message-ID: <20080128060227.B1D2118585A7@rubyforge.org> Revision: 373 Author: kato-k Date: 2008-01-28 01:02:26 -0500 (Mon, 28 Jan 2008) Log Message: ----------- Added tests for message_build.rb. Modified Paths: -------------- trunk/ap4r/lib/ap4r/message_builder.rb trunk/ap4r/spec/local/message_builder_spec.rb Modified: trunk/ap4r/lib/ap4r/message_builder.rb =================================================================== --- trunk/ap4r/lib/ap4r/message_builder.rb 2008-01-25 02:54:56 UTC (rev 372) +++ trunk/ap4r/lib/ap4r/message_builder.rb 2008-01-28 06:02:26 UTC (rev 373) @@ -3,6 +3,7 @@ # Licence:: MIT Licence require 'active_record' +require 'active_support' module Ap4r #:nodoc: @@ -81,7 +82,7 @@ when :json set_content_type("application/json") when :yaml - set_content_type("text/plain text/yaml") + set_content_type("text/yaml") else set_content_type("application/x-www-form-urlencoded") end Modified: trunk/ap4r/spec/local/message_builder_spec.rb =================================================================== --- trunk/ap4r/spec/local/message_builder_spec.rb 2008-01-25 02:54:56 UTC (rev 372) +++ trunk/ap4r/spec/local/message_builder_spec.rb 2008-01-28 06:02:26 UTC (rev 373) @@ -5,13 +5,13 @@ describe "When simple API is used," do - describe Ap4r::MessageBuilder, " with empty message" do + describe Ap4r::MessageBuilder, " with an empty message" do before(:all) do empty_message = {} @message_builder = Ap4r::MessageBuilder.new("queue_name", empty_message, {}) end - it "should have right MIME header." do + it "should have the right MIME header." do pending("TODO: should modify implementation? 2008/01/18 kiwamu") mime_type = @message_builder.message_headers["http_header_Content-type".to_sym] mime_type.should == "application/x-www-form-urlencoded" @@ -33,7 +33,7 @@ @message_builder = Ap4r::MessageBuilder.new("queue_name", message, {}) end - it "should have right MIME header." do + it "should have the right MIME header." do pending("TODO: should modify implementation? 2008/01/18 kiwamu") mime_type = @message_builder.message_headers["http_header_Content-type".to_sym] mime_type.should == "application/x-www-form-urlencoded" @@ -51,16 +51,17 @@ describe Ap4r::MessageBuilder, " with a nested complicated message" do before(:all) do - message = {:foo => "bar"} # TODO - @message_builder = Ap4r::MessageBuilder.new("queue_name", message, {}) + @message = {:a => {:b => "c", :d => { :e => "f", :g => "h"}}, :i => "j"} + @message_builder = Ap4r::MessageBuilder.new("queue_name", @message, {}) end it "should have the given message." do - @message_builder.message_body.should == {:foo => "bar"} + @message_builder.message_body.should == @message end it "should return the urlencoded body." do - @message_builder.format_message_body.should == "foo=bar" + query = @message_builder.format_message_body + query.split("&").sort.should == %w(a[b]=c a[d][e]=f a[d][g]=h i=j).sort end end @@ -70,58 +71,129 @@ describe "When block style API is used, " do - describe Ap4r::MessageBuilder, " assigned no format" do - it "should have right MIME header." do + describe Ap4r::MessageBuilder, " assigned unknown format" do + + before(:all) do + + block = Proc.new do + body :key1, "value" + body :key2, 1 + format :unknown_format + end + + @message_builder = Ap4r::MessageBuilder.new("", {}, {}) + @message_builder.instance_eval(&block) end + it "should have the right MIME header." do + pending("TODO: should modify implementation? 2008/01/24 kiwamu") + mime_type = @message_builder.message_headers["http_header_Content-type".to_sym] + mime_type.should == "application/x-www-form-urlencoded" + end + it "should have the given message." do + @message_builder.message_body.should == {:key1 => "value", :key2 => 1} end it "should return the urlencoded body." do + @message_builder.format_message_body.should == "key1=value&key2=1" end + end describe Ap4r::MessageBuilder, " assigned text format" do - it "should have right MIME header." do + + before(:all) do + + block = Proc.new do + body :key1, "value" + body :key2, 1 + format :text + end + + @message_builder = Ap4r::MessageBuilder.new("", {}, {}) + @message_builder.instance_eval(&block) end - it "should have the given message." do + it "should have the right MIME header." do + mime_type = @message_builder.message_headers["http_header_Content-type".to_sym] + mime_type.should == "text/plain" end it "should return the to_s formatted body." do + @message_builder.format_message_body.should == {:key1 => "value", :key2 => 1}.to_s end end describe Ap4r::MessageBuilder, " assigned xml format" do - it "should have right MIME header." do + + before(:all) do + + block = Proc.new do + body :key1, "value" + body :key2, 1 + format :xml + end + + @message_builder = Ap4r::MessageBuilder.new("", {}, {}) + @message_builder.instance_eval(&block) end - it "should have the given message." do + it "should have the right MIME header." do + mime_type = @message_builder.message_headers["http_header_Content-type".to_sym] + mime_type.should == "application/xml" end it "should return the xml formatted body." do + @message_builder.format_message_body.should == {:key1 => "value", :key2 => 1}.to_xml(:root => "root") end end describe Ap4r::MessageBuilder, " assigned json format" do - it "should have right MIME header." do + + before(:all) do + + block = Proc.new do + body :key1, "value" + body :key2, 1 + format :json + end + + @message_builder = Ap4r::MessageBuilder.new("", {}, {}) + @message_builder.instance_eval(&block) end - it "should have the given message." do + it "should have the right MIME header." do + mime_type = @message_builder.message_headers["http_header_Content-type".to_sym] + mime_type.should == "application/json" end it "should return the json formatted body." do + @message_builder.format_message_body.should == {:key1 => "value", :key2 => 1}.to_json end end describe Ap4r::MessageBuilder, " assigned yaml format" do - it "should have right MIME header." do + + before(:all) do + + block = Proc.new do + body :key1, "value" + body :key2, 1 + format :yaml + end + + @message_builder = Ap4r::MessageBuilder.new("", {}, {}) + @message_builder.instance_eval(&block) end - it "should have the given message." do + it "should have the right MIME header." do + mime_type = @message_builder.message_headers["http_header_Content-type".to_sym] + mime_type.should == "text/yaml" end it "should return the yaml formatted body." do + @message_builder.format_message_body.should == {:key1 => "value", :key2 => 1}.to_yaml end end From shino at rubyforge.org Mon Jan 28 01:57:38 2008 From: shino at rubyforge.org (shino at rubyforge.org) Date: Mon, 28 Jan 2008 01:57:38 -0500 (EST) Subject: [ap4r-devel] [374] trunk/ap4r/lib/ap4r/mongrel.rb: Misc: specify Exception for rescue clause. Message-ID: <20080128065738.2B5891858636@rubyforge.org> Revision: 374 Author: shino Date: 2008-01-28 01:57:37 -0500 (Mon, 28 Jan 2008) Log Message: ----------- Misc: specify Exception for rescue clause. !NOTE! a rescue clause without an exception type ONLY rescues subclasses of StandardError. Modified Paths: -------------- trunk/ap4r/lib/ap4r/mongrel.rb Modified: trunk/ap4r/lib/ap4r/mongrel.rb =================================================================== --- trunk/ap4r/lib/ap4r/mongrel.rb 2008-01-28 06:02:26 UTC (rev 373) +++ trunk/ap4r/lib/ap4r/mongrel.rb 2008-01-28 06:57:37 UTC (rev 374) @@ -152,7 +152,7 @@ head['Content-Type'] = 'text/plain' out.write mid end - rescue + rescue Exception response.start(500) do |head, out| head['Content-Type'] = 'text/plain' out.write "Failed to send message. #{request.body.string}" From shino at rubyforge.org Mon Jan 28 02:39:18 2008 From: shino at rubyforge.org (shino at rubyforge.org) Date: Mon, 28 Jan 2008 02:39:18 -0500 (EST) Subject: [ap4r-devel] [375] trunk/ap4r/lib/ap4r/dispatcher.rb: Fix: missspelled variable 'm' Message-ID: <20080128073918.DE93E185863C@rubyforge.org> Revision: 375 Author: shino Date: 2008-01-28 02:39:18 -0500 (Mon, 28 Jan 2008) Log Message: ----------- Fix: missspelled variable 'm' Modified Paths: -------------- trunk/ap4r/lib/ap4r/dispatcher.rb Modified: trunk/ap4r/lib/ap4r/dispatcher.rb =================================================================== --- trunk/ap4r/lib/ap4r/dispatcher.rb 2008-01-28 06:57:37 UTC (rev 374) +++ trunk/ap4r/lib/ap4r/dispatcher.rb 2008-01-28 07:39:18 UTC (rev 375) @@ -94,7 +94,7 @@ # If no class for +dispatch_mode+, raises an exception. def get_dispather_instance(dispatch_mode, message, conf_per_targets) klass = @@subclasses[dispatch_mode] - raise "undefined dispatch mode #{m.headers[:mode]}" unless klass + raise "undefined dispatch mode #{message.headers[:mode]}" unless klass klass.new(message, conf_per_targets) end From kato-k at rubyforge.org Thu Jan 31 01:44:01 2008 From: kato-k at rubyforge.org (kato-k at rubyforge.org) Date: Thu, 31 Jan 2008 01:44:01 -0500 (EST) Subject: [ap4r-devel] [376] trunk/ap4r: Modified version # and added comments. Message-ID: <20080131064401.7921D18585ED@rubyforge.org> Revision: 376 Author: kato-k Date: 2008-01-31 01:44:00 -0500 (Thu, 31 Jan 2008) Log Message: ----------- Modified version # and added comments. Modified Paths: -------------- trunk/ap4r/History.txt trunk/ap4r/lib/ap4r/version.rb Modified: trunk/ap4r/History.txt =================================================================== --- trunk/ap4r/History.txt 2008-01-28 07:39:18 UTC (rev 375) +++ trunk/ap4r/History.txt 2008-01-31 06:44:00 UTC (rev 376) @@ -1,5 +1,10 @@ == 0.3.x +=== 0.3.6 (January ?, 2008) +* Added: provisional support Rails2.0. +* Changed: the location of message_builder.rb from rails plugin to ap4r core (ap4r/lib directory). +* Fixed: bug (tracker #17206) that uninitialized constant error occurs when :active_record_store is used as session store. + === 0.3.5 (November 29, 2007) * Fixed: bug that SAF transaction is NOT guaranteed when some models are created/updated before using of ap4r.async_to API in ap4r.transaction block. Modified: trunk/ap4r/lib/ap4r/version.rb =================================================================== --- trunk/ap4r/lib/ap4r/version.rb 2008-01-28 07:39:18 UTC (rev 375) +++ trunk/ap4r/lib/ap4r/version.rb 2008-01-31 06:44:00 UTC (rev 376) @@ -8,7 +8,7 @@ module VERSION #:nodoc: MAJOR = 0 MINOR = 3 - TINY = 5 + TINY = 6 STRING = [MAJOR, MINOR, TINY].join('.') end From kato-k at rubyforge.org Thu Jan 31 02:04:06 2008 From: kato-k at rubyforge.org (kato-k at rubyforge.org) Date: Thu, 31 Jan 2008 02:04:06 -0500 (EST) Subject: [ap4r-devel] [377] trunk/ap4r: Modified manifest file. Message-ID: <20080131070406.4A4C818585E8@rubyforge.org> Revision: 377 Author: kato-k Date: 2008-01-31 02:04:05 -0500 (Thu, 31 Jan 2008) Log Message: ----------- Modified manifest file. Modified Paths: -------------- trunk/ap4r/Manifest.txt trunk/ap4r/Rakefile Modified: trunk/ap4r/Manifest.txt =================================================================== --- trunk/ap4r/Manifest.txt 2008-01-31 06:44:00 UTC (rev 376) +++ trunk/ap4r/Manifest.txt 2008-01-31 07:04:05 UTC (rev 377) @@ -15,6 +15,7 @@ lib/ap4r/carrier.rb lib/ap4r/db/migrate/001_reliable_msg_queue_and_topic.rb lib/ap4r/dispatcher.rb +lib/ap4r/message_builder.rb lib/ap4r/message_store_ext.rb lib/ap4r/mongrel.rb lib/ap4r/mongrel_ap4r.rb @@ -43,11 +44,13 @@ rails_plugin/ap4r/lib/ap4r/service_handler.rb rails_plugin/ap4r/lib/ap4r_client.rb rails_plugin/ap4r/lib/async_helper.rb -rails_plugin/ap4r/lib/message_builder.rb rails_plugin/ap4r/tasks/ap4r.rake script/irm script/mongrel_ap4r script/start script/stop spec/local/dispatcher_base_spec.rb +spec/local/message_builder_spec.rb +spec/local/send_message_handler_spec.rb +spec/local/subscribe_message_handler_spec.rb spec/spec_helper.rb Modified: trunk/ap4r/Rakefile =================================================================== --- trunk/ap4r/Rakefile 2008-01-31 06:44:00 UTC (rev 376) +++ trunk/ap4r/Rakefile 2008-01-31 07:04:05 UTC (rev 377) @@ -1,5 +1,6 @@ require 'rubygems' require 'erb' +require 'find' require 'active_record' require File.join(File.dirname(__FILE__), 'lib/ap4r', 'version') @@ -64,8 +65,10 @@ path_list = [] Find.find('.') do |path| next unless File.file?(path) + next if path =~ /^\.\/coverage\// next if path =~ /^\.\/doc\// - next if path =~ /\.svn|tmp$|CVS|\~$/ + next if path =~ /^\.\/log\// + next if path =~ /\.svn|tmp$|CVS|\.msg$|\.idx$|\.state$|\#$|\~$/ path_list << path end From kato-k at rubyforge.org Thu Jan 31 21:22:47 2008 From: kato-k at rubyforge.org (kato-k at rubyforge.org) Date: Thu, 31 Jan 2008 21:22:47 -0500 (EST) Subject: [ap4r-devel] [378] trunk/samples/HelloWorld/spec: Added spec' s require option to test without ap4r gem. Message-ID: <20080201022247.DC49118586D3@rubyforge.org> Revision: 378 Author: kato-k Date: 2008-01-31 21:22:46 -0500 (Thu, 31 Jan 2008) Log Message: ----------- Added spec's require option to test without ap4r gem. Modified Paths: -------------- trunk/samples/HelloWorld/spec/spec.opts Added Paths: ----------- trunk/samples/HelloWorld/spec/load_ap4r_without_gem.rb Added: trunk/samples/HelloWorld/spec/load_ap4r_without_gem.rb =================================================================== --- trunk/samples/HelloWorld/spec/load_ap4r_without_gem.rb (rev 0) +++ trunk/samples/HelloWorld/spec/load_ap4r_without_gem.rb 2008-02-01 02:22:46 UTC (rev 378) @@ -0,0 +1,5 @@ +# load non-gem ap4r. +# In the case of using gem ap4r, remove a require option from spec.opts. + +ap4r_path = File.expand_path(File.dirname(__FILE__)) + "/../../../ap4r/lib" +$LOAD_PATH << ap4r_path Modified: trunk/samples/HelloWorld/spec/spec.opts =================================================================== --- trunk/samples/HelloWorld/spec/spec.opts 2008-01-31 07:04:05 UTC (rev 377) +++ trunk/samples/HelloWorld/spec/spec.opts 2008-02-01 02:22:46 UTC (rev 378) @@ -1,3 +1,5 @@ +--require +./spec/load_ap4r_without_gem.rb --colour --format progress From kato-k at rubyforge.org Thu Jan 31 21:34:43 2008 From: kato-k at rubyforge.org (kato-k at rubyforge.org) Date: Thu, 31 Jan 2008 21:34:43 -0500 (EST) Subject: [ap4r-devel] [379] trunk/ap4r/lib/ap4r/carrier.rb: Added require rubygems to execute rake spec:local. Message-ID: <20080201023443.A49C018586D1@rubyforge.org> Revision: 379 Author: kato-k Date: 2008-01-31 21:34:43 -0500 (Thu, 31 Jan 2008) Log Message: ----------- Added require rubygems to execute rake spec:local. Modified Paths: -------------- trunk/ap4r/lib/ap4r/carrier.rb Modified: trunk/ap4r/lib/ap4r/carrier.rb =================================================================== --- trunk/ap4r/lib/ap4r/carrier.rb 2008-02-01 02:22:46 UTC (rev 378) +++ trunk/ap4r/lib/ap4r/carrier.rb 2008-02-01 02:34:43 UTC (rev 379) @@ -2,11 +2,12 @@ # Copyright:: Copyright (c) 2007 Future Architect Inc. # Licence:: MIT Licence +begin require 'rubygems'; rescue LoadError; end + require 'yaml' require 'thread' require 'pp' require 'active_support' - require 'reliable-msg' module Ap4r @@ -80,7 +81,7 @@ # local_queue = ReliableMsg::Queue.new queue_name # local_queue.put m.object # }.join - + #version 2: store tx and set nil, and resotre tx after putting a message begin tx = Thread.current[ReliableMsg::Client::THREAD_CURRENT_TX]