scrolls_rails 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,20 @@
1
+ Copyright 2012 Dominic Dagradi
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,42 @@
1
+ # scrolls_rails
2
+
3
+ scrolls_rails is an extension to the Scrolls logging library that makes it easy
4
+ to log user interface/Javascript events the same way that you log actions in
5
+ your models and controllers.
6
+
7
+ For more information about Scrolls, visit its repository [here](https://github.com/asenchi/scrolls).
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'scrolls_rails'
14
+
15
+ Add scrolls_rails to your javascript manifest, normally application.js:
16
+
17
+ //= require scrolls_rails
18
+
19
+ And add scrolls_rails's routes to your routes file:
20
+
21
+ mount ScrollsRails::Engine => "/scrolls", :as => "scrolls_rails"
22
+
23
+ ## Usage
24
+
25
+ scrolls_rails uses the syntax you're already familiar with, to log events from
26
+ Javascript:
27
+
28
+ ```javascript
29
+ Scrolls.log({fn: "items", at: "viewed_list"})
30
+ ```
31
+
32
+ The output of which will be:
33
+
34
+ fn=items at=viewed_list
35
+
36
+ In addition, since scrolls_rails works with your existing Rails app, any
37
+ Scrolls contexts set for your application will be set for your Javascript
38
+ logs as well.
39
+
40
+ ## License
41
+
42
+ scrolls_rails is released under the {MIT License}[http://www.opensource.org/licenses/MIT].
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'ScrollsRails'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+
28
+ Bundler::GemHelper.install_tasks
29
+
30
+ require 'rake/testtask'
31
+
32
+ Rake::TestTask.new(:test) do |t|
33
+ t.libs << 'lib'
34
+ t.libs << 'test'
35
+ t.pattern = 'test/**/*_test.rb'
36
+ t.verbose = false
37
+ end
38
+
39
+
40
+ task :default => :test
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into scrolls_rails.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
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,12 @@
1
+ <% url = ScrollsRails::Engine.routes.url_helpers %>
2
+
3
+ var Scrolls = {
4
+ log: function(measurement) {
5
+ $.ajax({
6
+ type: "POST",
7
+ url: "<%= url.log_path %> ",
8
+ data: {measurement: measurement},
9
+ dataType: "text"
10
+ })
11
+ }
12
+ }
@@ -0,0 +1,8 @@
1
+ module ScrollsRails
2
+ class MetricsController < ApplicationController
3
+ def log
4
+ Scrolls.log params[:measurement]
5
+ render text: "success"
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,3 @@
1
+ ScrollsRails::Engine.routes.draw do
2
+ match "log", controller: "metrics", action: "log", via: :post
3
+ end
@@ -0,0 +1,4 @@
1
+ require "scrolls_rails/engine"
2
+
3
+ module ScrollsRails
4
+ end
@@ -0,0 +1,7 @@
1
+ module ScrollsRails
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace ScrollsRails
4
+
5
+ require "scrolls"
6
+ end
7
+ end
@@ -0,0 +1,3 @@
1
+ module ScrollsRails
2
+ VERSION = "0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scrolls_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.1'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Dominic Dagradi
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-28 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.8
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.8
30
+ - !ruby/object:Gem::Dependency
31
+ name: scrolls
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '0.2'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '0.2'
46
+ description: Rails helpers for logging Javascript and UI events with Scrolls
47
+ email:
48
+ - ddagradi@gmail.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - app/assets/javascripts/scrolls_rails/metrics.js.erb
54
+ - app/assets/javascripts/scrolls_rails.js
55
+ - app/controllers/scrolls_rails/metrics_controller.rb
56
+ - config/routes.rb
57
+ - lib/scrolls_rails/engine.rb
58
+ - lib/scrolls_rails/version.rb
59
+ - lib/scrolls_rails.rb
60
+ - MIT-LICENSE
61
+ - Rakefile
62
+ - README.md
63
+ homepage: https://github.com/dominic/scrolls_rails
64
+ licenses: []
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ! '>='
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ requirements: []
82
+ rubyforge_project:
83
+ rubygems_version: 1.8.24
84
+ signing_key:
85
+ specification_version: 3
86
+ summary: Simple logging for Javascript
87
+ test_files: []