rails_app_generator 0.1.11 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +22 -0
  3. data/after_templates/addons/honeybadger/_.rb +46 -0
  4. data/after_templates/addons/honeybadger/app/controllers/application_controller.rb +9 -0
  5. data/after_templates/addons/honeybadger/app/controllers/errors_controller.rb +17 -0
  6. data/after_templates/addons/honeybadger/app/controllers/products_controller.rb +72 -0
  7. data/after_templates/addons/honeybadger/app/views/home/index.html.erb +49 -0
  8. data/after_templates/addons/honeybadger/public/404.html +69 -0
  9. data/after_templates/addons/honeybadger/public/500.html +68 -0
  10. data/after_templates/addons/rails_html_sanitizer/home/index.html.erb +30 -2
  11. data/after_templates/addons/twilio_ruby/_.rb +23 -0
  12. data/after_templates/addons/twilio_ruby/app/controllers/home_controller.rb +54 -0
  13. data/after_templates/addons/twilio_ruby/app/views/home/index.html.erb +27 -0
  14. data/after_templates/addons/twilio_ruby/config/initializers/twilio.rb +4 -0
  15. data/lib/rails_app_generator/add_on.rb +36 -0
  16. data/lib/rails_app_generator/addons/honeybadger.rb +19 -0
  17. data/lib/rails_app_generator/app_generator.rb +134 -116
  18. data/lib/rails_app_generator/options/rails_options.rb +3 -0
  19. data/lib/rails_app_generator/version.rb +1 -1
  20. data/package-lock.json +2 -2
  21. data/package.json +1 -1
  22. data/profiles/addons/{rails_html_sanitizer.json → honeybadger.json} +3 -3
  23. data/profiles/addons/twilio_ruby.json +12 -0
  24. data/tasks/addon.thor +45 -8
  25. data/tasks/profile.thor +26 -20
  26. data/templates/addons/honeybadger/en.yml +10 -0
  27. data/templates/addons/honeybadger/honeybadger.sample.yml +37 -0
  28. data/templates/thor_task/addon/addon.tt +13 -6
  29. data/templates/thor_task/profile/after_template.rb.tt +30 -1
  30. data/templates/thor_task/profile/home/index.html.erb.tt +10 -0
  31. metadata +18 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b44292560d4550ab186996b836d0fb0c84fb5d17ea6cf7b6c72df0c6d5fac33c
4
- data.tar.gz: 46074355f3d140e76c0722c99111d0fccfcbc3b5cba1e6f905e76985b7629196
3
+ metadata.gz: 75a314b07d31b22d3aa8c2249efa2884d59f4d6ec2aa13966e52ded99aa8aa79
4
+ data.tar.gz: ee79c7ebb7828f2cc5fe27ae226f107f841947185d3c21ba4f4a0e6fcb7b3323
5
5
  SHA512:
