Skip to content

Commit

Permalink
improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
Ismail Akbudak committed Aug 21, 2015
1 parent a5158f0 commit 1433ad6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
33 changes: 18 additions & 15 deletions lib/cybele/app_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,15 @@ def configure_smtp

config = <<-RUBY
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = false
config.action_mailer.smtp_settings = Settings.smtp.mandrill
config.action_mailer.raise_delivery_errors = false
config.action_mailer.smtp_settings = {
address: Settings.smtp.mandrill.address,
port: Settings.smtp.mandrill.port,
enable_starttls_auto: Settings.smtp.mandrill.enable_starttls_auto,
user_name: Settings.smtp.mandrill.user_name,
password: Settings.smtp.mandrill.password,
authentication: Settings.smtp.mandrill.authentication
}
RUBY

configure_environment 'production', config
Expand All @@ -134,14 +141,14 @@ def setup_staging_environment

config = <<-YML
email:
noreply: [email protected]
noreply: no-reply@#{app_name}.com
YML
prepend_file 'config/settings.yml', config
end

def configure_action_mailer
action_mailer_host 'development', "#{app_name}.dev"
action_mailer_host 'test', "#{app_name}.com"
action_mailer_host 'development', "localhost:3000"
action_mailer_host 'staging', "staging.#{app_name}.com"
action_mailer_host 'production', "#{app_name}.com"
end

Expand Down Expand Up @@ -191,12 +198,12 @@ def generate_exception_notification

def add_exception_notification_to_environments
config = <<-CODE
config.middleware.use ExceptionNotification::Rack,
:email => {
:email_prefix => "[Whatever] ",
:sender_address => %{"notifier" <notifier@example.com>},
:exception_recipients => %w{exceptions@example.com}
}
config.middleware.use ExceptionNotification::Rack,
:email => {
:email_prefix => "[#{app_name}]",
:sender_address => %{"Notifier" <notifier@#{app_name}.com>},
:exception_recipients => %w{your_email@address.com}
}
CODE

configure_environment('production', config)
Expand Down Expand Up @@ -453,10 +460,7 @@ def create_sanitizer_initializer(model_name)

def devise_parameter_sanitizer(model_name)
inject_into_file 'app/controllers/application_controller.rb', :after => 'protect_from_forgery with: :exception' do <<-CODE
protected
def devise_parameter_sanitizer
if resource_class == #{model_name.classify}
#{model_name.classify}::ParameterSanitizer.new(#{model_name.classify}, :#{model_name.parameterize}, params)
Expand Down Expand Up @@ -496,7 +500,6 @@ def add_set_user_time_zone_method_to_application_controller
def set_user_time_zone
Time.zone = current_user.time_zone if user_signed_in? && current_user.time_zone.present?
end
CODE
end
inject_into_file 'app/controllers/application_controller.rb', :after => 'class ApplicationController < ActionController::Base' do <<-CODE
Expand Down
2 changes: 1 addition & 1 deletion templates/app/controllers/hq/admin_profiles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Hq::AdminProfilesController < Hq::ApplicationController

before_action :check_profile, only: [:new, :create]
before_action :profile_controller, except: [:new, :create]
before_action :set_admin_profile, only: [:show, :edit, :update, :destroy]
before_action :set_admin_profile, only: [:show, :edit, :update]
add_breadcrumb I18n.t('activerecord.models.admin_profiles'), :hq_admin_profile_path

def show
Expand Down
4 changes: 2 additions & 2 deletions templates/app/controllers/user_profiles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class UserProfilesController < ApplicationController
before_action :authenticate_user!
before_action :check_profile, only: [:new, :create]
before_action :profile_controller, except: [:new, :create]
before_action :set_user_profile, only: [:show, :edit, :update, :destroy]
before_action :set_user_profile, only: [:show, :edit, :update]
add_breadcrumb I18n.t('activerecord.models.user_profiles'), :user_profile_path

def show
Expand Down Expand Up @@ -45,7 +45,7 @@ def check_profile
redirect_to user_profile_path
end
end

def set_user_profile
@user_profile = current_user.user_profile
end
Expand Down

0 comments on commit 1433ad6

Please sign in to comment.