eventy 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +21 -4
- data/lib/eventy.rb +2 -0
- data/lib/eventy/backends/active_record_hstore.rb +11 -0
- data/lib/eventy/version.rb +1 -1
- data/lib/generators/eventy/active_record_hstore_generator.rb +15 -0
- data/lib/generators/eventy/templates/setup_eventy_hstore.rb +23 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24bee34870e8b88e3d749d1f01f542fb46fe6332
|
4
|
+
data.tar.gz: 0ac34b2a49c5a5f994f873d077ff059a942965d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a7024380bec5f673db8f8113b0818c0010339dfc3c3c65a8fc026fce0da694a352a6b473fb25b2a2eb9006104d0ee4f527911c2c646d642338eef6a0bca71ca
|
7
|
+
data.tar.gz: 7ca796841268780e8832ae0656ced444b655817780c13a3c6f36c6be8e2553f43acd9a0e455e7f06dbc0a06a63059cf03b4abc0ff944f150f90b53240c5897c5
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Eventy
|
2
2
|
|
3
|
-
|
3
|
+
Super simple event tracking in Rails. Record arbitrary events, associate them with a user or account, and record any associated properties.
|
4
|
+
|
5
|
+
Currently, Eventy ships with two backends: `active_record`, and `active_record_hstore`.
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
@@ -12,13 +14,28 @@ And then execute:
|
|
12
14
|
|
13
15
|
$ bundle
|
14
16
|
|
15
|
-
|
17
|
+
Next, run the Rails generator to create a migration for your desired backend (either `active_record` or `active_record_hstore`):
|
18
|
+
|
19
|
+
$ bundle exec rails generate eventy:active_record
|
20
|
+
|
21
|
+
You may need to modify this migration. Then run the migration:
|
22
|
+
|
23
|
+
$ bundle exec rake db:migrate
|
16
24
|
|
17
|
-
|
25
|
+
Finally, configure eventy to use your preferred backend:
|
26
|
+
|
27
|
+
# config/initializers/eventy.rb
|
28
|
+
Eventy.configure(backend: :active_record)
|
18
29
|
|
19
30
|
## Usage
|
20
31
|
|
21
|
-
|
32
|
+
Record events by calling `Eventy.record(event_name, unique_identifier, attributes)`:
|
33
|
+
|
34
|
+
Eventy.record('account:signup', session[:unique_id], { referrer: 'Facebook' })
|
35
|
+
Eventy.record('response:create', current_account.unique_id)
|
36
|
+
Eventy.record('response:create', current_account.unique_id)
|
37
|
+
|
38
|
+
You can name your events however you like, associate them with whatever unique identifier you like, and assign them arbitrary properties. Simple.
|
22
39
|
|
23
40
|
## Contributing
|
24
41
|
|
data/lib/eventy.rb
CHANGED
data/lib/eventy/version.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/migration'
|
3
|
+
|
4
|
+
class Eventy::ActiveRecordHstoreGenerator < Rails::Generators::Base
|
5
|
+
include Rails::Generators::Migration
|
6
|
+
source_root File.expand_path('../templates', __FILE__)
|
7
|
+
|
8
|
+
def self.next_migration_number(path)
|
9
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
10
|
+
end
|
11
|
+
|
12
|
+
def copy_migrations
|
13
|
+
migration_template 'setup_eventy_hstore.rb', "db/migrate/setup_eventy.rb"
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Creates the database table plus indexes you'll need to use Eventy
|
2
|
+
class SetupEventy < ActiveRecord::Migration
|
3
|
+
def self.up
|
4
|
+
execute "CREATE EXTENSION hstore"
|
5
|
+
|
6
|
+
create_table :events, force: true do |t|
|
7
|
+
t.string :name
|
8
|
+
t.string :identity
|
9
|
+
t.hstore :properties
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
|
13
|
+
add_index :events, :name
|
14
|
+
add_index :events, [:identity, :name]
|
15
|
+
add_index :events, :properties, using: :gin
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.down
|
19
|
+
drop_table :events
|
20
|
+
|
21
|
+
execute "DROP EXTENSION hstore"
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eventy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicholas Firth-McCoy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-05-
|
11
|
+
date: 2013-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -55,9 +55,12 @@ files:
|
|
55
55
|
- lib/eventy.rb
|
56
56
|
- lib/eventy/abstract_event.rb
|
57
57
|
- lib/eventy/backends/active_record.rb
|
58
|
+
- lib/eventy/backends/active_record_hstore.rb
|
58
59
|
- lib/eventy/version.rb
|
59
60
|
- lib/generators/eventy/active_record_generator.rb
|
61
|
+
- lib/generators/eventy/active_record_hstore_generator.rb
|
60
62
|
- lib/generators/eventy/templates/setup_eventy.rb
|
63
|
+
- lib/generators/eventy/templates/setup_eventy_hstore.rb
|
61
64
|
homepage: https://github.com/nfm/eventy
|
62
65
|
licenses:
|
63
66
|
- MIT
|