happy_seed 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/MIT-LICENSE +20 -0
- data/Rakefile +32 -0
- data/bin/happy_seed +7 -0
- data/happy_seed.rb +45 -0
- data/lib/generators/happy_seed/.DS_Store +0 -0
- data/lib/generators/happy_seed/bootstrap/bootstrap_generator.rb +31 -0
- data/lib/generators/happy_seed/bootstrap/templates/app/assets/javascripts/application.js +15 -0
- data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/application/index.css.scss +7 -0
- data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/application/variables.css.scss +12 -0
- data/lib/generators/happy_seed/bootstrap/templates/app/helpers/application_helper.rb +19 -0
- data/lib/generators/happy_seed/bootstrap/templates/app/views/application/_chromeframe.html.haml +4 -0
- data/lib/generators/happy_seed/bootstrap/templates/app/views/application/_flashes.html.haml +8 -0
- data/lib/generators/happy_seed/bootstrap/templates/app/views/application/_footer.html.haml +8 -0
- data/lib/generators/happy_seed/bootstrap/templates/app/views/application/_head.html.haml +13 -0
- data/lib/generators/happy_seed/bootstrap/templates/app/views/application/_header.html.haml +16 -0
- data/lib/generators/happy_seed/bootstrap/templates/app/views/application/_javascripts.html.haml +12 -0
- data/lib/generators/happy_seed/bootstrap/templates/app/views/application/_stylesheets.html.haml +4 -0
- data/lib/generators/happy_seed/bootstrap/templates/app/views/layouts/application.html.haml +16 -0
- data/lib/generators/happy_seed/bootstrap/templates/docs/README.01.bootstrap.rdoc +31 -0
- data/lib/generators/happy_seed/bootstrap/templates/lib/templates/haml/scaffold/_form.html.haml +19 -0
- data/lib/generators/happy_seed/bootstrap/templates/lib/templates/haml/scaffold/edit.html.haml +10 -0
- data/lib/generators/happy_seed/bootstrap/templates/lib/templates/haml/scaffold/index.html.haml +26 -0
- data/lib/generators/happy_seed/bootstrap/templates/lib/templates/haml/scaffold/new.html.haml +8 -0
- data/lib/generators/happy_seed/bootstrap/templates/lib/templates/haml/scaffold/show.html.haml +15 -0
- data/lib/generators/happy_seed/bootstrap/templates/lib/templates/rails/.DS_Store +0 -0
- data/lib/generators/happy_seed/bootstrap/templates/lib/templates/rails/scaffold_controller/controller.rb +54 -0
- data/lib/generators/happy_seed/devise/devise_generator.rb +37 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/passwords/edit.html.haml +31 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/passwords/new.html.haml +27 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/registrations/new.html.haml +34 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/sessions/new.html.haml +38 -0
- data/lib/generators/happy_seed/devise/templates/docs/README.03.devise.rdoc +24 -0
- data/lib/generators/happy_seed/facebook/facebook_generator.rb +50 -0
- data/lib/generators/happy_seed/facebook/templates/docs/README.06.facebook.rdoc +24 -0
- data/lib/generators/happy_seed/foreman/foreman_generator.rb +27 -0
- data/lib/generators/happy_seed/foreman/templates/.env +5 -0
- data/lib/generators/happy_seed/foreman/templates/.foreman +1 -0
- data/lib/generators/happy_seed/foreman/templates/Procfile +1 -0
- data/lib/generators/happy_seed/foreman/templates/app/controllers/.DS_Store +0 -0
- data/lib/generators/happy_seed/foreman/templates/app/controllers/setup_controller.rb +29 -0
- data/lib/generators/happy_seed/foreman/templates/app/views/setup/index.html.haml +31 -0
- data/lib/generators/happy_seed/foreman/templates/application_controller.rb +10 -0
- data/lib/generators/happy_seed/foreman/templates/config/unicorn.rb +33 -0
- data/lib/generators/happy_seed/foreman/templates/docs/README.00.base.rdoc +34 -0
- data/lib/generators/happy_seed/omniauth/omniauth_generator.rb +48 -0
- data/lib/generators/happy_seed/omniauth/templates/app/controllers/omniauth_callbacks_controller.rb +29 -0
- data/lib/generators/happy_seed/omniauth/templates/app/models/identity.rb +11 -0
- data/lib/generators/happy_seed/omniauth/templates/docs/README.04.omniauth.rdoc +27 -0
- data/lib/generators/happy_seed/omniauth/templates/user.rb +51 -0
- data/lib/generators/happy_seed/splash/splash_generator.rb +44 -0
- data/lib/generators/happy_seed/splash/templates/app/controllers/splash_controller.rb +55 -0
- data/lib/generators/happy_seed/splash/templates/app/views/layouts/splash.html.haml +14 -0
- data/lib/generators/happy_seed/splash/templates/app/views/splash/_environment_checks.html.haml +45 -0
- data/lib/generators/happy_seed/splash/templates/app/views/splash/index.html.haml +23 -0
- data/lib/generators/happy_seed/splash/templates/app/views/splash/signup.js.erb +8 -0
- data/lib/generators/happy_seed/splash/templates/docs/README.02.splash.rdoc +29 -0
- data/lib/generators/happy_seed/twitter/.DS_Store +0 -0
- data/lib/generators/happy_seed/twitter/templates/docs/README.05.twitter.rdoc +24 -0
- data/lib/generators/happy_seed/twitter/twitter_generator.rb +50 -0
- data/lib/generators/seed/bootstrap/templates/lib/templates/rails/.DS_Store +0 -0
- data/lib/happy_seed.rb +2 -0
- data/lib/happy_seed/version.rb +3 -0
- data/lib/tasks/seed_tasks.rake +4 -0
- data/test/dummy/README.rdoc +28 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +5 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +37 -0
- data/test/dummy/config/environments/production.rb +82 -0
- data/test/dummy/config/environments/test.rb +39 -0
- data/test/dummy/config/initializers/assets.rb +8 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +56 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/test.log +10 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/seed_test.rb +7 -0
- data/test/test_helper.rb +15 -0
- metadata +213 -0
@@ -0,0 +1,48 @@
|
|
1
|
+
module HappySeed
|
2
|
+
module Generators
|
3
|
+
class OmniauthGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
|
+
|
6
|
+
def install_omniauth
|
7
|
+
if File.exists? 'app/models/identity.rb'
|
8
|
+
puts "identity.rb already exists, skipping"
|
9
|
+
return
|
10
|
+
end
|
11
|
+
|
12
|
+
unless gem_available?( "devise" )
|
13
|
+
puts "The omniauth generator requires devise"
|
14
|
+
|
15
|
+
if yes?( "Run happy_seed:devise now?" )
|
16
|
+
generate "happy_seed:devise"
|
17
|
+
else
|
18
|
+
exit
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
gem 'omniauth'
|
23
|
+
|
24
|
+
Bundler.with_clean_env do
|
25
|
+
run "bundle install"
|
26
|
+
end
|
27
|
+
|
28
|
+
generate 'model identity user:references provider:string uid:string'
|
29
|
+
remove_file 'app/models/identity.rb'
|
30
|
+
directory 'app'
|
31
|
+
|
32
|
+
gsub_file "app/models/user.rb", "devise :", "devise :omniauthable, :"
|
33
|
+
insert_into_file "app/models/user.rb", File.read( find_in_source_paths( "user.rb" ) ), :before => "\nend\n"
|
34
|
+
gsub_file 'config/routes.rb', "devise_for :users\n", "devise_for :users, :controllers => { omniauth_callbacks: 'omniauth_callbacks' }\n"
|
35
|
+
directory "docs"
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
def gem_available?(name)
|
40
|
+
Gem::Specification.find_by_name(name)
|
41
|
+
rescue Gem::LoadError
|
42
|
+
false
|
43
|
+
rescue
|
44
|
+
Gem.available?(name)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
data/lib/generators/happy_seed/omniauth/templates/app/controllers/omniauth_callbacks_controller.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
2
|
+
def self.provides_callback_for(provider)
|
3
|
+
class_eval %Q{
|
4
|
+
def #{provider}
|
5
|
+
@user = User.find_for_oauth(env["omniauth.auth"], current_user)
|
6
|
+
|
7
|
+
if @user.persisted?
|
8
|
+
sign_in_and_redirect @user, event: :authentication
|
9
|
+
set_flash_message(:notice, :success, kind: "#{provider}".capitalize) if is_navigational_format?
|
10
|
+
else
|
11
|
+
session["devise.#{provider}_data"] = env["omniauth.auth"]
|
12
|
+
redirect_to new_user_registration_url
|
13
|
+
end
|
14
|
+
end
|
15
|
+
}
|
16
|
+
end
|
17
|
+
|
18
|
+
[:twitter, :facebook, :linked_in].each do |provider|
|
19
|
+
provides_callback_for provider
|
20
|
+
end
|
21
|
+
|
22
|
+
def after_sign_in_path_for(resource)
|
23
|
+
if resource.email_verified?
|
24
|
+
super resource
|
25
|
+
else
|
26
|
+
finish_signup_path(resource)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class Identity < ActiveRecord::Base
|
2
|
+
belongs_to :user
|
3
|
+
validates_presence_of :uid, :provider
|
4
|
+
validates_uniqueness_of :uid, :scope => :provider
|
5
|
+
|
6
|
+
def self.find_for_oauth(auth)
|
7
|
+
identity = find_by(provider: auth.provider, uid: auth.uid)
|
8
|
+
identity = create(uid: auth.uid, provider: auth.provider) if identity.nil?
|
9
|
+
identity
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
HappySeed Omniauth Install
|
2
|
+
=====================
|
3
|
+
|
4
|
+
### What does this do?
|
5
|
+
|
6
|
+
The happy_seed:omniauth generator depends upon happy_seed:devise and
|
7
|
+
|
8
|
+
|
9
|
+
* Generates an Intentity model, linked to user
|
10
|
+
* Installs omniauth
|
11
|
+
* Installs an omniauth_controller
|
12
|
+
* Updates devise configuration
|
13
|
+
* Adds routes
|
14
|
+
* Inserts code into User to do the lookup TODO
|
15
|
+
* Inserts fallback controller to handle the login
|
16
|
+
|
17
|
+
### Why do you want this?
|
18
|
+
|
19
|
+
Once this is in place you can easily add other oauth providers
|
20
|
+
|
21
|
+
### Environment Variables
|
22
|
+
|
23
|
+
na
|
24
|
+
|
25
|
+
### What needs to be done?
|
26
|
+
|
27
|
+
na
|
@@ -0,0 +1,51 @@
|
|
1
|
+
|
2
|
+
TEMP_EMAIL_PREFIX = 'change@me'
|
3
|
+
TEMP_EMAIL_REGEX = /\Achange@me/
|
4
|
+
|
5
|
+
# validates_format_of :email, :without => TEMP_EMAIL_REGEX, on: :update
|
6
|
+
|
7
|
+
def self.find_for_oauth(auth, signed_in_resource = nil)
|
8
|
+
|
9
|
+
# Get the identity and user if they exist
|
10
|
+
identity = Identity.find_for_oauth(auth)
|
11
|
+
|
12
|
+
# If a signed_in_resource is provided it always overrides the existing user
|
13
|
+
# to prevent the identity being locked with accidentally created accounts.
|
14
|
+
# Note that this may leave zombie accounts (with no associated identity) which
|
15
|
+
# can be cleaned up at a later date.
|
16
|
+
user = signed_in_resource ? signed_in_resource : identity.user
|
17
|
+
|
18
|
+
# Create the user if needed
|
19
|
+
if user.nil?
|
20
|
+
|
21
|
+
# Get the existing user by email if the provider gives us a verified email.
|
22
|
+
# If no verified email was provided we assign a temporary email and ask the
|
23
|
+
# user to verify it on the next step via UsersController.finish_signup
|
24
|
+
email_is_verified = auth.info.email && (auth.info.verified || auth.info.verified_email)
|
25
|
+
email = auth.info.email if email_is_verified
|
26
|
+
user = User.where(:email => email).first if email
|
27
|
+
|
28
|
+
# Create the user if it's a new registration
|
29
|
+
if user.nil?
|
30
|
+
user = User.new(
|
31
|
+
name: auth.extra.raw_info.name,
|
32
|
+
#username: auth.info.nickname || auth.uid,
|
33
|
+
email: email ? email : "#{TEMP_EMAIL_PREFIX}-#{auth.uid}-#{auth.provider}.com",
|
34
|
+
password: Devise.friendly_token[0,20]
|
35
|
+
)
|
36
|
+
user.skip_confirmation!
|
37
|
+
user.save!
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Associate the identity with the user if needed
|
42
|
+
if identity.user != user
|
43
|
+
identity.user = user
|
44
|
+
identity.save!
|
45
|
+
end
|
46
|
+
user
|
47
|
+
end
|
48
|
+
|
49
|
+
def email_verified?
|
50
|
+
self.email && self.email !~ TEMP_EMAIL_REGEX
|
51
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module HappySeed
|
2
|
+
module Generators
|
3
|
+
class SplashGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
|
+
|
6
|
+
def install_landing_page
|
7
|
+
unless gem_available?( "bootstrap-sass" )
|
8
|
+
puts "The splash generator requires bootstrap"
|
9
|
+
|
10
|
+
if yes?( "Run happy_seed:bootstrap now?" )
|
11
|
+
generate "happy_seed:bootstrap"
|
12
|
+
else
|
13
|
+
exit
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
gem 'gibbon'
|
18
|
+
|
19
|
+
Bundler.with_clean_env do
|
20
|
+
run "bundle install"
|
21
|
+
end
|
22
|
+
|
23
|
+
remove_file 'public/index.html'
|
24
|
+
|
25
|
+
gsub_file "config/routes.rb", /\s*root.*\n/, "\n"
|
26
|
+
route "root 'splash#index'"
|
27
|
+
route "post '/signup' => 'splash#signup', as: :splash_signup"
|
28
|
+
|
29
|
+
directory 'app'
|
30
|
+
directory "docs"
|
31
|
+
append_to_file ".env", "MAILCHIMP_API_KEY=\nMAILCHIMP_SPLASH_SIGNUP_LIST_ID=\n"
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
def gem_available?(name)
|
36
|
+
Gem::Specification.find_by_name(name)
|
37
|
+
rescue Gem::LoadError
|
38
|
+
false
|
39
|
+
rescue
|
40
|
+
Gem.available?(name)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
class SplashController < ApplicationController
|
2
|
+
|
3
|
+
skip_before_filter :authenticate
|
4
|
+
|
5
|
+
def index
|
6
|
+
|
7
|
+
@tracker_gems = Hash[%w( honeybadger bugsnag errorapp_notifier exceptiontrap rollbar
|
8
|
+
runtimeerror_notifier sentry-raven airbrake ).map{|x| [x,gem_available?(x)]}]
|
9
|
+
|
10
|
+
puts @tracker_gems.to_yaml
|
11
|
+
end
|
12
|
+
|
13
|
+
def signup
|
14
|
+
if ENV['MAILCHIMP_SPLASH_SIGNUP_LIST_ID'].blank? or ENV['MAILCHIMP_API_KEY'].blank?
|
15
|
+
|
16
|
+
@message = "The MAILCHIMP_API_KEY and MAILCHIMP_SPLASH_SIGNUP_LIST_ID environment variables need to be set for mailing list signup to work! If you don't want this feature, you can just remove the mailing list signup feature from app/views/splash/index.html.haml"
|
17
|
+
|
18
|
+
else
|
19
|
+
begin
|
20
|
+
|
21
|
+
gb = Gibbon::API.new
|
22
|
+
|
23
|
+
gb.lists.subscribe({
|
24
|
+
:id => ENV['MAILCHIMP_SPLASH_SIGNUP_LIST_ID'],
|
25
|
+
:email => {:email => params[:signup_email]},
|
26
|
+
:double_optin => true
|
27
|
+
})
|
28
|
+
|
29
|
+
@message = 'Thanks for signing up!'
|
30
|
+
|
31
|
+
rescue StandardError => e
|
32
|
+
@error = true
|
33
|
+
|
34
|
+
if e.message =~ /is already subscribed to list/
|
35
|
+
@message = "You're already signed up to receive updates. Thanks for your enthusiasm!"
|
36
|
+
else
|
37
|
+
@message = "Oops! Looks like we ran into an error. How embarrassing. Please try again later!"
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def gem_available?(name)
|
48
|
+
Gem::Specification.find_by_name(name)
|
49
|
+
rescue Gem::LoadError
|
50
|
+
false
|
51
|
+
rescue
|
52
|
+
Gem.available?(name)
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
!!! 5
|
2
|
+
%html.no-js
|
3
|
+
= render 'head'
|
4
|
+
|
5
|
+
%body{ :class => "#{ controller.controller_name }" }
|
6
|
+
= render 'chromeframe'
|
7
|
+
= render 'flashes'
|
8
|
+
|
9
|
+
= yield
|
10
|
+
|
11
|
+
= render 'footer'
|
12
|
+
|
13
|
+
-# Javascript at the bottom for fast page loading
|
14
|
+
= render 'javascripts'
|
data/lib/generators/happy_seed/splash/templates/app/views/splash/_environment_checks.html.haml
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
%ul.list-group
|
2
|
+
|
3
|
+
- if ENV['AWS_ACCESS_KEY_ID'].blank? or ENV['AWS_SECRET_ACCESS_KEY'].blank?
|
4
|
+
%li.list-group-item.list-group-item-danger
|
5
|
+
%h4 AWS
|
6
|
+
You haven't set up your AWS account in this environment! Set the <code>AWS_ACCESS_KEY_ID</code> and <code>AWS_SECRET_ACCESS_KEY</code> environment variables to configure AWS. You should have the client sign up and follow the instructions below.
|
7
|
+
- else
|
8
|
+
%li.list-group-item.list-group-item-success
|
9
|
+
%h4 AWS
|
10
|
+
Your AWS account is configured for this environment!
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
- if ENV['GOOGLE_ANALYTICS_SITE_ID'].blank?
|
15
|
+
%li.list-group-item.list-group-item-danger
|
16
|
+
%h4 Google Analytics
|
17
|
+
You haven't set up a Google Analytics account in this environment! Set the <code>GOOGLE_ANALYTICS_SITE_ID</code> environment variables to configure Google Analytics. You should ask the client to <a href="http://google.com/analytics/" target="_blank">set up a Google Analytics account</a>.
|
18
|
+
- else
|
19
|
+
%li.list-group-item.list-group-item-success
|
20
|
+
%h4 Google Analytics
|
21
|
+
Your Google Analytics account is configured for this environment!
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
- unless @tracker_gems.values.any?
|
26
|
+
%li.list-group-item.list-group-item-danger
|
27
|
+
%h4 Exception Tracking
|
28
|
+
You haven't set up an exception tracker! May I recommend <a href="https://addons.heroku.com/honeybadger" target="_blank">Honeybadger</a>?
|
29
|
+
- else
|
30
|
+
%li.list-group-item.list-group-item-success
|
31
|
+
%h4 Exception Tracking
|
32
|
+
Found exception tracker gems(s):
|
33
|
+
= @tracker_gems.select{|k,v| v}.keys.join(', ')
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
- if ENV['MAILCHIMP_API_KEY'].blank?
|
38
|
+
%li.list-group-item.list-group-item-danger
|
39
|
+
%h4 Mailchimp
|
40
|
+
<p>You haven't set up a Mailchimp account in this environment! Have the client create an account at <a href="http://mailchimp.com" target="_blank">mailchimp.com</a> and set the <code>MAILCHIMP_API_KEY</code> environment variables to configure Mailchimp.</p>
|
41
|
+
<p>Once a Mailchimp account is configured, you'll need to create a list through the web interface and set the <code>MAILCHIMP_SPLASH_SIGNUP_LIST_ID</code> environment variable to the list id (ten-digit hex id visible in the List name & defaults tab).</p>
|
42
|
+
- else
|
43
|
+
%li.list-group-item.list-group-item-success
|
44
|
+
%h4 Mailchimp
|
45
|
+
Your Mailchimp account is configured for this environment!
|
@@ -0,0 +1,23 @@
|
|
1
|
+
%section.masthead.jumbotron
|
2
|
+
.container
|
3
|
+
.row
|
4
|
+
.col-md-8.col-md-offset-2
|
5
|
+
.panel.panel-default
|
6
|
+
.panel-body
|
7
|
+
.row
|
8
|
+
.col-md-4.text-center.brand
|
9
|
+
%h1
|
10
|
+
%span.glyphicon.glyphicon-cloud
|
11
|
+
%br
|
12
|
+
App
|
13
|
+
.signup.col-md-7.col-md-offset-0.col-lg-7.col-lg-offset-0.col-sm-offset-2.col-sm-8
|
14
|
+
%p.lead Get ready. We'll make your life easier and more meaningful.
|
15
|
+
= form_tag splash_signup_path, role: :form, :class=>'form-horizontal', :remote=>true do
|
16
|
+
.form-group#signup
|
17
|
+
.col-sm-12
|
18
|
+
.input-group
|
19
|
+
= text_field_tag :signup_email, '', :class=>'form-control', :placeholder=>'Enter your email to know when we launch!'
|
20
|
+
%span.input-group-btn
|
21
|
+
= submit_tag 'Sign up', :class=>'btn btn-primary'
|
22
|
+
%small#signup-message
|
23
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
HappySeed Splash Install
|
2
|
+
===================
|
3
|
+
|
4
|
+
### What does this do?
|
5
|
+
|
6
|
+
The happy_seed:splash generator depends upon the happy_seed:bootstrap generator and will prompt you to run it if it hasn't already.
|
7
|
+
|
8
|
+
* Installs a splash screen with sign up for the mailing list.
|
9
|
+
* Installs a base styling for the splash screen TODO
|
10
|
+
* Installs a splash controller which can used to signup for a Mailchimp mailing list.
|
11
|
+
|
12
|
+
### Why do you want this?
|
13
|
+
|
14
|
+
Everyone wants an interest signup page ASAP.
|
15
|
+
|
16
|
+
### Environment Variables
|
17
|
+
|
18
|
+
This is for the mailchimp signup form.
|
19
|
+
|
20
|
+
```
|
21
|
+
MAILCHIMP_API_KEY=
|
22
|
+
MAILCHIMP_SPLASH_SIGNUP_LIST_ID=
|
23
|
+
```
|
24
|
+
|
25
|
+
### What needs to be done?
|
26
|
+
|
27
|
+
Style the page.
|
28
|
+
|
29
|
+
Sign up for mailchimp and setup the environment.
|
Binary file
|
@@ -0,0 +1,24 @@
|
|
1
|
+
HappySeed Twitter Install
|
2
|
+
====================
|
3
|
+
|
4
|
+
### What does this do?
|
5
|
+
|
6
|
+
The happy_seed:twitter depends upon happy_seed:omniauth and
|
7
|
+
|
8
|
+
* Installs twitter authentication
|
9
|
+
* Installs links in the nav bar and use signup/signin pages
|
10
|
+
|
11
|
+
### Why do you want this?
|
12
|
+
|
13
|
+
If you want to have the user connect via twitter, this is the one line command for it.
|
14
|
+
|
15
|
+
### Environment Variables
|
16
|
+
|
17
|
+
```
|
18
|
+
TWITTER_APP_ID=
|
19
|
+
TWITTER_APP_SECRET=
|
20
|
+
```
|
21
|
+
|
22
|
+
### What needs to be done?
|
23
|
+
|
24
|
+
na
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module HappySeed
|
2
|
+
module Generators
|
3
|
+
class TwitterGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
|
+
|
6
|
+
def install_landing_page
|
7
|
+
unless gem_available?( "devise" )
|
8
|
+
puts "The twitter generator requires devise"
|
9
|
+
|
10
|
+
if yes?( "Run happy_seed:devise now?" )
|
11
|
+
generate "happy_seed:devise"
|
12
|
+
else
|
13
|
+
exit
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
unless File.exists? 'app/models/identity.rb'
|
18
|
+
generate "happy_seed:omniauth"
|
19
|
+
end
|
20
|
+
|
21
|
+
gem 'omniauth-twitter'
|
22
|
+
|
23
|
+
Bundler.with_clean_env do
|
24
|
+
run "bundle install"
|
25
|
+
end
|
26
|
+
|
27
|
+
inject_into_file 'config/initializers/devise.rb', after: "==> OmniAuth\n" do <<-'RUBY'
|
28
|
+
config.omniauth :twitter, ENV['TWITTER_APP_ID'], ENV['TWITTER_APP_SECRET']
|
29
|
+
RUBY
|
30
|
+
end
|
31
|
+
append_to_file ".env", "TWITTER_APP_ID=\nTWITTER_APP_SECRET=\n"
|
32
|
+
|
33
|
+
inject_into_file 'app/views/application/_header.html.haml', " %li= link_to 'sign in with twitter', user_omniauth_authorize_path(:twitter)\n", after: "/ CONNECT\n"
|
34
|
+
inject_into_file 'app/views/devise/sessions/new.html.haml', " = link_to 'sign in with twitter', user_omniauth_authorize_path(:twitter)\n %br\n", after: "/ CONNECT\n"
|
35
|
+
inject_into_file 'app/views/devise/registrations/new.html.haml', " = link_to 'sign in with twitter', user_omniauth_authorize_path(:twitter)\n %br\n", after: "/ CONNECT\n"
|
36
|
+
|
37
|
+
directory "docs"
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
def gem_available?(name)
|
42
|
+
Gem::Specification.find_by_name(name)
|
43
|
+
rescue Gem::LoadError
|
44
|
+
false
|
45
|
+
rescue
|
46
|
+
Gem.available?(name)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|