lib/firebrew/firefox/extension.rb in firebrew-0.1.3 vs lib/firebrew/firefox/extension.rb in firebrew-0.2.0
- old
+ new
@@ -1,10 +1,10 @@
require 'fileutils'
require 'open-uri'
require 'json'
-require 'zip'
require 'rexml/document'
+require 'zip'
require 'firebrew/firefox/basic_extension'
module Firebrew::Firefox
class Extension < BasicExtension
class Manager
@@ -33,11 +33,11 @@
self.all.find{|ext| ext.name == name }
end
def find!(name)
result = self.find(name)
- raise Firebrew::ExtensionNotFoundError if result.nil?
+ raise Firebrew::ExtensionNotFoundError, "Extension not found: #{name}" if result.nil?
result
end
def install(extension)
dir = File.join(self.profile.path, 'extensions')
@@ -89,10 +89,10 @@
end
path
end
def fetch
- return @data if @data.present?
+ return @data unless @data.nil?
@data = JSON.load(File.read(self.data_path))
end
def push
json = JSON::pretty_generate(self.fetch, allow_nan: true, max_nesting: false)