ahoy_email 0.0.1
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 +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +47 -0
- data/Rakefile +2 -0
- data/ahoy_email.gemspec +25 -0
- data/app/controllers/ahoy/messages_controller.rb +9 -0
- data/app/models/ahoy/message.rb +4 -0
- data/config/routes.rb +9 -0
- data/lib/ahoy_email/engine.rb +5 -0
- data/lib/ahoy_email/interceptor.rb +24 -0
- data/lib/ahoy_email/version.rb +3 -0
- data/lib/ahoy_email.rb +6 -0
- data/lib/generators/ahoy_email/install_generator.rb +30 -0
- data/lib/generators/ahoy_email/templates/install.rb +20 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 099588e69bfa92fd90438816b1a5ef6857fb2f23
|
4
|
+
data.tar.gz: b9c49ef5f702558434df01c199c8eacd93d80bb3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 27f621400f1b6c2f85408f4e68c43a7cdd420b8b1496ba27b6715190a60c792a105762b1e6e1daa1ea04e31c12ca301618a9d93c4b483ce3eff820f4d7f0e350
|
7
|
+
data.tar.gz: df563aa16ce94a7197248a449de900f3501349d9b77450a294ed2e2b038e74702e040c7ee49f22e920ba8e9cb95e14b4865a08c7a0ceee6a07a163b0fd26c050
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 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,47 @@
|
|
1
|
+
# Ahoy Email
|
2
|
+
|
3
|
+
:construction: Coming soon - May 1, 2014
|
4
|
+
|
5
|
+
:envelope: Simple, powerful email tracking for Rails
|
6
|
+
|
7
|
+
Keep track of emails:
|
8
|
+
|
9
|
+
- sent
|
10
|
+
- opened
|
11
|
+
- clicked
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add this line to your application’s Gemfile:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'ahoy_email'
|
19
|
+
```
|
20
|
+
|
21
|
+
And run the generator. This creates a model to store messages.
|
22
|
+
|
23
|
+
```sh
|
24
|
+
rails generate ahoy_email:install
|
25
|
+
rake db:migrate
|
26
|
+
```
|
27
|
+
|
28
|
+
## How It Works
|
29
|
+
|
30
|
+
Ahoy creates an `Ahoy::Message` record when an email is sent. It also adds:
|
31
|
+
|
32
|
+
- open tracking
|
33
|
+
- click tracking
|
34
|
+
- UTM parameters
|
35
|
+
|
36
|
+
## TODO
|
37
|
+
|
38
|
+
- Subscription management (lists, opt-outs)
|
39
|
+
|
40
|
+
## Contributing
|
41
|
+
|
42
|
+
Everyone is encouraged to help improve this project. Here are a few ways you can help:
|
43
|
+
|
44
|
+
- [Report bugs](https://github.com/ankane/ahoy_email/issues)
|
45
|
+
- Fix bugs and [submit pull requests](https://github.com/ankane/ahoy_email/pulls)
|
46
|
+
- Write, clarify, or fix documentation
|
47
|
+
- Suggest or add new features
|
data/Rakefile
ADDED
data/ahoy_email.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 'ahoy_email/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "ahoy_email"
|
8
|
+
spec.version = AhoyEmail::VERSION
|
9
|
+
spec.authors = ["Andrew Kane"]
|
10
|
+
spec.email = ["andrew@chartkick.com"]
|
11
|
+
spec.summary = %q{Simple, powerful email tracking for Rails}
|
12
|
+
spec.description = %q{Simple, powerful email tracking for Rails}
|
13
|
+
spec.homepage = "https://github.com/ankane/ahoy_email"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
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 "actionmailer"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
end
|
data/config/routes.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
module AhoyEmail
|
2
|
+
class Interceptor
|
3
|
+
# include ActionView::Helpers::AssetTagHelper
|
4
|
+
|
5
|
+
def self.delivering_email(message)
|
6
|
+
# body = (message.html_part || message).body.raw_source
|
7
|
+
# p AhoyEmail::Engine.routes
|
8
|
+
# if body
|
9
|
+
# regex = /<\/body>/i
|
10
|
+
# pixel = image_tag(AhoyEmail::Engine.routes.url_helpers.url_for(controller: "messages", action: "open"))
|
11
|
+
# if body.match(regex)
|
12
|
+
# body.gsub!(regex, "#{pixel}\\0")
|
13
|
+
# else
|
14
|
+
# body << pixel
|
15
|
+
# end
|
16
|
+
# end
|
17
|
+
Ahoy::Message.create!(
|
18
|
+
subject: message.subject,
|
19
|
+
content: message.to_s
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
data/lib/ahoy_email.rb
ADDED
@@ -0,0 +1,30 @@
|
|
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 AhoyEmail
|
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/create_ahoy_messages.rb"
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class <%= migration_class_name %> < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :ahoy_messages do |t|
|
4
|
+
# user
|
5
|
+
t.integer :user_id
|
6
|
+
t.string :user_type
|
7
|
+
|
8
|
+
# message
|
9
|
+
t.text :subject
|
10
|
+
t.text :content
|
11
|
+
|
12
|
+
# timestamps
|
13
|
+
t.timestamp :sent_at
|
14
|
+
t.timestamp :opened_at
|
15
|
+
t.timestamp :clicked_at
|
16
|
+
end
|
17
|
+
|
18
|
+
add_index :ahoy_messages, [:user_id, :user_type]
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ahoy_email
|
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: 2014-04-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: actionmailer
|
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.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
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: Simple, powerful email tracking for Rails
|
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
|
+
- ahoy_email.gemspec
|
68
|
+
- app/controllers/ahoy/messages_controller.rb
|
69
|
+
- app/models/ahoy/message.rb
|
70
|
+
- config/routes.rb
|
71
|
+
- lib/ahoy_email.rb
|
72
|
+
- lib/ahoy_email/engine.rb
|
73
|
+
- lib/ahoy_email/interceptor.rb
|
74
|
+
- lib/ahoy_email/version.rb
|
75
|
+
- lib/generators/ahoy_email/install_generator.rb
|
76
|
+
- lib/generators/ahoy_email/templates/install.rb
|
77
|
+
homepage: https://github.com/ankane/ahoy_email
|
78
|
+
licenses:
|
79
|
+
- MIT
|
80
|
+
metadata: {}
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
requirements: []
|
96
|
+
rubyforge_project:
|
97
|
+
rubygems_version: 2.2.2
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: Simple, powerful email tracking for Rails
|
101
|
+
test_files: []
|