Class: Suspenders::AnalyticsGenerator

Inherits:
Generators::Base
  • Object
show all
Defined in:
lib/suspenders/generators/analytics_generator.rb

Instance Method Summary collapse

Methods inherited from Generators::Base

default_source_root, inherited

Methods included from ExitOnFailure

#bundle_command

Methods included from Actions

#action_mailer_asset_host, #action_mailer_host, #configure_environment, #expand_json, #gem, #replace_in_file

Instance Method Details

#install_partialObject



5
6
7
8
# File 'lib/suspenders/generators/analytics_generator.rb', line 5

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

#render_partialObject



10
11
12
13
14
15
16
# File 'lib/suspenders/generators/analytics_generator.rb', line 10

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