Class: RailsAppGenerator::AddOns::Chartkick

Inherits:
RailsAppGenerator::Addon show all
Defined in:
lib/rails_app_generator/addons/chartkick.rb

Overview

Add Chartkick to rails application

Instance Attribute Summary

Attributes inherited from RailsAppGenerator::Addon

#context, #dependencies, #gem_entries

Instance Method Summary collapse

Methods inherited from RailsAppGenerator::Addon

addon_name, dependencies, depends_on, gem, gem_entries, #initialize, required_gem, reset_gem_entries

Constructor Details

This class inherits a constructor from RailsAppGenerator::Addon

Instance Method Details

#after_bundleObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rails_app_generator/addons/chartkick.rb', line 12

def after_bundle
  append_to_file('config/importmap.rb', <<~RUBY)
    pin "chartkick", to: "chartkick.js"
    pin "Chart.bundle", to: "Chart.bundle.js"
  RUBY

  append_to_file('app/javascript/application.js', <<~RUBY)
    import "chartkick"
    import "Chart.bundle"
  RUBY
end

#applyObject



10
# File 'lib/rails_app_generator/addons/chartkick.rb', line 10

def apply; end