mousereco 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +15 -0
  2. data/LICENSE.txt +22 -0
  3. data/README.md +34 -0
  4. data/Rakefile +34 -0
  5. data/app/assets/javascripts/mousereco/mousereco.js +15 -0
  6. data/app/assets/javascripts/mousereco/pageviews.js +244 -0
  7. data/app/assets/javascripts/mousereco/tracker.js.erb +312 -0
  8. data/app/assets/stylesheets/mousereco/bootstrap.min.css +9 -0
  9. data/app/assets/stylesheets/mousereco/mousereco.css +39 -0
  10. data/app/controllers/mousereco/api/v1/application_controller.rb +18 -0
  11. data/app/controllers/mousereco/api/v1/events_controller.rb +17 -0
  12. data/app/controllers/mousereco/api/v1/pageviews_controller.rb +21 -0
  13. data/app/controllers/mousereco/application_controller.rb +5 -0
  14. data/app/controllers/mousereco/pageviews_controller.rb +8 -0
  15. data/app/controllers/mousereco/trackers_controller.rb +6 -0
  16. data/app/controllers/mousereco/visitors_controller.rb +5 -0
  17. data/app/helpers/mousereco/application_helper.rb +4 -0
  18. data/app/helpers/mousereco/pageview_helper.rb +7 -0
  19. data/app/models/mousereco/click.rb +4 -0
  20. data/app/models/mousereco/event.rb +13 -0
  21. data/app/models/mousereco/mousemove.rb +4 -0
  22. data/app/models/mousereco/pageview.rb +15 -0
  23. data/app/models/mousereco/scroll.rb +4 -0
  24. data/app/models/mousereco/visitor.rb +13 -0
  25. data/app/services/mousereco/events_service.rb +21 -0
  26. data/app/services/mousereco/pageviews_service.rb +14 -0
  27. data/app/views/layouts/mousereco/application.html.haml +21 -0
  28. data/app/views/mousereco/pageviews/page_html.html.haml +1 -0
  29. data/app/views/mousereco/pageviews/show.html.haml +18 -0
  30. data/app/views/mousereco/visitors/index.html.haml +12 -0
  31. data/config/routes.rb +25 -0
  32. data/db/migrate/20140128001612_create_mousereco_events.rb +14 -0
  33. data/db/migrate/20140128001832_create_mousereco_pageviews.rb +17 -0
  34. data/db/migrate/20140128001950_create_mousereco_visitors.rb +9 -0
  35. data/db/migrate/20140130215132_add_limit_to_timestamps.rb +12 -0
  36. data/lib/generators/mousereco/install/install_generator.rb +22 -0
  37. data/lib/mousereco/engine.rb +9 -0
  38. data/lib/mousereco/version.rb +3 -0
  39. data/lib/mousereco.rb +4 -0
  40. data/lib/tasks/mousereco_tasks.rake +4 -0
  41. data/spec/api/mousereco/events_api_spec.rb +37 -0
  42. data/spec/api/mousereco/pageviews_api_spec.rb +58 -0
  43. data/spec/controllers/mousereco/pageviews_controller_spec.rb +12 -0
  44. data/spec/controllers/mousereco/visitors_controller_spec.rb +12 -0
  45. data/spec/dummy/Gemfile +31 -0
  46. data/spec/dummy/Gemfile.lock +174 -0
  47. data/spec/dummy/Rakefile +6 -0
  48. data/spec/dummy/app/assets/javascripts/application.js +14 -0
  49. data/spec/dummy/app/assets/stylesheets/application.css +13 -0
  50. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  51. data/spec/dummy/app/controllers/home_controller.rb +4 -0
  52. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  53. data/spec/dummy/app/views/home/index.html.haml +2 -0
  54. data/spec/dummy/app/views/layouts/application.html.haml +17 -0
  55. data/spec/dummy/bin/bundle +3 -0
  56. data/spec/dummy/bin/rails +4 -0
  57. data/spec/dummy/bin/rake +4 -0
  58. data/spec/dummy/config/application.rb +27 -0
  59. data/spec/dummy/config/boot.rb +4 -0
  60. data/spec/dummy/config/database.yml +25 -0
  61. data/spec/dummy/config/environment.rb +5 -0
  62. data/spec/dummy/config/environments/development.rb +29 -0
  63. data/spec/dummy/config/environments/production.rb +80 -0
  64. data/spec/dummy/config/environments/test.rb +36 -0
  65. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  66. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  67. data/spec/dummy/config/initializers/inflections.rb +16 -0
  68. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  69. data/spec/dummy/config/initializers/secret_token.rb +12 -0
  70. data/spec/dummy/config/initializers/session_store.rb +3 -0
  71. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  72. data/spec/dummy/config/locales/en.yml +23 -0
  73. data/spec/dummy/config/routes.rb +7 -0
  74. data/spec/dummy/config.ru +4 -0
  75. data/spec/dummy/db/development.sqlite3 +0 -0
  76. data/spec/dummy/db/migrate/20140128221416_create_mousereco_events.mousereco.rb +15 -0
  77. data/spec/dummy/db/migrate/20140128221417_create_mousereco_pageviews.mousereco.rb +18 -0
  78. data/spec/dummy/db/migrate/20140128221418_create_mousereco_visitors.mousereco.rb +10 -0
  79. data/spec/dummy/db/migrate/20140130215835_add_limit_to_timestamps.mousereco.rb +13 -0
  80. data/spec/dummy/db/schema.rb +48 -0
  81. data/spec/dummy/db/seeds.rb +7 -0
  82. data/spec/dummy/db/test.sqlite3 +0 -0
  83. data/spec/dummy/log/development.log +13721 -0
  84. data/spec/dummy/log/test.log +13232 -0
  85. data/spec/dummy/public/404.html +58 -0
  86. data/spec/dummy/public/422.html +58 -0
  87. data/spec/dummy/public/500.html +57 -0
  88. data/spec/dummy/public/favicon.ico +0 -0
  89. data/spec/dummy/public/robots.txt +5 -0
  90. data/spec/dummy/public/test.html +59 -0
  91. data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  92. data/spec/dummy/tmp/cache/assets/development/sprockets/1510a9c9dc22b2be9eed26a8ed2dabe8 +0 -0
  93. data/spec/dummy/tmp/cache/assets/development/sprockets/16d2919a6d361fd8c6e82b279d64067d +0 -0
  94. data/spec/dummy/tmp/cache/assets/development/sprockets/1d3e49d5614179160c0b571a9927dcc1 +0 -0
  95. data/spec/dummy/tmp/cache/assets/development/sprockets/1de21ea3d9fadc1a1c3269614b19495b +0 -0
  96. data/spec/dummy/tmp/cache/assets/development/sprockets/2533caf6d0459a8624fd40d33cddde85 +0 -0
  97. data/spec/dummy/tmp/cache/assets/development/sprockets/29cde272ab8d39abcb99bfc3cba51e1b +0 -0
  98. data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  99. data/spec/dummy/tmp/cache/assets/development/sprockets/2fd3dabf7baee6c0702bc29f86d2a70c +0 -0
  100. data/spec/dummy/tmp/cache/assets/development/sprockets/2ffb0b37de65c4bc12c9759935bcfa4a +0 -0
  101. data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  102. data/spec/dummy/tmp/cache/assets/development/sprockets/40091f436d9a77d1d9a9de7f3da46098 +0 -0
  103. data/spec/dummy/tmp/cache/assets/development/sprockets/48139bef1023ab80e22b4891191c5c3a +0 -0
  104. data/spec/dummy/tmp/cache/assets/development/sprockets/4ea33e825e6e38bd22dccab488a0255b +0 -0
  105. data/spec/dummy/tmp/cache/assets/development/sprockets/54d5f50daadb633077b6cd9dd9fb72cc +0 -0
  106. data/spec/dummy/tmp/cache/assets/development/sprockets/5817965bb0355e7b0da40f9b36153ef6 +0 -0
  107. data/spec/dummy/tmp/cache/assets/development/sprockets/5cbf24a4616e0252f26d7949679a42fe +0 -0
  108. data/spec/dummy/tmp/cache/assets/development/sprockets/5d1aff6b78ca0eab106290139d3410a3 +0 -0
  109. data/spec/dummy/tmp/cache/assets/development/sprockets/6d498a2bfb1bc8566133e4eb5c0ccd35 +0 -0
  110. data/spec/dummy/tmp/cache/assets/development/sprockets/727930fb0f32b87625179e6a77770d16 +0 -0
  111. data/spec/dummy/tmp/cache/assets/development/sprockets/7be9086c960bb4384c9d23a52e489f29 +0 -0
  112. data/spec/dummy/tmp/cache/assets/development/sprockets/7cd76d5e9ba9b8658678d1455acfab74 +0 -0
  113. data/spec/dummy/tmp/cache/assets/development/sprockets/7d94acf804831ce74c7bf5455c1782f0 +0 -0
  114. data/spec/dummy/tmp/cache/assets/development/sprockets/8f8936f164170e095c5ca2d0c2ae6127 +0 -0
  115. data/spec/dummy/tmp/cache/assets/development/sprockets/912559948251ede2d7fcd0cbd58654da +0 -0
  116. data/spec/dummy/tmp/cache/assets/development/sprockets/9d48f1ca00d652a327f6e8f7c7fc0d40 +0 -0
  117. data/spec/dummy/tmp/cache/assets/development/sprockets/a9cf04e553d11e0103cf1c870e363d7d +0 -0
  118. data/spec/dummy/tmp/cache/assets/development/sprockets/b02bb55c99ea1e7b80cf52548ee0d1c5 +0 -0
  119. data/spec/dummy/tmp/cache/assets/development/sprockets/b9b341a8be874e4eee26dce66499bc80 +0 -0
  120. data/spec/dummy/tmp/cache/assets/development/sprockets/c6793056549a28ef6b4d0a4a8929f7e3 +0 -0
  121. data/spec/dummy/tmp/cache/assets/development/sprockets/cac5a12e0a520ce86636e0443f3da875 +0 -0
  122. data/spec/dummy/tmp/cache/assets/development/sprockets/cb21171d87e8bb8b243a86594263deff +0 -0
  123. data/spec/dummy/tmp/cache/assets/development/sprockets/cc5195a4891bb336aeb52b296f4971e9 +0 -0
  124. data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  125. data/spec/dummy/tmp/cache/assets/development/sprockets/d44cfedd9e50cf9fd20463a31bad4ce3 +0 -0
  126. data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  127. data/spec/dummy/tmp/cache/assets/development/sprockets/e6c6c2db7ca06e62d0b8d81c9ee3fcf0 +0 -0
  128. data/spec/dummy/tmp/cache/assets/development/sprockets/e73e1a39e822bb2763fbb90a3d41498f +0 -0
  129. data/spec/dummy/tmp/cache/assets/development/sprockets/eae4c7b940819b55676cea6e03251739 +0 -0
  130. data/spec/dummy/tmp/cache/assets/development/sprockets/f6f1db9d7bdcc747aae3fe9f3ec43dab +0 -0
  131. data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  132. data/spec/dummy/tmp/cache/assets/development/sprockets/fe8b16f9af7353e9609c7fe6259d6912 +0 -0
  133. data/spec/dummy/tmp/cache/assets/test/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  134. data/spec/dummy/tmp/cache/assets/test/sprockets/1d3e49d5614179160c0b571a9927dcc1 +0 -0
  135. data/spec/dummy/tmp/cache/assets/test/sprockets/2154a1002f636a71bd688ee3b7a40295 +0 -0
  136. data/spec/dummy/tmp/cache/assets/test/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  137. data/spec/dummy/tmp/cache/assets/test/sprockets/2ffb0b37de65c4bc12c9759935bcfa4a +0 -0
  138. data/spec/dummy/tmp/cache/assets/test/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  139. data/spec/dummy/tmp/cache/assets/test/sprockets/40091f436d9a77d1d9a9de7f3da46098 +0 -0
  140. data/spec/dummy/tmp/cache/assets/test/sprockets/417edfca088d0fa2811b10666b3adea4 +0 -0
  141. data/spec/dummy/tmp/cache/assets/test/sprockets/48139bef1023ab80e22b4891191c5c3a +0 -0
  142. data/spec/dummy/tmp/cache/assets/test/sprockets/4ea33e825e6e38bd22dccab488a0255b +0 -0
  143. data/spec/dummy/tmp/cache/assets/test/sprockets/54d5f50daadb633077b6cd9dd9fb72cc +0 -0
  144. data/spec/dummy/tmp/cache/assets/test/sprockets/5817965bb0355e7b0da40f9b36153ef6 +0 -0
  145. data/spec/dummy/tmp/cache/assets/test/sprockets/5cbf24a4616e0252f26d7949679a42fe +0 -0
  146. data/spec/dummy/tmp/cache/assets/test/sprockets/6d498a2bfb1bc8566133e4eb5c0ccd35 +0 -0
  147. data/spec/dummy/tmp/cache/assets/test/sprockets/7be9086c960bb4384c9d23a52e489f29 +0 -0
  148. data/spec/dummy/tmp/cache/assets/test/sprockets/7d94acf804831ce74c7bf5455c1782f0 +0 -0
  149. data/spec/dummy/tmp/cache/assets/test/sprockets/9fe452757d2a02edb37d0d7901709d9c +0 -0
  150. data/spec/dummy/tmp/cache/assets/test/sprockets/a9cf04e553d11e0103cf1c870e363d7d +0 -0
  151. data/spec/dummy/tmp/cache/assets/test/sprockets/b02bb55c99ea1e7b80cf52548ee0d1c5 +0 -0
  152. data/spec/dummy/tmp/cache/assets/test/sprockets/b9b341a8be874e4eee26dce66499bc80 +0 -0
  153. data/spec/dummy/tmp/cache/assets/test/sprockets/c7cac2711d4e453b8698081414f6bc73 +0 -0
  154. data/spec/dummy/tmp/cache/assets/test/sprockets/cac5a12e0a520ce86636e0443f3da875 +0 -0
  155. data/spec/dummy/tmp/cache/assets/test/sprockets/cb21171d87e8bb8b243a86594263deff +0 -0
  156. data/spec/dummy/tmp/cache/assets/test/sprockets/cc5195a4891bb336aeb52b296f4971e9 +0 -0
  157. data/spec/dummy/tmp/cache/assets/test/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  158. data/spec/dummy/tmp/cache/assets/test/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  159. data/spec/dummy/tmp/cache/assets/test/sprockets/e6c6c2db7ca06e62d0b8d81c9ee3fcf0 +0 -0
  160. data/spec/dummy/tmp/cache/assets/test/sprockets/f6f1db9d7bdcc747aae3fe9f3ec43dab +0 -0
  161. data/spec/dummy/tmp/cache/assets/test/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  162. data/spec/dummy/tmp/cache/assets/test/sprockets/fe8b16f9af7353e9609c7fe6259d6912 +0 -0
  163. data/spec/dummy/tmp/pids/server.pid +1 -0
  164. data/spec/fabricators/pageview.rb +3 -0
  165. data/spec/fabricators/visitor.rb +3 -0
  166. data/spec/spec_helper.rb +20 -0
  167. metadata +393 -0
