From 6142c7a1a5dbdcc10e375e9be6b540df1d37648c Mon Sep 17 00:00:00 2001 From: hamdibayhan Date: Fri, 6 Oct 2017 17:17:10 +0300 Subject: [PATCH] KBP-128 #time 20m - Integrate rollbar GEM --- README.md | 8 +++++++- lib/cybele/app_builder.rb | 4 ++++ lib/cybele/generators/app_generator.rb | 5 +++++ templates/cybele_Gemfile.erb | 5 ++++- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a934c79..3bcae73 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,13 @@ cybele project_name When the initialization is completed, there will be some required settings. * Set .env.local variables -* Set access_token in config/initializers/rollbar.rb +* Set ENV['ROLLBAR_ACCESS_TOKEN'] for Rollbar. +* If Sidekiq will be use, you must open sidekiq option in config/initializers/rollbar.rb like the following: + ```ruby + config.use_sidekiq 'queue' => 'default' + ``` +* If you don't want to use Rollbar in development environment, you can disable for development environment in + in config/initializers/rollbar.rb * Set default values for is_active, time_zone variable using in User and Admin model migrations db/migrate/*.rb * Change username and password in config/settings.yml * In public folder run this command ln -s ../VERSION.txt VERSION.txt diff --git a/lib/cybele/app_builder.rb b/lib/cybele/app_builder.rb index f87fa2d..d1d0163 100644 --- a/lib/cybele/app_builder.rb +++ b/lib/cybele/app_builder.rb @@ -94,6 +94,10 @@ def fill_settings_yml prepend_file 'config/settings.yml', config end + def generate_rollbar + generate 'rollbar' + end + private def configure_environment(rails_env, config) diff --git a/lib/cybele/generators/app_generator.rb b/lib/cybele/generators/app_generator.rb index ff806f4..a196080 100644 --- a/lib/cybele/generators/app_generator.rb +++ b/lib/cybele/generators/app_generator.rb @@ -120,6 +120,11 @@ def fill_settings_yml build :fill_settings_yml end + def setup_rollbar + say 'Generate rollbar', :green + build :generate_rollbar + end + def goodbye say 'Congratulations! That\'s all...', :green end diff --git a/templates/cybele_Gemfile.erb b/templates/cybele_Gemfile.erb index 22c542a..83f7c7d 100644 --- a/templates/cybele_Gemfile.erb +++ b/templates/cybele_Gemfile.erb @@ -3,4 +3,7 @@ gem 'recipient_interceptor', '~> 0.1.2' # RailsConfig helps you easily manage environment specific Rails settings in an easy and usable manner -gem 'config', '~> 1.5' \ No newline at end of file +gem 'config', '~> 1.5' + +# Rollbar is an error tracking service. +gem 'rollbar', '~> 2.15', '>= 2.15.4' \ No newline at end of file