rubygems_generators/executable/executable_generator.rb in newgem-1.0.3 vs rubygems_generators/executable/executable_generator.rb in newgem-1.0.4
- old
+ new
@@ -29,11 +29,15 @@
m.directory "test"
# App stub
m.template "bin/app.rb.erb", "bin/#{bin_name}"
m.template "lib/app/cli.rb.erb", "lib/#{bin_name}/cli.rb"
- m.template "test/test_cli.rb.erb", "test/test_#{bin_name}_cli.rb"
+ if using_rspec?
+ m.template "spec/cli_spec.rb.erb", "spec/#{bin_name}_cli_spec.rb"
+ else
+ m.template "test/test_cli.rb.erb", "test/test_#{bin_name}_cli.rb"
+ end
end
end
protected
def banner
@@ -53,7 +57,11 @@
"Default: none") { |x| options[:author] = x }
end
def extract_options
@author = options[:author]
+ end
+
+ def using_rspec?
+ !Dir[File.join(destination_root, 'spec')].empty?
end
end