Permalink
Browse files

Add some comments to code

  • Loading branch information...
1 parent e9acfd7 commit 56faa8f71454040a4471d5b96d8dc536fbc31343 @kugaevsky committed Jan 21, 2013
Showing with 9 additions and 0 deletions.
  1. +5 −0 lib/generators/mousetrap/install/install_generator.rb
  2. +4 −0 lib/mousetrap-rails.rb
@@ -1,13 +1,17 @@
module Mousetrap
+
+ # Mousetrap rails generators module
module Generators
class InstallGenerator < ::Rails::Generators::Base
desc "Copy Mousetrap default files"
source_root File.expand_path('../templates', __FILE__)
+ # Copy keybindings scripts to assets folder
def copy_mousetrap
copy_file "keybindings.js.coffee", "app/assets/javascripts/keybindings.js.coffee"
end
+ # Inject moustrap scripts to application.js
def add_javascript_assets
if File.exist?('app/assets/javascripts/application.js')
insert_into_file "app/assets/javascripts/application.js", "//= require mousetrap\n", :after => "jquery_ujs\n"
@@ -16,6 +20,7 @@ def add_javascript_assets
end
end
+ # Inject moustrap styles to application.css
def add_css_assets
if File.exist?('app/assets/stylesheets/application.css')
insert_into_file "app/assets/stylesheets/application.css", "*= require mousetrap\n ", :before => "*= require_tree ."
View
@@ -1,6 +1,10 @@
require "mousetrap-rails/version"
+# Mousetrap main module
module Mousetrap
+
+ # Mousetrap rails module
+ # Require railtie or engine depending of rails version
module Rails
if ::Rails.version < "3.1"
require "mousetrap-rails/railtie"

0 comments on commit 56faa8f

Please sign in to comment.