<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>spec/controllers/page_events_controller_spec.rb</filename>
    </added>
    <added>
      <filename>spec/models/page_extensions_spec.rb</filename>
    </added>
    <added>
      <filename>spec/scenarios/pages_scenario.rb</filename>
    </added>
    <added>
      <filename>spec/scenarios/users_scenario.rb</filename>
    </added>
    <added>
      <filename>spec/spec.opts</filename>
    </added>
    <added>
      <filename>spec/spec_helper.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,15 +1,102 @@
+# I think this is the one that should be moved to the extension Rakefile template
+
+# In rails 1.2, plugins aren't available in the path until they're loaded.
+# Check to see if the rspec plugin is installed first and require
+# it if it is.  If not, use the gem version.
+
+# Determine where the RSpec plugin is by loading the boot
+unless defined? RADIANT_ROOT
+  ENV[&quot;RAILS_ENV&quot;] = &quot;test&quot;
+  case
+  when ENV[&quot;RADIANT_ENV_FILE&quot;]
+    require File.dirname(ENV[&quot;RADIANT_ENV_FILE&quot;]) + &quot;/boot&quot;
+  when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions}
+    require &quot;#{File.expand_path(File.dirname(__FILE__) + &quot;/../../../../../&quot;)}/config/boot&quot;
+  else
+    require &quot;#{File.expand_path(File.dirname(__FILE__) + &quot;/../../../&quot;)}/config/boot&quot;
+  end
+end
+
 require 'rake'
-require 'rake/testtask'
 require 'rake/rdoctask'
+require 'rake/testtask'
 
-desc 'Default: run unit tests.'
-task :default =&gt; :test
+rspec_base = File.expand_path(RADIANT_ROOT + '/vendor/plugins/rspec/lib')
+$LOAD_PATH.unshift(rspec_base) if File.exist?(rspec_base)
+require 'spec/rake/spectask'
+# require 'spec/translator'
 
