Skip to content

Commit d54e772

Browse files
committed
Display an error message if not run from the root of the project, #186
1 parent d84a973 commit d54e772

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

bin/annotate

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
#!/usr/bin/env ruby
2+
3+
unless File.exists?('./Rakefile') || File.exists?('./Gemfile')
4+
abort "Please run annotate from the root of the project."
5+
end
6+
27
require 'rubygems'
38
begin
49
require 'bundler'
@@ -146,7 +151,6 @@ OptionParser.new do |opts|
146151

147152
end.parse!
148153

149-
150-
options=Annotate.setup_options({ :is_rake => !ENV['is_rake'].blank? })
154+
options = Annotate.setup_options({ :is_rake => ENV['is_rake'] && !ENV['is_rake'].empty? })
151155
Annotate.eager_load(options)
152156
target[:klass].send(target[:task], options)

0 commit comments

Comments
 (0)