Browse Source

add pry and bullet

anxgang 5 years ago
parent
commit
28ff7bff83
1 changed files with 37 additions and 4 deletions
  1. 37 4
      template.rb

+ 37 - 4
template.rb

@@ -2,10 +2,8 @@ require "fileutils"
 require "shellwords"
 
 # Copied from: https://github.com/mattbrictson/rails-template
-# Add this template directory to source_paths so that Thor actions like
-# copy_file and template resolve against our source files. If this file was
-# invoked remotely via HTTP, that means the files are not present locally.
-# In that case, use `git clone` to download them to a local temporary dir.
+# Copied from: https://github.com/excid3/jumpstart
+
 def add_template_repository_to_source_path
   if __FILE__ =~ %r{\Ahttps?://}
     require "tmpdir"
@@ -55,6 +53,11 @@ def add_gems
   gem 'sitemap_generator', '~> 6.0', '>= 6.0.1'
   gem 'whenever', require: false
 
+  gem_group :development do
+    gem 'pry'
+    gem 'bullet'
+  end
+
   if rails_5?
     gsub_file "Gemfile", /gem 'sqlite3'/, "gem 'sqlite3', '~> 1.3.0'"
     gem 'webpacker', '~> 4.0.1'
@@ -246,6 +249,34 @@ def add_sitemap
   rails_command "sitemap:install"
 end
 
+def add_bullet
+  conf = <<-RUBY
+    config.after_initialize do
+      Bullet.enable = true
+      # Bullet.sentry = true
+      # Bullet.alert = true
+      # Bullet.bullet_logger = true
+      Bullet.console = true
+      # Bullet.growl = true
+      # Bullet.xmpp = { :account  => 'bullets_account@jabber.org',
+      #                 :password => 'bullets_password_for_jabber',
+      #                 :receiver => 'your_account@jabber.org',
+      #                 :show_online_status => true }
+      # Bullet.rails_logger = true
+      # Bullet.honeybadger = true
+      # Bullet.bugsnag = true
+      # Bullet.airbrake = true
+      # Bullet.rollbar = true
+      Bullet.add_footer = true
+      # Bullet.stacktrace_includes = [ 'your_gem', 'your_middleware' ]
+      # Bullet.stacktrace_excludes = [ 'their_gem', 'their_middleware', ['my_file.rb', 'my_method'], ['my_file.rb', 16..20] ]
+      # Bullet.slack = { webhook_url: 'http://some.slack.url', channel: '#default', username: 'notifier' }
+    end
+  RUBY
+  
+  environment(conf, env: 'development')
+end
+
 # Main setup
 add_template_repository_to_source_path
 
@@ -267,6 +298,8 @@ after_bundle do
   add_whenever
   add_sitemap
 
+  add_bullet
+
   # Migrate
   rails_command "db:create"
   rails_command "db:migrate"