diff --git a/.gitignore b/.gitignore index 241bda6..a7d0512 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ .svn -.DS_Store \ No newline at end of file +.DS_Store +coverage +rdoc +pkg diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6dc3e7a --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2010 Sean Cribbs + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Rakefile b/Rakefile index c1638be..8d16e81 100644 --- a/Rakefile +++ b/Rakefile @@ -1,115 +1,46 @@ -# 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. +require 'rubygems' +require 'rake' -# Determine where the RSpec plugin is by loading the boot -unless defined? RADIANT_ROOT - ENV["RAILS_ENV"] = "test" - case - when ENV["RADIANT_ENV_FILE"] - require File.dirname(ENV["RADIANT_ENV_FILE"]) + "/boot" - when File.dirname(__FILE__) =~ %r{vendor/radiant/vendor/extensions} - require "#{File.expand_path(File.dirname(__FILE__) + "/../../../../../")}/config/boot" - else - require "#{File.expand_path(File.dirname(__FILE__) + "/../../../")}/config/boot" +begin + require 'jeweler' + Jeweler::Tasks.new do |gem| + gem.name = "radiant-aggregation-extension" + gem.summary = %Q{Aggregate the children of multiple pages.} + gem.description = %Q{Provides tags to aggregate the children of multiple pages as well as page types +to create aggregated archives.} + gem.email = "radiant@radiantcms.org" + gem.homepage = "http://github.com/radiant/radiant-aggregation-extension" + gem.authors = ["Sean Cribbs", "Jim Gay"] + gem.add_development_dependency "rspec" + # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings end + Jeweler::GemcutterTasks.new +rescue LoadError + puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler" end -require 'rake' -require 'rake/rdoctask' -require 'rake/testtask' - -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' - -# 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__)) - -# desc 'Default: run unit tests.' -# task :default => :test - -task :default => :spec -task :stats => "spec:statsetup" - -desc "Run all specs in spec directory" -Spec::Rake::SpecTask.new(:spec) do |t| - t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""] - t.spec_files = FileList['spec/**/*_spec.rb'] +Spec::Rake::SpecTask.new(:spec) do |spec| + spec.libs << 'lib' << 'spec' + spec.spec_files = FileList['spec/**/*_spec.rb'] end -namespace :spec do - desc "Run all specs in spec directory with RCov" - Spec::Rake::SpecTask.new(:rcov) do |t| - t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""] - t.spec_files = FileList['spec/**/*_spec.rb'] - t.rcov = true - t.rcov_opts = ['--exclude', 'spec', '--rails'] - end - - desc "Print Specdoc for all specs" - Spec::Rake::SpecTask.new(:doc) do |t| - t.spec_opts = ["--format", "specdoc", "--dry-run"] - t.spec_files = FileList['spec/**/*_spec.rb'] - end +Spec::Rake::SpecTask.new(:rcov) do |spec| + spec.libs << 'lib' << 'spec' + spec.pattern = 'spec/**/*_spec.rb' + spec.rcov = true +end - [:models, :controllers, :views, :helpers].each do |sub| - desc "Run the specs under spec/#{sub}" - Spec::Rake::SpecTask.new(sub) do |t| - t.spec_opts = ['--options', "\"#{extension_root}/spec/spec.opts\""] - t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"] - end - end +task :spec => :check_dependencies - # Setup specs for stats - task :statsetup do - require 'code_statistics' - ::STATS_DIRECTORIES << %w(Model\ specs spec/models) - ::STATS_DIRECTORIES << %w(View\ specs spec/views) - ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) - ::STATS_DIRECTORIES << %w(Helper\ specs spec/views) - ::CodeStatistics::TEST_TYPES << "Model specs" - ::CodeStatistics::TEST_TYPES << "View specs" - ::CodeStatistics::TEST_TYPES << "Controller specs" - ::CodeStatistics::TEST_TYPES << "Helper specs" - ::STATS_DIRECTORIES.delete_if {|a| a[0] =~ /test/} - end +task :default => :spec - namespace :db do - namespace :fixtures do - desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y" - task :load => :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 +require 'rake/rdoctask' +Rake::RDocTask.new do |rdoc| + version = File.exist?('VERSION') ? File.read('VERSION') : "" -desc 'Generate documentation for the aggregation extension.' -Rake::RDocTask.new(:rdoc) do |rdoc| rdoc.rdoc_dir = 'rdoc' - rdoc.title = 'AggregationExtension' - rdoc.options << '--line-numbers' << '--inline-source' - rdoc.rdoc_files.include('README') + rdoc.title = "radiant-aggregation-extension #{version}" + rdoc.rdoc_files.include('README*') rdoc.rdoc_files.include('lib/**/*.rb') end - -# For extensions that are in transition -desc 'Test the aggregation extension.' -Rake::TestTask.new(:test) do |t| - t.libs << '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 --git a/VERSION b/VERSION index 77d6f4c..3eefcb9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.0.0 +1.0.0 diff --git a/radiant-aggregation-extension.gemspec b/radiant-aggregation-extension.gemspec new file mode 100644 index 0000000..e6fa460 --- /dev/null +++ b/radiant-aggregation-extension.gemspec @@ -0,0 +1,60 @@ +# Generated by jeweler +# DO NOT EDIT THIS FILE DIRECTLY +# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{radiant-aggregation-extension} + s.version = "1.0.0" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Sean Cribbs", "Jim Gay"] + s.date = %q{2010-04-20} + s.description = %q{Provides tags to aggregate the children of multiple pages as well as page types +to create aggregated archives.} + s.email = %q{radiant@radiantcms.org} + s.extra_rdoc_files = [ + "LICENSE", + "README" + ] + s.files = [ + ".gitignore", + "README", + "Rakefile", + "VERSION", + "aggregation_extension.rb", + "app/models/aggregated_archive.rb", + "app/models/aggregated_archive_day.rb", + "app/models/aggregated_archive_month.rb", + "app/models/aggregated_archive_year.rb", + "lib/aggregation_tags.rb", + "lib/radiant-aggregation-extension.rb", + "lib/tasks/aggregation_extension_tasks.rake", + "spec/models/aggregation_tags_spec.rb", + "spec/spec.opts", + "spec/spec_helper.rb" + ] + s.homepage = %q{http://github.com/radiant/radiant-aggregation-extension} + s.rdoc_options = ["--charset=UTF-8"] + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.6} + s.summary = %q{Aggregate the children of multiple pages.} + s.test_files = [ + "spec/models/aggregation_tags_spec.rb", + "spec/spec_helper.rb" + ] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then + s.add_development_dependency(%q, [">= 0"]) + else + s.add_dependency(%q, [">= 0"]) + end + else + s.add_dependency(%q, [">= 0"]) + end +end +