lib/gem2rpm/template.rb in gem2rpm-0.11.1 vs lib/gem2rpm/template.rb in gem2rpm-0.11.2
- old
+ new
@@ -23,18 +23,19 @@
# it tries to instantiate the template of specific name first. When
# options[:gem_file] is specified, it can be taken into consideration
# when looking for vagrant templates for example.
def self.find(name = nil, options = {})
if name.nil?
- case options[:gem_file]
+ gem_file = File.basename(options[:gem_file]) if options[:gem_file]
+ case gem_file
when /^vagrant(-|_).*/
- Gem2Rpm::VAGRANT_PLUGIN_TEMPLATE
+ Gem2Rpm.vagrant_plugin_template
else
- Gem2Rpm::RUBYGEM_TEMPLATE
+ Gem2Rpm.rubygem_template
end
else
begin
- if File.exists?(name)
+ if File.exists?(name)
Gem2Rpm::Template.new(name)
else
Gem2Rpm::Template.new(File.join(Gem2Rpm::Template::default_location, name + '.spec.erb'))
end
rescue TemplateError