Skip to content

Commit

Permalink
KBP-131 #time 1.5h - intagrate bullet gem
Browse files Browse the repository at this point in the history
  • Loading branch information
FatihAvsan committed Oct 31, 2017
1 parent 8c6675e commit 90d4558
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/cybele.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
require 'cybele/helpers/recipient_interceptor'
require 'cybele/helpers/haml'
require 'cybele/helpers/locale_language'
require 'cybele/helpers/bullet'
require 'cybele/app_builder'
1 change: 1 addition & 0 deletions lib/cybele/app_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class AppBuilder < Rails::AppBuilder
include Cybele::Helpers::ShowFor
include Cybele::Helpers::Haml
include Cybele::Helpers::LocaleLanguage
include Cybele::Helpers::Bullet

def readme
template 'README.md.erb',
Expand Down
5 changes: 5 additions & 0 deletions lib/cybele/generators/app_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ def add_staging_secret_key
build :add_staging_secret_key_to_secrets_yml
end

def setup_bullet_config
say 'Setup bullet config'
build :configure_bullet
end

def goodbye
say 'Congratulations! That\'s all...', :green
end
Expand Down
22 changes: 22 additions & 0 deletions lib/cybele/helpers/bullet.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

module Cybele
module Helpers
module Bullet
def configure_bullet
config = <<-RUBY
config.after_initialize do
Bullet.enable = true
Bullet.alert = true
Bullet.bullet_logger = true
Bullet.console = true
Bullet.rails_logger = true
Bullet.add_footer = false
end
RUBY
bundle_command 'exec rails generate bullet:install'
configure_environment 'development', config
end
end
end
end
11 changes: 11 additions & 0 deletions spec/features/new_default_project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,15 @@
expect(File).not_to exist(file_project_path('app/views/layouts/application.html.erb'))
expect(File).to exist(file_project_path('app/views/layouts/application.html.haml'))
end

it 'uses bullet' do
gemfile_file = content('Gemfile')
expect(gemfile_file).to match("gem 'bullet'")

locale_file = content('config/environments/development.rb')
expect(locale_file).to match('Bullet')

locale_file = content('config/environments/test.rb')
expect(locale_file).not_to match('Bullet')
end
end
11 changes: 11 additions & 0 deletions spec/features/new_not_default_project_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,17 @@
expect(File).to exist(file_project_path('public/VERSION.txt'))
end

it 'uses bullet' do
gemfile_file = content('Gemfile')
expect(gemfile_file).to match("gem 'bullet'")

locale_file = content('config/environments/development.rb')
expect(locale_file).to match('Bullet')

locale_file = content('config/environments/test.rb')
expect(locale_file).not_to match('Bullet')
end

it 'do not use simple_form' do
gemfile_file = content('Gemfile')
expect(gemfile_file).not_to match(/^gem 'simple_form'/)
Expand Down
1 change: 1 addition & 0 deletions templates/Gemfile.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ gem 'roo', '~> 2.7', '>= 2.7.1'
group :development, :test do
gem 'colorize', '~> 0.8.1'
gem 'better_errors', '~> 2.4'
gem 'bullet', '~> 5.6', '>= 5.6.1'
end

0 comments on commit 90d4558

Please sign in to comment.