Commit 73a84323 by Jeremy Olliver

Specify development dependencies and ensure correct loading of test libraries

parent 3fae3291
...@@ -45,6 +45,9 @@ Gem::Specification.new do |s| ...@@ -45,6 +45,9 @@ Gem::Specification.new do |s|
"spec/annotate_spec.rb", "spec/annotate_spec.rb",
"spec/spec_helper.rb" "spec/spec_helper.rb"
] ]
s.add_development_dependency('jeweler')
s.add_development_dependency('rspec', '~> 1.3.2')
s.add_development_dependency('activesupport', '>= 2.1.0')
if s.respond_to? :specification_version then if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
......
$:.unshift(File.dirname(__FILE__)) unless $:.unshift(File.dirname(__FILE__)) unless
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__))) $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
require 'yaml'
module Annotate module Annotate
def self.version def self.version
version_file = File.dirname(__FILE__) + "/../VERSION.yml" version_file = File.dirname(__FILE__) + "/../VERSION.yml"
......
...@@ -229,7 +229,7 @@ module AnnotateModels ...@@ -229,7 +229,7 @@ module AnnotateModels
# in subdirectories without namespacing. # in subdirectories without namespacing.
def get_model_class(file) def get_model_class(file)
require File.expand_path("#{model_dir}/#{file}") # this is for non-rails projects, which don't get Rails auto-require magic require File.expand_path("#{model_dir}/#{file}") # this is for non-rails projects, which don't get Rails auto-require magic
model = file.gsub(/\.rb$/, '').camelize model = ActiveSupport::Inflector.camelize(file.gsub(/\.rb$/, ''))
parts = model.split('::') parts = model.split('::')
begin begin
parts.inject(Object) {|klass, part| klass.const_get(part) } parts.inject(Object) {|klass, part| klass.const_get(part) }
......
require File.dirname(__FILE__) + '/../spec_helper.rb' require File.dirname(__FILE__) + '/../spec_helper.rb'
require 'annotate/annotate_models' require 'annotate/annotate_models'
require 'rubygems' require 'rubygems'
require 'activesupport' require 'active_support'
describe AnnotateModels do describe AnnotateModels do
......
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