url_job 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/README.rdoc +9 -1
- data/lib/generators/templates/migration.rb +17 -0
- data/lib/generators/url_job_generator.rb +29 -0
- data/lib/url_job/job.rb +1 -3
- data/lib/url_job/version.rb +1 -1
- data/url_job.gemspec +2 -7
- metadata +9 -7
- data/NOTES +0 -3
data/CHANGELOG
ADDED
data/README.rdoc
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
= UrlJob
|
2
2
|
|
3
|
-
|
3
|
+
Need to track if an email was opened? If a link was clicked? If a page was viewed?
|
4
|
+
Too lazy to setup cron (or is it impossible?)?
|
5
|
+
|
6
|
+
Easy -- Just create a url_job that when visited does things (like the above) for you.
|
7
|
+
|
8
|
+
This is a rails gem that provides an engine which allows for creating urls that execute jobs.
|
4
9
|
|
5
10
|
== Install
|
6
11
|
|
@@ -58,6 +63,9 @@ And embed a image tag like:
|
|
58
63
|
|
59
64
|
Inside some emails to track some email opens
|
60
65
|
|
66
|
+
== Thanks
|
67
|
+
UrlJob::Job almost exactly a stripped down version of Delayed::Job.
|
68
|
+
|
61
69
|
== Licence
|
62
70
|
|
63
71
|
Copyright (c) 2011 Timothy Frison
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreateUrlJobs < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :url_jobs, :force => true do |t|
|
4
|
+
t.string :token, :limit => 60 # The unique token for looking up this entry.
|
5
|
+
t.integer :action_limit, :default => 0 # The number of times the action can be executed when url visited.
|
6
|
+
t.integer :action_count, :default => 0 # The number of times the action has been executed when url visited.
|
7
|
+
t.text :handler # YAML-encoded string of the object that will do work
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
|
11
|
+
add_index :url_jobs, [:token]
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
drop_table :url_jobs
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
require 'rails/generators/migration'
|
3
|
+
|
4
|
+
class UrlJobGenerator < Rails::Generators::Base
|
5
|
+
|
6
|
+
include Rails::Generators::Migration
|
7
|
+
|
8
|
+
def self.source_root
|
9
|
+
@source_root ||= File.join(File.dirname(__FILE__), 'templates')
|
10
|
+
end
|
11
|
+
|
12
|
+
# Implement the required interface for Rails::Generators::Migration.
|
13
|
+
#
|
14
|
+
def self.next_migration_number(dirname) #:nodoc:
|
15
|
+
next_migration_number = current_migration_number(dirname) + 1
|
16
|
+
if ActiveRecord::Base.timestamped_migrations
|
17
|
+
[Time.now.utc.strftime("%Y%m%d%H%M%S"), "%.14d" % next_migration_number].max
|
18
|
+
else
|
19
|
+
"%.3d" % next_migration_number
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_migration_file
|
24
|
+
if defined?(ActiveRecord)
|
25
|
+
migration_template 'migration.rb', 'db/migrate/create_url_jobs.rb'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
data/lib/url_job/job.rb
CHANGED
data/lib/url_job/version.rb
CHANGED
data/url_job.gemspec
CHANGED
@@ -8,14 +8,9 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Timothy Frison"]
|
10
10
|
s.email = ["tim@frison.ca"]
|
11
|
-
s.homepage = "http://
|
11
|
+
s.homepage = "http://github.com/frison/url_job"
|
12
12
|
s.summary = %q{A rails engine for creating urls that run jobs}
|
13
|
-
s.description =
|
14
|
-
Need to track if an email was opened? If a link was clicked? If a page was viewed?
|
15
|
-
Too lazy to setup cron (or is it impossible?)?
|
16
|
-
|
17
|
-
Easy -- Just create a url_job that when visited does things (like the above) for you.
|
18
|
-
EOF
|
13
|
+
s.description = s.summary
|
19
14
|
|
20
15
|
s.rubyforge_project = "url_job"
|
21
16
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: url_job
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Timothy Frison
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-02-
|
18
|
+
date: 2011-02-22 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
version: 3.0.0
|
51
51
|
type: :runtime
|
52
52
|
version_requirements: *id002
|
53
|
-
description:
|
53
|
+
description: A rails engine for creating urls that run jobs
|
54
54
|
email:
|
55
55
|
- tim@frison.ca
|
56
56
|
executables: []
|
@@ -61,12 +61,14 @@ extra_rdoc_files: []
|
|
61
61
|
|
62
62
|
files:
|
63
63
|
- .gitignore
|
64
|
+
- CHANGELOG
|
64
65
|
- Gemfile
|
65
|
-
- NOTES
|
66
66
|
- README.rdoc
|
67
67
|
- Rakefile
|
68
68
|
- app/controllers/url_job/url_job_controller.rb
|
69
69
|
- config/routes.rb
|
70
|
+
- lib/generators/templates/migration.rb
|
71
|
+
- lib/generators/url_job_generator.rb
|
70
72
|
- lib/url_job.rb
|
71
73
|
- lib/url_job/deserialization_error.rb
|
72
74
|
- lib/url_job/engine.rb
|
@@ -74,7 +76,7 @@ files:
|
|
74
76
|
- lib/url_job/version.rb
|
75
77
|
- url_job.gemspec
|
76
78
|
has_rdoc: true
|
77
|
-
homepage: http://
|
79
|
+
homepage: http://github.com/frison/url_job
|
78
80
|
licenses: []
|
79
81
|
|
80
82
|
post_install_message:
|
data/NOTES
DELETED