Permalink
Browse files

Added travis config, per-rails-version testing

  • Loading branch information...
1 parent f85d29d commit 02b250f6b5d530eefd4c46cd573b0bee57c3b372 @pyromaniac pyromaniac committed Feb 20, 2012
Showing with 90 additions and 202 deletions.
  1. +1 −0 .gitignore
  2. +21 −0 .travis.yml
  3. +16 −7 Gemfile
  4. +0 −68 Gemfile.lock
  5. +2 −0 README.md
  6. +5 −21 Rakefile
  7. +0 −1 VERSION
  8. +2 −2 lib/nested_set/railtie.rb
  9. +3 −0 lib/nested_set/version.rb
  10. +17 −78 nested_set.gemspec
  11. +2 −5 test/benchmarks.rb
  12. +5 −5 test/fixtures/category.rb
  13. +5 −5 test/nested_set_test.rb
  14. +11 −10 test/test_helper.rb
View
@@ -24,3 +24,4 @@ test/debug.log
rdoc
*.sw?
.bundle
+Gemfile.lock
View
@@ -0,0 +1,21 @@
+rvm:
+ - 1.8.7
+ - 1.9.2
+ - 1.9.3
+ - ruby-head
+
+env:
+ - RAILS_VERSION=3.0.11
+ - RAILS_VERSION=3.1.3
+ - RAILS_VERSION=3.2.1
+ - RAILS_VERSION=3-0-stable
+ - RAILS_VERSION=3-1-stable
+ - RAILS_VERSION=3-2-stable
+ - RAILS_VERSION=master
+
+matrix:
+ exclude:
+ - rvm: 1.9.2
+ env: RAILS_VERSION=master
+ - rvm: 1.8.7
+ env: RAILS_VERSION=master
View
23 Gemfile
@@ -1,11 +1,20 @@
source :rubygems
-gem "railties", ">= 3.0.0"
-gem "activerecord", ">= 3.0.0"
+gemspec
-group :development, :test do
- gem "sqlite3"
- gem "actionpack", ">= 3.0.0"
- gem "bench_press", ">= 0.3.1"
- gem "jeweler"
+case version = ENV['RAILS_VERSION'] || ">= 3.0.0"
+when /3-0-stable/
+ gem "rails", :git => "git://github.com/rails/rails.git", :branch => "3-0-stable"
+ gem "arel", :git => "git://github.com/rails/arel.git", :branch => "2-0-stable"
+when /3-1-stable/
+ gem "rails", :git => "git://github.com/rails/rails.git", :branch => "3-1-stable"
+when /3-2-stable/
+ gem "rails", :git => "git://github.com/rails/rails.git", :branch => "3-2-stable"
+ gem "journey", :git => "git://github.com/rails/journey.git"
+when /master/
+ gem "rails", :git => "git://github.com/rails/rails.git"
+ gem "arel", :git => "git://github.com/rails/arel.git"
+ gem "journey", :git => "git://github.com/rails/journey.git"
+else
+ gem "rails", version
end
View
@@ -1,68 +0,0 @@
-GEM
- remote: http://rubygems.org/
- specs:
- abstract (1.0.0)
- actionpack (3.0.3)
- activemodel (= 3.0.3)
- activesupport (= 3.0.3)
- builder (~> 2.1.2)
- erubis (~> 2.6.6)
- i18n (~> 0.4)
- rack (~> 1.2.1)
- rack-mount (~> 0.6.13)
- rack-test (~> 0.5.6)
- tzinfo (~> 0.3.23)
- activemodel (3.0.3)
- activesupport (= 3.0.3)
- builder (~> 2.1.2)
- i18n (~> 0.4)
- activerecord (3.0.3)
- activemodel (= 3.0.3)
- activesupport (= 3.0.3)
- arel (~> 2.0.2)
- tzinfo (~> 0.3.23)
- activesupport (3.0.3)
- arel (2.0.4)
- bench_press (0.3.1)
- activesupport (>= 2.3.5)
- facter (>= 1.5.7)
- httparty (>= 0.6.1)
- jeweler (>= 1.4.0)
- builder (2.1.2)
- crack (0.1.8)
- erubis (2.6.6)
- abstract (>= 1.0.0)
- facter (1.5.8)
- git (1.2.5)
- httparty (0.6.1)
- crack (= 0.1.8)
- i18n (0.4.2)
- jeweler (1.5.1)
- bundler (~> 1.0.0)
- git (>= 1.2.5)
- rake
- rack (1.2.1)
- rack-mount (0.6.13)
- rack (>= 1.0.0)
- rack-test (0.5.6)
- rack (>= 1.0)
- railties (3.0.3)
- actionpack (= 3.0.3)
- activesupport (= 3.0.3)
- rake (>= 0.8.7)
- thor (~> 0.14.4)
- rake (0.8.7)
- sqlite3 (1.3.4)
- thor (0.14.6)
- tzinfo (0.3.23)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- actionpack (>= 3.0.0)
- activerecord (>= 3.0.0)
- bench_press (>= 0.3.1)
- jeweler
- railties (>= 3.0.0)
- sqlite3
View
@@ -1,3 +1,5 @@
+[![Build Status](https://secure.travis-ci.org/skyeagle/nested_set.png)](http://travis-ci.org/skyeagle/nested_set)
+
# NestedSet
Nested Set is an implementation of the nested set pattern for ActiveRecord models. It is replacement for acts_as_nested_set and BetterNestedSet, but awesomer. It supports Rails 3.0 and later.
View
@@ -1,30 +1,12 @@
# encoding: utf-8
require 'rubygems'
-require 'bundler'
begin
- Bundler.setup(:default, :development)
-rescue Bundler::BundlerError => e
- $stderr.puts e.message
- $stderr.puts "Run `bundle install` to install missing gems"
- exit e.status_code
-end
-require 'rake'
-
-begin
- require 'jeweler'
- Jeweler::Tasks.new do |gem|
- gem.name = "nested_set"
- gem.summary = "An awesome nested set implementation for Active Record"
- gem.description = gem.summary
- gem.email = "info@collectiveidea.com"
- gem.homepage = "http://github.com/skyeagle/nested_set"
- gem.authors = ["Brandon Keepers", "Daniel Morrison"]
- end
- Jeweler::GemcutterTasks.new
+ require 'bundler/setup'
rescue LoadError
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
+require 'rake'
require 'rake/testtask'
Rake::TestTask.new(:test) do |test|
test.libs << 'lib' << 'test'
@@ -56,3 +38,5 @@ Rake::RDocTask.new do |rdoc|
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
+
+require "bundler/gem_tasks"
View
@@ -1 +0,0 @@
-1.6.8
@@ -16,8 +16,8 @@ class Railtie < ::Rails::Railtie
end
end
- def self.extend_active_record
- ActiveRecord::Base.send :include, CollectiveIdea::Acts::NestedSet::Base
+ def self.extend_active_record!
+ ::ActiveRecord::Base.send :include, CollectiveIdea::Acts::NestedSet::Base
end
end
end
@@ -0,0 +1,3 @@
+module NestedSet
+ VERSION = "1.6.8"
+end
View
@@ -1,86 +1,25 @@
-# Generated by jeweler
-# DO NOT EDIT THIS FILE DIRECTLY
-# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "nested_set/version"
Gem::Specification.new do |s|
- s.name = %q{nested_set}
- s.version = "1.6.8"
-
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Brandon Keepers", "Daniel Morrison"]
- s.date = %q{2011-08-31}
+ s.name = "nested_set"
+ s.version = NestedSet::VERSION
+ s.authors = ["Brandon Keepers", "Daniel Morrison"]
+ s.email = ["info@collectiveidea.com"]
+ s.homepage = "http://github.com/skyeagle/nested_set"
+ s.summary = %q{An awesome nested set implementation for Active Record}
s.description = %q{An awesome nested set implementation for Active Record}
- s.email = %q{info@collectiveidea.com}
- s.extra_rdoc_files = [
- "README.md"
- ]
- s.files = [
- ".autotest",
- "Gemfile",
- "Gemfile.lock",
- "MIT-LICENSE",
- "README.md",
- "Rakefile",
- "VERSION",
- "init.rb",
- "lib/nested_set.rb",
- "lib/nested_set/base.rb",
- "lib/nested_set/depth.rb",
- "lib/nested_set/descendants.rb",
- "lib/nested_set/helper.rb",
- "lib/nested_set/railtie.rb",
- "nested_set.gemspec",
- "rails/init.rb",
- "test/benchmarks.rb",
- "test/db/database.yml",
- "test/db/schema.rb",
- "test/fixtures/categories.yml",
- "test/fixtures/category.rb",
- "test/fixtures/departments.yml",
- "test/fixtures/notes.yml",
- "test/nested_set/helper_test.rb",
- "test/nested_set_test.rb",
- "test/test_helper.rb"
- ]
- s.homepage = %q{http://github.com/skyeagle/nested_set}
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
- s.rubygems_version = %q{1.6.2}
- s.summary = %q{An awesome nested set implementation for Active Record}
- s.test_files = [
- "test/benchmarks.rb",
- "test/db/schema.rb",
- "test/fixtures/category.rb",
- "test/nested_set/helper_test.rb",
- "test/nested_set_test.rb",
- "test/test_helper.rb"
- ]
- if s.respond_to? :specification_version then
- s.specification_version = 3
+ s.add_runtime_dependency(%q<railties>, [">= 3.0.0"])
+ s.add_runtime_dependency(%q<activerecord>, [">= 3.0.0"])
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<railties>, [">= 3.0.0"])
- s.add_runtime_dependency(%q<activerecord>, [">= 3.0.0"])
- s.add_development_dependency(%q<sqlite3>, [">= 0"])
- s.add_development_dependency(%q<actionpack>, [">= 3.0.0"])
- s.add_development_dependency(%q<bench_press>, [">= 0.3.1"])
- s.add_development_dependency(%q<jeweler>, [">= 0"])
- else
- s.add_dependency(%q<railties>, [">= 3.0.0"])
- s.add_dependency(%q<activerecord>, [">= 3.0.0"])
- s.add_dependency(%q<sqlite3>, [">= 0"])
- s.add_dependency(%q<actionpack>, [">= 3.0.0"])
- s.add_dependency(%q<bench_press>, [">= 0.3.1"])
- s.add_dependency(%q<jeweler>, [">= 0"])
- end
- else
- s.add_dependency(%q<railties>, [">= 3.0.0"])
- s.add_dependency(%q<activerecord>, [">= 3.0.0"])
- s.add_dependency(%q<sqlite3>, [">= 0"])
- s.add_dependency(%q<actionpack>, [">= 3.0.0"])
- s.add_dependency(%q<bench_press>, [">= 0.3.1"])
- s.add_dependency(%q<jeweler>, [">= 0"])
- end
+ s.add_development_dependency(%q<rails>, [">= 3.0.0"])
+ s.add_development_dependency(%q<sqlite3>, [">= 0"])
+ s.add_development_dependency(%q<bench_press>, [">= 0.3.1"])
end
-
View
@@ -4,14 +4,11 @@
$:.unshift(plugin_test_dir + '/../lib')
- #require 'logger'
- require 'active_support'
- require 'active_record'
+ require 'rails/all'
require 'nested_set'
require 'bench_press'
-
- CollectiveIdea::Acts::NestedSet::Railtie.extend_active_record
+ CollectiveIdea::Acts::NestedSet::Railtie.extend_active_record!
#ActiveRecord::Base.logger = Logger.new(plugin_test_dir + "/debug.log")
ActiveRecord::Base.configurations = YAML::load(IO.read(plugin_test_dir + "/db/database.yml"))
ActiveRecord::Base.establish_connection(ENV["DB"] || "sqlite3mem")
View
@@ -1,11 +1,11 @@
class Category < ActiveRecord::Base
- set_primary_key :not_default_id_name
+ self.primary_key = 'not_default_id_name'
acts_as_nested_set
-
+
def to_s
name
end
-
+
def recurse(&block)
block.call self, lambda{
self.children.each do |child|
@@ -27,8 +27,8 @@ class Category_DefaultScope < Category
end
class Category_WithCustomDestroy < ActiveRecord::Base
- set_table_name 'categories'
- set_primary_key :not_default_id_name
+ self.table_name = 'categories'
+ self.primary_key = 'not_default_id_name'
acts_as_nested_set
private :destroy
View
@@ -5,14 +5,14 @@ class Note < ActiveRecord::Base
end
class Default < ActiveRecord::Base
- set_table_name 'categories'
- set_primary_key :not_default_id_name
+ self.table_name = 'categories'
+ self.primary_key = 'not_default_id_name'
acts_as_nested_set
end
class ScopedCategory < ActiveRecord::Base
- set_table_name 'categories'
- set_primary_key :not_default_id_name
+ self.table_name = 'categories'
+ self.primary_key = 'not_default_id_name'
acts_as_nested_set :scope => :organization
end
@@ -836,7 +836,7 @@ def test_map_with_level
def test_model_with_attr_accessible
model = Class.new(ActiveRecord::Base)
- model.set_table_name 'categories'
+ model.table_name = 'categories'
model.attr_accessible :name
assert_nothing_raised do
model.acts_as_nested_set
View
@@ -1,21 +1,22 @@
+ENV["RAILS_ENV"] ||= "test"
+
plugin_test_dir = File.dirname(__FILE__)
$:.unshift(plugin_test_dir + '/../lib')
require 'rubygems'
require 'test/unit'
-require 'logger'
-require 'active_support'
-require 'active_support/test_case'
-require 'active_record'
-require 'action_pack'
-require 'action_view'
-require 'action_view/base'
-require 'action_view/template/handlers/erb'
-require 'action_view/test_case'
+require 'rails/all'
+if Rails.version < '3.1.0'
+ require 'action_view/base'
+ require 'action_view/template/handlers/erb'
+end
require 'nested_set'
-CollectiveIdea::Acts::NestedSet::Railtie.extend_active_record
+class NestedSetApplication < Rails::Application
+end
+
+CollectiveIdea::Acts::NestedSet::Railtie.extend_active_record!
ActiveRecord::Base.logger = Logger.new(plugin_test_dir + "/debug.log")

0 comments on commit 02b250f

Please sign in to comment.