Sha256: 1b23014c9827fa0d56b3594991f00e315f53b0a3352791bbaae82056ac57c17a

Contents?: true

Size: 643 Bytes

Versions: 5

Compression:

Stored size: 643 Bytes

Contents

require "rails/generators"

module Suspenders
  class AnalyticsGenerator < Rails::Generators::Base
    source_root File.expand_path(
      File.join("..", "..", "..", "templates"),
      File.dirname(__FILE__),
    )

    def install_partial
      copy_file "_analytics.html.erb",
        "app/views/application/_analytics.html.erb"
    end

    def render_partial
      if File.exist?(js_partial)
        inject_into_file js_partial,
          %{\n\n<%= render "analytics" %>},
          after: "<%= yield :javascript %>"
      end
    end

    private

    def js_partial
      "app/views/application/_javascript.html.erb"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
suspenders-1.50.0 lib/suspenders/generators/analytics_generator.rb
suspenders-1.49.0 lib/suspenders/generators/analytics_generator.rb
suspenders-1.48.0 lib/suspenders/generators/analytics_generator.rb
suspenders-1.47.0 lib/suspenders/generators/analytics_generator.rb
suspenders-1.46.0 lib/suspenders/generators/analytics_generator.rb