Commit d5cff4cf by Jon Frisby

Improved code loading, incl. support for older versions of Rake.

parent 68f459be
source :rubygems source :rubygems
gem "rake" gem 'rake', '>= 0.8.7', :require => false
gem 'activesupport', '>= 2.3.0', :require => false
group :development do group :development do
gem 'mg' gem 'mg'
gem 'rspec'
gem 'wrong', '>=0.6.2'
gem 'files', '>=0.2.1'
platforms :ruby do platforms :ruby do
gem 'yard', :require => false gem 'yard', :require => false
end end
end end
gem 'activesupport', '>= 3.0.0', :require => nil group :development, :test do
gem 'rspec', :require => false
platforms :ruby do
gem 'pry', :require => false
gem 'pry-coolline', :require => false
end
end
group :test do
gem 'wrong', '>=0.6.2', :require => false
gem 'files', '>=0.2.1', :require => false
end
here = File.dirname __FILE__
# Note : this causes annoying psych warnings under Ruby 1.9.2-p180; to fix, upgrade to 1.9.3 # Note : this causes annoying psych warnings under Ruby 1.9.2-p180; to fix, upgrade to 1.9.3
begin begin
require 'bundler' require 'bundler'
...@@ -10,11 +8,19 @@ rescue Bundler::BundlerError => e ...@@ -10,11 +8,19 @@ rescue Bundler::BundlerError => e
exit e.status_code exit e.status_code
end end
require 'rake/dsl_definition' using_dsl = false
begin
require 'rake/dsl_definition'
using_dsl = true
rescue Exception => e
# We might just be on an old version of Rake...
end
require 'rake' require 'rake'
include Rake::DSL if(using_dsl)
include Rake::DSL
end
require "#{here}/lib/annotate" require "./lib/annotate"
# want other tests/tasks run by default? Add them to the list # want other tests/tasks run by default? Add them to the list
task :default => [:spec] task :default => [:spec]
......
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'rubygems'
begin
require 'bundler'
Bundler.setup
rescue Exception => e
end
here = File.expand_path(File.dirname __FILE__)
$:<< "#{here}/../lib"
require 'optparse' require 'optparse'
require 'rake/dsl_definition'
require 'rake'
begin begin
require "annotate" require 'rake/dsl_definition'
rescue LoadError rescue Exception => e
here = File.expand_path(File.dirname __FILE__) # We might just be on an old version of Rake...
$:<< "#{here}/../lib"
require "annotate"
end end
require 'rake'
require 'annotate'
task = :annotate_models task = :annotate_models
......
here = File.dirname __FILE__ $:.unshift(File.dirname(__FILE__))
require "#{here}/annotate/version" require 'annotate/version'
module Annotate module Annotate
def self.load_tasks def self.load_tasks
......
begin require 'rubygems'
require 'rspec' require 'bundler'
rescue LoadError Bundler.setup
require 'rubygems'
gem 'rspec'
require 'rspec'
end
require "wrong/adapters/rspec" require 'rspec'
require 'wrong/adapters/rspec'
$:.unshift(File.join(File.dirname(__FILE__), '../lib'))
$:.unshift(File.dirname(__FILE__))
$:.unshift(File.dirname(__FILE__) + '/../lib')
require 'active_support' require 'active_support'
require 'active_support/core_ext/string/inflections' require 'active_support/core_ext/string/inflections'
require 'annotate' require 'annotate'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment