Class: VeddyGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- VeddyGenerator
- Defined in:
- lib/generators/veddy/veddy_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_vendor_files ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/generators/veddy/veddy_generator.rb', line 5 def create_vendor_files # Some browsers are not capable of Base64 decoding *cough IE10 and below* # Nick Galbreat has gone and solved this issue for us. template "vendor/assets/javascripts/base64/base64-1.1.js" template "vendor/assets/javascripts/base64/base64-1.1.min.js" # To decode the Ved parameters and set them up to be sent off to Universal # Analytics, we use some JavaScript created by Deed Poll Office Ltd, UK template "vendor/assets/javascripts/ved_analytics/ved_analytics-1.1.js" template "vendor/assets/javascripts/ved_analytics/ved_analytics-1.1.min.js" end |
#mobile_installation ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/generators/veddy/veddy_generator.rb', line 16 def mobile_installation # Since mobile devices are not able to do hyperlink auditing, # (well, they can, just don't expect the average user to turn it on) # we insert a meta tag to be able to capture the ved parameter. # Make sure that this comes before your JavaScript. insert_into_file "app/views/layouts/application.html.erb", %Q{\n <meta name="referrer" content="origin">\n}, after: "<head>" end |
#set_up_assets ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/generators/veddy/veddy_generator.rb', line 24 def set_up_assets # This initializer will ensure that we don't add the Base64 encoding # to our asset pipeline. template "config/initializers/assets.rb" # Now that the asset will not be included in the pipeline, we insert # it into the layout just after the closing title tag. insert_into_file "app/views/layouts/application.html.erb", %Q{\n\n <!--[if lt IE 10]>\n <%= javascript_include_tag 'base64/base64-1.1.min.js' %>\n <![endif]-->\n}, after: "</title>" # To add the Ved Analytics to our asset pipeline, we make sure it is # run first due to the dependency reasons. insert_into_file "app/assets/javascripts/application.js", %Q{//= require ved_analytics/ved_analytics-1.1\n}, before: "//= require jquery\n" end |