Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@juanje
Created December 13, 2011 23:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanje/1474442 to your computer and use it in GitHub Desktop.
Save juanje/1474442 to your computer and use it in GitHub Desktop.
Install required library
diff --git a/providers/bookmarks.rb b/providers/bookmarks.rb
index ac470fa..f75fe11 100644
--- a/providers/bookmarks.rb
+++ b/providers/bookmarks.rb
@@ -1,4 +1,8 @@
-require ('sqlite3')
+begin
+ require 'sqlite3'
+rescue LoadError => e
+ Chef::Log.warn("Dependency 'gem' not loaded: #{e}")
+end
action :add do
if FileTest.exist? new_resource.sqlitedb
diff --git a/recipes/bookmarks.rb b/recipes/bookmarks.rb
index 5c850f3..880bf86 100644
--- a/recipes/bookmarks.rb
+++ b/recipes/bookmarks.rb
@@ -23,6 +23,12 @@
# limitations under the License.
#
+package 'libsqlite3-ruby' do
+ action :nothing
+end.run_action(:install)
+Gem.clear_paths
+require 'sqlite3'
+
users.each do |userdata|
username = userdata["id"]
sqlitefile = "/home/#{username}/.mozilla/firefox/firefox-firma/places.sqlite"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment