persist_campaign 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.gitignore +1 -0
- data/.travis.yml +12 -0
- data/Appraisals +24 -0
- data/LICENSE.txt +1 -1
- data/README.md +3 -1
- data/gemfiles/rails_3.1.gemfile +7 -0
- data/gemfiles/rails_3.2.gemfile +7 -0
- data/gemfiles/rails_4.0.gemfile +7 -0
- data/gemfiles/rails_4.1.gemfile +7 -0
- data/gemfiles/rails_4.2.gemfile +7 -0
- data/lib/persist_campaign/controller.rb +15 -3
- data/lib/persist_campaign/version.rb +1 -1
- data/persist_campaign.gemspec +3 -3
- data/spec/dummy/config/application.rb +3 -2
- data/spec/spec_helper.rb +1 -1
- metadata +43 -36
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
MjdhMGM2YzAxYTMzMTRkYTg2NzgxMzNmYTQ4NWMwMTg4NzM5NTM0Yw==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1b82f1c95d7fab634604c373cdabbc334c781015
|
4
|
+
data.tar.gz: 04f643c8a836396a7d5554d3ad8f2ab1e7f6b884
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MWE0ZDYwOTA2NGE0NDc5MjkwOWVhZWEyYWJkYTBjOWUyNjEwYzA0MWY5OWIw
|
11
|
-
MjY3NWJlOGU4MjM0ZGRhY2IzZWZjOGJkN2M4NTYzMDE1NWI5OTE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NTJlMTkzZDgxZjAyN2UwZTZlODU4YjI2NDgzMDI0NjEwMTViZjM3MTFjNTI0
|
14
|
-
YzExNjMxYjIyMWU4NzQzNzEyMjI4ZDdmMWFmYzRmZWE4ZWJkYWIzZWQ1NTg5
|
15
|
-
OGIzY2NmYzc1ZjIxOWJiMjk1NjE4ZDc1MzVlZmQ3NmQzMmRjM2M=
|
6
|
+
metadata.gz: 43dbdc2fcad408c45976bcd54dc4ed08ae5bc04082c307847de09e645261e37f49efb63baf8fec18e9ee221bff02ba2535bcdb52630f1b8ef6d5901e5a970151
|
7
|
+
data.tar.gz: cd52998655c3771d7d9b98dca6f7cf772319bed0a478f9b5d1b0c0bea5cc78dc8fea3d999cc25718161dc8b7863e28cd02f37982c32a45c2ee2e20af51fa315e
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
language: ruby
|
2
|
+
cache: bundler
|
3
|
+
rvm:
|
4
|
+
- 2.1.3
|
5
|
+
gemfile:
|
6
|
+
- gemfiles/rails_3.1.gemfile
|
7
|
+
- gemfiles/rails_3.2.gemfile
|
8
|
+
- gemfiles/rails_4.0.gemfile
|
9
|
+
- gemfiles/rails_4.1.gemfile
|
10
|
+
- gemfiles/rails_4.2.gemfile
|
11
|
+
before_install:
|
12
|
+
gem install bundler
|
data/Appraisals
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
appraise "rails-3.1" do
|
2
|
+
gem "rails", "~> 3.1.0"
|
3
|
+
gemspec
|
4
|
+
end
|
5
|
+
|
6
|
+
appraise "rails-3.2" do
|
7
|
+
gem "rails", "~> 3.2.1"
|
8
|
+
gemspec
|
9
|
+
end
|
10
|
+
|
11
|
+
appraise "rails-4.0" do
|
12
|
+
gem "rails", "~> 4.0.0"
|
13
|
+
gemspec
|
14
|
+
end
|
15
|
+
|
16
|
+
appraise "rails-4.1" do
|
17
|
+
gem "rails", "~> 4.1.0"
|
18
|
+
gemspec
|
19
|
+
end
|
20
|
+
|
21
|
+
appraise "rails-4.2" do
|
22
|
+
gem "rails", "~> 4.2"
|
23
|
+
gemspec
|
24
|
+
end
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# PersistCampaign
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/mubi/persist_campaign.svg)](https://travis-ci.org/mubi/persist_campaign)
|
4
|
+
|
3
5
|
Persist campaign parameters - such as utm_campaign, utm_source, etc - on Rails redirect_to.
|
4
6
|
|
5
7
|
## Installation
|
@@ -56,4 +58,4 @@ MIT license.
|
|
56
58
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
57
59
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
58
60
|
4. Push to the branch (`git push origin my-new-feature`)
|
59
|
-
5. Create new Pull Request
|
61
|
+
5. Create new Pull Request
|
@@ -8,10 +8,22 @@ module PersistCampaign
|
|
8
8
|
module InstanceMethods
|
9
9
|
# Solution provided by ndp's save-the-campaign gem (http://github.com/ndp/save-the-campaign),
|
10
10
|
# reproduced here under the MIT license
|
11
|
-
|
11
|
+
|
12
|
+
if Gem::Version.new(Rails.version) >= Gem::Version.new('4.2.1')
|
13
|
+
def _compute_redirect_to_location_with_persist_campaign_params(request, options = {})
|
14
|
+
url = _compute_redirect_to_location_without_persist_campaign_params(request, options)
|
15
|
+
_add_persisted_keys_to(request, url)
|
16
|
+
end
|
17
|
+
else
|
18
|
+
def _compute_redirect_to_location_with_persist_campaign_params(options = {})
|
19
|
+
url = _compute_redirect_to_location_without_persist_campaign_params(options)
|
20
|
+
_add_persisted_keys_to(request, url)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def _add_persisted_keys_to(request, url)
|
12
25
|
keys = PersistCampaign.config.keys.map(&:to_s)
|
13
26
|
to_persist = request.params.slice(*keys)
|
14
|
-
url = _compute_redirect_to_location_without_persist_campaign_params(options)
|
15
27
|
|
16
28
|
unless to_persist.empty?
|
17
29
|
url << (url =~ /\?/ ? '&' : '?')
|
@@ -22,4 +34,4 @@ module PersistCampaign
|
|
22
34
|
end
|
23
35
|
end
|
24
36
|
end
|
25
|
-
end
|
37
|
+
end
|
data/persist_campaign.gemspec
CHANGED
@@ -20,9 +20,9 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_runtime_dependency 'rails', '>= 3.1.12'
|
24
23
|
spec.add_development_dependency "bundler", "~> 1.5"
|
25
24
|
spec.add_development_dependency "rake"
|
26
|
-
spec.add_development_dependency 'rspec-rails', '~>
|
27
|
-
spec.add_development_dependency 'generator_spec', '~> 0.9.
|
25
|
+
spec.add_development_dependency 'rspec-rails', '~> 3.4.0'
|
26
|
+
spec.add_development_dependency 'generator_spec', '~> 0.9.3'
|
27
|
+
spec.add_development_dependency "appraisal"
|
28
28
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,100 +1,107 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: persist_campaign
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Dust
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rails
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ! '>='
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 3.1.12
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ! '>='
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 3.1.12
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: bundler
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
30
16
|
requirements:
|
31
|
-
- - ~>
|
17
|
+
- - "~>"
|
32
18
|
- !ruby/object:Gem::Version
|
33
19
|
version: '1.5'
|
34
20
|
type: :development
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
|
-
- - ~>
|
24
|
+
- - "~>"
|
39
25
|
- !ruby/object:Gem::Version
|
40
26
|
version: '1.5'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: rake
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
|
-
- -
|
31
|
+
- - ">="
|
46
32
|
- !ruby/object:Gem::Version
|
47
33
|
version: '0'
|
48
34
|
type: :development
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
|
-
- -
|
38
|
+
- - ">="
|
53
39
|
- !ruby/object:Gem::Version
|
54
40
|
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: rspec-rails
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
|
-
- - ~>
|
45
|
+
- - "~>"
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
47
|
+
version: 3.4.0
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
|
-
- - ~>
|
52
|
+
- - "~>"
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
54
|
+
version: 3.4.0
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: generator_spec
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- - ~>
|
59
|
+
- - "~>"
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.9.
|
61
|
+
version: 0.9.3
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- - ~>
|
66
|
+
- - "~>"
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.9.
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
68
|
+
version: 0.9.3
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: appraisal
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: |-
|
84
|
+
This Rails gem allows you to persist analytics parameters through redirects. By default its
|
85
|
+
persists utm_campaign, utm_source, utm_term, utm_medium, utm_content and gclid (for Google Adwords).
|
86
|
+
Additional param keys can be configured.
|
87
87
|
email:
|
88
88
|
- adust@mubi.com
|
89
89
|
executables: []
|
90
90
|
extensions: []
|
91
91
|
extra_rdoc_files: []
|
92
92
|
files:
|
93
|
-
- .gitignore
|
93
|
+
- ".gitignore"
|
94
|
+
- ".travis.yml"
|
95
|
+
- Appraisals
|
94
96
|
- Gemfile
|
95
97
|
- LICENSE.txt
|
96
98
|
- README.md
|
97
99
|
- Rakefile
|
100
|
+
- gemfiles/rails_3.1.gemfile
|
101
|
+
- gemfiles/rails_3.2.gemfile
|
102
|
+
- gemfiles/rails_4.0.gemfile
|
103
|
+
- gemfiles/rails_4.1.gemfile
|
104
|
+
- gemfiles/rails_4.2.gemfile
|
98
105
|
- lib/generators/persist_campaign/install_generator.rb
|
99
106
|
- lib/generators/persist_campaign/templates/initializer.rb
|
100
107
|
- lib/persist_campaign.rb
|
@@ -126,17 +133,17 @@ require_paths:
|
|
126
133
|
- lib
|
127
134
|
required_ruby_version: !ruby/object:Gem::Requirement
|
128
135
|
requirements:
|
129
|
-
- -
|
136
|
+
- - ">="
|
130
137
|
- !ruby/object:Gem::Version
|
131
138
|
version: '0'
|
132
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
140
|
requirements:
|
134
|
-
- -
|
141
|
+
- - ">="
|
135
142
|
- !ruby/object:Gem::Version
|
136
143
|
version: '0'
|
137
144
|
requirements: []
|
138
145
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.
|
146
|
+
rubygems_version: 2.4.6
|
140
147
|
signing_key:
|
141
148
|
specification_version: 4
|
142
149
|
summary: Persist campaign parameters - such as utm_campaign, utm_source, etc - on
|