-desc 'Test the page_event extension.'
-Rake::TestTask.new(:test) do |t|
-  t.libs &lt;&lt; 'lib'
-  t.pattern = 'test/**/*_test.rb'
-  t.verbose = true
+# Cleanup the RADIANT_ROOT constant so specs will load the environment
+Object.send(:remove_const, :RADIANT_ROOT)
+
+extension_root = File.expand_path(File.dirname(__FILE__))
+
+task :default =&gt; :spec
+task :stats =&gt; &quot;spec:statsetup&quot;
+
+desc &quot;Run all specs in spec directory&quot;
+Spec::Rake::SpecTask.new(:spec) do |t|
+  t.spec_opts = ['--options', &quot;\&quot;#{extension_root}/spec/spec.opts\&quot;&quot;]
+  t.spec_files = FileList['spec/**/*_spec.rb']
+end
+
+namespace :spec do
+  desc &quot;Run all specs in spec directory with RCov&quot;
+  Spec::Rake::SpecTask.new(:rcov) do |t|
+    t.spec_opts = ['--options', &quot;\&quot;#{extension_root}/spec/spec.opts\&quot;&quot;]
+    t.spec_files = FileList['spec/**/*_spec.rb']
+    t.rcov = true
+    t.rcov_opts = ['--exclude', 'spec', '--rails']
+  end
+  
+  desc &quot;Print Specdoc for all specs&quot;
+  Spec::Rake::SpecTask.new(:doc) do |t|
+    t.spec_opts = [&quot;--format&quot;, &quot;specdoc&quot;, &quot;--dry-run&quot;]
+    t.spec_files = FileList['spec/**/*_spec.rb']
+  end
+
+  [:models, :controllers, :views, :helpers].each do |sub|
+    desc &quot;Run the specs under spec/#{sub}&quot;
+    Spec::Rake::SpecTask.new(sub) do |t|
+      t.spec_opts = ['--options', &quot;\&quot;#{extension_root}/spec/spec.opts\&quot;&quot;]
+      t.spec_files = FileList[&quot;spec/#{sub}/**/*_spec.rb&quot;]
+    end
+  end
+  
+  # Hopefully no one has written their extensions in pre-0.9 style
+  # desc &quot;Translate specs from pre-0.9 to 0.9 style&quot;
+  # task :translate do
+  #   translator = ::Spec::Translator.new
+  #   dir = RAILS_ROOT + '/spec'
+  #   translator.translate(dir, dir)
+  # end
+
+  # Setup specs for stats
+  task :statsetup do
+    require 'code_statistics'
+    ::STATS_DIRECTORIES &lt;&lt; %w(Model\ specs spec/models)
+    ::STATS_DIRECTORIES &lt;&lt; %w(View\ specs spec/views)
+    ::STATS_DIRECTORIES &lt;&lt; %w(Controller\ specs spec/controllers)
+    ::STATS_DIRECTORIES &lt;&lt; %w(Helper\ specs spec/views)
+    ::CodeStatistics::TEST_TYPES &lt;&lt; &quot;Model specs&quot;
+    ::CodeStatistics::TEST_TYPES &lt;&lt; &quot;View specs&quot;
+    ::CodeStatistics::TEST_TYPES &lt;&lt; &quot;Controller specs&quot;
+    ::CodeStatistics::TEST_TYPES &lt;&lt; &quot;Helper specs&quot;
+    ::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/}
+  end
+
+  namespace :db do
+    namespace :fixtures do
+      desc &quot;Load fixtures (from spec/fixtures) into the current environment's database.  Load specific fixtures using FIXTURES=x,y&quot;
+      task :load =&gt; :environment do
+        require 'active_record/fixtures'
+        ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
+        (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/) : Dir.glob(File.join(RAILS_ROOT, 'spec', 'fixtures', '*.{yml,csv}'))).each do |fixture_file|
+          Fixtures.create_fixtures('spec/fixtures', File.basename(fixture_file, '.*'))
+        end
+      end
+    end
+  end
 end
 
 desc 'Generate documentation for the page_event extension.'
@@ -21,5 +108,13 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
   rdoc.rdoc_files.include('lib/**/*.rb')
 end
 
+# For extensions that are in transition
+desc 'Test the page_event extension.'
+Rake::TestTask.new(:test) do |t|
+  t.libs &lt;&lt; 'lib'
+  t.pattern = 'test/**/*_test.rb'
+  t.verbose = true
+end
+
 # Load any custom rakefiles for extension
 Dir[File.dirname(__FILE__) + '/tasks/*.rake'].sort.each { |f| require f }
\ No newline at end of file</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 module PageEvent::CalendarSupport
 
 	def events_for(selected_date)
-		events = Page.events_by_month(selected_date)
+		events = Page.events_by_month(selected_date, Status['published'].id)
 		events_by_date = {}
 		events.map do |e|
 			event_date = e.event_datetime.to_date</diff>
      <filename>lib/page_event/calendar_support.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,9 +5,12 @@ module PageEvent::PageExtensions
   end	
 
   module ClassMethods
-		def events_by_month(date = Time.now)
+		def events_by_month(date = Time.now, status = nil)
 			month_start = date.at_beginning_of_month
-			Page.find(:all,:conditions =&gt; &quot;event_datetime #{(month_start .. month_start.next_month - 1.minute).to_s(:db)}&quot;)		
+			condition_str = &quot;event_datetime #{(month_start .. month_start.next_month - 1.minute).to_s(:db)}&quot;
+			condition_str &lt;&lt; &quot; AND status_id = #{status}&quot;  if status
+			
+			Page.find(:all,:conditions =&gt; condition_str)		
 		end
 		
 		def event_count_by_month(date = Time.now)</diff>
      <filename>lib/page_event/page_extensions.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,32 +1,80 @@
 module PageEventTags
   include Radiant::Taggable
   include PageEvent::CalendarSupport
+  
 
+	desc %{
+    Will conditionally output its content if the current page has an event.
+    
+    *Usage:*
+    &lt;pre&gt;&lt;code&gt;&lt;r:event&gt;...&lt;/r:event&gt;&lt;/code&gt;&lt;/pre&gt;
+  }
 	tag &quot;event&quot; do |tag|
 		tag.expand if tag.locals.page.event_datetime
 	end
 
+# TODO do we need a to_date for any reason?
+	desc %{
+	  Will output the current event's date in the default format of MM/DD/YYYY, such as 07/15/2008
+  
+	  *Usage:*
+	  &lt;pre&gt;&lt;code&gt;&lt;r:event:date /&gt;&lt;/code&gt;&lt;/pre&gt;
+	}
 	tag &quot;event:date&quot; do |tag|
 		tag.locals.page.event_datetime.strftime(&quot;%m/%d/%Y&quot;) if tag.locals.page.event_datetime
 	end
+	
+	desc %{
+	  Will output the current event's time in the default format of HH:MM PM, such as 08:30 PM
   
+	  *Usage:*
+	  &lt;pre&gt;&lt;code&gt;&lt;r:event:time /&gt;&lt;/code&gt;&lt;/pre&gt;
+	}  
 	tag &quot;event:time&quot; do |tag|
 		tag.locals.page.event_datetime.strftime(&quot;%I:%M %p&quot;) if tag.locals.page.event_datetime
 	end
 	
+	tag &quot;events&quot; do |tag|
+		tag.expand
+	end
+	
+  desc %{
+    Returns the page with the next occurring event. Inside this tag all page attribute tags are mapped to
+    the this page. 
+    
+    *Usage:*
+    &lt;pre&gt;&lt;code&gt;&lt;r:events:next&gt;...&lt;/r:events:next&gt;&lt;/code&gt;&lt;/pre&gt;
+  }	
 	tag &quot;events:next&quot; do |tag|
 		if next_event = Page.next_event
       tag.locals.page = next_event
       tag.expand
     end
 	end	
-	
+
+  desc %{
+    Gives access to next three upcoming events' pages.
+    
+    *Usage:*
+    &lt;pre&gt;&lt;code&gt;&lt;r:events:upcoming&gt;...&lt;/r:events:upcoming&gt;&lt;/code&gt;&lt;/pre&gt;
+  }
 	tag &quot;events:upcoming&quot; do |tag|
     tag.locals.events = Page.upcoming_events
     tag.expand
 	end	
-	
+
+  desc %{
+    Cycles through each of the upcoming events. Inside this tag all page attribute tags
+    are mapped to the current event's page.
+    
+    *Usage:*
+    &lt;pre&gt;&lt;code&gt;&lt;r:events:upcoming:each&gt;
+     ...
+    &lt;/r:events:upcoming:each&gt;
+    &lt;/code&gt;&lt;/pre&gt;
+  }	
 	tag &quot;events:upcoming:each&quot; do |tag|
+		result = []
     tag.locals.events.each do |event|
       tag.locals.event = event
       tag.locals.page = event
@@ -40,7 +88,15 @@ module PageEventTags
     tag.expand
   end	
 	
-
+  desc %{
+    Displays a monthly calendar with any published events displayed on the date the event occurs
+    
+    *Usage:*
+    &lt;pre&gt;&lt;code&gt;&lt;r:events:upcoming:each&gt;
+     ...
+    &lt;/r:events:upcoming:each&gt;
+    &lt;/code&gt;&lt;/pre&gt;
+  }
 	tag	&quot;events:calendar&quot; do |tag|
 		params = tag.locals.page.request.parameters
 
@@ -54,7 +110,7 @@ module PageEventTags
 		
 		prev_month = selected_date - 1.month
 		next_month = selected_date + 1.month		
-		events_by_date = events_for(selected_date) # TODO - needs to limit events to the published status
+		events_by_date = events_for(selected_date)
 		
 		Date::MONTHNAMES[selected_date.mon]
 
@@ -111,50 +167,4 @@ module PageEventTags
 			end
     end		
 	end
-	
-	private
-	
-		def event_find_options(tag)
-	    attr = tag.attr.symbolize_keys
-    
-	    options = {}
-    
-	    [:limit, :offset].each do |symbol|
-	      if number = attr[symbol]
-	        if number =~ /^\d{1,4}$/
-	          options[symbol] = number.to_i
-	        else
-	          raise TagError.new(&quot;`#{symbol}' attribute of `each' tag must be a positive number between 1 and 4 digits&quot;)
-	        end
-	      end
-	    end
-    
-	    by = (attr[:by] || 'published_at').strip
-	    order = (attr[:order] || 'asc').strip
-	    order_string = ''
-	    if self.attributes.keys.include?(by)
-	      order_string &lt;&lt; by
-	    else
-	      raise TagError.new(&quot;`by' attribute of `each' tag must be set to a valid field name&quot;)
-	    end
-	    if order =~ /^(asc|desc)$/i
-	      order_string &lt;&lt; &quot; #{$1.upcase}&quot;
-	    else
-	      raise TagError.new(%{`order' attribute of `each' tag must be set to either &quot;asc&quot; or &quot;desc&quot;})
-	    end
-	    options[:order] = order_string
-    
-	    status = (attr[:status] || 'published').downcase
-	    unless status == 'all'
-	      stat = Status[status]
-	      unless stat.nil?
-	        options[:conditions] = [&quot;(virtual = ?) and (status_id = ?)&quot;, false, stat.id]
-	      else
-	        raise TagError.new(%{`status' attribute of `each' tag must be set to a valid status})
-	      end
-	    else
-	      options[:conditions] = [&quot;virtual = ?&quot;, false]
-	    end
-	    options
-	  end
 end
\ No newline at end of file</diff>
      <filename>lib/page_event_tags.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 
 class PageEventExtension &lt; Radiant::Extension
-  version &quot;0.1&quot;
+  version &quot;0.2&quot;
   description &quot;Allows you to add event dates to your pages that can be viewed on a site-wide calendar&quot;
   url &quot;http://martyhaught.com&quot;
   </diff>
      <filename>page_event_extension.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>test/fixtures/page_events.yml</filename>
    </removed>
    <removed>
      <filename>test/fixtures/pages.yml</filename>
    </removed>
    <removed>
      <filename>test/functional/page_event_extension_test.rb</filename>
    </removed>
    <removed>
      <filename>test/functional/page_events_controller_test.rb</filename>
    </removed>
    <removed>
      <filename>test/test_helper.rb</filename>
    </removed>
    <removed>
      <filename>test/unit/page_event_test.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>0280b13bad24438a0b7fa0668b4abec7a18e9141</id>
    </parent>
  </parents>
  <author>
    <name>Marty Haught</name>
    <email>mghaught@gmail.com</email>
  </author>
  <url>http://github.com/mghaught/radiant-page-event/commit/a508af0cbc8160221f624037f944e59cab5367fe</url>
  <id>a508af0cbc8160221f624037f944e59cab5367fe</id>
  <committed-date>2008-07-12T21:34:44-07:00</committed-date>
  <authored-date>2008-07-12T21:34:44-07:00</authored-date>
  <message>Remove Test:Unit and moved to Rspec and scenarios
Added &lt;r:events:next&gt; and &lt;r:events:upcoming&gt; tags
Calendar tag now only displays published events
Added doc for tag use.</message>
  <tree>7174d36c5fe40f3ed378fa18fba4baa195de8ad4</tree>
  <committer>
    <name>Marty Haught</name>
    <email>mghaught@gmail.com</email>
  </committer>
</commit>
