diff options
-rw-r--r-- | lib/bundler/cli/gem.rb | 2 | ||||
-rw-r--r-- | lib/bundler/templates/newgem/Rakefile.tt | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/bundler/cli/gem.rb b/lib/bundler/cli/gem.rb index 231f3b3d..cbbaa277 100644 --- a/lib/bundler/cli/gem.rb +++ b/lib/bundler/cli/gem.rb @@ -22,6 +22,7 @@ module Bundler namespaced_path = name.tr('-', '/') constant_name = name.gsub(/-[_-]*(?![_-]|$)/){ '::' }.gsub(/([_-]+|(::)|^)(.|$)/){ $2.to_s + $3.upcase } constant_array = constant_name.split('::') + test_task = options[:test] == 'minitest' ? 'test' : 'spec' git_user_name = `git config user.name`.chomp git_user_email = `git config user.email`.chomp @@ -36,6 +37,7 @@ module Bundler :author => git_user_name.empty? ? "TODO: Write your name" : git_user_name, :email => git_user_email.empty? ? "TODO: Write your email address" : git_user_email, :test => options[:test], + :test_task => test_task, :ext => options[:ext], :bin => options[:bin], :bundler_version => bundler_dependency_version diff --git a/lib/bundler/templates/newgem/Rakefile.tt b/lib/bundler/templates/newgem/Rakefile.tt index 3d3fb674..edb93b4d 100644 --- a/lib/bundler/templates/newgem/Rakefile.tt +++ b/lib/bundler/templates/newgem/Rakefile.tt @@ -7,15 +7,12 @@ Rake::TestTask.new(:test) do |t| t.libs << "lib" t.test_files = FileList['test/**/*_test.rb'] end - -task :default => :test <% elsif config[:test] == 'rspec' -%> require "rspec/core/rake_task" RSpec::Core::RakeTask.new(:spec) - -task :default => :spec <% end -%> + <% if config[:ext] -%> require "rake/extensiontask" @@ -24,4 +21,8 @@ task :build => :compile Rake::ExtensionTask.new("<%=config[:underscored_name]%>") do |ext| ext.lib_dir = "lib/<%=config[:namespaced_path]%>" end + +task :default => [:clobber, :compile, :<%= config[:test_task] %>] +<% else -%> +task :default => :<%= config[:test_task] %> <% end -%> |