rails_generators/rtml/templates/lib/tasks/rtml.rake in rtml-2.0.1 vs rails_generators/rtml/templates/lib/tasks/rtml.rake in rtml-2.0.2

- old
+ new

@@ -14,14 +14,13 @@ namespace :rtml do desc "Generates RTML rdoc documentation in ./doc/rtml" Rake::RDocTask.new(:docs) do |rdoc| target_dir = File.expand_path(".") - chdir Rtml.root accessors = Rtml::Widget::RDOC_ACCESSORS.collect { |k,v| "#{k}=#{v}" }.join(",") - files = ['README.rdoc', 'History.txt', 'lib/**/*.rb', 'doc/**/*.rdoc', 'builtin/**/*.rb', - 'rails_generators/*/*.rb'] + files = FileList.new(['README.rdoc', 'History.txt', 'lib/**/*.rb', 'doc/**/*.rdoc', 'builtin/**/*.rb', + 'rails_generators/*/*.rb'].collect { |fi| File.join(Rtml.root, fi) }) rdoc.rdoc_files.add(files) rdoc.main = 'README.rdoc' rdoc.title = 'RubyTML 2.0 Documentation' #rdoc.template = '/path/to/gems/allison-2.0/lib/allison' rdoc.rdoc_dir = File.join(target_dir, 'doc/rtml') @@ -47,18 +46,29 @@ Spec::Rake::SpecTask.new(:test => spec_prereq) do |t| opts = "\"#{$root_dir || RAILS_ROOT}/spec/spec.opts\"" if File.exist?(opts) t.spec_opts = ['--options', opts] end + if $root_dir + t.ruby_opts << ['-r', File.join(Rtml.root, 'lib/rtml/init')] + end + if File.file?(File.join(RAILS_ROOT, "spec/spec_helper")) + t.ruby_opts << ['-r', File.join(RAILS_ROOT, "spec/spec_helper")] + end t.spec_files = FileList[File.join(Rtml.root, "spec/**/*_spec.rb")] end else task :test do puts "You need to have rspec, rspec-rails and webrat installed before you can run" puts "in-place testing." puts - puts "Make sure you've also run script/generate rspec, or you'll just see this" - puts "message again." + if defined?(RAILS_ROOT) && !$rtml_external + puts "Make sure you've also run script/generate rspec, or you'll just see this" + puts "message again." + else + puts "Make sure you've also got a spec folder, or you'll just see this message" + puts "again." + end end end task :noop end