Sha256: 2fe5b60631cbb628ff0bf3816a7b41e6c2baf4a5f86ef1e27536d813e07e3c2f

Contents?: true

Size: 675 Bytes

Versions: 6

Compression:

Stored size: 675 Bytes

Contents

# frozen_string_literal: true

module RailsAppGenerator
  # Custom add-ons for RailsAppGenerator
  module AddOns
    # Add Chartkick to rails application
    class Chartkick < AddOn
      required_gem gem.version('chartkick', '4.2.1', 'Create beautiful JavaScript charts with one line of Ruby')

      def apply; end

      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
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails_app_generator-0.1.26 lib/rails_app_generator/addons/chartkick.rb
rails_app_generator-0.1.25 lib/rails_app_generator/addons/chartkick.rb
rails_app_generator-0.1.24 lib/rails_app_generator/addons/chartkick.rb
rails_app_generator-0.1.23 lib/rails_app_generator/addons/chartkick.rb
rails_app_generator-0.1.22 lib/rails_app_generator/addons/chartkick.rb
rails_app_generator-0.1.21 lib/rails_app_generator/addons/chartkick.rb