6
- metadata.gz: caf678cc3d14eadd3f04e537fba8e6bdad98f3b078d34ba449206d87902c43818bca2a0302245e227b9dc368616ace587ab200aaac1046dd41d24ea9887295f8
7
- data.tar.gz: 9d4147b99276b596098e73931d755b0ffbbda649fd214e503b7f3476a52ea955d0dea881ea0ecbba1a1e5492e1ca84eefef542b8025fa3b0f43ee2f03aa5bed3
6
+ metadata.gz: 7011a7def931cb0ca1e5e7502372cad5da9f9887e2195b6f708963f1a34205cd74cd6812f877c77fa98faf3dc590d15f256319085af79416f98fd67480ddf0af
7
+ data.tar.gz: 6ee2229ccce12d2dcba53b841125ac72cc2a07dfe6432b21029395460efb704e8621697c833fdc77fbaaf9520347aac08562adf16de6e17b86cd31284de678ce
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## [0.1.13](https://github.com/klueless-io/rails_app_generator/compare/v0.1.12...v0.1.13) (2022-08-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * add honeybadger addon ([5118957](https://github.com/klueless-io/rails_app_generator/commit/511895750056a8eff7bc41c0cc902ff81cfcd7d3))
7
+ * add honeybadger addon + cops ([e105b47](https://github.com/klueless-io/rails_app_generator/commit/e105b47790c2a91a0a9ec0224f8a7aecb75067a9))
8
+
9
+ ## [0.1.12](https://github.com/klueless-io/rails_app_generator/compare/v0.1.11...v0.1.12) (2022-08-02)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * update rails-html-sanitizer example ([7f3a2d8](https://github.com/klueless-io/rails_app_generator/commit/7f3a2d810a968748baf4f8a4a147b086a26781c0))
15
+
16
+ ## [0.1.11](https://github.com/klueless-io/rails_app_generator/compare/v0.1.10...v0.1.11) (2022-08-02)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * add thor task to create profiles ([0ec4ae0](https://github.com/klueless-io/rails_app_generator/commit/0ec4ae01a2879fc627422cb79e4cbc685e78dcb8))
22
+
1
23
  ## [0.1.10](https://github.com/klueless-io/rails_app_generator/compare/v0.1.9...v0.1.10) (2022-08-02)
2
24
 
3
25
 
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ # require 'pry'
4
+
5
+ # Make managing application errors a more pleasant experience.
6
+ #
7
+ # exe/rag addons/honeybadger
8
+ # see: https://honeybadger.wistia.com/medias/l3cmyucx8f
9
+
10
+ self.local_template_path = File.dirname(__FILE__)
11
+
12
+ gac 'base rails 7 image created'
13
+
14
+ add_controller('home', 'index')
15
+ route("root 'home#index'")
16
+
17
+ force_copy
18
+
19
+ copy_file 'app/views/home/index.html.erb', 'app/views/home/index.html.erb'
20
+ copy_file 'app/controllers/application_controller.rb', 'app/controllers/application_controller.rb'
21
+ copy_file 'app/controllers/errors_controller.rb', 'app/controllers/errors_controller.rb'
22
+
23
+ # Test if this is really needed
24
+ insert_into_file 'config/application.rb', after: 'class Application < Rails::Application' do
25
+ <<-RUBY
26
+ config.generators.system_tests = nil
27
+ RUBY
28
+ end
29
+
30
+ copy_file 'public/404.html', 'public/404.html'
31
+ copy_file 'public/500.html', 'public/500.html'
32
+
33
+ copy_file 'config/locales/en.yml', 'config/locales/en.yml'
34
+
35
+ move_file('config/honeybadger.sample.yml', 'config/honeybadger.yml')
36
+
37
+ after_bundle do
38
+ setup_db
39
+ end
40
+
41
+ def setup_db
42
+ add_scaffold('product', 'name', 'price:integer')
43
+ copy_file 'app/controllers/products_controller.rb', 'app/controllers/products_controller.rb'
44
+
45
+ db_migrate
46
+ end
@@ -0,0 +1,9 @@
1
+ class ApplicationController < ActionController::Base
2
+ before_action do |_|
3
+ Honeybadger.context(
4
+ user_email: 'klueless-io@example.com',
5
+ name: 'David',
6
+ company: 'AppyDave'
7
+ )
8
+ end
9
+ end
@@ -0,0 +1,17 @@
1
+ class ErrorsController < ApplicationController
2
+ def not_found
3
+ render status: 404
4
+ end
5
+
6
+ def internal_server
7
+ render status: 500
8
+ end
9
+
10
+ def unprocessable
11
+ render status: 422
12
+ end
13
+
14
+ def unacceptable
15
+ render status: 406
16
+ end
17
+ end
@@ -0,0 +1,72 @@
1
+ class ProductsController < ApplicationController
2
+ before_action :set_product, only: %i[ show edit update destroy ]
3
+
4
+ # GET /products or /products.json
5
+ def index
6
+ @products = Product.all
7
+ end
8
+
9
+ # GET /products/1 or /products/1.json
10
+ def show
11
+ end
12
+
13
+ # GET /products/new
14
+ def new
15
+ # remove this comment to see error in Honeybadger
16
+ raise 'Oh No!'
17
+ @product = Product.new
18
+ end
19
+
20
+ # GET /products/1/edit
21
+ def edit
22
+ end
23
+
24
+ # POST /products or /products.json
25
+ def create
26
+ @product = Product.new(product_params)
27
+
28
+ respond_to do |format|
29
+ if @product.save
30
+ format.html { redirect_to product_url(@product), notice: "Product was successfully created." }
31
+ format.json { render :show, status: :created, location: @product }
32
+ else
33
+ format.html { render :new, status: :unprocessable_entity }
34
+ format.json { render json: @product.errors, status: :unprocessable_entity }
35
+ end
36
+ end
37
+ end
38
+
39
+ # PATCH/PUT /products/1 or /products/1.json
40
+ def update
41
+ respond_to do |format|
42
+ if @product.update(product_params)
43
+ format.html { redirect_to product_url(@product), notice: "Product was successfully updated." }
44
+ format.json { render :show, status: :ok, location: @product }
45
+ else
46
+ format.html { render :edit, status: :unprocessable_entity }
47
+ format.json { render json: @product.errors, status: :unprocessable_entity }
48
+ end
49
+ end
50
+ end
51
+
52
+ # DELETE /products/1 or /products/1.json
53
+ def destroy
54
+ @product.destroy
55
+
56
+ respond_to do |format|
57
+ format.html { redirect_to products_url, notice: "Product was successfully destroyed." }
58
+ format.json { head :no_content }
59
+ end
60
+ end
61
+
62
+ private
63
+ # Use callbacks to share common setup or constraints between actions.
64
+ def set_product
65
+ @product = Product.find(params[:id])
66
+ end
67
+
68
+ # Only allow a list of trusted parameters through.
69
+ def product_params
70
+ params.require(:product).permit(:name, :price)
71
+ end
72
+ end
@@ -0,0 +1,49 @@
1
+ <h1>Honeybadger</h1>
2
+
3
+ <h2>Make managing application errors a more pleasant experience.</h2>
4
+
5
+ <p>Follow the instructions below and then click on products -> new</p>
6
+
7
+ <%= link_to 'Products', products_path %>
8
+
9
+ <h2>Instructions</h2>
10
+
11
+ <p>If you want to see 404/500 HTML inplace of the debug routing error when in development then alter the following file</p>
12
+
13
+ <b>config/environments/development.rb</b>
14
+ <pre>
15
+
16
+ # config.consider_all_requests_local = true
17
+ config.consider_all_requests_local = false
18
+
19
+ </pre>
20
+
21
+ <p>If you want to see the exception message in Honeybadger then make sure then remove the comment<p>
22
+
23
+ <b>config/honeybadger.yml</b>
24
+
25
+ <pre>
26
+ # report_data: true
27
+ report_data: true
28
+ </pre>
29
+
30
+ <p>If you want to send the exception message to Honeybadger then make sure your remove development from the list<p>
31
+
32
+ <pre>
33
+ # development_environments:
34
+ - test
35
+ - development
36
+ - cucumber
37
+ </pre>
38
+
39
+ <p>Test frrom the command line using</p>
40
+
41
+ <pre>
42
+ bundle exec honeybadger test
43
+ </pre>
44
+
45
+ <p>More information can be found at
46
+ <a href="http://honeybadger.io/">http://honeybadger.io/</a> and
47
+ <a hreg="https://honeybadger.wistia.com/medias/l3cmyucx8f">https://honeybadger.wistia.com/medias/l3cmyucx8f</a>
48
+
49
+ </p>
@@ -0,0 +1,69 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ <!-- HONEYBADGER FEEDBACK -->
67
+ <!-- HONEYBADGER ERROR -->
68
+ </body>
69
+ </html>
@@ -0,0 +1,68 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/500.html -->
59
+ <!-- HONEYBADGER FEEDBACK -->
60
+ <!-- HONEYBADGER ERROR -->
61
+ <div class="dialog">
62
+ <div>
63
+ <h1>We're sorry, but something went wrong.</h1>
64
+ </div>
65
+ <p>If you are the application owner check the logs for more information.</p>
66
+ </div>
67
+ </body>
68
+ </html>
@@ -1,3 +1,31 @@
1
- <h1>Rails html sanitizer</h1>
1
+ <h1>Rails HTML Sanitizer</h1>
2
2
 
3
- <h2>HTML sanitization for Rails applications</h2>
3
+ <p>Read more here <a href="https://github.com/rails/rails-html-sanitizer">rails-html-sanitizer</a></p>
4
+
5
+ <textarea rows="4" cols="200">
6
+ full_sanitizer = Rails::Html::FullSanitizer.new
7
+ full_sanitizer.sanitize("<b>Bold</b> no more! <a href='more.html'>See more here</a>...")
8
+ </textarea>
9
+
10
+ <hr>
11
+ <%=
12
+ Rails::Html::FullSanitizer
13
+ .new
14
+ .sanitize("<b>Bold</b> no more! <a href='more.html'>See more here</a>...")
15
+ %>
16
+
17
+ <br/><br/><br/>
18
+
19
+ <hr>
20
+
21
+ <textarea rows="4" cols="200">
22
+ link_sanitizer = Rails::Html::LinkSanitizer.new
23
+ link_sanitizer.sanitize('<a href="example.com">Only the link text will be kept.</a>')
24
+ # => Only the link text will be kept.
25
+ </textarea>
26
+
27
+ <%=
28
+ Rails::Html::LinkSanitizer
29
+ .new
30
+ .sanitize('<a href="example.com">Only the link text will be kept.</a>')
31
+ %>
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ # require 'pry'
4
+
5
+ # The official library for communicating with the Twilio REST API, building TwiML, and generating Twilio JWT Capability Tokens
6
+ #
7
+ # exe/rag addons/twilio_ruby
8
+
9
+ self.local_template_path = File.dirname(__FILE__)
10
+
11
+ gac 'base rails 7 image created'
12
+
13
+ add_controller('home', 'index')
14
+ route("root 'home#index'")
15
+ route("get 'home/send_sms'")
16
+
17
+ # route("root 'home#index'")
18
+
19
+ force_copy
20
+
21
+ copy_file 'app/controllers/home_controller.rb', 'app/controllers/home_controller.rb'
22
+ copy_file 'app/views/home/index.html.erb', 'app/views/home/index.html.erb'
23
+ copy_file 'config/initializers/twilio.rb', 'config/initializers/twilio.rb'
@@ -0,0 +1,54 @@
1
+ class HomeController < ApplicationController
2
+ after_action -> { flash.discard }, if: -> { request.xhr? }
3
+
4
+ def index
5
+ end
6
+
7
+ def send_sms
8
+ client = Twilio::REST::Client.new
9
+
10
+ message = client.messages.create(
11
+ to: ENV['TWILIO_MY_PHONE'],
12
+ body: "#{Time.now.strftime("%I:%M %p")} - #{random_message}",
13
+ messaging_service_sid: ENV['TWILIO_MESSAGING_SERVICE_SID']
14
+ )
15
+
16
+ flash.notice = "Message sent to #{message.to} with ID #{message.sid}<br />#{message.body}".html_safe
17
+
18
+ render 'home/index'
19
+ rescue Twilio::REST::RestError => error
20
+ error_message = "#{error.code} - #{error.message}"
21
+ error_message = "Invalid 'To' Phone Number" if error.code == 21211
22
+ error_message = "Not found" if error.code == 20404
23
+ flash.alert = error_message
24
+ puts '22222222222'
25
+ render 'home/index'
26
+ end
27
+
28
+ private
29
+
30
+ def random_message
31
+ [
32
+ "The changing of down comforters to cotton bedspreads always meant the squirrels had returned.",
33
+ "The father died during childbirth.",
34
+ "It's much more difficult to play tennis with a bowling ball than it is to bowl with a tennis ball.",
35
+ "Jason lived his life by the motto, 'Anything worth doing is worth doing poorly.'",
36
+ "It was difficult for Mary to admit that most of her workout consisted of exercising poor judgment.",
37
+ "Their argument could be heard across the parking lot.",
38
+ "The mysterious diary records the voice.",
39
+ "My secretary is the only person who truly understands my stamp-collecting obsession.",
40
+ "They did nothing as the raccoon attacked the lady’s bag of food.",
41
+ "It was the first time he had ever seen someone cook dinner on an elephant.",
42
+ "I had a friend in high school named Rick Shaw, but he was fairly useless as a mode of transport.",
43
+ "She was amazed by the large chunks of ice washing up on the beach.",
44
+ "On each full moon",
45
+ "Check back tomorrow; I will see if the book has arrived.",
46
+ "A good example of a useful vegetable is medicinal rhubarb.",
47
+ "Beach-combing replaced wine tasting as his new obsession.",
48
+ "While on the first date he accidentally hit his head on the beam.",
49
+ "The balloons floated away along with all my hopes and dreams.",
50
+ "For the 216th time, he said he would quit drinking soda after this last Coke.",
51
+ "The swirled lollipop had issues with the pop rock candy."
52
+ ].sample
53
+ end
54
+ end
@@ -0,0 +1,27 @@
1
+ <style>
2
+ .alert { color: red; }
3
+ .notice { color: green; }
4
+ </style>
5
+
6
+ <% flash.each do |type, msg| %>
7
+ <div class="<%= type%>"><%= msg %></div>
8
+ <% end %>
9
+ <% if flash.any? %>
10
+ <hr />
11
+ <% end %>
12
+
13
+ <h1>Twilio ruby</h1>
14
+
15
+ <h2>The official library for communicating with the Twilio REST API, building TwiML, and generating Twilio JWT Capability Tokens</h2>
16
+
17
+ <%= link_to 'Send SMS', home_send_sms_path %>
18
+ <!--
19
+ Add/Remove as needed
20
+ -->
21
+
22
+ <!--
23
+ <= link_to 'Products', products_path %> |
24
+ <= link_to 'Posts', posts_path %> |
25
+ <= link_to 'People', people_path %>
26
+ -->
27
+
@@ -0,0 +1,4 @@
1
+ Twilio.configure do |config|
2
+ config.account_sid = ENV['TWILIO_ACCOUNT_SID']
3
+ config.auth_token = ENV['TWILIO_AUTH_TOKEN']
4
+ end
@@ -21,6 +21,7 @@ module RailsAppGenerator
21
21
  def apply; end
22
22
 
23
23
  # list any methods that you want access to, but not to be exposed as a thor command
24
+ # rubocop:disable Metrics/BlockLength
24
25
  no_commands do
25
26
  def source_paths
26
27
  [
@@ -43,7 +44,42 @@ module RailsAppGenerator
43
44
  klass = addon_name.nil? ? self.class : self.class.get(addon_name)
44
45
  Dependencies.new(klass, context).satisfied?
45
46
  end
47
+
48
+ def read_template(template_file)
49
+ path = find_in_source_paths(template_file)
50
+
51
+ File.read(path)
52
+ end
53
+
54
+ # Moves a file at given location, to another location. Both files are relative to the destination_root
55
+ #
56
+ # ==== Parameters
57
+ # path<String>:: source_path of the file to be moved (relative to destination_root)
58
+ # path<String>:: target_path of the file moving to (relative to destination_root)
59
+ # config<Hash>:: give :verbose => false to not log the status.
60
+ #
61
+ # ==== Example
62
+ #
63
+ # move_file 'README', 'readme.md'
64
+ # move_file 'config/xmen.sample.yml', 'config/xmen.yml
65
+ #
66
+ # rubocop:disable Metrics/AbcSize
67
+ def move_file(source_path, target_path, config = {})
68
+ source = File.expand_path(source_path, destination_root)
69
+ target = File.expand_path(target_path, destination_root)
70
+ config.merge!({ verbose: true })
71
+
72
+ say_status :move_file_source, relative_to_original_destination_root(source), config.fetch(:verbose, true)
73
+ say_status :move_file_source, relative_to_original_destination_root(target), config.fetch(:verbose, true)
74
+
75
+ return unless !options[:pretend] && File.exist?(source)
76
+
77
+ require 'fileutils'
78
+ ::FileUtils.mv(source, target)
79
+ end
80
+ # rubocop:enable Metrics/AbcSize
46
81
  end
82
+ # rubocop:enable Metrics/BlockLength
47
83
 
48
84
  class << self
49
85
  def apply(context = Context.new({}))
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RailsAppGenerator
4
+ # Custom add-ons for RailsAppGenerator
5
+ module AddOns
6
+ # Add Honeybadger to rails application
7
+ class Honeybadger < AddOn
8
+ required_gem gem.version('honeybadger', '4.12.1', 'Make managing application errors a more pleasant experience.')
9
+
10
+ def apply
11
+ run('bundle exec honeybadger install 1111')
12
+ say 'Update the honeybadger.yml file with your API key.'
13
+
14
+ copy_file('honeybadger.sample.yml', 'config/honeybadger.sample.yml')
15
+ append_to_file('config/locales/en.yml', read_template('en.yml'))
16
+ end
17
+ end
18
+ end
19
+ end