lib/jekyll/bower_plugin.rb in jekyll-bower-1.1.0 vs lib/jekyll/bower_plugin.rb in jekyll-bower-1.1.1
- old
+ new
@@ -25,24 +25,30 @@
system('bower install --allow-root')
end
print "Bower dependencies resolved successfully\n"
else
if site.config['bower']
- print "Resolving bower individually configured in config"
+ print "Resolving bower individually configured in config" + "\n"
site.config['bower'].each do |name, library|
- bower_command = 'bower install ' + library
- system(bower_command)
- if library =~ URI::regexp
- print "Identified bower downloaded dependency is a URL"
- print "Performing rename activity if possible"
- uri = URI.parse(library)
- filename = File.basename(uri.path, ".*")
- bowerOld = 'bower_components' + File::SEPARATOR + filename
- bowerNew = 'bower_components' + File::SEPARATOR + name
- File.rename(bowerOld, bowerNew)
- print "Renamed bower ("+filename+") library to " + name
+ unless File.exists?('bower_components' + File::SEPARATOR + name)
+ bower_command = 'bower install ' + library
+ system(bower_command)
+ if library =~ URI::regexp
+ print "Identified bower downloaded dependency is a URL" + "\n"
+ print "Performing rename activity if possible" + "\n"
+ uri = URI.parse(library)
+ filename = File.basename(uri.path, ".*")
+ bowerOld = 'bower_components' + File::SEPARATOR + filename
+ bowerNew = 'bower_components' + File::SEPARATOR + name
+ unless File.exists?(bowerNew)
+ File.rename(bowerOld, bowerNew)
+ print "Renamed bower ("+filename+") library to " + name + "\n"
+ end
+ end
+ print "Downloaded bower dependency: " + name + "\n"
+ else
+ print "Bower dependency exists, skipping download\n"
end
- print "Downloaded bower dependency: " + name
end
end
end
end
end
\ No newline at end of file