From 9bab872e5bed99e848570979be215d7340adbe4a Mon Sep 17 00:00:00 2001 From: Sean Grove Date: Mon, 25 Jul 2011 19:37:23 -0700 Subject: [PATCH] Updated gem hooks for bushido claimed event --- Gemfile | 2 +- Gemfile.lock | 16 +++++++++++----- lib/locomotive/hosting/bushido/enabler.rb | 4 +++- lib/locomotive/hosting/bushido/hooks.rb | 7 +++++++ 4 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 lib/locomotive/hosting/bushido/hooks.rb diff --git a/Gemfile b/Gemfile index 3202a1cb..e0af41e6 100644 --- a/Gemfile +++ b/Gemfile @@ -78,6 +78,6 @@ group :test do end group :production do - gem 'bushido' + gem 'bushido', :git => 'git://github.com/Bushido/bushidogem.git' end diff --git a/Gemfile.lock b/Gemfile.lock index ccbbd3ee..38f00731 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,13 @@ +GIT + remote: git://github.com/Bushido/bushidogem.git + revision: 42dee66bb6a89d6e65e2b474289d37b0790a9913 + specs: + bushido (0.0.30) + highline (>= 1.6.1) + json (>= 1.4.6) + orm_adapter (~> 0.0.3) + rest-client (>= 1.6.1) + GIT remote: git://github.com/Bushido/devise_cas_authenticatable.git revision: 0e5a949fba02629b4ee18a59c0ff410cea523829 @@ -67,10 +77,6 @@ GEM bson (1.3.1) bson_ext (1.3.1) builder (2.1.2) - bushido (0.0.30) - highline (>= 1.6.1) - json (>= 1.4.6) - rest-client (>= 1.6.1) cancan (1.6.5) capybara (1.0.0) mime-types (>= 1.16) @@ -296,7 +302,7 @@ DEPENDENCIES actionmailer-with-request autotest bson_ext (~> 1.3.0) - bushido + bushido! bushido_stub! cancan capybara diff --git a/lib/locomotive/hosting/bushido/enabler.rb b/lib/locomotive/hosting/bushido/enabler.rb index 6eedb962..008795a4 100644 --- a/lib/locomotive/hosting/bushido/enabler.rb +++ b/lib/locomotive/hosting/bushido/enabler.rb @@ -26,6 +26,8 @@ module Locomotive end def enable_bushido! + require './lib/locomotive/hosting/bushido/hooks' + self.config.domain = ENV['APP_TLD'] unless self.config.multi_sites? self.config.devise_modules = [:cas_authenticatable, :rememberable, :trackable] @@ -134,4 +136,4 @@ module Locomotive end end end -end \ No newline at end of file +end diff --git a/lib/locomotive/hosting/bushido/hooks.rb b/lib/locomotive/hosting/bushido/hooks.rb new file mode 100644 index 00000000..ad0680af --- /dev/null +++ b/lib/locomotive/hosting/bushido/hooks.rb @@ -0,0 +1,7 @@ +Bushido::Hooks.listen("app.claimed") do |data| + puts "Saving #{account.inspect} with incoming data #{data.inspect}" + + account = Account.first + account.email = data["email"] + account.save +end