@@ -0,0 +1,12 @@
1
+ class AddLimitToTimestamps < ActiveRecord::Migration
2
+ def up
3
+ #these probably should be stored as timestamp type, not integers. not refactoring yet
4
+ change_column :mousereco_events, :timestamp, :integer, limit: 5
5
+ change_column :mousereco_pageviews, :timestamp, :integer, limit: 5
6
+ end
7
+
8
+ def down
9
+ change_column :mousereco_events, :timestamp, :integer
10
+ change_column :mousereco_pageviews, :timestamp, :integer
11
+ end
12
+ end
@@ -0,0 +1,22 @@
1
+ module Mousereco
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ desc "This generator installs Mousereco"
5
+
6
+ def add_assets
7
+ js_manifest = 'app/assets/javascripts/application.js'
8
+
9
+ inject_into_file js_manifest, "//= require mousereco/tracker\n", :before => '//= require_tree .'
10
+ end
11
+
12
+ def add_routes
13
+ route "mount Mousereco::Engine, at: \"/mousereco\"\n"
14
+ end
15
+
16
+ def run_migrations
17
+ rake "mousereco:install:migrations"
18
+ rake "db:migrate"
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,9 @@
1
+ module Mousereco
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Mousereco
4
+
5
+ initializer "mousereco.assets.precompile" do |app|
6
+ app.config.assets.precompile += %w(mousereco/mousereco.js mousereco/mousereco.css)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module Mousereco
2
+ VERSION = "0.0.2"
3
+ end
data/lib/mousereco.rb ADDED
@@ -0,0 +1,4 @@
1
+ require "mousereco/engine"
2
+
3
+ module Mousereco
4
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :mousereco do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,37 @@
1
+ require 'spec_helper'
2
+
3
+ describe Mousereco::Api::V1::EventsController, type: :controller do
4
+ routes { Mousereco::Engine.routes }
5
+
6
+ subject { post "/mousereco/api/v1/events", data; response }
7
+ let(:data) {
8
+ {"url" => "http://test.com",
9
+ "pageview_key" => pageview.key,
10
+ "visitor_key" => pageview.visitor.key,
11
+ "events" =>
12
+ {"0" => {"x" => "123.0", "y" => "321.4", "timestamp" => "123456671"},
13
+ "1" => {"x" => "125.0", "y" => "323.4", "timestamp" => "123456678", "type" => "scroll"},
14
+ "2" => {"x" => "125.0", "y" => "323.4", "timestamp" => "123456771", "type" => "scroll"},
15
+ "3" => {"x" => "125.0", "y" => "323.4", "timestamp" => "123456872", "type" => "mousemove"},
16
+ "4" => {"x" => "125.0", "y" => "323.4", "timestamp" => "123456973", "type" => "click"}
17
+ }
18
+ }
19
+ }
20
+ let(:pageview) { Fabricate(:pageview) }
21
+
22
+ its(:status) { should eq 200 }
23
+
24
+ it 'saves events' do
25
+ subject
26
+ Mousereco::Visitor.count.should eq 1
27
+ Mousereco::Pageview.count.should eq 1
28
+ visitor = Mousereco::Visitor.last
29
+ visitor.clicks.count.should eq 2
30
+ visitor.mousemoves.count.should eq 1
31
+ visitor.pageviews.count.should eq 1
32
+ visitor.scrolls.count.should eq 2
33
+ visitor.events.count.should eq data["events"].count
34
+ Mousereco::Pageview.last.events.count.should eq data["events"].count
35
+ Mousereco::Event.count.should eq data["events"].count
36
+ end
37
+ end
@@ -0,0 +1,58 @@
1
+ # coding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Mousereco::Api::V1::PageviewsController, type: :controller do
6
+ routes { Mousereco::Engine.routes }
7
+
8
+ describe '#preflight' do
9
+ subject { post "/mousereco/api/v1/pageviews/preflight", data; response }
10
+ let(:data) {
11
+ {"url" => "http://test.com",
12
+ "pageview_key" => "3kjn234jk23n4tk4her",
13
+ "visitor_key" => "49tuhiarf9q834tn34k3t",
14
+ "timestamp" => "123456671"
15
+ }
16
+ }
17
+
18
+ its(:status) { should eq 200 }
19
+
20
+ it 'returns success' do
21
+ json_response = JSON.parse(subject.body)
22
+ json_response.keys.should include('success')
23
+ json_response.keys.should include('send_html')
24
+ end
25
+ end
26
+
27
+ describe '#create' do
28
+ subject { post "/mousereco/api/v1/pageviews", data; response }
29
+ let(:data) {
30
+ {"url" => "http://test.com",
31
+ "pageview_key" => "3kjn234jk23n4tk4her",
32
+ "visitor_key" => "49tuhiarf9q834tn34k3t",
33
+ "window_width" => "1200",
34
+ "window_height" => "900",
35
+ "timestamp" => "123456671",
36
+ "page_html" => <<EOS
37
+ <html lang="en-us"><head> <meta charset="utf-8"> <title>HTML5 Boilerplate: The web's most popular front-end template</title> <meta name="description" content="HTML5 Boilerplate is a professional front-end template for building fast, robust, and adaptable web apps or sites. Spend more time developing and less time reinventing the wheel."> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open Sans:400,700"> <link rel="stylesheet" href="css/main-7b3fecba68527e3c683b5ffed5a0c131.min.css"> <script src="//www.google-analytics.com/ga.js"></script><script id="twitter-wjs" src="http://platform.twitter.com/widgets.js"></script><script src="js/html5.js"></script> <style type="text/css"></style></head> <body style="zoom: 1;" data-twttr-rendered="true"> <div class="container"> <header class="site-header cf" role="banner"> <div class="site-logo"> HTML5 <span class="star">★</span> Boilerplate </div> <ul class="site-nav inline-block-list"> <li><a href="https://github.com/h5bp/html5-boilerplate" data-ga-category="Outbound links" data-ga-action="Nav click" data-ga-label="Source code">Source code</a></li> <li><a href="https://github.com/h5bp/html5-boilerplate/blob/v4.3.0/doc/TOC.md" data-ga-category="Outbound links" data-ga-action="Nav click" data-ga-label="Docs">Docs</a></li> <li><a href="http://h5bp.github.com" data-ga-category="Outbound links" data-ga-action="Nav click" data-ga-label="Other projects">Other projects</a></li> </ul> </header><!-- end site-header --> <div class="site-promo"> <h1>The web’s most popular front-end template</h1> <p class="description">HTML5 Boilerplate helps you build <strong>fast</strong>, <strong>robust</strong>, and <strong>adaptable</strong> web apps or sites. Kick-start your project with the combined knowledge and effort of 100s of developers, all in one little package.</p> <div class="cta-option"> <a class="btn-download" href="https://github.com/h5bp/html5-boilerplate/zipball/v4.3.0" data-ga-category="Download" data-ga-action="Download - top" data-ga-label="v4.3.0"> <strong>Download</strong> <span class="version">v4.3.0</span> </a> <a class="last-update" href="https://github.com/h5bp/html5-boilerplate/blob/v4.3.0/CHANGELOG.md"> See the CHANGELOG </a> </div> <div class="cta-option"> <a class="btn-download btn-download-alt" href="http://initializr.com" data-ga-category="Outbound links" data-ga-action="Get custom build" data-ga-label="v4.3.0"> Get a custom build </a> </div> </div><!-- end site-promo --> </div> <div class="site-content"> <div class="container"> <h2>Save time. Create with confidence.</h2> <div class="grid"> <div class="grid-cell"> <h3><span class="star">★</span> Analytics, icons, and more</h3> <p>A lean, mobile-friendly HTML template; optimized Google Analytics snippet; placeholder touch-device icons; and docs covering dozens of extra tips and tricks.</p> </div> <div class="grid-cell"> <h3><span class="star">★</span> Normalize.css and helpers</h3> <p>Includes <a href="http://necolas.github.com/normalize.css/">Normalize.css</a> v1 — a modern, HTML5-ready alternative to CSS resets — and further base styles, helpers, media queries, and print styles.</p> </div> <div class="grid-cell"> <h3><span class="star">★</span> jQuery and Modernizr</h3> <p>Get the latest minified versions of two best-of-breed libraries: <a href="http://jquery.org/">jQuery</a> (via Google’s CDN, with local fallback) and the <a href="http://modernizr.com/">Modernizr</a> feature detection library.</p> </div> <div class="grid-cell"> <h3><span class="star">★</span> High performance</h3> <p>Apache settings to help you deliver excellent site performance. We independently maintain <a href="https://github.com/h5bp/server-configs">server configs</a>, a <a href="https://github.com/h5bp/node-build-script">node build script</a>, and an <a href="https://github.com/h5bp/ant-build-script">ant build script</a>.</p> </div> </div> <div class="flex-embed"> <iframe width="720" height="540" src="http://www.youtube.com/embed/WkLO-q2wC80?theme=light" frameborder="0" allowfullscreen=""></iframe> </div> <h2>Who uses HTML5 Boilerplate?</h2> <p class="in-the-wild"> <a href="http://www.projectrebrief.com/">Google</a>, <a href="http://www.microsoft.com/surface/">Microsoft</a>, <a href="http://data.nasa.gov/">NASA</a>, <a href="http://www.nikeskateboarding.com/">Nike</a>, <a href="http://www.barackobama.com/">Barack Obama</a>, <a href="http://a-class.mercedes-benz.com/">Mercedes-Benz</a>, <a href="http://www.itv.com/news/">ITV News</a>, <a href="http://www.astuteclass.com/">BAE Systems</a>, <a href="http://creativecommons.org/">Creative Commons</a>, <a href="http://auspost.com.au/">Australia Post</a>, <a href="http://www.ew.com/">Entertainment Weekly</a>, <a href="http://www.racinggreen.co.uk/">Racing Green</a>, and <a href="https://github.com/h5bp/html5-boilerplate/wiki/sites">many more</a>. </p> <div class="cta-option"> <a class="btn-download" href="https://github.com/h5bp/html5-boilerplate/zipball/v4.3.0" data-ga-category="Download" data-ga-action="Download - bottom" data-ga-label="v4.3.0"> <strong>Download</strong> <span class="version">v4.3.0</span> </a> </div> </div> </div> <aside class="aside"> <div class="container"> <ul class="inline-block-list"> <li><a href="https://github.com/h5bp/html5-boilerplate/issues" data-ga-category="Outbound links" data-ga-action="Footer click" data-ga-label="Report issues"> <img class="icon" src="http://www.google.com/s2/favicons?domain=github.com" alt=""> Report issues </a></li> <li><a href="http://stackoverflow.com/questions/tagged/html5boilerplate" data-ga-category="Outbound links" data-ga-action="Footer click" data-ga-label="Help on Stack Overflow"> <img class="icon" src="http://www.google.com/s2/favicons?domain=stackoverflow.com" alt=""> Help on Stack Overflow </a></li> <li><a href="http://h5bp.net" data-ga-category="Outbound links" data-ga-action="Footer click" data-ga-label="View the showcase"> <img class="icon" src="http://24.media.tumblr.com/avatar_c11b98176b89_16.png" alt=""> View the showcase </a></li> </ul> </div> </aside><!-- end aside --> <footer class="site-footer" role="contentinfo"> <div class="container"> <p> <iframe id="twitter-widget-0" scrolling="no" frameborder="0" allowtransparency="true" src="http://platform.twitter.com/widgets/tweet_button.1382126667.html#_=1382262711246
38
+ EOS
39
+ }
40
+ }
41
+
42
+ its(:status) { should eq 200 }
43
+
44
+ it 'returns success' do
45
+ json_response = JSON.parse(subject.body)
46
+ json_response.keys.should include('success')
47
+ end
48
+
49
+ it 'creates pageview' do
50
+ subject
51
+ Mousereco::Pageview.count.should eq 1
52
+ Mousereco::Pageview.last.page_html.should eq data["page_html"]
53
+ Mousereco::Pageview.last.window_width.should eq 1200
54
+ Mousereco::Pageview.last.window_height.should eq 900
55
+ Mousereco::Pageview.last.timestamp.should eq 123456671
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe Mousereco::PageviewsController do
4
+ routes { Mousereco::Engine.routes }
5
+
6
+ describe '#show' do
7
+ let(:pageview) { Fabricate(:pageview) }
8
+ subject { get :show, {id: pageview.id}; response }
9
+
10
+ its(:status) { should eq 200 }
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ describe Mousereco::VisitorsController do
4
+ routes { Mousereco::Engine.routes }
5
+
6
+ describe '#index' do
7
+ subject { get :index; response }
8
+
9
+ its(:status) { should eq 200 }
10
+ it { should be_success }
11
+ end
12
+ end
@@ -0,0 +1,31 @@
1
+ ruby '2.0.0'
2
+ source 'https://rubygems.org'
3
+
4
+ gem 'rails', '4.0.0'
5
+ gem 'sass-rails', '~> 4.0.0'
6
+ gem 'uglifier', '>= 1.3.0'
7
+ gem 'coffee-rails', '~> 4.0.0'
8
+ gem 'jquery-rails'
9
+ #gem 'turbolinks'
10
+ gem 'jbuilder', '~> 1.2'
11
+ gem 'therubyracer', platforms: :ruby
12
+
13
+ group :development, :test do
14
+ gem 'pry'
15
+ gem 'rspec'
16
+ gem 'rspec-rails'
17
+ end
18
+
19
+ group :development do
20
+ gem 'sqlite3'
21
+ end
22
+
23
+ group :production do
24
+ gem 'pg'
25
+ gem 'rails_12factor'
26
+ end
27
+
28
+ gem 'haml'
29
+ gem 'inherited_resources'
30
+ gem 'fabrication'
31
+ gem 'mousereco', path: '../../'
@@ -0,0 +1,174 @@
1
+ PATH
2
+ remote: ../../
3
+ specs:
4
+ mousereco (0.0.2)
5
+ inherited_resources
6
+ jquery-rails
7
+ rails (~> 4.0)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ actionmailer (4.0.0)
13
+ actionpack (= 4.0.0)
14
+ mail (~> 2.5.3)
15
+ actionpack (4.0.0)
16
+ activesupport (= 4.0.0)
17
+ builder (~> 3.1.0)
18
+ erubis (~> 2.7.0)
19
+ rack (~> 1.5.2)
20
+ rack-test (~> 0.6.2)
21
+ activemodel (4.0.0)
22
+ activesupport (= 4.0.0)
23
+ builder (~> 3.1.0)
24
+ activerecord (4.0.0)
25
+ activemodel (= 4.0.0)
26
+ activerecord-deprecated_finders (~> 1.0.2)
27
+ activesupport (= 4.0.0)
28
+ arel (~> 4.0.0)
29
+ activerecord-deprecated_finders (1.0.3)
30
+ activesupport (4.0.0)
31
+ i18n (~> 0.6, >= 0.6.4)
32
+ minitest (~> 4.2)
33
+ multi_json (~> 1.3)
34
+ thread_safe (~> 0.1)
35
+ tzinfo (~> 0.3.37)
36
+ arel (4.0.1)
37
+ atomic (1.1.14)
38
+ builder (3.1.4)
39
+ coderay (1.1.0)
40
+ coffee-rails (4.0.1)
41
+ coffee-script (>= 2.2.0)
42
+ railties (>= 4.0.0, < 5.0)
43
+ coffee-script (2.2.0)
44
+ coffee-script-source
45
+ execjs
46
+ coffee-script-source (1.6.3)
47
+ diff-lcs (1.2.5)
48
+ erubis (2.7.0)
49
+ execjs (2.0.2)
50
+ fabrication (2.9.6)
51
+ haml (4.0.5)
52
+ tilt
53
+ has_scope (0.6.0.rc)
54
+ actionpack (>= 3.2, < 5)
55
+ activesupport (>= 3.2, < 5)
56
+ hike (1.2.3)
57
+ i18n (0.6.9)
58
+ inherited_resources (1.4.1)
59
+ has_scope (~> 0.6.0.rc)
60
+ responders (~> 1.0.0.rc)
61
+ jbuilder (1.5.3)
62
+ activesupport (>= 3.0.0)
63
+ multi_json (>= 1.2.0)
64
+ jquery-rails (3.0.4)
65
+ railties (>= 3.0, < 5.0)
66
+ thor (>= 0.14, < 2.0)
67
+ json (1.8.1)
68
+ libv8 (3.16.14.3)
69
+ mail (2.5.4)
70
+ mime-types (~> 1.16)
71
+ treetop (~> 1.4.8)
72
+ method_source (0.8.2)
73
+ mime-types (1.25.1)
74
+ minitest (4.7.5)
75
+ multi_json (1.8.4)
76
+ pg (0.17.1)
77
+ polyglot (0.3.3)
78
+ pry (0.9.12.4)
79
+ coderay (~> 1.0)
80
+ method_source (~> 0.8)
81
+ slop (~> 3.4)
82
+ rack (1.5.2)
83
+ rack-test (0.6.2)
84
+ rack (>= 1.0)
85
+ rails (4.0.0)
86
+ actionmailer (= 4.0.0)
87
+ actionpack (= 4.0.0)
88
+ activerecord (= 4.0.0)
89
+ activesupport (= 4.0.0)
90
+ bundler (>= 1.3.0, < 2.0)
91
+ railties (= 4.0.0)
92
+ sprockets-rails (~> 2.0.0)
93
+ rails_12factor (0.0.2)
94
+ rails_serve_static_assets
95
+ rails_stdout_logging
96
+ rails_serve_static_assets (0.0.2)
97
+ rails_stdout_logging (0.0.3)
98
+ railties (4.0.0)
99
+ actionpack (= 4.0.0)
100
+ activesupport (= 4.0.0)
101
+ rake (>= 0.8.7)
102
+ thor (>= 0.18.1, < 2.0)
103
+ rake (10.1.1)
104
+ ref (1.0.5)
105
+ responders (1.0.0)
106
+ railties (>= 3.2, < 5)
107
+ rspec (2.14.1)
108
+ rspec-core (~> 2.14.0)
109
+ rspec-expectations (~> 2.14.0)
110
+ rspec-mocks (~> 2.14.0)
111
+ rspec-core (2.14.7)
112
+ rspec-expectations (2.14.4)
113
+ diff-lcs (>= 1.1.3, < 2.0)
114
+ rspec-mocks (2.14.4)
115
+ rspec-rails (2.14.1)
116
+ actionpack (>= 3.0)
117
+ activemodel (>= 3.0)
118
+ activesupport (>= 3.0)
119
+ railties (>= 3.0)
120
+ rspec-core (~> 2.14.0)
121
+ rspec-expectations (~> 2.14.0)
122
+ rspec-mocks (~> 2.14.0)
123
+ sass (3.2.14)
124
+ sass-rails (4.0.1)
125
+ railties (>= 4.0.0, < 5.0)
126
+ sass (>= 3.1.10)
127
+ sprockets-rails (~> 2.0.0)
128
+ slop (3.4.7)
129
+ sprockets (2.10.1)
130
+ hike (~> 1.2)
131
+ multi_json (~> 1.0)
132
+ rack (~> 1.0)
133
+ tilt (~> 1.1, != 1.3.0)
134
+ sprockets-rails (2.0.1)
135
+ actionpack (>= 3.0)
136
+ activesupport (>= 3.0)
137
+ sprockets (~> 2.8)
138
+ sqlite3 (1.3.8)
139
+ therubyracer (0.12.0)
140
+ libv8 (~> 3.16.14.0)
141
+ ref
142
+ thor (0.18.1)
143
+ thread_safe (0.1.3)
144
+ atomic
145
+ tilt (1.4.1)
146
+ treetop (1.4.15)
147
+ polyglot
148
+ polyglot (>= 0.3.1)
149
+ tzinfo (0.3.38)
150
+ uglifier (2.4.0)
151
+ execjs (>= 0.3.0)
152
+ json (>= 1.8.0)
153
+
154
+ PLATFORMS
155
+ ruby
156
+
157
+ DEPENDENCIES
158
+ coffee-rails (~> 4.0.0)
159
+ fabrication
160
+ haml
161
+ inherited_resources
162
+ jbuilder (~> 1.2)
163
+ jquery-rails
164
+ mousereco!
165
+ pg
166
+ pry
167
+ rails (= 4.0.0)
168
+ rails_12factor
169
+ rspec
170
+ rspec-rails
171
+ sass-rails (~> 4.0.0)
172
+ sqlite3
173
+ therubyracer
174
+ uglifier (>= 1.3.0)
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ MouseRecorder::Application.load_tasks
@@ -0,0 +1,14 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require mousereco/tracker
14
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,4 @@
1
+ class HomeController < ApplicationController
2
+ def index
3
+ end
4
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ %h1
2
+ Test homepage
@@ -0,0 +1,17 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %meta{name: "viewport", content: "width=device-width, initial-scale=1.0"}
5
+ %title= "Mouse recorder"
6
+ = stylesheet_link_tag "application"
7
+ = javascript_include_tag "application"
8
+ = csrf_meta_tag
9
+ %body{class: controller_name}
10
+ .navbar.navbar-inverse.navbar-fixed-top
11
+ .container
12
+ .navbar-header
13
+ = link_to 'Dummy App', root_path, class: 'navbar-brand'
14
+ .container.main-container
15
+ .row
16
+ .col-md-12
17
+ = yield
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,27 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # Require the gems listed in Gemfile, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env)
8
+
9
+ module MouseRecorder
10
+ class Application < Rails::Application
11
+ # Settings in config/environments/* take precedence over those specified here.
12
+ # Application configuration should go into files in config/initializers
13
+ # -- all .rb files in that directory are automatically loaded.
14
+
15
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
16
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
17
+ # config.time_zone = 'Central Time (US & Canada)'
18
+
19
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
21
+ # config.i18n.default_locale = :de
22
+
23
+ config.paths.add "app/api", glob: "**/*.rb"
24
+ config.autoload_paths += Dir["#{Rails.root}/app/api/*"]
25
+ config.i18n.enforce_available_locales = true
26
+ end
27
+ end
@@ -0,0 +1,4 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ development:
7
+ adapter: sqlite3
8
+ database: db/development.sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ # Warning: The database defined as "test" will be erased and
13
+ # re-generated from your development database when you run "rake".
14
+ # Do not set this db to the same as development or production.
15
+ test:
16
+ adapter: sqlite3
17
+ database: db/test.sqlite3
18
+ pool: 5
19
+ timeout: 5000
20
+
21
+ production:
22
+ adapter: sqlite3
23
+ database: db/production.sqlite3
24
+ pool: 5
25
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ MouseRecorder::Application.initialize!
@@ -0,0 +1,29 @@
1
+ MouseRecorder::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
+
12
+ # Show full error reports and disable caching.
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send.
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger.
20
+ config.active_support.deprecation = :log
21
+
22
+ # Raise an error on page load if there are pending migrations
23
+ config.active_record.migration_error = :page_load
24
+
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true
29
+ end