beta_invite 0.1.2 → 1.0.0
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 +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +58 -6
- data/app/controllers/beta_invite/beta_invites_controller.rb +13 -3
- data/app/mailers/beta_invite/beta_invite_notification_mailer.rb +35 -0
- data/app/views/beta_invite/beta_invite_notification_mailer/notify_admins.html.erb +9 -0
- data/app/views/beta_invite/beta_invite_notification_mailer/thank_user.html.erb +6 -0
- data/app/views/beta_invite/beta_invites/new.html.erb +8 -1
- data/lib/beta_invite.rb +1 -0
- data/lib/beta_invite/version.rb +1 -1
- data/lib/beta_invite_setup.rb +14 -0
- data/lib/generators/beta_invite/install_generator.rb +21 -0
- data/lib/generators/beta_invite/templates/README +18 -0
- data/lib/generators/beta_invite/templates/beta_invite.rb +22 -0
- data/lib/generators/beta_invite/views_generator.rb +2 -0
- metadata +10 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38c94035d41e4bc8e96514edf8a0f3b336647cde
|
4
|
+
data.tar.gz: 495a73b6976bd45153f3efd2c105cd6185d089a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: deca01f33c4a4840c801206d1ec6007a9c8de4325b5b570bb08098aa1b57e18db79fc95f36ecbc85f1211efed44e004cdf6f665cf88a562c6b73597d6c390cd3
|
7
|
+
data.tar.gz: b1392ebe030a4e4726c3b04dc12411a1898cfbdde6705567f18a24385e0211ec4e509f54ca148bdaf0bd1768a61a74ed2931c7320ab9c61d97be19d4b87e7db0
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -2,9 +2,27 @@
|
|
2
2
|
|
3
3
|
A simple gem to help you build your __beta_invite__ page up and running in no time
|
4
4
|
|
5
|
-
|
5
|
+
* [Features](#features)
|
6
|
+
* [Installation](#installation)
|
7
|
+
* [Setup](#setup)
|
8
|
+
- [Initializer](#initializer)
|
9
|
+
- [Migrations](#migrations)
|
10
|
+
- [Mount](#mount)
|
11
|
+
* [API](#where-are-the-invites-)
|
12
|
+
* [Views](#views)
|
6
13
|
|
7
|
-
|
14
|
+
## For version >= 1.0.0
|
15
|
+
|
16
|
+
##Features
|
17
|
+
|
18
|
+
* Quick and easy setup of __Beta Invite__ engine and its functionality
|
19
|
+
* Random Token stored and generated with each invite
|
20
|
+
* Customize and modify all the views and email templates
|
21
|
+
* Send emails as notification when someone requests for an invite to the admins
|
22
|
+
* Send __Thank you__ emails which can easily be customized by the developer in future.
|
23
|
+
|
24
|
+
|
25
|
+
##Installation
|
8
26
|
|
9
27
|
```ruby
|
10
28
|
gem install beta_invite
|
@@ -12,9 +30,27 @@ gem install beta_invite
|
|
12
30
|
|
13
31
|
or with the use of __Bundler__, you can just write `beta_invite` in your `Gemfile` and run `bundle` command in your CLI.
|
14
32
|
|
15
|
-
|
33
|
+
Installing from the source:
|
34
|
+
|
35
|
+
```
|
36
|
+
gem 'beta_invite', :github => 'git://github.com/ktkaushik/beta_invite.git'
|
37
|
+
```
|
16
38
|
|
17
|
-
|
39
|
+
If you are living on the edge with `beta_invite` gem, then you should refer [this](https://github.com/ktkaushik/beta_invite/blob/master/living_on_the_edge.md)
|
40
|
+
|
41
|
+
##Setup
|
42
|
+
|
43
|
+
###Initializer
|
44
|
+
|
45
|
+
The `beta_invite` gem has a beta_invite installer. First step to setup is to run the __install generator__
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
rails g beta_invite:install
|
49
|
+
```
|
50
|
+
|
51
|
+
This would create an __initializer__ named `beta_invite.rb`
|
52
|
+
|
53
|
+
###Migrations
|
18
54
|
The setup is very primary as of now. Once installed, you will need to copy the migrations by running this command
|
19
55
|
|
20
56
|
```ruby
|
@@ -29,14 +65,25 @@ rake db:migrate
|
|
29
65
|
|
30
66
|
The above migrations would create a `beta_invites` table in your app
|
31
67
|
|
32
|
-
|
68
|
+
|
69
|
+
###Mount
|
33
70
|
Now mount the `BetaInvite` engine by going into your `routes.rb` file and adding the below line
|
34
71
|
|
35
72
|
```ruby
|
36
73
|
mount BetaInvite::Engine, at: '/'
|
37
74
|
```
|
38
75
|
|
39
|
-
|
76
|
+
##Where are the invites ?
|
77
|
+
|
78
|
+
Well, you can fire up your rails console and you will see that all the tables are under `BetaInvite::BetaInvite`
|
79
|
+
|
80
|
+
This should fetch you all the records
|
81
|
+
|
82
|
+
```ruby
|
83
|
+
BetaInvite::BetaInvite.all
|
84
|
+
```
|
85
|
+
|
86
|
+
##Views
|
40
87
|
|
41
88
|
___for version >= 0.1.1___
|
42
89
|
|
@@ -56,6 +103,7 @@ Obviously, you can mount it to any route.
|
|
56
103
|
|
57
104
|
__You may wanna restart your server__
|
58
105
|
|
106
|
+
###[Roadmap](https://github.com/ktkaushik/beta_invite/wiki/Roadmap)
|
59
107
|
###[Changelogs](https://github.com/ktkaushik/beta_invite/wiki/Changelog)
|
60
108
|
|
61
109
|
##Contributing
|
@@ -68,3 +116,7 @@ __You may wanna restart your server__
|
|
68
116
|
```
|
69
117
|
|
70
118
|
Thank you !
|
119
|
+
|
120
|
+
|
121
|
+
[](https://bitdeli.com/free "Bitdeli Badge")
|
122
|
+
|
@@ -7,18 +7,28 @@ module BetaInvite
|
|
7
7
|
@beta_invite = BetaInvite.new
|
8
8
|
end
|
9
9
|
|
10
|
+
# Save the email and a randomly generated token
|
10
11
|
def create
|
11
12
|
email = params[:beta_invite][:email]
|
12
|
-
beta_invite = BetaInvite.new
|
13
|
-
|
14
|
-
beta_invite.token = SecureRandom.hex(10) #generate a random hex token for all the users
|
13
|
+
beta_invite = BetaInvite.new( email: email, token: SecureRandom.hex(10) )
|
14
|
+
|
15
15
|
if beta_invite.save
|
16
16
|
flash[:success] = "#{email} has been registered for beta invite"
|
17
|
+
|
18
|
+
# send an email if configured
|
19
|
+
if BetaInviteSetup.send_email_to_admins
|
20
|
+
BetaInvite::BetaInviteNotificationMailer.notify_admins( BetaInviteSetup.from_email, BetaInviteSetup.admin_emails, email, BetaInvite.count ).deliver
|
21
|
+
end
|
22
|
+
|
23
|
+
if BetaInviteSetup.send_thank_you_email
|
24
|
+
BetaInvite::BetaInviteNotificationMailer.thank_user( BetaInviteSetup.from_email, email ).deliver
|
25
|
+
end
|
17
26
|
redirect_to beta_invites_path
|
18
27
|
else
|
19
28
|
flash[:alert] = beta_invite.errors.full_messages
|
20
29
|
redirect_to new_beta_invite_path
|
21
30
|
end
|
31
|
+
|
22
32
|
end
|
23
33
|
end
|
24
34
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module BetaInvite
|
2
|
+
|
3
|
+
# The BetaInviteNotificationMailer sends notification emails to users and admins
|
4
|
+
# The `from` and `to` emails has to be configured in the initializer.
|
5
|
+
#
|
6
|
+
# Do not forget to enter the mail configurations in your environments file.
|
7
|
+
#
|
8
|
+
class BetaInviteNotificationMailer < ActionMailer::Base
|
9
|
+
|
10
|
+
# send the email with adequate info
|
11
|
+
# TODO: Subject in locales
|
12
|
+
def notify_admins( from_email, to_email, beta_invite_email, count )
|
13
|
+
|
14
|
+
@email = beta_invite_email
|
15
|
+
@count = count
|
16
|
+
subject = "#{@email} has registered for your app"
|
17
|
+
mail(
|
18
|
+
to: to_email,
|
19
|
+
from: from_email,
|
20
|
+
subject: subject
|
21
|
+
)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Send an email to the user as a thank you
|
25
|
+
# TODO: Subject in locales
|
26
|
+
def thank_user( from_email, to_email )
|
27
|
+
subject = "Thank you for requesting an invite"
|
28
|
+
mail(
|
29
|
+
to: to_email,
|
30
|
+
from: from_email,
|
31
|
+
subject: subject
|
32
|
+
)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -1,4 +1,11 @@
|
|
1
|
-
|
1
|
+
<% flash.each do |key, msg| %>
|
2
|
+
<div class="alert alert-#{name == :notice ? 'success' : 'error' }">
|
3
|
+
<% Array(msg).each_with_index do |message, index| %>
|
4
|
+
<%= content_tag :div, message %>
|
5
|
+
<% end %>
|
6
|
+
</div>
|
7
|
+
<% end %>
|
8
|
+
<h1>Request for a beta invite</h1>
|
2
9
|
<%= form_for @beta_invite do |f| %>
|
3
10
|
<%= f.label :email, 'Email'%>
|
4
11
|
<%= f.text_field :email, placeholder: "Enter your email" %>
|
data/lib/beta_invite.rb
CHANGED
data/lib/beta_invite/version.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# TODO: add copy migration file as well. No need for developer to run another command
|
3
|
+
#
|
4
|
+
module BetaInvite
|
5
|
+
module Generators
|
6
|
+
class InstallGenerator < Rails::Generators::Base
|
7
|
+
source_root File.expand_path("../templates", __FILE__)
|
8
|
+
|
9
|
+
desc "Creates a BetaInvite initializer"
|
10
|
+
|
11
|
+
def copy_initializer
|
12
|
+
template "beta_invite.rb", "config/initializers/beta_invite.rb"
|
13
|
+
end
|
14
|
+
|
15
|
+
# Display readme when the user installs the gem. inspired from Devise gem :)
|
16
|
+
def show_readme
|
17
|
+
readme "README" if behavior == :invoke
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
=================================================================================
|
2
|
+
Instructions for beta_invite gem
|
3
|
+
|
4
|
+
An initializer by the name beta_invite.rb has been created in your initializer,
|
5
|
+
wherein you will find a few options there with instructions for you to configure
|
6
|
+
|
7
|
+
You can also generate views by running this comamnd:
|
8
|
+
|
9
|
+
rails g beta_invite:views
|
10
|
+
|
11
|
+
Please checkout the README on the below URL for full information:
|
12
|
+
|
13
|
+
https://github.com/ktkaushik/beta_invite#betainvite
|
14
|
+
|
15
|
+
Thanks !
|
16
|
+
Roadmap: https://github.com/ktkaushik/beta_invite/wiki/Roadmap
|
17
|
+
|
18
|
+
=================================================================================
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#
|
2
|
+
# Setup your BetaInvite engine in easy steps using this config initializer
|
3
|
+
#
|
4
|
+
|
5
|
+
BetaInviteSetup.setup do |config|
|
6
|
+
# Setting this to true would send an email to the admins saying that a
|
7
|
+
# particular user with a particular email address has requested for an invite
|
8
|
+
config.send_email_to_admins = false
|
9
|
+
|
10
|
+
# If you have set the above option as true then you should add the email addresses
|
11
|
+
# of the admins who should receive a notification about the user having requested
|
12
|
+
# for an invite in a comma separated value.
|
13
|
+
config.admin_emails = 'email_1@example.org, email_2@example.org'
|
14
|
+
|
15
|
+
# Configure your mail configuration in the environments file and enter the from email
|
16
|
+
# to send emails
|
17
|
+
config.from_email = 'from@email.com'
|
18
|
+
|
19
|
+
# Send thank you emails to the user who has requested for an invite
|
20
|
+
# False by default
|
21
|
+
config.send_thank_you_email = false
|
22
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require "rails/generators"
|
2
2
|
|
3
|
+
# Generate View Generator
|
3
4
|
module BetaInvite
|
4
5
|
module Generators
|
5
6
|
class ViewsGenerator < Rails::Generators::Base
|
@@ -7,6 +8,7 @@ module BetaInvite
|
|
7
8
|
|
8
9
|
desc "this generator would copy all the view files for beta_invite engine into your rails app"
|
9
10
|
|
11
|
+
# Generate views from the beta_invite gem
|
10
12
|
def create_views
|
11
13
|
copy_file 'new.html.erb', Rails.root.join('app','views','beta_invite','beta_invites','new.html.erb')
|
12
14
|
copy_file 'index.html.erb', Rails.root.join('app','views','beta_invite','beta_invites','index.html.erb')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beta_invite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kaushik Thirthappa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -39,7 +39,10 @@ files:
|
|
39
39
|
- app/controllers/beta_invite/beta_invites_controller.rb
|
40
40
|
- app/helpers/beta_invite/application_helper.rb
|
41
41
|
- app/helpers/beta_invite/beta_invites_helper.rb
|
42
|
+
- app/mailers/beta_invite/beta_invite_notification_mailer.rb
|
42
43
|
- app/models/beta_invite/beta_invite.rb
|
44
|
+
- app/views/beta_invite/beta_invite_notification_mailer/notify_admins.html.erb
|
45
|
+
- app/views/beta_invite/beta_invite_notification_mailer/thank_user.html.erb
|
43
46
|
- app/views/beta_invite/beta_invites/index.html.erb
|
44
47
|
- app/views/beta_invite/beta_invites/new.html.erb
|
45
48
|
- app/views/layouts/beta_invite/application.html.erb
|
@@ -48,6 +51,10 @@ files:
|
|
48
51
|
- lib/beta_invite/engine.rb
|
49
52
|
- lib/beta_invite/version.rb
|
50
53
|
- lib/beta_invite.rb
|
54
|
+
- lib/beta_invite_setup.rb
|
55
|
+
- lib/generators/beta_invite/install_generator.rb
|
56
|
+
- lib/generators/beta_invite/templates/beta_invite.rb
|
57
|
+
- lib/generators/beta_invite/templates/README
|
51
58
|
- lib/generators/beta_invite/views_generator.rb
|
52
59
|
- lib/tasks/beta_invite_tasks.rake
|
53
60
|
- MIT-LICENSE
|
@@ -80,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
87
|
version: '0'
|
81
88
|
requirements: []
|
82
89
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.1.
|
90
|
+
rubygems_version: 2.1.6
|
84
91
|
signing_key:
|
85
92
|
specification_version: 4
|
86
93
|
summary: Setup beta invite system with ease
|