spec/fixtures/script.thor in thor-0.13.8 vs spec/fixtures/script.thor in thor-0.14.0

- old
+ new

@@ -1,7 +1,7 @@ class MyScript < Thor - check_unknown_options! + check_unknown_options! :except => :with_optional attr_accessor :some_attribute attr_writer :another_attribute attr_reader :another_attribute @@ -71,10 +71,13 @@ def name_with_dashes end method_options :all => :boolean method_option :lazy, :lazy_default => "yes" + method_option :lazy_numeric, :type => :numeric, :lazy_default => 42 + method_option :lazy_array, :type => :array, :lazy_default => %w[eat at joes] + method_option :lazy_hash, :type => :hash, :lazy_default => {'swedish' => 'meatballs'} desc "with_optional NAME", "invoke with optional name" def with_optional(name=nil) [ name, options ] end @@ -134,10 +137,17 @@ puts "That's going to leave a mark." else puts "Open sesame!" end end + + desc "paint [COLOR]", "paint the barn" + method_option :coats, :type => :numeric, :default => 2, :desc => 'how many coats of paint' + def paint(color='red') + puts "#{options[:coats]} coats of #{color} paint" + end + end module Scripts class MyScript < MyChildScript argument :accessor, :type => :string @@ -148,9 +158,11 @@ self.accessor end end class MyDefaults < Thor + check_unknown_options! + namespace :default desc "cow", "prints 'moo'" def cow puts "moo" end