Skip to content
Browse files

Merge pull request #23 from cloudpassage/master

This is related to Issue #20, added support for Appraisal and integrated the fix for AR 3.2
  • Loading branch information...
2 parents d17674e + a960624 commit c6b4ed4dc24a27662f1fff8a922ca5b7631c53d7 @isaacsanders isaacsanders committed May 14, 2012
View
11 Appraisals
@@ -0,0 +1,11 @@
+appraise "rails-3.2" do
+ gem 'rails', '~> 3.2.3'
+end
+
+appraise "rails-3.1" do
+ gem 'rails', '~> 3.1.3'
+end
+
+appraise "rails-3.0" do
+ gem 'rails', '~> 3.0.0'
+end
View
1 Gemfile
@@ -1,2 +1,3 @@
source "http://rubygems.org"
gemspec
+gem 'appraisal'
View
57 Gemfile.lock
@@ -2,40 +2,45 @@ PATH
remote: .
specs:
activerecord-nulldb-adapter (0.2.1)
- activerecord (>= 2.0.0, < 3.1)
+ activerecord (>= 2.0.0)
GEM
remote: http://rubygems.org/
specs:
- activemodel (3.0.8)
- activesupport (= 3.0.8)
- builder (~> 2.1.2)
- i18n (~> 0.5.0)
- activerecord (3.0.8)
- activemodel (= 3.0.8)
- activesupport (= 3.0.8)
- arel (~> 2.0.10)
- tzinfo (~> 0.3.23)
- activesupport (3.0.8)
- arel (2.0.10)
- builder (2.1.2)
- diff-lcs (1.1.2)
- i18n (0.5.0)
- rake (0.9.2)
- rspec (2.6.0)
- rspec-core (~> 2.6.0)
- rspec-expectations (~> 2.6.0)
- rspec-mocks (~> 2.6.0)
- rspec-core (2.6.4)
- rspec-expectations (2.6.0)
- diff-lcs (~> 1.1.2)
- rspec-mocks (2.6.0)
- tzinfo (0.3.27)
+ activemodel (3.2.3)
+ activesupport (= 3.2.3)
+ builder (~> 3.0.0)
+ activerecord (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activesupport (3.2.3)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ appraisal (0.4.1)
+ bundler
+ rake
+ arel (3.0.2)
+ builder (3.0.0)
+ diff-lcs (1.1.3)
+ i18n (0.6.0)
+ multi_json (1.3.4)
+ rake (0.9.2.2)
+ rspec (2.10.0)
+ rspec-core (~> 2.10.0)
+ rspec-expectations (~> 2.10.0)
+ rspec-mocks (~> 2.10.0)
+ rspec-core (2.10.0)
+ rspec-expectations (2.10.0)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.10.1)
+ tzinfo (0.3.33)
PLATFORMS
ruby
DEPENDENCIES
activerecord-nulldb-adapter!
- rake
+ appraisal
rspec (>= 1.2.9)
View
58 Rakefile
@@ -1,6 +1,7 @@
require 'rubygems'
require 'rake'
-require 'thread'
+require 'appraisal'
+require 'rspec/core/rake_task'
begin
require 'jeweler'
@@ -16,7 +17,6 @@ begin
gem.add_dependency 'activerecord', '>= 2.0.0'
gem.add_development_dependency "rspec", ">= 1.2.9"
- gem.files.exclude 'vendor/ginger'
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
Jeweler::GemcutterTasks.new
@@ -27,58 +27,10 @@ rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
end
-# We want to test ActiveRecord 3 against RSpec 2.x, and
-# prior versions of AR against RSpec 1.x. The task
-# definitions are different, and in order to allow ginger
-# to invoke a single task (:spec_for_ginger) that runs the
-# specs against the right version of RSpec, we dynamically
-# define the spec task with this method.
-def define_specs_task
- require 'active_record'
- require 'active_record/version'
+RSpec::Core::RakeTask.new(:spec)
+task :default => :spec
- if ActiveRecord::VERSION::MAJOR > 2
- # rspec 2
- require "rspec/core/rake_task"
- RSpec::Core::RakeTask.new(:specs) do |spec|
- spec.pattern = "spec/*_spec.rb"
- end
- else
- # rspec 1
- require 'spec/rake/spectask'
- Spec::Rake::SpecTask.new(:specs) do |spec|
- spec.libs << 'lib' << 'spec'
- spec.spec_files = FileList['spec/**/*_spec.rb']
- end
- end
-end
-
-desc "Run the specs"
-task :spec do
- define_specs_task
- Rake::Task[:specs].invoke
-end
-
-task :spec_for_ginger do
- $LOAD_PATH << File.join(*%w[vendor ginger lib])
- require 'ginger'
- define_specs_task
- Rake::Task[:specs].invoke
-end
-
-task :spec => :check_dependencies if defined?(Jeweler)
-
-desc 'Run ginger tests'
-task :ginger do
- $LOAD_PATH << File.join(*%w[vendor ginger lib])
- ARGV.clear
- ARGV << 'spec_for_ginger'
- load File.join(*%w[vendor ginger bin ginger])
-end
-
-task :default => :ginger
-
-require 'rake/rdoctask'
+require 'rdoc/task'
Rake::RDocTask.new do |rd|
rd.main = "README.rdoc"
rd.rdoc_files.include("README.rdoc", "LICENSE", "lib/**/*.rb")
View
8 gemfiles/rails-3.0.gemfile
@@ -0,0 +1,8 @@
+# This file was generated by Appraisal
+
+source "http://rubygems.org"
+
+gem "appraisal"
+gem "rails", "~> 3.0.0"
+
+gemspec :path=>"../"
View
97 gemfiles/rails-3.0.gemfile.lock
@@ -0,0 +1,97 @@
+PATH
+ remote: /Users/theocummings/cp/nulldb
+ specs:
+ activerecord-nulldb-adapter (0.2.1)
+ activerecord (>= 2.0.0)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ actionmailer (3.0.12)
+ actionpack (= 3.0.12)
+ mail (~> 2.2.19)
+ actionpack (3.0.12)
+ activemodel (= 3.0.12)
+ activesupport (= 3.0.12)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.5.0)
+ rack (~> 1.2.5)
+ rack-mount (~> 0.6.14)
+ rack-test (~> 0.5.7)
+ tzinfo (~> 0.3.23)
+ activemodel (3.0.12)
+ activesupport (= 3.0.12)
+ builder (~> 2.1.2)
+ i18n (~> 0.5.0)
+ activerecord (3.0.12)
+ activemodel (= 3.0.12)
+ activesupport (= 3.0.12)
+ arel (~> 2.0.10)
+ tzinfo (~> 0.3.23)
+ activeresource (3.0.12)
+ activemodel (= 3.0.12)
+ activesupport (= 3.0.12)
+ activesupport (3.0.12)
+ appraisal (0.4.1)
+ bundler
+ rake
+ arel (2.0.10)
+ builder (2.1.2)
+ diff-lcs (1.1.3)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ i18n (0.5.0)
+ json (1.7.1)
+ mail (2.2.19)
+ activesupport (>= 2.3.6)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.18)
+ polyglot (0.3.3)
+ rack (1.2.5)
+ rack-mount (0.6.14)
+ rack (>= 1.0.0)
+ rack-test (0.5.7)
+ rack (>= 1.0)
+ rails (3.0.12)
+ actionmailer (= 3.0.12)
+ actionpack (= 3.0.12)
+ activerecord (= 3.0.12)
+ activeresource (= 3.0.12)
+ activesupport (= 3.0.12)
+ bundler (~> 1.0)
+ railties (= 3.0.12)
+ railties (3.0.12)
+ actionpack (= 3.0.12)
+ activesupport (= 3.0.12)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.4)
+ rake (0.9.2.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ rspec (2.10.0)
+ rspec-core (~> 2.10.0)
+ rspec-expectations (~> 2.10.0)
+ rspec-mocks (~> 2.10.0)
+ rspec-core (2.10.0)
+ rspec-expectations (2.10.0)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.10.1)
+ thor (0.14.6)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.33)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ activerecord-nulldb-adapter!
+ appraisal
+ rails (~> 3.0.0)
+ rspec (>= 1.2.9)
View
8 gemfiles/rails-3.1.gemfile
@@ -0,0 +1,8 @@
+# This file was generated by Appraisal
+
+source "http://rubygems.org"
+
+gem "appraisal"
+gem "rails", "~> 3.1.3"
+
+gemspec :path=>"../"
View
108 gemfiles/rails-3.1.gemfile.lock
@@ -0,0 +1,108 @@
+PATH
+ remote: /Users/theocummings/cp/nulldb
+ specs:
+ activerecord-nulldb-adapter (0.2.1)
+ activerecord (>= 2.0.0)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.1.4)
+ actionpack (= 3.1.4)
+ mail (~> 2.3.0)
+ actionpack (3.1.4)
+ activemodel (= 3.1.4)
+ activesupport (= 3.1.4)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ i18n (~> 0.6)
+ rack (~> 1.3.6)
+ rack-cache (~> 1.1)
+ rack-mount (~> 0.8.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.0.3)
+ activemodel (3.1.4)
+ activesupport (= 3.1.4)
+ builder (~> 3.0.0)
+ i18n (~> 0.6)
+ activerecord (3.1.4)
+ activemodel (= 3.1.4)
+ activesupport (= 3.1.4)
+ arel (~> 2.2.3)
+ tzinfo (~> 0.3.29)
+ activeresource (3.1.4)
+ activemodel (= 3.1.4)
+ activesupport (= 3.1.4)
+ activesupport (3.1.4)
+ multi_json (~> 1.0)
+ appraisal (0.4.1)
+ bundler
+ rake
+ arel (2.2.3)
+ builder (3.0.0)
+ diff-lcs (1.1.3)
+ erubis (2.7.0)
+ hike (1.2.1)
+ i18n (0.6.0)
+ json (1.7.1)
+ mail (2.3.3)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.18)
+ multi_json (1.3.4)
+ polyglot (0.3.3)
+ rack (1.3.6)
+ rack-cache (1.2)
+ rack (>= 0.4)
+ rack-mount (0.8.3)
+ rack (>= 1.0.0)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.1.4)
+ actionmailer (= 3.1.4)
+ actionpack (= 3.1.4)
+ activerecord (= 3.1.4)
+ activeresource (= 3.1.4)
+ activesupport (= 3.1.4)
+ bundler (~> 1.0)
+ railties (= 3.1.4)
+ railties (3.1.4)
+ actionpack (= 3.1.4)
+ activesupport (= 3.1.4)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ rspec (2.10.0)
+ rspec-core (~> 2.10.0)
+ rspec-expectations (~> 2.10.0)
+ rspec-mocks (~> 2.10.0)
+ rspec-core (2.10.0)
+ rspec-expectations (2.10.0)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.10.1)
+ sprockets (2.0.4)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ thor (0.14.6)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.33)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ activerecord-nulldb-adapter!
+ appraisal
+ rails (~> 3.1.3)
+ rspec (>= 1.2.9)
View
8 gemfiles/rails-3.2.gemfile
@@ -0,0 +1,8 @@
+# This file was generated by Appraisal
+
+source "http://rubygems.org"
+
+gem "appraisal"
+gem "rails", "~> 3.2.3"
+
+gemspec :path=>"../"
View
106 gemfiles/rails-3.2.gemfile.lock
@@ -0,0 +1,106 @@
+PATH
+ remote: /Users/theocummings/cp/nulldb
+ specs:
+ activerecord-nulldb-adapter (0.2.1)
+ activerecord (>= 2.0.0)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (3.2.3)
+ actionpack (= 3.2.3)
+ mail (~> 2.4.4)
+ actionpack (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ builder (~> 3.0.0)
+ erubis (~> 2.7.0)
+ journey (~> 1.0.1)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.2)
+ rack-test (~> 0.6.1)
+ sprockets (~> 2.1.2)
+ activemodel (3.2.3)
+ activesupport (= 3.2.3)
+ builder (~> 3.0.0)
+ activerecord (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ arel (~> 3.0.2)
+ tzinfo (~> 0.3.29)
+ activeresource (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ activesupport (3.2.3)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ appraisal (0.4.1)
+ bundler
+ rake
+ arel (3.0.2)
+ builder (3.0.0)
+ diff-lcs (1.1.3)
+ erubis (2.7.0)
+ hike (1.2.1)
+ i18n (0.6.0)
+ journey (1.0.3)
+ json (1.7.1)
+ mail (2.4.4)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.18)
+ multi_json (1.3.4)
+ polyglot (0.3.3)
+ rack (1.4.1)
+ rack-cache (1.2)
+ rack (>= 0.4)
+ rack-ssl (1.3.2)
+ rack
+ rack-test (0.6.1)
+ rack (>= 1.0)
+ rails (3.2.3)
+ actionmailer (= 3.2.3)
+ actionpack (= 3.2.3)
+ activerecord (= 3.2.3)
+ activeresource (= 3.2.3)
+ activesupport (= 3.2.3)
+ bundler (~> 1.0)
+ railties (= 3.2.3)
+ railties (3.2.3)
+ actionpack (= 3.2.3)
+ activesupport (= 3.2.3)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (~> 0.14.6)
+ rake (0.9.2.2)
+ rdoc (3.12)
+ json (~> 1.4)
+ rspec (2.10.0)
+ rspec-core (~> 2.10.0)
+ rspec-expectations (~> 2.10.0)
+ rspec-mocks (~> 2.10.0)
+ rspec-core (2.10.0)
+ rspec-expectations (2.10.0)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.10.1)
+ sprockets (2.1.3)
+ hike (~> 1.2)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ thor (0.14.6)
+ tilt (1.3.3)
+ treetop (1.4.10)
+ polyglot
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.33)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ activerecord-nulldb-adapter!
+ appraisal
+ rails (~> 3.2.3)
+ rspec (>= 1.2.9)
View
29 ginger_scenarios.rb
@@ -1,29 +0,0 @@
-require 'ginger'
-
-def create_scenario(version)
- scenario = Ginger::Scenario.new("Rails #{version}")
- scenario[/^active_?record$/] = version
- scenario[/^active_?support$/] = version
- scenario
-end
-
-Ginger.configure do |config|
- config.aliases["active_record"] = "activerecord"
- config.aliases["active_support"] = "activesupport"
-
- versions = []
-
- # Rails 3 only works on Ruby 1.8.7 and 1.9.2
- if %w[1.8.7 1.9.2].include?(RUBY_VERSION)
- versions += %w(3.1.1 3.1.0 3.0.8)
- end
- versions += %w( 2.3.14 2.3.8 2.3.5 2.3.4 2.3.3 2.3.2 )
- versions += %w(
- 2.2.3 2.2.2
- 2.1.2 2.1.1 2.1.0
- 2.0.5 2.0.4 2.0.2 2.0.1 2.0.0
- ) if RUBY_VERSION =~ /^1\.8/
- versions.each do |version|
- config.scenarios << create_scenario(version)
- end
-end
View
1 lib/active_record/connection_adapters/nulldb_adapter.rb
@@ -120,6 +120,7 @@ def initialize(config={})
@schema_path = config.fetch(:schema){ "db/schema.rb" }
@config = config.merge(:adapter => :nulldb)
super(nil, @logger)
+ @visitor = Arel::Visitors::ToSql.new self if defined?(Arel::Visitors::ToSql)
end
# A log of every statement that has been "executed" by this connection adapter
View
2 spec/nulldb_spec.rb
@@ -1,7 +1,5 @@
require 'rubygems'
-$LOAD_PATH << File.join(File.dirname(__FILE__), *%w[.. vendor ginger lib])
-require 'ginger'
require 'active_record'
require 'active_record/version'
$: << File.join(File.dirname(__FILE__), "..", "lib")
View
1 vendor/ginger/.gitignore
@@ -1 +0,0 @@
-ginger*.gem
View
20 vendor/ginger/LICENCE
@@ -1,20 +0,0 @@
-Copyright (c) 2008 Pat Allan
-
-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.
View
55 vendor/ginger/README.textile
@@ -1,55 +0,0 @@
-Ginger is a small gem that allows you to test your projects using multiple versions of gem libraries. The idea is from "Ian White's garlic":http://github.com/ianwhite/garlic/tree - hence the related name of this - but my approach is a bit different, since I don't test my plugins from within a rails application. Maybe they can be merged at some point - I just hacked this up quickly to fit my needs.
-
-To get it all working, you need to do four things. The first is, of course, to install this gem.
-
-<pre><code>sudo gem install ginger --source=http://gemcutter.org</code></pre>
-
-Next, add the following line of code to your @spec_helper.rb@ file (or equivalent):
-
-<pre><code>require 'ginger'</code></pre>
-
-You'll want to put it as high up as possible - in particular, before any @require@ calls to libraries you want to cover multiple versions of.
-
-Step number three is creating the sets of scenarios in a file called @ginger_scenarios.rb@, which should go in the root, spec or test directory of your project. Here's an example, showing off the syntax possibilities.
-
-<pre><code>require 'ginger'
-
-Ginger.configure do |config|
- config.aliases["active_record"] = "activerecord"
-
- ar_1_2_6 = Ginger::Scenario.new
- ar_1_2_6[/^active_?record$/] = "1.15.6"
-
- ar_2_0_2 = Ginger::Scenario.new
- ar_2_0_2[/^active_?record$/] = "2.0.2"
-
- ar_2_1_1 = Ginger::Scenario.new
- ar_2_1_1[/^active_?record$/] = "2.1.1"
-
- config.scenarios << ar_1_2_6 << ar_2_0_2 << ar_2_1_1
-end</code></pre>
-
-Above, I've added three different scenarios, for three different versions of ActiveRecord. I also added an alias, as people sometimes use the underscore, and sometimes don't. The gem's name has no underscore though, so the _value_ of the alias matches the gem name (whereas the key would be alternative usage).
-
-You can have multiple gems set in each scenario - and you don't have to use regular expressions, you can just use straight strings.
-
-<pre><code>sphinx_scenario = Ginger::Scenario.new
-sphinx_scenario["riddle"] = "0.9.8"
-sphinx_scenario["thinking_sphinx"] = "0.9.8"</code></pre>
-
-Don't forget to add them to @config@'s scenarios collection, else they're not saved anywhere.
-
-To better discern different defined scenarios you can create them with a name. The name will be output when the scenario runs as the title.
-
-<pre><code>sphinx_scenario = Ginger::Scenario.new('Thinking Sphinx 0.9.8')</code></pre>
-
-And finally, you'll want to run the tests or specs for each scenario. This is done using the @ginger@ CLI tool, which parrots whatever parameters you give it onto @rake@. So just do something like:
-
-<pre><code>ginger spec
-ginger test
-ginger spec:unit</code></pre>
-
-h2. Contributors
-
-* "Adam Meehan":http://duckpunching.com/
-* "Darragh Curran":http://peelmeagrape.net/
View
6 vendor/ginger/Rakefile
@@ -1,6 +0,0 @@
-require 'rubygems'
-
-require 'tasks/distribution'
-require 'tasks/testing'
-
-task :default => :spec
View
1 vendor/ginger/VERSION
@@ -1 +0,0 @@
-1.2.0
View
45 vendor/ginger/bin/ginger
@@ -1,45 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'rubygems'
-require 'ginger'
-require 'rake'
-
-if ARGV.length == 0
- puts <<-USAGE
-ginger #{Ginger::Version::String}
-Use ginger to run specs for each scenario defined. Scenarios must be set out in
-a file called ginger_scenarios.rb wherever this tool is run. Once they're
-defined, then you can run this tool and provide the rake task that would
-normally be called.
-
-Examples:
- ginger spec
- ginger test
- ginger spec:models
-USAGE
- exit 0
-end
-
-file_path = File.join Dir.pwd, ".ginger"
-
-File.delete(file_path) if File.exists?(file_path)
-
-scenarios = Ginger::Configuration.instance.scenarios
-puts "No Ginger Scenarios defined" if scenarios.empty?
-
-scenarios.each_with_index do |scenario, index|
- puts <<-SCENARIO
-
--------------------
-Ginger Scenario: #{scenario.name || index+1}
--------------------
- SCENARIO
-
- File.open('.ginger', 'w') { |f| f.write index.to_s }
-
- system("rake #{ARGV.join(" ")}") || # Standard
- system("rake.bat #{ARGV.join(" ")}") || # Windows
- raise('Missing: rake or rake.bat. You might want to fix that.')
-end
-
-File.delete(file_path) if File.exists?(file_path)
View
59 vendor/ginger/ginger.gemspec
@@ -1,59 +0,0 @@
-# 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{ginger}
- s.version = "1.2.0"
-
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
- s.authors = ["Pat Allan"]
- s.date = %q{2009-11-27}
- s.default_executable = %q{ginger}
- s.description = %q{Run rake tasks multiple times with different gem versions.}
- s.email = %q{pat@freelancing-gods.com}
- s.executables = ["ginger"]
- s.extra_rdoc_files = [
- "README.textile"
- ]
- s.files = [
- "LICENCE",
- "README.textile",
- "bin/ginger",
- "lib/ginger.rb",
- "lib/ginger/configuration.rb",
- "lib/ginger/kernel.rb",
- "lib/ginger/scenario.rb"
- ]
- s.homepage = %q{http://github.com/freelancing_god/ginger/tree}
- s.rdoc_options = ["--charset=UTF-8"]
- s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.5}
- s.summary = %q{Run rake tasks multiple times with different gem versions.}
- s.test_files = [
- "spec/ginger",
- "spec/ginger/configuration_spec.rb",
- "spec/ginger/kernel_spec.rb",
- "spec/ginger/scenario_spec.rb",
- "spec/ginger_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<rspec>, [">= 1.2.9"])
- s.add_development_dependency(%q<yard>, [">= 0"])
- else
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
- s.add_dependency(%q<yard>, [">= 0"])
- end
- else
- s.add_dependency(%q<rspec>, [">= 1.2.9"])
- s.add_dependency(%q<yard>, [">= 0"])
- end
-end
-
View
14 vendor/ginger/lib/ginger.rb
@@ -1,14 +0,0 @@
-require 'rubygems'
-require 'ginger/configuration'
-require 'ginger/scenario'
-require 'ginger/kernel'
-
-module Ginger
- def self.configure(&block)
- yield Ginger::Configuration.instance
- end
-end
-
-Kernel.send(:include, Ginger::Kernel)
-
-Ginger::Configuration.detect_scenario_file
View
20 vendor/ginger/lib/ginger/configuration.rb
@@ -1,20 +0,0 @@
-require 'singleton'
-
-module Ginger
- class Configuration
- include Singleton
-
- attr_accessor :scenarios, :aliases
-
- def initialize
- @scenarios = []
- @aliases = {}
- end
-
- def self.detect_scenario_file
- ['.','spec','test'].each do |path|
- require "#{path}/ginger_scenarios" and break if File.exists?("#{path}/ginger_scenarios.rb")
- end
- end
- end
-end
View
56 vendor/ginger/lib/ginger/kernel.rb
@@ -1,56 +0,0 @@
-module Ginger
- module Kernel
- def self.included(base)
- base.class_eval do
- def require_with_ginger(req)
- unless scenario = ginger_scenario
- require_without_ginger(req)
- return
- end
-
- if scenario.version(req)
- gem ginger_gem_name(req)
- end
-
- require_without_ginger(req)
- end
-
- alias_method :require_without_ginger, :require
- alias_method :require, :require_with_ginger
-
- def gem_with_ginger(gem_name, *version_requirements)
- unless scenario = ginger_scenario
- gem_without_ginger(gem_name, *version_requirements)
- return
- end
-
- if version_requirements.length == 0 &&
- version = scenario.version(gem_name)
- version_requirements << "= #{version}"
- end
-
- gem_without_ginger(gem_name, *version_requirements)
- end
-
- alias_method :gem_without_ginger, :gem
- alias_method :gem, :gem_with_ginger
-
- private
-
- def ginger_scenario
- return nil unless File.exists?(".ginger")
-
- scenario = nil
- File.open('.ginger') { |f| scenario = f.read }
- return nil unless scenario
-
- Ginger::Configuration.instance.scenarios[scenario.to_i]
- end
-
- def ginger_gem_name(gem_name)
- Ginger::Configuration.instance.aliases[gem_name] || gem_name
- end
- end
- end
- end
-end
View
30 vendor/ginger/lib/ginger/scenario.rb
@@ -1,30 +0,0 @@
-module Ginger
- class Scenario < Hash
- attr_accessor :name
-
- def initialize(name=nil)
- @name = name
- end
-
- def add(gem, version)
- self[gem] = version
- end
-
- def version(gem)
- self.keys.each do |key|
- case key
- when String
- return self[key] if gem == key
- when Regexp
- return self[key] if gem =~ key
- end
- end
-
- return nil
- end
-
- def gems
- self.keys
- end
- end
-end
View
7 vendor/ginger/spec/ginger/configuration_spec.rb
@@ -1,7 +0,0 @@
-require File.dirname(__FILE__) + '/../spec_helper'
-
-describe Ginger::Configuration do
- it "should be a singleton class" do
- Ginger::Configuration.should respond_to(:instance)
- end
-end
View
7 vendor/ginger/spec/ginger/kernel_spec.rb
@@ -1,7 +0,0 @@
-require File.dirname(__FILE__) + '/../spec_helper'
-
-describe "Ginger::Kernel" do
- it "should description" do
- #
- end
-end
View
57 vendor/ginger/spec/ginger/scenario_spec.rb
@@ -1,57 +0,0 @@
-require File.dirname(__FILE__) + '/../spec_helper'
-
-describe Ginger::Scenario do
- it "should allow for multiple gem/version pairs" do
- scenario = Ginger::Scenario.new
- scenario.add "thinking_sphinx", "1.0"
- scenario.add "riddle", "0.9.8"
-
- scenario.gems.should include("thinking_sphinx")
- scenario.gems.should include("riddle")
- end
-
- it "should be able to be used as a hash" do
- scenario = Ginger::Scenario.new
- scenario["thinking_sphinx"] = "1.0"
- scenario["riddle"] = "0.9.8"
-
- scenario.gems.should include("thinking_sphinx")
- scenario.gems.should include("riddle")
- end
-
- it "should allow gem names to be regular expressions" do
- scenario = Ginger::Scenario.new
- scenario.add /^active_?record$/, "2.1.0"
-
- scenario.gems.first.should be_kind_of(Regexp)
- end
-
- it "should return the appropriate version for a given gem" do
- scenario = Ginger::Scenario.new
- scenario.add "riddle", "0.9.8"
-
- scenario.version("riddle").should == "0.9.8"
- end
-
- it "should use regular expressions to figure out matching version" do
- scenario = Ginger::Scenario.new
- scenario[/^active_?record$/] = "2.1.0"
-
- scenario.version("activerecord").should == "2.1.0"
- scenario.version("active_record").should == "2.1.0"
- end
-
- it "should return nil if no matching gem" do
- scenario = Ginger::Scenario.new
- scenario.add "riddle", "0.9.8"
-
- scenario.version("thinking_sphinx").should be_nil
- end
-
- it "should return name of scenario if defined" do
- scenario = Ginger::Scenario.new('Thinking Sphinx')
- scenario.add "riddle", "0.9.8"
-
- scenario.name.should == "Thinking Sphinx"
- end
-end
View
14 vendor/ginger/spec/ginger_spec.rb
@@ -1,14 +0,0 @@
-require File.dirname(__FILE__) + '/spec_helper'
-
-describe "Ginger" do
- it "should add scenarios to the Configuration instance" do
- Ginger.configure do |config|
- scenario = Ginger::Scenario.new
- scenario["riddle"] = "0.9.8"
-
- config.scenarios << scenario
- end
-
- Ginger::Configuration.instance.scenarios.length.should == 1
- end
-end
View
7 vendor/ginger/spec/spec_helper.rb
@@ -1,7 +0,0 @@
-$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
-
-require 'ginger'
-
-Spec::Runner.configure do |config|
- # ...
-end
View
28 vendor/ginger/tasks/distribution.rb
@@ -1,28 +0,0 @@
-require 'jeweler'
-require 'yard'
-
-YARD::Rake::YardocTask.new
-
-Jeweler::Tasks.new do |gem|
- gem.name = 'ginger'
- gem.summary = 'Run rake tasks multiple times with different gem versions.'
- gem.description = 'Run rake tasks multiple times with different gem versions.'
- gem.email = "pat@freelancing-gods.com"
- gem.homepage = "http://github.com/freelancing_god/ginger/tree"
- gem.authors = ["Pat Allan"]
-
- gem.add_development_dependency "rspec", ">= 1.2.9"
- gem.add_development_dependency "yard", ">= 0"
-
- gem.files = FileList[
- 'bin/*',
- 'lib/**/*.rb',
- 'LICENCE',
- 'README.textile'
- ]
- gem.test_files = FileList[
- 'spec/**/*'
- ]
-end
-
-Jeweler::GemcutterTasks.new
View
15 vendor/ginger/tasks/testing.rb
@@ -1,15 +0,0 @@
-require 'spec/rake/spectask'
-
-Spec::Rake::SpecTask.new(:spec) do |spec|
- spec.libs << 'lib' << 'spec'
- spec.spec_files = FileList['spec/**/*_spec.rb']
-end
-
-Spec::Rake::SpecTask.new(:rcov) do |spec|
- spec.libs << 'lib' << 'spec'
- spec.rcov_opts = ['--exclude', 'spec', '--exclude', 'gems']
- spec.pattern = 'spec/**/*_spec.rb'
- spec.rcov = true
-end
-
-task :spec => :check_dependencies

0 comments on commit c6b4ed4

Please sign in to comment.
Something went wrong with that request. Please try again.