Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit 554f4d3b6e1d663b49cacb3d8d54083322dbc467 @kugaevsky committed Sep 22, 2012
@@ -0,0 +1,17 @@
+*.gem
+*.rbc
+.bundle
+.config
+.yardoc
+Gemfile.lock
+InstalledFiles
+_yardoc
+coverage
+doc/
+lib/bundler/man
+pkg
+rdoc
+spec/reports
+test/tmp
+test/version_tmp
+tmp
@@ -0,0 +1,4 @@
+source 'https://rubygems.org'
+
+# Specify your gem's dependencies in mousetrap-rails.gemspec
+gemspec
@@ -0,0 +1,13 @@
+Copyright 2012 Nick Kugaevsky
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
@@ -0,0 +1,41 @@
+# Mousetrap::Rails
+
+[Moustrap](https://github.com/ccampbell/mousetrap) is a javascript library for handling keyboard shortcuts in your web applications written by [Craig Campbell](http://craig.is/).
+
+The `mousetrap-rails` gem integrates Moustrap javascript library with Rails Asset Pipeline.
+
+## Installation
+
+### Install mousetrap-rails gem
+
+Add this line to your application's Gemfile:
+
+ gem 'mousetrap-rails'
+
+And then execute:
+
+ $ bundle install
+
+### Include moustrap to asset pipeline
+
+Add to your `app/assets/javascripts/application.js` file
+
+ //= require mousetrap
+
+Voila!
+
+## Usage
+
+Now you can use Moustrap library features in your rails application. To test it out create coffeescript file in your `app/assets/javascripts` directory and add to it this code
+
+ # app/assets/javascripts/test_hotkeys.js.coffee
+ Mousetrap.bind 's', -> console.log 's pressed!'
+
+Run application and press `s` on your keyboard. You should see `s pressed!` message in your javascript console.
+
+You can find full documentation on [Moustrap library page](http://craig.is/killing/mice). Really, look there – there are plenty examples of using this awesome library.
+
+## Authors
+
+* mousetrap-rails gem by [Nick Kugaevsky](http://kugaevsky.ru)
+* original moustrap library by [Craig Campbell](http://craig.is/).
@@ -0,0 +1 @@
+require "bundler/gem_tasks"
@@ -0,0 +1,11 @@
+require "mousetrap-rails/version"
+
+module Mousetrap
+ module Rails
+ if ::Rails.version < "3.1"
+ require "mousetrap-rails/railtie"
+ else
+ require "mousetrap-rails/engine"
+ end
+ end
+end
@@ -0,0 +1,6 @@
+module Mousetrap
+ module Rails
+ class Engine < ::Rails::Engine
+ end
+ end
+end
@@ -0,0 +1,6 @@
+module Mousetrap
+ module Rails
+ class Railtie < ::Rails::Railtie
+ end
+ end
+end
@@ -0,0 +1,5 @@
+module Mousetrap
+ module Rails
+ VERSION = "0.0.1"
+ end
+end
@@ -0,0 +1,19 @@
+# -*- encoding: utf-8 -*-
+lib = File.expand_path('../lib', __FILE__)
+$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
+require 'mousetrap-rails/version'
+
+Gem::Specification.new do |gem|
+ gem.name = "mousetrap-rails"
+ gem.version = Mousetrap::Rails::VERSION
+ gem.authors = ["Nick Kugaevsky"]
+ gem.email = ["nick@kugaevsky.ru"]
+ gem.description = %q{Mousetrap is a javascript library for handling keyboard shortcuts in your web applications. This gem integrates Mousetrap with Rails asset pipeline for easy of use.}
+ gem.summary = %q{Integrate Moustrap javascript library with Rails Asset Pipeline}
+ gem.homepage = "https://github.com/kugaevsky/mousetrap-rails"
+
+ gem.files = `git ls-files`.split($/)
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
+ gem.require_paths = ["lib"]
+end
Oops, something went wrong.

0 comments on commit 554f4d3

Please sign in to comment.