meta_events 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # `meta_events` Changelog
2
2
 
3
+ ### 1.2.1, 6 November 2014
4
+
5
+ * Fixed an issue where you could get a `NoMethodError` (`undefined method 'watch' for Spring:Module`) if running with
6
+ Spring, depending on your exact load order and dependency set. (Thanks to [charle5](https://github.com/charle5) for
7
+ the catch, and [charle5](https://github.com/charle5) and [Fabian Stehle](https://github.com/fstehle) for fixes!)
8
+ * Fixed an issue where the JavaScript exception you would get if you tried to invoke a front-end event that hadn't
9
+ been registered would have the wrong event name in it. (Thanks to [Hubert Lee](https://github.com/hube) for the
10
+ catch and the fix!)
11
+ * Fixed an issue where using `link_to` with a block would fail if you're using `meta_events`, due to the way Rails
12
+ renames parameters in this scenario. (Thanks to [David Yarbro](https://github.com/yarbro) for the catch and the
13
+ fix, and [Mark Quezada](https://github.com/markquezada) for submitting it as a pull request!)
14
+ * Added installation instructions. (Thanks to [Anthony](https://github.com/Aerlinger) for the pull request!)
15
+
3
16
  ### 1.2.0, 30 June 2014
4
17
 
5
18
  * You can now customize the separator used in nested properties by passing (_e.g._) `:property_separator => ' '` to
@@ -10,6 +10,17 @@ Additional contributions by:
10
10
  * [Pete Sharum](https://github.com/petesharum): Fix for `Time` objects passed in; turns out `Time#utc` _modifies_ its
11
11
  receiver, which is bad.
12
12
  * [Jesse Rusak](https://github.com/jder): doc typos and fixes for usage of `Rails.logger`.
13
+ * [charle5](https://github.com/charle5): Fix for `NoMethodError` (`undefined method 'watch' for Spring:Module`)
14
+ when used with Spring in certain circumstances.
15
+ * [Fabian Stehle](https://github.com/fstehle): Fix for `NoMethodError` (`undefined method 'watch' for Spring:Module`)
16
+ when used with Spring in certain circumstances.
17
+ * [Hubert Lee](https://github.com/hube): Fix for issue where the JavaScript exception you would get if you tried to
18
+ invoke a front-end event that hadn't been registered would have the wrong event name in it.
19
+ * [David Yarbro](https://github.com/yarbro): Fix for issue where using `link_to` with a block would fail if you're
20
+ using `meta_events`, due to the way Rails renames parameters in this scenario.
21
+ * [Mark Quezada](https://github.com/markquezada): Submitting a pull request for issue where using `link_to` with a
22
+ block would fail if you're using `meta_events`, due to the way Rails renames parameters in this scenario.
23
+ * [Anthony](https://github.com/Aerlinger): Improved installation instructions.
13
24
 
14
25
  Inspiration for ideas by:
15
26
 
data/README.md CHANGED
@@ -14,6 +14,22 @@ Current build status: ![Current Build Status](https://api.travis-ci.org/swiftype
14
14
  Brought to you by the folks at [Swiftype](https://www.swiftype.com/). First version written by
15
15
  [Andrew Geweke](https://www.github.com/ageweke). For additional contributors, see [CONTRIBUTORS](CONTRIBUTORS.md).
16
16
 
17
+ ### Installation
18
+
19
+ If you're in a project using [Bundler](http://bundler.io/) — for example, any Rails project, most Gems, and
20
+ probably most other Ruby software these days — and therefore have a [`Gemfile`](http://bundler.io/gemfile.html),
21
+ simply add this to the end of your `Gemfile`:
22
+
23
+ ```ruby
24
+ gem 'meta_events'
25
+ ```
26
+
27
+ Alternatively, if you aren't using Bundler:
28
+
29
+ ```ruby
30
+ gem install meta_events
31
+ ```
32
+
17
33
  ### Background
18
34
 
19
35
  Sending user-centric events to (_e.g._) Mixpanel is far from difficult; it's a single method call. However, in a
@@ -93,11 +93,17 @@ module MetaEvents
93
93
  # Obviously, feel free to create a shorter alias for this method in your application; we give it a long, unique
94
94
  # name here so that we don't accidentally collide with another helper method in your project.
95
95
  def meta_events_tracked_link_to(name = nil, options = nil, html_options = nil, &block)
96
+ html_options, options, name = options, name, nil if block_given?
97
+
96
98
  unless html_options && html_options[:meta_event]
97
99
  raise ArgumentError, "You asked for a tracked link, but you didn't provide a :meta_event: #{html_options.inspect}"
98
100
  end
99
101
 
100
- link_to(name, options, meta_events_tracking_attributes_for(html_options, meta_events_tracker), &block)
102
+ if block_given?
103
+ link_to(options, meta_events_tracking_attributes_for(html_options, meta_events_tracker), &block)
104
+ else
105
+ link_to(name, options, meta_events_tracking_attributes_for(html_options, meta_events_tracker))
106
+ end
101
107
  end
102
108
 
103
109
 
@@ -1,3 +1,17 @@
1
+ # See if we can load Spring -- but don't fail if we can't; this just helps us decide whether to call
2
+ # Spring.watch.
3
+ begin
4
+ gem 'spring'
5
+ rescue Gem::LoadError => le
6
+ # ok
7
+ end
8
+
9
+ begin
10
+ require 'spring/watcher'
11
+ rescue LoadError => le
12
+ # ok
13
+ end
14
+
1
15
  module MetaEvents
2
16
  class Railtie < Rails::Railtie
3
17
  def say(x)
@@ -20,9 +34,7 @@ module MetaEvents
20
34
  ::MetaEvents::Tracker.default_definitions = config_meta_events
21
35
  say "Loaded event definitions from #{config_meta_events.inspect}"
22
36
 
23
- if defined?(::Spring)
24
- Spring.watch config_meta_events
25
- end
37
+ Spring.watch config_meta_events if defined?(::Spring)
26
38
  end
27
39
  end
28
40
  end
@@ -1,3 +1,3 @@
1
1
  module MetaEvents
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -116,7 +116,7 @@ MetaEvents = (function() {
116
116
 
117
117
  if (eventData == null) {
118
118
  <% if Rails.env.development? %>
119
- throw "No front-end event has been registered named '" + name + "'. Did you forget to call meta_events_define_frontend_event on the server?";
119
+ throw "No front-end event has been registered named '" + eventAlias + "'. Did you forget to call meta_events_define_frontend_event on the server?";
120
120
  <% end %>
121
121
  return;
122
122
  }
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meta_events
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Andrew Geweke
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-06-30 00:00:00.000000000 Z
12
+ date: 2014-11-06 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: json
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: activesupport
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ! '>='
32
36
  - !ruby/object:Gem::Version
@@ -37,6 +41,7 @@ dependencies:
37
41
  type: :runtime
38
42
  prerelease: false
39
43
  version_requirements: !ruby/object:Gem::Requirement
44
+ none: false
40
45
  requirements:
41
46
  - - ! '>='
42
47
  - !ruby/object:Gem::Version
@@ -47,6 +52,7 @@ dependencies:
47
52
  - !ruby/object:Gem::Dependency
48
53
  name: bundler
49
54
  requirement: !ruby/object:Gem::Requirement
55
+ none: false
50
56
  requirements:
51
57
  - - ~>
52
58
  - !ruby/object:Gem::Version
@@ -54,6 +60,7 @@ dependencies:
54
60
  type: :development
55
61
  prerelease: false
56
62
  version_requirements: !ruby/object:Gem::Requirement
63
+ none: false
57
64
  requirements:
58
65
  - - ~>
59
66
  - !ruby/object:Gem::Version
@@ -61,6 +68,7 @@ dependencies:
61
68
  - !ruby/object:Gem::Dependency
62
69
  name: rake
63
70
  requirement: !ruby/object:Gem::Requirement
71
+ none: false
64
72
  requirements:
65
73
  - - ! '>='
66
74
  - !ruby/object:Gem::Version
@@ -68,6 +76,7 @@ dependencies:
68
76
  type: :development
69
77
  prerelease: false
70
78
  version_requirements: !ruby/object:Gem::Requirement
79
+ none: false
71
80
  requirements:
72
81
  - - ! '>='
73
82
  - !ruby/object:Gem::Version
@@ -75,6 +84,7 @@ dependencies:
75
84
  - !ruby/object:Gem::Dependency
76
85
  name: rspec
77
86
  requirement: !ruby/object:Gem::Requirement
87
+ none: false
78
88
  requirements:
79
89
  - - ~>
80
90
  - !ruby/object:Gem::Version
@@ -82,6 +92,7 @@ dependencies:
82
92
  type: :development
83
93
  prerelease: false
84
94
  version_requirements: !ruby/object:Gem::Requirement
95
+ none: false
85
96
  requirements:
86
97
  - - ~>
87
98
  - !ruby/object:Gem::Version
@@ -124,26 +135,27 @@ files:
124
135
  homepage: http://www.github.com/swiftype/meta_events
125
136
  licenses:
126
137
  - MIT
127
- metadata: {}
128
138
  post_install_message:
129
139
  rdoc_options: []
130
140
  require_paths:
131
141
  - lib
132
142
  required_ruby_version: !ruby/object:Gem::Requirement
143
+ none: false
133
144
  requirements:
134
145
  - - ! '>='
135
146
  - !ruby/object:Gem::Version
136
147
  version: '0'
137
148
  required_rubygems_version: !ruby/object:Gem::Requirement
149
+ none: false
138
150
  requirements:
139
151
  - - ! '>='
140
152
  - !ruby/object:Gem::Version
141
153
  version: '0'
142
154
  requirements: []
143
155
  rubyforge_project:
144
- rubygems_version: 2.2.2
156
+ rubygems_version: 1.8.23.2
145
157
  signing_key:
146
- specification_version: 4
158
+ specification_version: 3
147
159
  summary: Structured, documented, powerful event emitting library for Mixpanel and
148
160
  other such systems.
149
161
  test_files:
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NzJiMzIzNTY1ZGVhZTQwZjFmYWE1YWM5NTY3YzRhYjMyNDMyZDgwYw==
5
- data.tar.gz: !binary |-
6
- Y2FkY2IxOTdhNTFmODVhMTQ1YTk1ODUxNzViNDIxNGNkOGFhMTk5ZQ==
7
- SHA512:
8
- metadata.gz: !binary |-
9
- MDA0ZjdjYWYwZTFiODRjZTdlNzk5YmJlOTc0ZGExZmQwOThlOWE0MWZjZWQ1
10
- OTIzZjgxN2ZhY2M2OTM5YjVjMzUyY2I2NDE3ZWYwZDVjZTU0NmM1MTAyMWYx
11
- NjBiNDFmMjhmMTljM2I5OTQ0ODRlNjA0MmIwZTA4MjljYmM5YjQ=
12
- data.tar.gz: !binary |-
13
- YTU5Y2NlMmIyZWUxODIzODI4ZWMzZTk2OTM3ZTViMmY1OGM4MTBkYjU5OGEy
14
- MjkzMmQwZjBkMWM3Y2ZjOTM4MmJiNWZiMGI0YWY3MjE5ZmJkMDk2NzdmNDgy
15
- MTkwYzBmYThlNGQ4MDZiMTcyYjRhYjBiYzdhNmE0ZmNhZDczYWE=