intel 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +56 -0
- data/Rakefile +1 -0
- data/intel.gemspec +25 -0
- data/lib/generators/intel/install_generator.rb +29 -0
- data/lib/generators/intel/templates/install.rb +10 -0
- data/lib/intel.rb +14 -0
- data/lib/intel/engine.rb +4 -0
- data/lib/intel/search.rb +4 -0
- data/lib/intel/track.rb +16 -0
- data/lib/intel/version.rb +3 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b03f995035ea2892df23d4d49479c10d8e2e6fe5
|
4
|
+
data.tar.gz: 1770eb2f64a96b5751fbafcfce6c87aab2f31225
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8827a71c28cba3c68a2b76dea14573cd8f7420ee4239dc55f8cbc087943153315b2efe8be03b99c647250ed6677e8bcbb72119e0653561b1be92254f082ed9b2
|
7
|
+
data.tar.gz: 08955ef22b11378624daffc0fec7291cd4778881d2e84daf68b43c9cb6fc793db4eff29ca9461a59869e6536cedd2b5c27e6e39b0c81f19c7ae4843992272d3b
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Andrew Kane
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# Intel
|
2
|
+
|
3
|
+
Search analytics made easy
|
4
|
+
|
5
|
+
- track searches and conversions
|
6
|
+
- watch searches in real-time [coming soon]
|
7
|
+
- view searches with low conversions or no results [coming soon]
|
8
|
+
|
9
|
+
## Get Started
|
10
|
+
|
11
|
+
Add this line to your application’s Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem "intel"
|
15
|
+
```
|
16
|
+
|
17
|
+
Create a table to keep track of searches.
|
18
|
+
|
19
|
+
```sh
|
20
|
+
rails generate intel:install
|
21
|
+
rake db:migrate
|
22
|
+
```
|
23
|
+
|
24
|
+
Use the `track` option to track searches.
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
Item.search "apple", track: true
|
28
|
+
```
|
29
|
+
|
30
|
+
Want to track more attributes? Just add them to the `searches` table with migrations and pass the values to the `track` option.
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
Item.search "apple", track: {user_id: true, source: "web"}
|
34
|
+
```
|
35
|
+
|
36
|
+
It’s that easy!
|
37
|
+
|
38
|
+
## View the Data [coming soon]
|
39
|
+
|
40
|
+
Add the dashboards to your `config/routes.rb`.
|
41
|
+
|
42
|
+
```ruby
|
43
|
+
mount Intel::Engine => "searches"
|
44
|
+
```
|
45
|
+
|
46
|
+
Be sure to protect the endpoint in production.
|
47
|
+
|
48
|
+
[show example]
|
49
|
+
|
50
|
+
## Contributing
|
51
|
+
|
52
|
+
1. Fork it
|
53
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
54
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
55
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
56
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/intel.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'intel/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "intel"
|
8
|
+
spec.version = Intel::VERSION
|
9
|
+
spec.authors = ["Andrew Kane"]
|
10
|
+
spec.email = ["andrew@chartkick.com"]
|
11
|
+
spec.description = %q{Search analytics made easy}
|
12
|
+
spec.summary = %q{Search analytics made easy}
|
13
|
+
spec.homepage = "https://github.com/ankane/intel"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "searchkick"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# taken from https://github.com/collectiveidea/audited/blob/master/lib/generators/audited/install_generator.rb
|
2
|
+
require "rails/generators"
|
3
|
+
require "rails/generators/migration"
|
4
|
+
require "active_record"
|
5
|
+
require "rails/generators/active_record"
|
6
|
+
|
7
|
+
module Intel
|
8
|
+
module Generators
|
9
|
+
class InstallGenerator < Rails::Generators::Base
|
10
|
+
include Rails::Generators::Migration
|
11
|
+
|
12
|
+
source_root File.expand_path("../templates", __FILE__)
|
13
|
+
|
14
|
+
# Implement the required interface for Rails::Generators::Migration.
|
15
|
+
def self.next_migration_number(dirname) #:nodoc:
|
16
|
+
next_migration_number = current_migration_number(dirname) + 1
|
17
|
+
if ActiveRecord::Base.timestamped_migrations
|
18
|
+
[Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
|
19
|
+
else
|
20
|
+
"%.3d" % next_migration_number
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def copy_migration
|
25
|
+
migration_template "install.rb", "db/migrate/install_intel.rb"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/intel.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require "searchkick"
|
2
|
+
require "intel/search"
|
3
|
+
require "intel/track"
|
4
|
+
require "intel/engine"
|
5
|
+
require "intel/version"
|
6
|
+
|
7
|
+
module Searchkick
|
8
|
+
module Search
|
9
|
+
include Intel::Track
|
10
|
+
|
11
|
+
alias_method :search_without_track, :search
|
12
|
+
alias_method :search, :search_with_track
|
13
|
+
end
|
14
|
+
end
|
data/lib/intel/engine.rb
ADDED
data/lib/intel/search.rb
ADDED
data/lib/intel/track.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
module Intel
|
2
|
+
module Track
|
3
|
+
|
4
|
+
def search_with_track(term, options = {})
|
5
|
+
results = search_without_track(term, options)
|
6
|
+
|
7
|
+
if options[:track]
|
8
|
+
attributes = options[:track] == true ? {} : options[:track]
|
9
|
+
Intel::Search.create({searchable_type: self.name, query: term, results_count: results.total_count}.merge(attributes))
|
10
|
+
end
|
11
|
+
|
12
|
+
results
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: intel
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrew Kane
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: searchkick
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Search analytics made easy
|
56
|
+
email:
|
57
|
+
- andrew@chartkick.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- intel.gemspec
|
68
|
+
- lib/generators/intel/install_generator.rb
|
69
|
+
- lib/generators/intel/templates/install.rb
|
70
|
+
- lib/intel.rb
|
71
|
+
- lib/intel/engine.rb
|
72
|
+
- lib/intel/search.rb
|
73
|
+
- lib/intel/track.rb
|
74
|
+
- lib/intel/version.rb
|
75
|
+
homepage: https://github.com/ankane/intel
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.0.0
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: Search analytics made easy
|
99
|
+
test_files: []
|