invitable 0.0.1.alpha.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.
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,3 @@
1
+ = Invitable
2
+
3
+ This project rocks and uses MIT-LICENSE.
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'Invitable'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+
28
+ Bundler::GemHelper.install_tasks
29
+
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,4 @@
1
+ module Invitable
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,26 @@
1
+ module Invitable
2
+ class InvitationsController < ApplicationController
3
+ def create
4
+ @invitation = Invitation.new(params[:invitation])
5
+
6
+ respond_to do |format|
7
+ if @invitation.save
8
+ mailer(@invitation)
9
+ message = I18n.t :success, :scope => [:invitable]
10
+ format.html { redirect_to main_app.root_path, :notice => message }
11
+ format.js { render :json => { :success => true, :message => message }, :content_type => 'application/json' }
12
+ else
13
+ message = I18n.t :failure, :scope => [:invitable]
14
+ format.html { redirect_to main_app.root_path, :alert => message }
15
+ format.js { render :json => { :success => false, :message => message }, :content_type => 'application/json' }
16
+ end
17
+ end
18
+ end
19
+
20
+ private
21
+
22
+ def mailer(invitation)
23
+ InvitationMailer.thank_you(invitation.id).deliver
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,4 @@
1
+ module Invitable
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,10 @@
1
+ module Invitable
2
+ class InvitationMailer < ActionMailer::Base
3
+ default from: 'donotreply@openbay.com'
4
+
5
+ def thank_you(id)
6
+ @invitation = Invitation.find(id)
7
+ mail(:to => @invitation.email, :subject => I18n.t(:thank_you_subject, :scope => [:invitable]))
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ module Invitable
2
+ class Invitation < ActiveRecord::Base
3
+ validates :email, :format => %r{\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z}
4
+
5
+ before_create :generate_code
6
+
7
+ private
8
+
9
+ def generate_code
10
+ self.code = Digest::MD5.hexdigest("#{self.email}-#{Time.now}")
11
+ end
12
+ end
13
+ end
@@ -0,0 +1 @@
1
+ Thank-you for signing up. We will be in touch soon.
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Invitable</title>
5
+ <%= stylesheet_link_tag "invitable/application", :media => "all" %>
6
+ <%= javascript_include_tag "invitable/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,5 @@
1
+ en:
2
+ invitable:
3
+ success: 'Thank-you'
4
+ failure: 'There was an error, please try again'
5
+ thank_you_subject: 'Thank-you for signing up!'
@@ -0,0 +1,3 @@
1
+ Invitable::Engine.routes.draw do
2
+ post '/invitations' => 'invitations#create', :as => :invitations
3
+ end
@@ -0,0 +1,12 @@
1
+ class CreateInvitableInvitations < ActiveRecord::Migration
2
+ def change
3
+ create_table :invitable_invitations do |t|
4
+ t.string :email
5
+ t.integer :invitable_id
6
+ t.string :invitable_type
7
+ t.string :code
8
+
9
+ t.timestamps
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,4 @@
1
+ require "invitable/engine"
2
+
3
+ module Invitable
4
+ end
@@ -0,0 +1,22 @@
1
+ module Invitable
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Invitable
4
+
5
+ config.generators do |g|
6
+ g.test_framework :rspec, :view_specs => false
7
+ end
8
+
9
+ def self.app_path
10
+ File.expand_path('../../app', called_from)
11
+ end
12
+
13
+ %w{controller helper mailer model}.each do |resource|
14
+ class_eval <<-RUBY
15
+ def self.#{resource}_path(name)
16
+ File.expand_path("#{resource.pluralize}/invitable/\#{name}.rb", app_path)
17
+ end
18
+ RUBY
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ module Invitable
2
+ VERSION = '0.0.1.alpha.1'
3
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :invitable do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,178 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: invitable
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.alpha.1
5
+ prerelease: 6
6
+ platform: ruby
7
+ authors:
8
+ - Brian Cardarella
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-02-19 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: &70214826405700 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.1
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70214826405700
25
+ - !ruby/object:Gem::Dependency
26
+ name: sqlite3
27
+ requirement: &70214826403340 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70214826403340
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec-rails
38
+ requirement: &70214826402620 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70214826402620
47
+ - !ruby/object:Gem::Dependency
48
+ name: capybara
49
+ requirement: &70214826401820 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70214826401820
58
+ - !ruby/object:Gem::Dependency
59
+ name: capybara-webkit
60
+ requirement: &70214826390020 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *70214826390020
69
+ - !ruby/object:Gem::Dependency
70
+ name: factory_girl_rails
71
+ requirement: &70214826389020 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70214826389020
80
+ - !ruby/object:Gem::Dependency
81
+ name: pry
82
+ requirement: &70214826387900 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *70214826387900
91
+ - !ruby/object:Gem::Dependency
92
+ name: valid_attribute
93
+ requirement: &70214826386940 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *70214826386940
102
+ - !ruby/object:Gem::Dependency
103
+ name: email_spec
104
+ requirement: &70214826386020 !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ type: :development
111
+ prerelease: false
112
+ version_requirements: *70214826386020
113
+ - !ruby/object:Gem::Dependency
114
+ name: bourne
115
+ requirement: &70214826385440 !ruby/object:Gem::Requirement
116
+ none: false
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: *70214826385440
124
+ description: Invitable
125
+ email:
126
+ - brian@dockyard.com
127
+ - bcardarella@gmail.com
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files: []
131
+ files:
132
+ - app/assets/javascripts/invitable/application.js
133
+ - app/assets/stylesheets/invitable/application.css
134
+ - app/controllers/invitable/application_controller.rb
135
+ - app/controllers/invitable/invitations_controller.rb
136
+ - app/helpers/invitable/application_helper.rb
137
+ - app/mailers/invitable/invitation_mailer.rb
138
+ - app/models/invitable/invitation.rb
139
+ - app/views/invitable/invitation_mailer/thank_you.html.erb
140
+ - app/views/layouts/invitable/application.html.erb
141
+ - config/locales/en.yml
142
+ - config/routes.rb
143
+ - db/migrate/20120217012945_create_invitable_invitations.rb
144
+ - lib/invitable/engine.rb
145
+ - lib/invitable/version.rb
146
+ - lib/invitable.rb
147
+ - lib/tasks/invitable_tasks.rake
148
+ - MIT-LICENSE
149
+ - Rakefile
150
+ - README.rdoc
151
+ homepage: https://github.com/dockyard/invitable
152
+ licenses: []
153
+ post_install_message:
154
+ rdoc_options: []
155
+ require_paths:
156
+ - lib
157
+ required_ruby_version: !ruby/object:Gem::Requirement
158
+ none: false
159
+ requirements:
160
+ - - ! '>='
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ segments:
164
+ - 0
165
+ hash: -3795702357829871114
166
+ required_rubygems_version: !ruby/object:Gem::Requirement
167
+ none: false
168
+ requirements:
169
+ - - ! '>'
170
+ - !ruby/object:Gem::Version
171
+ version: 1.3.1
172
+ requirements: []
173
+ rubyforge_project:
174
+ rubygems_version: 1.8.15
175
+ signing_key:
176
+ specification_version: 3
177
+ summary: Invitable
178
+ test_files: []