From 2cd0caaf7300d18a565cfe304997b42bca12a947 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Sat, 22 Sep 2012 11:20:04 -0400 Subject: [PATCH 1/3] Rename 4_resque_queues initializer to 4_resque --- config/initializers/{4_resque_queues.rb => 4_resque.rb} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename config/initializers/{4_resque_queues.rb => 4_resque.rb} (100%) diff --git a/config/initializers/4_resque_queues.rb b/config/initializers/4_resque.rb similarity index 100% rename from config/initializers/4_resque_queues.rb rename to config/initializers/4_resque.rb From 6ddbee5d89b3ea0e5d2a8f2b72416dcb7ab39fe5 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Sat, 22 Sep 2012 11:23:12 -0400 Subject: [PATCH 2/3] Consolidate all Resque-related initializers into "4_resque" --- config/initializers/4_resque.rb | 30 ++++++++++++++++++++ config/initializers/resque.rb | 8 ------ config/initializers/resque_authentication.rb | 14 --------- config/initializers/resque_mailer.rb | 1 - 4 files changed, 30 insertions(+), 23 deletions(-) delete mode 100644 config/initializers/resque.rb delete mode 100644 config/initializers/resque_authentication.rb delete mode 100644 config/initializers/resque_mailer.rb diff --git a/config/initializers/4_resque.rb b/config/initializers/4_resque.rb index 5b0087ab..2a5721ec 100644 --- a/config/initializers/4_resque.rb +++ b/config/initializers/4_resque.rb @@ -1 +1,31 @@ +# Custom Redis configuration +rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..' +rails_env = ENV['RAILS_ENV'] || 'development' +config_file = File.join(rails_root, 'config', 'resque.yml') + +if File.exists?(config_file) + resque_config = YAML.load_file(config_file) + Resque.redis = resque_config[rails_env] +end + +# Queues Resque.watch_queue(PostReceive.instance_variable_get("@queue")) + +# Authentication +require 'resque/server' +class Authentication + def initialize(app) + @app = app + end + + def call(env) + account = env['warden'].authenticate!(:database_authenticatable, :rememberable, scope: :user) + raise "Access denied" if !account.admin? + @app.call(env) + end +end + +Resque::Server.use Authentication + +# Mailer +Resque::Mailer.excluded_environments = [] diff --git a/config/initializers/resque.rb b/config/initializers/resque.rb deleted file mode 100644 index b333ceee..00000000 --- a/config/initializers/resque.rb +++ /dev/null @@ -1,8 +0,0 @@ -rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..' -rails_env = ENV['RAILS_ENV'] || 'development' -config_file = File.join(rails_root, 'config', 'resque.yml') - -if File.exists?(config_file) - resque_config = YAML.load_file(config_file) - Resque.redis = resque_config[rails_env] -end diff --git a/config/initializers/resque_authentication.rb b/config/initializers/resque_authentication.rb deleted file mode 100644 index a439d322..00000000 --- a/config/initializers/resque_authentication.rb +++ /dev/null @@ -1,14 +0,0 @@ -require 'resque/server' -class Authentication - def initialize(app) - @app = app - end - - def call(env) - account = env['warden'].authenticate!(:database_authenticatable, :rememberable, scope: :user) - raise "Access denied" if !account.admin? - @app.call(env) - end -end - -Resque::Server.use Authentication \ No newline at end of file diff --git a/config/initializers/resque_mailer.rb b/config/initializers/resque_mailer.rb deleted file mode 100644 index cec9dec9..00000000 --- a/config/initializers/resque_mailer.rb +++ /dev/null @@ -1 +0,0 @@ -Resque::Mailer.excluded_environments = [] From ad3eefdcb8cf08007c45876afea20109b5984876 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Sat, 22 Sep 2012 17:06:19 -0400 Subject: [PATCH 3/3] Minor grammar change [ci skip] --- app/views/events/_event_last_push.html.haml | 2 +- features/steps/dashboard/dashboard.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/events/_event_last_push.html.haml b/app/views/events/_event_last_push.html.haml index aa1d28f2..81b9994c 100644 --- a/app/views/events/_event_last_push.html.haml +++ b/app/views/events/_event_last_push.html.haml @@ -2,7 +2,7 @@ .event_lp %div = image_tag gravatar_icon(event.author_email), class: "avatar" - %span Your pushed to + %span You pushed to = event.ref_type = link_to project_commits_path(event.project, ref: event.ref_name) do %strong= truncate(event.ref_name, length: 28) diff --git a/features/steps/dashboard/dashboard.rb b/features/steps/dashboard/dashboard.rb index 6c603bbe..154b97e3 100644 --- a/features/steps/dashboard/dashboard.rb +++ b/features/steps/dashboard/dashboard.rb @@ -16,7 +16,7 @@ class Dashboard < Spinach::FeatureSteps end Then 'I should see last push widget' do - page.should have_content "Your pushed to branch new_design" + page.should have_content "You pushed to branch new_design" page.should have_link "Create Merge Request" end