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,37 @@
|
|
1
|
+
module HappySeed
|
2
|
+
module Generators
|
3
|
+
class DeviseGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
|
+
|
6
|
+
def install_landing_page
|
7
|
+
gem 'devise'
|
8
|
+
|
9
|
+
Bundler.with_clean_env do
|
10
|
+
run "bundle install"
|
11
|
+
end
|
12
|
+
|
13
|
+
run 'rails generate devise:install'
|
14
|
+
run 'rails generate devise User'
|
15
|
+
run 'rails generate devise:views'
|
16
|
+
|
17
|
+
remove_file 'app/views/devise/registrations/new.html.erb'
|
18
|
+
remove_file 'app/views/devise/sessions/new.html.erb'
|
19
|
+
remove_file 'app/views/devise/passwords/edit.html.erb'
|
20
|
+
remove_file 'app/views/devise/passwords/new.html.erb'
|
21
|
+
|
22
|
+
directory 'app'
|
23
|
+
directory 'docs'
|
24
|
+
|
25
|
+
gsub_file 'app/views/application/_header.html.haml', "/ USER NAV", <<-'RUBY'
|
26
|
+
%ul.nav.navbar-nav.navbar-right
|
27
|
+
- if user_signed_in?
|
28
|
+
%li= link_to 'Sign Out', user_session_path, :method=>:destroy
|
29
|
+
- else
|
30
|
+
/ CONNECT
|
31
|
+
%li= link_to 'Sign In', new_user_session_path
|
32
|
+
%li= link_to 'Sign Up', new_user_registration_path
|
33
|
+
RUBY
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
.container
|
2
|
+
.row
|
3
|
+
.col-lg-6.col-lg-offset-3.col-md-6.col-md-offset-3.col-sm-8.col-sm-offset-2
|
4
|
+
.panel.panel-default.only
|
5
|
+
|
6
|
+
.panel-heading
|
7
|
+
Change your password
|
8
|
+
|
9
|
+
.panel-body
|
10
|
+
|
11
|
+
= form_for(resource, as: resource_name, url: password_path(resource_name), :html=>{:role=>:form, :class=>'form-horizontal'}) do |f|
|
12
|
+
|
13
|
+
= devise_error_messages!
|
14
|
+
|
15
|
+
.form-group
|
16
|
+
= f.label :password, :class=>'control-label col-lg-3'
|
17
|
+
.col-lg-9= f.password_field :password, autocomplete: "off", :autofocus: true, :class=>'form-control', :placeholder=>'Password'
|
18
|
+
|
19
|
+
.form-group
|
20
|
+
= f.label :password_confirmation, :class=>'control-label col-lg-3'
|
21
|
+
.col-lg-9= f.password_field :password_confirmation, autocomplete: "off", :class=>'form-control', :placeholder=>'Confirm password'
|
22
|
+
|
23
|
+
.form-group
|
24
|
+
.col-lg-9.col-lg-offset-3
|
25
|
+
= f.submit "Change my password", :class=>'btn btn-primary form-control'
|
26
|
+
|
27
|
+
.form-group
|
28
|
+
.col-lg-9.col-lg-offset-3.text-right
|
29
|
+
= link_to 'Sign in', new_user_session_path
|
30
|
+
%br
|
31
|
+
= link_to 'Sign up', new_user_registration_path
|
@@ -0,0 +1,27 @@
|
|
1
|
+
.container
|
2
|
+
.row
|
3
|
+
.col-lg-6.col-lg-offset-3.col-md-6.col-md-offset-3.col-sm-8.col-sm-offset-2
|
4
|
+
.panel.panel-default.only
|
5
|
+
|
6
|
+
.panel-heading
|
7
|
+
Forgot your password?
|
8
|
+
|
9
|
+
.panel-body
|
10
|
+
|
11
|
+
= form_for(resource, as: resource_name, url: password_path(resource_name), :html=>{:role=>:form, :class=>'form-horizontal'}) do |f|
|
12
|
+
|
13
|
+
= devise_error_messages!
|
14
|
+
|
15
|
+
.form-group
|
16
|
+
= f.label :email, :class=>'control-label col-lg-3'
|
17
|
+
.col-lg-9= f.email_field :email, autofocus: true, :class=>'form-control', :placeholder=>'Email'
|
18
|
+
|
19
|
+
.form-group
|
20
|
+
.col-lg-9.col-lg-offset-3
|
21
|
+
= f.submit "Send me reset password instructions", :class=>'btn btn-primary form-control'
|
22
|
+
|
23
|
+
.form-group
|
24
|
+
.col-lg-9.col-lg-offset-3.text-right
|
25
|
+
= link_to 'Sign in', new_user_session_path
|
26
|
+
%br
|
27
|
+
= link_to 'Sign up', new_user_registration_path
|
@@ -0,0 +1,34 @@
|
|
1
|
+
.container
|
2
|
+
.row
|
3
|
+
.col-lg-6.col-lg-offset-3.col-md-6.col-md-offset-3.col-sm-8.col-sm-offset-2
|
4
|
+
.panel.panel-default.only
|
5
|
+
|
6
|
+
.panel-heading
|
7
|
+
Sign up
|
8
|
+
|
9
|
+
.panel-body
|
10
|
+
|
11
|
+
= form_for(resource, as: resource_name, url: registration_path(resource_name), :html=>{:role=>:form, :class=>'form-horizontal'}) do |f|
|
12
|
+
|
13
|
+
= devise_error_messages!
|
14
|
+
|
15
|
+
.form-group
|
16
|
+
= f.label :email, :class=>'control-label col-lg-3'
|
17
|
+
.col-lg-9= f.email_field :email, autofocus: true, :class=>'form-control', :placeholder=>'Email'
|
18
|
+
|
19
|
+
.form-group
|
20
|
+
= f.label :password, :class=>'control-label col-lg-3'
|
21
|
+
.col-lg-9= f.password_field :password, autocomplete: "off", :class=>'form-control', :placeholder=>'Password'
|
22
|
+
|
23
|
+
.form-group
|
24
|
+
= f.label :password_confirmation, :class=>'control-label col-lg-3'
|
25
|
+
.col-lg-9= f.password_field :password_confirmation, autocomplete: "off", :class=>'form-control', :placeholder=>'Confirm password'
|
26
|
+
|
27
|
+
.form-group
|
28
|
+
.col-lg-9.col-lg-offset-3
|
29
|
+
= f.submit "Sign up", :class=>'btn btn-primary form-control'
|
30
|
+
|
31
|
+
.form-group
|
32
|
+
.col-lg-9.col-lg-offset-3.text-right
|
33
|
+
/ CONNECT
|
34
|
+
= link_to 'Sign in', new_user_session_path
|
@@ -0,0 +1,38 @@
|
|
1
|
+
.container
|
2
|
+
.row
|
3
|
+
.col-lg-6.col-lg-offset-3.col-md-6.col-md-offset-3.col-sm-8.col-sm-offset-2
|
4
|
+
.panel.panel-default.only
|
5
|
+
|
6
|
+
.panel-heading
|
7
|
+
Sign in
|
8
|
+
|
9
|
+
.panel-body
|
10
|
+
|
11
|
+
= form_for(resource, as: resource_name, url: session_path(resource_name), :html=>{:role=>:form, :class=>'form-horizontal'}) do |f|
|
12
|
+
|
13
|
+
.form-group
|
14
|
+
= f.label :email, :class=>'control-label col-sm-3'
|
15
|
+
.col-sm-9= f.email_field :email, autofocus: true, :class=>'form-control'
|
16
|
+
|
17
|
+
.form-group
|
18
|
+
= f.label :password, :class=>'control-label col-sm-3'
|
19
|
+
.col-sm-9= f.password_field :password, autocomplete: "off", :class=>'form-control'
|
20
|
+
|
21
|
+
- if devise_mapping.rememberable?
|
22
|
+
.form-group
|
23
|
+
.col-sm-9.col-sm-offset-3
|
24
|
+
.checkbox
|
25
|
+
= f.label :remember_me do
|
26
|
+
= f.check_box :remember_me
|
27
|
+
Remember me
|
28
|
+
|
29
|
+
.form-group
|
30
|
+
.col-lg-9.col-lg-offset-3
|
31
|
+
= f.submit "Sign in", :class=>'btn btn-primary form-control'
|
32
|
+
|
33
|
+
.form-group
|
34
|
+
.col-lg-9.col-lg-offset-3.text-right
|
35
|
+
/ CONNECT
|
36
|
+
= link_to 'Sign up', new_user_registration_path
|
37
|
+
%br
|
38
|
+
= link_to 'Forgot your password?', new_user_password_path
|
@@ -0,0 +1,24 @@
|
|
1
|
+
HappySeed Devise Install
|
2
|
+
===================
|
3
|
+
|
4
|
+
### What does this do?
|
5
|
+
|
6
|
+
The happy_seed:devise generator
|
7
|
+
|
8
|
+
* Installs devise
|
9
|
+
* Generates a User class
|
10
|
+
* Copies over devise views
|
11
|
+
* Gives them bootstrap views
|
12
|
+
* Adds use signin/signup stuff to the navbar
|
13
|
+
|
14
|
+
### Why do you want this?
|
15
|
+
|
16
|
+
User auth is boring.
|
17
|
+
|
18
|
+
### Environment Variables
|
19
|
+
|
20
|
+
na
|
21
|
+
|
22
|
+
### What needs to be done?
|
23
|
+
|
24
|
+
Flesh out the user model and run rake db:migrate.
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module HappySeed
|
2
|
+
module Generators
|
3
|
+
class FacebookGenerator < 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 facebook 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-facebook'
|
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 :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_APP_SECRET'], scope: 'offline_access,read_insights,manage_pages'
|
29
|
+
RUBY
|
30
|
+
end
|
31
|
+
|
32
|
+
append_to_file ".env", "FACEBOOK_APP_ID=\nFACEBOOK_APP_SECRET=\n"
|
33
|
+
inject_into_file 'app/views/application/_header.html.haml', " %li= link_to 'sign in with facebook', user_omniauth_authorize_path(:facebook)\n", after: "/ CONNECT\n"
|
34
|
+
inject_into_file 'app/views/devise/sessions/new.html.haml', " = link_to 'sign in with facebook', user_omniauth_authorize_path(:facebook)\n %br\n", after: "/ CONNECT\n"
|
35
|
+
inject_into_file 'app/views/devise/registrations/new.html.haml', " = link_to 'sign in with facebook', user_omniauth_authorize_path(:facebook)\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
|
@@ -0,0 +1,24 @@
|
|
1
|
+
HappySeed Facebook Install
|
2
|
+
====================
|
3
|
+
|
4
|
+
### What does this do?
|
5
|
+
|
6
|
+
The happy_seed:facebook depends upon happy_seed:omniauth and
|
7
|
+
|
8
|
+
* Installs facebook 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 facebook, this is the one line command for it.
|
14
|
+
|
15
|
+
### Environment Variables
|
16
|
+
|
17
|
+
```
|
18
|
+
FACEBOOK_APP_ID=
|
19
|
+
FACEBOOK_APP_SECRET=
|
20
|
+
```
|
21
|
+
|
22
|
+
### What needs to be done?
|
23
|
+
|
24
|
+
In config/initializers/devise.rb make sure that the scope you are requesting is correct.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module HappySeed
|
2
|
+
module Generators
|
3
|
+
class ForemanGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
|
+
|
6
|
+
def install_foreman
|
7
|
+
gem 'dotenv-rails', :groups=>[:development, :test]
|
8
|
+
gem 'rdiscount', :groups => [:development]
|
9
|
+
gem 'unicorn'
|
10
|
+
gem 'rails_12factor'
|
11
|
+
|
12
|
+
Bundler.with_clean_env do
|
13
|
+
run "bundle install"
|
14
|
+
end
|
15
|
+
|
16
|
+
directory '.'
|
17
|
+
|
18
|
+
remove_file "application_controller.rb"
|
19
|
+
|
20
|
+
inject_into_file 'app/controllers/application_controller.rb', File.read( find_in_source_paths('application_controller.rb') ), :after=>/protect_from_forgery.*\n/
|
21
|
+
|
22
|
+
route "get '/setup' => 'setup#index'"
|
23
|
+
route "root 'setup#index'"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
port: 3000
|
@@ -0,0 +1 @@
|
|
1
|
+
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
|
@@ -0,0 +1,29 @@
|
|
1
|
+
class SetupController < ApplicationController
|
2
|
+
before_filter :require_local!
|
3
|
+
layout :false
|
4
|
+
|
5
|
+
def index
|
6
|
+
@env = File.read( File.join( Rails.root, ".env" ) )
|
7
|
+
@docs = files
|
8
|
+
end
|
9
|
+
|
10
|
+
protected
|
11
|
+
|
12
|
+
def require_local!
|
13
|
+
unless local_request?
|
14
|
+
render text: '<p>For security purposes, this information is only available to local requests.</p>', status: :forbidden
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def local_request?
|
19
|
+
Rails.application.config.consider_all_requests_local || request.local?
|
20
|
+
end
|
21
|
+
|
22
|
+
def files
|
23
|
+
docs = Dir.glob(File.join( Rails.root, "docs/README.*" )).collect do |file|
|
24
|
+
name = file.gsub( /.*README.\d\d./, "happy_seed:" ).gsub( /.rdoc/, "" )
|
25
|
+
html = RDiscount.new( File.read( file ) ).to_html
|
26
|
+
{ name: name, html: html }
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%title HappySeed Generator setup page
|
5
|
+
%script{:src=>"//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"}
|
6
|
+
%link{:href=>"//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css", :rel=>"stylesheet"}
|
7
|
+
|
8
|
+
%body
|
9
|
+
.container
|
10
|
+
.row
|
11
|
+
.col-sm-2
|
12
|
+
.panel
|
13
|
+
%ul.affix
|
14
|
+
%li
|
15
|
+
%a{ href: "#env" }Environment Variables
|
16
|
+
- @docs.each do |f|
|
17
|
+
%li
|
18
|
+
%a{ href: "##{f[:name]}"}= f[:name]
|
19
|
+
.col-sm-10
|
20
|
+
/ Environment Variables
|
21
|
+
%h3
|
22
|
+
%a{ name: "env" }Environment Variables
|
23
|
+
|
24
|
+
%pre= @env
|
25
|
+
|
26
|
+
/ rdocs
|
27
|
+
- @docs.each do |f|
|
28
|
+
%h3
|
29
|
+
%a{ name: "#{f[:name]}"}= f[:name]
|
30
|
+
|
31
|
+
~ f[:html].html_safe
|
@@ -0,0 +1,10 @@
|
|
1
|
+
|
2
|
+
before_filter :authenticate
|
3
|
+
|
4
|
+
def authenticate
|
5
|
+
unless ENV['HTTP_AUTH_USERNAME'].blank? or ENV['HTTP_AUTH_PASSWORD'].blank?
|
6
|
+
authenticate_or_request_with_http_basic do |username, password|
|
7
|
+
username == ENV['HTTP_AUTH_USERNAME'] && password == ENV['HTTP_AUTH_PASSWORD']
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
worker_processes 3
|
2
|
+
timeout 30
|
3
|
+
preload_app true
|
4
|
+
|
5
|
+
before_fork do |server, worker|
|
6
|
+
# Replace with MongoDB or whatever
|
7
|
+
if defined?(ActiveRecord::Base)
|
8
|
+
ActiveRecord::Base.connection.disconnect!
|
9
|
+
Rails.logger.info('Disconnected from ActiveRecord')
|
10
|
+
end
|
11
|
+
|
12
|
+
# If you are using Redis but not Resque, change this
|
13
|
+
if defined?(Resque)
|
14
|
+
Resque.redis.quit
|
15
|
+
Rails.logger.info('Disconnected from Redis')
|
16
|
+
end
|
17
|
+
|
18
|
+
sleep 1
|
19
|
+
end
|
20
|
+
|
21
|
+
after_fork do |server, worker|
|
22
|
+
# Replace with MongoDB or whatever
|
23
|
+
if defined?(ActiveRecord::Base)
|
24
|
+
ActiveRecord::Base.establish_connection
|
25
|
+
Rails.logger.info('Connected to ActiveRecord')
|
26
|
+
end
|
27
|
+
|
28
|
+
# If you are using Redis but not Resque, change this
|
29
|
+
if defined?(Resque)
|
30
|
+
Resque.redis = ENV['REDIS_URI']
|
31
|
+
Rails.logger.info('Connected to Redis')
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
HappySeed Base Install
|
2
|
+
=================
|
3
|
+
|
4
|
+
### What does this do?
|
5
|
+
|
6
|
+
The happy_seed application template sets up haml, meta-tags, disables turbolinks, and installs the happy_seed generators into your application.
|
7
|
+
|
8
|
+
The happy_seed:foreman generator installs dotenv-rails, unicorn, http site authentication, and the setup_controller.
|
9
|
+
|
10
|
+
/setup is used to see the happy_seed documentation for each of the installed generators, and copies things into the rails doc directory. The setup_controller is only visible locally.
|
11
|
+
|
12
|
+
### Why do you want this?
|
13
|
+
|
14
|
+
Haml is create and turbolinks make it impossible to correctly debug a site.
|
15
|
+
|
16
|
+
Using the .env file to manage configuration variables makes it much easier to keep track of what is needed in each environment, and sets you up to use heroku.
|
17
|
+
|
18
|
+
### Environment Variables
|
19
|
+
|
20
|
+
The AWS env variables are there for reference
|
21
|
+
|
22
|
+
If the HTTP_AUTH_U* variables are set, application_controller will force them to be used for authentication to let people into the site. (The happy_seed:splash generator will not use this.)
|
23
|
+
|
24
|
+
```
|
25
|
+
AWS_ACCESS_KEY_ID=
|
26
|
+
AWS_SECRET_ACCESS_KEY=
|
27
|
+
S3_BUCKET_NAME=
|
28
|
+
HTTP_AUTH_USERNAME=
|
29
|
+
HTTP_AUTH_PASSWORD=
|
30
|
+
```
|
31
|
+
|
32
|
+
### What needs to be done?
|
33
|
+
|
34
|
+
At some point, you should remove the setup_controller from your application.
|