rtml 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
data/lib/rtml/init.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
+
$root_dir = Dir.pwd
|
1
2
|
unless defined?(Rtml) && defined?(Rails)
|
3
|
+
$rtml_external = true
|
2
4
|
# Now, for some reason, Rails (ActiveSupport?) is removing a lot of existing directories from
|
3
5
|
# the load path. Probably for optimization, but kind of counterproductive for this edge case.
|
4
6
|
# So I'm going to back them up, and then re-add them.
|
@@ -77,6 +79,4 @@ unless defined?(Rtml) && defined?(Rails)
|
|
77
79
|
load File.join(File.dirname(__FILE__), '../../tasks/db.rake')
|
78
80
|
load 'tasks/routes.rake'
|
79
81
|
end
|
80
|
-
|
81
|
-
Dir.chdir RAILS_ROOT
|
82
82
|
end
|
data/lib/rtml/version.rb
CHANGED
@@ -16,10 +16,9 @@ namespace :rtml do
|
|
16
16
|
desc "Generates RTML rdoc documentation in ./doc/rtml"
|
17
17
|
Rake::RDocTask.new(:docs) do |rdoc|
|
18
18
|
target_dir = File.expand_path(".")
|
19
|
-
chdir Rtml.root
|
20
19
|
accessors = Rtml::Widget::RDOC_ACCESSORS.collect { |k,v| "#{k}=#{v}" }.join(",")
|
21
|
-
files = ['README.rdoc', 'History.txt', 'lib/**/*.rb', 'doc/**/*.rdoc', 'builtin/**/*.rb',
|
22
|
-
'rails_generators/*/*.rb']
|
20
|
+
files = FileList.new(['README.rdoc', 'History.txt', 'lib/**/*.rb', 'doc/**/*.rdoc', 'builtin/**/*.rb',
|
21
|
+
'rails_generators/*/*.rb'].collect { |fi| File.join(Rtml.root, fi) })
|
23
22
|
rdoc.rdoc_files.add(files)
|
24
23
|
rdoc.main = 'README.rdoc'
|
25
24
|
rdoc.title = 'RubyTML 2.0 Documentation'
|
@@ -49,6 +48,12 @@ namespace :rtml do
|
|
49
48
|
if File.exist?(opts)
|
50
49
|
t.spec_opts = ['--options', opts]
|
51
50
|
end
|
51
|
+
if $root_dir
|
52
|
+
t.ruby_opts << ['-r', File.join(Rtml.root, 'lib/rtml/init')]
|
53
|
+
end
|
54
|
+
if File.file?(File.join(RAILS_ROOT, "spec/spec_helper"))
|
55
|
+
t.ruby_opts << ['-r', File.join(RAILS_ROOT, "spec/spec_helper")]
|
56
|
+
end
|
52
57
|
t.spec_files = FileList[File.join(Rtml.root, "spec/**/*_spec.rb")]
|
53
58
|
end
|
54
59
|
else
|
@@ -56,8 +61,13 @@ namespace :rtml do
|
|
56
61
|
puts "You need to have rspec, rspec-rails and webrat installed before you can run"
|
57
62
|
puts "in-place testing."
|
58
63
|
puts
|
59
|
-
|
60
|
-
|
64
|
+
if defined?(RAILS_ROOT) && !$rtml_external
|
65
|
+
puts "Make sure you've also run script/generate rspec, or you'll just see this"
|
66
|
+
puts "message again."
|
67
|
+
else
|
68
|
+
puts "Make sure you've also got a spec folder, or you'll just see this message"
|
69
|
+
puts "again."
|
70
|
+
end
|
61
71
|
end
|
62
72
|
end
|
63
73
|
|
data/spec/spec_helper.rb
CHANGED
@@ -2,9 +2,6 @@ unless $rtml_spec_helper_already_loaded
|
|
2
2
|
$rtml_spec_helper_already_loaded = 1
|
3
3
|
$LOAD_PATH << File.join(File.dirname(__FILE__), 'support/app/controllers')
|
4
4
|
|
5
|
-
# this loads the Rails spec helper, if any, and reloads the current spec helper if run outside of a Rails project
|
6
|
-
# (ie, in the RTML working project dir). Reloading this file is safe thanks to $rtml_spec_helper_already_loaded == 1.
|
7
|
-
require 'spec_helper'
|
8
5
|
unless defined?(RAILS_ROOT)
|
9
6
|
require File.join(File.dirname(__FILE__), 'support/rails')
|
10
7
|
gem 'rspec-rails'
|
Binary file
|