Skip to content

Instantly share code, notes, and snippets.

@naag
Created January 27, 2015 21:39
Show Gist options
  • Save naag/0ada5e7cf852e05bf4b7 to your computer and use it in GitHub Desktop.
Save naag/0ada5e7cf852e05bf4b7 to your computer and use it in GitHub Desktop.
class Foo < Thor::Group
include Thor::Actions
# Define arguments and options
argument :name
class_option :test_framework, :default => :test_unit
def self.source_root
File.dirname(__FILE__)
end
#def create_lib_file
# template('templates/newgem.tt', "#{name}/lib/#{name}.rb")
#end
def create_test_file
test = options[:test_framework] == "rspec" ? :spec : :test
create_file "#{name}/#{test}/#{name}_#{test}.rb"
end
def copy_licence
if yes?("Use MIT license?")
# Make a copy of the MITLICENSE file at the source root
# copy_file "MITLICENSE", "#{name}/MITLICENSE"
else
say "Shame on you…", :red
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment