Skip to content

Commit

Permalink
Remove all from reserved words.
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jun 23, 2009
1 parent 9ddba47 commit e93949e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/thor/base.rb
Expand Up @@ -9,7 +9,7 @@

class Thor
HELP_MAPPINGS = %w(-h -? --help -D)
THOR_RESERVED_WORDS = %w(all invoke shell options behavior root destination_root relative_root source_root)
THOR_RESERVED_WORDS = %w(invoke shell options behavior root destination_root relative_root source_root)

class Maxima < Struct.new(:usage, :options, :class_options)
end
Expand Down Expand Up @@ -391,7 +391,7 @@ def class_options_help(shell, ungrouped_name=nil) #:nodoc:
#
def is_thor_reserved_word?(word, type)
return false unless THOR_RESERVED_WORDS.include?(word.to_s)
raise ScriptError, "'#{word}' is a Thor reserved word and cannot be defined as #{type}"
raise "'#{word}' is a Thor reserved word and cannot be defined as #{type}"
end

# Build an option and adds it to the given scope.
Expand Down
5 changes: 3 additions & 2 deletions spec/base_spec.rb
Expand Up @@ -169,8 +169,9 @@ def hello

it "raises an error if a task with reserved word is defined" do
lambda {
MyCounter.class_eval "def all; end"
}.must raise_error(ScriptError, /'all' is a Thor reserved word and cannot be defined as task/)
klass = Class.new(Thor::Group)
klass.class_eval "def shell; end"
}.must raise_error(RuntimeError, /'shell' is a Thor reserved word and cannot be defined as task/)
end
end

Expand Down

0 comments on commit e93949e

Please sign in to comment.