happy_seed 0.0.5 → 0.0.6
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 +5 -13
- data/happy_seed.rb +4 -1
- data/lib/generators/happy_seed/bootstrap/bootstrap_generator.rb +5 -1
- data/lib/generators/happy_seed/devise/devise_generator.rb +37 -15
- data/lib/generators/happy_seed/foreman/foreman_generator.rb +8 -1
- data/lib/generators/happy_seed/foreman/templates/app/controllers/setup_controller.rb +1 -1
- data/lib/generators/happy_seed/foreman/templates/docs/README.00.base.rdoc +1 -1
- data/lib/generators/happy_seed/foreman/templates/spec/controllers/application_controller_spec.rb +42 -0
- data/lib/generators/happy_seed/foreman/templates/spec/controllers/setup_controller_spec.rb +17 -0
- data/lib/generators/happy_seed/happy_seed_generator.rb +23 -5
- data/lib/generators/happy_seed/omniauth/omniauth_generator.rb +14 -3
- data/lib/generators/happy_seed/omniauth/templates/spec/models/identity_spec.rb +22 -0
- data/lib/generators/happy_seed/splash/splash_generator.rb +11 -2
- data/lib/generators/happy_seed/splash/templates/app/assets/stylesheets/splash.css.scss +100 -0
- data/lib/generators/happy_seed/splash/templates/app/controllers/splash_controller.rb +0 -6
- data/lib/generators/happy_seed/splash/templates/app/views/layouts/splash.html.haml +54 -2
- data/lib/generators/happy_seed/splash/templates/app/views/splash/index.html.haml +177 -5
- data/lib/generators/happy_seed/splash/templates/spec/controllers/splash_controller_spec.rb +61 -0
- data/lib/generators/happy_seed/splash/templates/vendor/assets/javascripts/scrollReveal.js +398 -0
- data/lib/happy_seed/version.rb +1 -1
- metadata +14 -8
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ZDc5MTg5OTAzMTY3NGNiNTllNzBkNDY5Zjg3OWRlOWMxYzU2N2NmMw==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: abfbe568c635b764f4d827088805d64a6b9fa441
|
4
|
+
data.tar.gz: ff15a8f6302a0d8f27750b7561c20eb1d2f9bb6d
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
ZTMzZTVkOTA0NTY3MjAxNGQ1MDVkZDdiOWQ0ZGNjN2ExYTlmNzgyNjFlOTll
|
11
|
-
NzcwYjIxZTFlZjU3NDVlZWNmZmIwNjkwNjBmMzA0MjY5ZTlmZjU=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
OGI0ZmJmYzA1ZmFjMGRjZjk0OWRkMmZjNmQ1MTU1N2M2YWU2NmFkZmZmZjYx
|
14
|
-
YjA0OTAxZTM0NmYyYTQ4ZGU0OTI3ZWRmODQxOTI5YjRlYmYzMWViM2JhM2Vh
|
15
|
-
MTI3NGYzNGMyODljNjg4NTdkMDcwZjlkYjc0MDY0NzU5MGU1Yjc=
|
6
|
+
metadata.gz: 9df1a0df197a4c01de8e6886043adae0f62a48638818377d86895e439c526c6e8d0d61a75c97b7cf35d81bcbf2a79e0a47dfb433e7c86e20a468aa7d5cee4c40
|
7
|
+
data.tar.gz: 6e9a2d0e0746702b91b5bf1cdb01f0ef1728d932d5eb0bd9ade9a4fb74d2767708791db21301bf3a43c9cb07abd30949d220be6f89e8b2c156e456af4a1398ff
|
data/happy_seed.rb
CHANGED
@@ -10,11 +10,14 @@ gem_group :development, :test do
|
|
10
10
|
gem "autotest-rails"
|
11
11
|
end
|
12
12
|
|
13
|
+
gem_group :test do
|
14
|
+
gem "webmock"
|
15
|
+
end
|
16
|
+
|
13
17
|
gem_group :production do
|
14
18
|
gem 'pg'
|
15
19
|
end
|
16
20
|
|
17
|
-
gem 'meta-tags', :require => 'meta_tags'
|
18
21
|
if ENV['SEED_DEVELOPMENT']
|
19
22
|
gem 'happy_seed', :path => File.dirname(__FILE__)
|
20
23
|
else
|
@@ -6,6 +6,8 @@ module HappySeed
|
|
6
6
|
def update_application_haml
|
7
7
|
gem 'bootstrap-sass'
|
8
8
|
gem 'modernizr-rails'
|
9
|
+
gem 'haml-rails'
|
10
|
+
gem 'meta-tags', :require => 'meta_tags'
|
9
11
|
|
10
12
|
Bundler.with_clean_env do
|
11
13
|
run "bundle install"
|
@@ -25,7 +27,9 @@ module HappySeed
|
|
25
27
|
end
|
26
28
|
RUBY
|
27
29
|
end
|
28
|
-
|
30
|
+
if File.exists?( File.join( destination_root, ".env" ) )
|
31
|
+
append_to_file ".env", "GOOGLE_ANALYTICS_SITE_ID=\n"
|
32
|
+
end
|
29
33
|
end
|
30
34
|
end
|
31
35
|
end
|
@@ -4,6 +4,12 @@ module HappySeed
|
|
4
4
|
source_root File.expand_path('../templates', __FILE__)
|
5
5
|
|
6
6
|
def install_landing_page
|
7
|
+
if !gem_available?( "bootstrap-sass" )
|
8
|
+
if yes?( "Bootstrap-sass gem doesn't seem to be installed, install now?" )
|
9
|
+
generate "happy_seed:bootstrap"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
7
13
|
gem 'devise'
|
8
14
|
|
9
15
|
Bundler.with_clean_env do
|
@@ -14,10 +20,12 @@ module HappySeed
|
|
14
20
|
run 'rails generate devise User'
|
15
21
|
run 'rails generate devise:views'
|
16
22
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
23
|
+
if gem_available?( "haml-rails" )
|
24
|
+
remove_file 'app/views/devise/registrations/new.html.erb'
|
25
|
+
remove_file 'app/views/devise/sessions/new.html.erb'
|
26
|
+
remove_file 'app/views/devise/passwords/edit.html.erb'
|
27
|
+
remove_file 'app/views/devise/passwords/new.html.erb'
|
28
|
+
end
|
21
29
|
|
22
30
|
directory 'app'
|
23
31
|
directory 'docs'
|
@@ -25,18 +33,32 @@ module HappySeed
|
|
25
33
|
|
26
34
|
application(nil, env: "development") do
|
27
35
|
"config.action_mailer.default_url_options = { host: 'localhost:3000' }"
|
28
|
-
end
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
end
|
37
|
+
|
38
|
+
if File.exists?( File.join( destination_root, 'app/views/application/_header.html.haml' ) )
|
39
|
+
gsub_file 'app/views/application/_header.html.haml', "/ USER NAV", <<-'RUBY'
|
40
|
+
%ul.nav.navbar-nav.navbar-right
|
41
|
+
- if user_signed_in?
|
42
|
+
%li= link_to 'Sign Out', destroy_user_session_path, :method=>:delete
|
43
|
+
- else
|
44
|
+
/ CONNECT
|
45
|
+
%li= link_to 'Sign In', new_user_session_path
|
46
|
+
%li= link_to 'Sign Up', new_user_registration_path
|
47
|
+
RUBY
|
48
|
+
else
|
49
|
+
say_status :gsub_file, "Can't find application/_header.html.haml, skipping"
|
50
|
+
end
|
39
51
|
end
|
52
|
+
|
53
|
+
private
|
54
|
+
def gem_available?(name)
|
55
|
+
Gem::Specification.find_by_name(name)
|
56
|
+
rescue Gem::LoadError
|
57
|
+
false
|
58
|
+
rescue
|
59
|
+
Gem.available?(name)
|
60
|
+
end
|
61
|
+
|
40
62
|
end
|
41
63
|
end
|
42
64
|
end
|
@@ -5,7 +5,7 @@ module HappySeed
|
|
5
5
|
|
6
6
|
def install_foreman
|
7
7
|
gem 'dotenv-rails', :groups=>[:development, :test]
|
8
|
-
gem 'rdiscount', :groups => [:development]
|
8
|
+
gem 'rdiscount', :groups => [:development, :test]
|
9
9
|
gem 'unicorn'
|
10
10
|
gem 'rails_12factor'
|
11
11
|
|
@@ -18,6 +18,13 @@ module HappySeed
|
|
18
18
|
remove_file "application_controller.rb"
|
19
19
|
|
20
20
|
inject_into_file 'app/controllers/application_controller.rb', File.read( find_in_source_paths('application_controller.rb') ), :after=>/protect_from_forgery.*\n/
|
21
|
+
inject_into_file 'config/environments/test.rb', " config.log_level = :error\n", before: "end\n"
|
22
|
+
|
23
|
+
begin
|
24
|
+
inject_into_file 'spec/rails_helper.rb', "require 'webmock/rspec'\n", after: "'rspec/rails'\n"
|
25
|
+
rescue
|
26
|
+
say_status :spec, "Unable to add webmock to rails_helper.rb", :red
|
27
|
+
end
|
21
28
|
|
22
29
|
route "get '/setup' => 'setup#index'"
|
23
30
|
route "root 'setup#index'"
|
@@ -11,7 +11,7 @@ class SetupController < ApplicationController
|
|
11
11
|
|
12
12
|
def require_local!
|
13
13
|
unless local_request?
|
14
|
-
|
14
|
+
redirect_to root_url, error: "This information is only available to local requests"
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -19,7 +19,7 @@ Using the .env file to manage configuration variables makes it much easier to ke
|
|
19
19
|
|
20
20
|
The AWS env variables are there for reference
|
21
21
|
|
22
|
-
If the
|
22
|
+
If the HTTP_AUTH_* 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
23
|
|
24
24
|
```
|
25
25
|
AWS_ACCESS_KEY_ID=
|
data/lib/generators/happy_seed/foreman/templates/spec/controllers/application_controller_spec.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe ApplicationController, :type => :controller do
|
4
|
+
controller do
|
5
|
+
def index
|
6
|
+
render body: "aok"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should not have authentication if http_auth env are blank" do
|
11
|
+
ENV['HTTP_AUTH_USERNAME'] = nil
|
12
|
+
ENV['HTTP_AUTH_PASSWORD'] = nil
|
13
|
+
|
14
|
+
get :index
|
15
|
+
expect( response ).to be_success
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should request authentication if http_auth is set" do
|
19
|
+
ENV['HTTP_AUTH_USERNAME'] = "user"
|
20
|
+
ENV['HTTP_AUTH_PASSWORD'] = "pass"
|
21
|
+
|
22
|
+
get :index
|
23
|
+
expect( response.status ).to eq( 401 )
|
24
|
+
|
25
|
+
ENV['HTTP_AUTH_USERNAME'] = nil
|
26
|
+
ENV['HTTP_AUTH_PASSWORD'] = nil
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should let people through if the correct pass is set" do
|
30
|
+
ENV['HTTP_AUTH_USERNAME'] = "user"
|
31
|
+
ENV['HTTP_AUTH_PASSWORD'] = "pass"
|
32
|
+
|
33
|
+
credentials = ActionController::HttpAuthentication::Basic.encode_credentials 'user', 'pass'
|
34
|
+
request.env['HTTP_AUTHORIZATION'] = credentials
|
35
|
+
|
36
|
+
get :index
|
37
|
+
expect( response ).to be_success
|
38
|
+
|
39
|
+
ENV['HTTP_AUTH_USERNAME'] = nil
|
40
|
+
ENV['HTTP_AUTH_PASSWORD'] = nil
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe SetupController, :type => :controller do
|
4
|
+
it "should return setup information for local requests" do
|
5
|
+
get :index
|
6
|
+
expect(response).to render_template( :index )
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should redirect to root url for non-local requests" do
|
10
|
+
@request.remote_addr = "1.1.1.1"
|
11
|
+
prev = Rails.configuration.consider_all_requests_local
|
12
|
+
Rails.configuration.consider_all_requests_local = false
|
13
|
+
get :index
|
14
|
+
expect(response).to redirect_to( root_url )
|
15
|
+
Rails.configuration.consider_all_requests_local = prev
|
16
|
+
end
|
17
|
+
end
|
@@ -25,11 +25,30 @@ module HappySeed
|
|
25
25
|
config.omniauth :#{provider}, ENV['#{provider.upcase}_APP_ID'], ENV['#{provider.upcase}_APP_SECRET']#{scopeline}
|
26
26
|
RUBY
|
27
27
|
end
|
28
|
-
|
28
|
+
begin
|
29
|
+
append_to_file ".env", "#{provider.upcase}_APP_ID=\n#{provider.upcase}_APP_SECRET=\n"
|
30
|
+
rescue
|
31
|
+
say_status :env, "Unable to add template variables to .env", :red
|
32
|
+
end
|
33
|
+
|
34
|
+
begin
|
35
|
+
inject_into_file 'app/views/application/_header.html.haml', " %li= link_to 'sign in with #{provider}', user_omniauth_authorize_path(:#{provider})\n", after: "/ CONNECT\n"
|
36
|
+
rescue
|
37
|
+
say_status :header_links, "Unable to add links to the nav bar header", :red
|
38
|
+
end
|
39
|
+
|
40
|
+
begin
|
41
|
+
inject_into_file 'app/views/devise/sessions/new.html.haml', " = link_to 'sign in with #{provider}', user_omniauth_authorize_path(:#{provider})\n %br\n", after: "/ CONNECT\n"
|
42
|
+
rescue
|
43
|
+
say_status :sign_links, "Unable to add sign in links to app/views/devise/sessions/new.html.haml", :red
|
44
|
+
end
|
45
|
+
|
46
|
+
begin
|
47
|
+
inject_into_file 'app/views/devise/registrations/new.html.haml', " = link_to 'sign in with #{provider}', user_omniauth_authorize_path(:#{provider})\n %br\n", after: "/ CONNECT\n"
|
48
|
+
rescue
|
49
|
+
say_status :sign_up_links, "Unable to add sign in links to app/views/devise/registrations/new.html.haml"
|
50
|
+
end
|
29
51
|
|
30
|
-
inject_into_file 'app/views/application/_header.html.haml', " %li= link_to 'sign in with #{provider}', user_omniauth_authorize_path(:#{provider})\n", after: "/ CONNECT\n"
|
31
|
-
inject_into_file 'app/views/devise/sessions/new.html.haml', " = link_to 'sign in with #{provider}', user_omniauth_authorize_path(:#{provider})\n %br\n", after: "/ CONNECT\n"
|
32
|
-
inject_into_file 'app/views/devise/registrations/new.html.haml', " = link_to 'sign in with #{provider}', user_omniauth_authorize_path(:#{provider})\n %br\n", after: "/ CONNECT\n"
|
33
52
|
inject_into_file 'app/controllers/omniauth_callbacks_controller.rb', "\n def #{provider}\n generic_callback( '#{provider}' )\n end\n", before: /\s*def generic_callback/
|
34
53
|
inject_into_file 'app/models/user.rb', :before => "\nend" do <<-"RUBY"
|
35
54
|
def #{provider}
|
@@ -50,7 +69,6 @@ RUBY
|
|
50
69
|
rescue
|
51
70
|
Gem.available?(name)
|
52
71
|
end
|
53
|
-
|
54
72
|
end
|
55
73
|
end
|
56
74
|
end
|
@@ -28,12 +28,23 @@ module HappySeed
|
|
28
28
|
generate 'model identity user:references provider:string accesstoken:string uid:string name:string email:string nickname:string image:string phone:string urls:string'
|
29
29
|
remove_file 'app/models/identity.rb'
|
30
30
|
directory 'app'
|
31
|
+
directory 'spec'
|
31
32
|
route "match '/profile/:id/finish_signup' => 'users#finish_signup', via: [:get, :patch], :as => :finish_signup"
|
32
33
|
route "get '/account' => 'users#show', as: 'user'"
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
35
|
+
begin
|
36
|
+
gsub_file "app/models/user.rb", "devise :", "devise :omniauthable, :"
|
37
|
+
insert_into_file "app/models/user.rb", File.read( find_in_source_paths( "user.rb" ) ), :before => "\nend\n"
|
38
|
+
rescue
|
39
|
+
say_status :user_model, "Unable to add omniauthable to app/models/users.rb", :red
|
40
|
+
end
|
41
|
+
|
42
|
+
begin
|
43
|
+
insert_into_file "app/views/application/_header.html.haml", " %li= link_to 'Account', user_path\n", after: " - if user_signed_in?\n"
|
44
|
+
rescue
|
45
|
+
say_status :header_links, "Unable to add user accounts links to the nav bar", :red
|
46
|
+
end
|
47
|
+
|
37
48
|
gsub_file 'config/routes.rb', "devise_for :users\n", "devise_for :users, :controllers => { omniauth_callbacks: 'omniauth_callbacks' }\n"
|
38
49
|
|
39
50
|
directory "docs"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe Identity, :type => :model do
|
4
|
+
it "should always have a provider and uid" do
|
5
|
+
i = Identity.create
|
6
|
+
expect( i ).to_not be_valid
|
7
|
+
|
8
|
+
i = Identity.create( :provider => "test" )
|
9
|
+
expect( i ).to_not be_valid
|
10
|
+
|
11
|
+
i = Identity.create( :provider => "test", :uid => "1" )
|
12
|
+
expect( i ).to be_valid
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should have a unique uid" do
|
16
|
+
i = Identity.create( :provider => "test", :uid => "1" )
|
17
|
+
expect( i ).to be_valid
|
18
|
+
|
19
|
+
i = Identity.create( :provider => "test", :uid => "1" )
|
20
|
+
expect( i ).to_not be_valid
|
21
|
+
end
|
22
|
+
end
|
@@ -28,7 +28,16 @@ module HappySeed
|
|
28
28
|
|
29
29
|
directory 'app'
|
30
30
|
directory "docs"
|
31
|
-
|
31
|
+
directory "spec"
|
32
|
+
directory "vendor"
|
33
|
+
|
34
|
+
append_to_file "config/initializers/assets.rb", "Rails.application.config.assets.precompile += %w( splash.css scrollReveal.js )\n"
|
35
|
+
|
36
|
+
begin
|
37
|
+
append_to_file ".env", "MAILCHIMP_API_KEY=\nMAILCHIMP_SPLASH_SIGNUP_LIST_ID=\n"
|
38
|
+
rescue
|
39
|
+
say_status :env, "Unable to add template .env files", :red
|
40
|
+
end
|
32
41
|
end
|
33
42
|
|
34
43
|
private
|
@@ -41,4 +50,4 @@ module HappySeed
|
|
41
50
|
end
|
42
51
|
end
|
43
52
|
end
|
44
|
-
end
|
53
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
//-----------------------------------------
|
2
|
+
// Variables, customize bootstrap here
|
3
|
+
//-----------------------------------------
|
4
|
+
@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,300,600);
|
5
|
+
$headings-font-family: 'Open Sans';
|
6
|
+
|
7
|
+
$navbar-height: 75px;
|
8
|
+
|
9
|
+
$navbar-default-bg: rgba(255,255,255,.5);
|
10
|
+
$navbar-inverse-bg: rgba(0,0,0,.5);
|
11
|
+
|
12
|
+
|
13
|
+
// Color Palate
|
14
|
+
$brand-primary: #9CCC00;
|
15
|
+
$color-accent: #428bca;
|
16
|
+
$color-background: #202a39;
|
17
|
+
$color-background-light: darken( white, 10% ); // #DAE3BB; //#3D6299;
|
18
|
+
$color-text: #ddd;
|
19
|
+
$color-text-light: $color-background; //#3F005E;
|
20
|
+
|
21
|
+
// $carousel-control-color: lighten( $color-text-light, 10% );
|
22
|
+
// $carousel-indicator-border-color: $carousel-control-color;
|
23
|
+
|
24
|
+
// $color-text-light: #D0F2EF;
|
25
|
+
// $color-accent: #91A644;
|
26
|
+
// $color-background: #445925;
|
27
|
+
// $color-background-light: #735D34;
|
28
|
+
// $color-text: #91A644;
|
29
|
+
|
30
|
+
// Default bootstrap reference
|
31
|
+
// $brand-primary: #428bca !default;
|
32
|
+
// $brand-success: #5cb85c !default;
|
33
|
+
// $brand-info: #5bc0de !default;
|
34
|
+
// $brand-warning: #f0ad4e !default;
|
35
|
+
// $brand-danger: #d9534f !default;
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
$body-bg: $color-background;
|
40
|
+
$text-color: $color-text;
|
41
|
+
$navbar-inverse-brand-color: $text-color;
|
42
|
+
|
43
|
+
@import 'bootstrap-sprockets';
|
44
|
+
@import 'bootstrap';
|
45
|
+
|
46
|
+
body {
|
47
|
+
margin-top: $navbar-height;
|
48
|
+
position: relative;
|
49
|
+
}
|
50
|
+
|
51
|
+
.navbar li.active {
|
52
|
+
border-bottom: 2px solid $brand-primary;
|
53
|
+
}
|
54
|
+
|
55
|
+
@media screen and (min-width: $screen-sm-min) {
|
56
|
+
h1 { font-size: 72px }
|
57
|
+
.navbar-brand {
|
58
|
+
font-family: $headings-font-family;
|
59
|
+
font-size: 24px;
|
60
|
+
}
|
61
|
+
|
62
|
+
// .navbar-nav {
|
63
|
+
// margin: ($navbar-padding-vertical / 2) (-$navbar-padding-horizontal);
|
64
|
+
|
65
|
+
// > li > a {
|
66
|
+
// padding-top: 13px;
|
67
|
+
// padding-bottom: 10px;
|
68
|
+
// line-height: 13px;
|
69
|
+
// font-size: 20px;
|
70
|
+
// }
|
71
|
+
// }
|
72
|
+
}
|
73
|
+
|
74
|
+
.navbar#top {
|
75
|
+
border-bottom: 1px solid $brand-primary;
|
76
|
+
}
|
77
|
+
|
78
|
+
.navbar-collapse.in {
|
79
|
+
background: white;
|
80
|
+
}
|
81
|
+
|
82
|
+
section {
|
83
|
+
padding-top: 20vh;
|
84
|
+
min-height: 90vh;
|
85
|
+
padding-bottom: 20vh;
|
86
|
+
}
|
87
|
+
|
88
|
+
section #bottom {
|
89
|
+
margin-top: 10vh;
|
90
|
+
font-size: 24px;
|
91
|
+
}
|
92
|
+
|
93
|
+
section.light {
|
94
|
+
background: $color-background-light;
|
95
|
+
color: $color-text-light;
|
96
|
+
|
97
|
+
a {
|
98
|
+
color: darken( $brand-primary, 5% );
|
99
|
+
}
|
100
|
+
}
|
@@ -1,13 +1,7 @@
|
|
1
1
|
class SplashController < ApplicationController
|
2
|
-
|
3
2
|
skip_before_filter :authenticate
|
4
3
|
|
5
4
|
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
5
|
end
|
12
6
|
|
13
7
|
def signup
|
@@ -1,14 +1,66 @@
|
|
1
1
|
!!! 5
|
2
2
|
%html.no-js
|
3
|
-
|
3
|
+
%head
|
4
|
+
%meta{ :charset => 'utf-8' }/
|
5
|
+
%meta{ 'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1' }/
|
4
6
|
|
5
|
-
|
7
|
+
= display_meta_tags :site => 'Seed Site', :title => page_title, :reverse => true
|
8
|
+
|
9
|
+
%meta{ :name => 'description', :content => '' }/
|
10
|
+
%meta{ :name => 'viewport', :content => 'width=device-width' }/
|
11
|
+
|
12
|
+
= stylesheet_link_tag 'splash', :media => nil
|
13
|
+
|
14
|
+
-# Append your own using content_for :stylesheets
|
15
|
+
= yield :stylesheets
|
16
|
+
= javascript_include_tag 'modernizr'
|
17
|
+
|
18
|
+
= csrf_meta_tag
|
19
|
+
|
20
|
+
%body{ "data-spy" => "scroll", "data-target" => "#top"}
|
6
21
|
= render 'chromeframe'
|
7
22
|
= render 'flashes'
|
8
23
|
|
24
|
+
%header#top.navbar.navbar-inverse.navbar-fixed-top{:role=>:banner}
|
25
|
+
.navbar-header
|
26
|
+
%button.navbar-toggle{:type=>:button, 'data-toggle'=>:collapse, 'data-target'=>'.navbar-collapse'}
|
27
|
+
%span.sr-only Toggle navigations
|
28
|
+
%span.icon-bar
|
29
|
+
%span.icon-bar
|
30
|
+
%span.icon-bar
|
31
|
+
= link_to '#', :class=>'navbar-brand' do
|
32
|
+
%span.glyphicon.glyphicon-leaf
|
33
|
+
Happy Seed
|
34
|
+
%nav.collapse.navbar-collapse{:role=>:navigation}
|
35
|
+
%ul.nav.navbar-nav
|
36
|
+
%li= link_to 'What', '#what'
|
37
|
+
%li= link_to 'Why', '#why'
|
38
|
+
%li= link_to 'How', '#how'
|
39
|
+
%li= link_to 'Who', '#who'
|
40
|
+
|
9
41
|
= yield
|
10
42
|
|
11
43
|
= render 'footer'
|
12
44
|
|
13
45
|
-# Javascript at the bottom for fast page loading
|
14
46
|
= render 'javascripts'
|
47
|
+
= javascript_include_tag 'scrollReveal.js'
|
48
|
+
:javascript
|
49
|
+
$(function() {
|
50
|
+
window.scrollReveal = new scrollReveal();
|
51
|
+
$("#top.navbar ul li a[href^='#']").on('click', function(e) {
|
52
|
+
e.preventDefault();
|
53
|
+
|
54
|
+
// store hash
|
55
|
+
var hash = this.hash;
|
56
|
+
|
57
|
+
// animate
|
58
|
+
$('html, body').animate({
|
59
|
+
scrollTop: $(this.hash).offset().top
|
60
|
+
}, 300, function(){
|
61
|
+
// when done, add hash to url
|
62
|
+
// (default click behaviour)
|
63
|
+
window.location.hash = hash;
|
64
|
+
});
|
65
|
+
});
|
66
|
+
});
|
@@ -1,4 +1,173 @@
|
|
1
|
-
%section.masthead
|
1
|
+
%section.masthead
|
2
|
+
.container
|
3
|
+
.row
|
4
|
+
.col-md-12.text-center
|
5
|
+
%h1{"data-scroll-reveal"=>"enter from the top but wait .5s"}
|
6
|
+
%span.glyphicon.glyphicon-leaf
|
7
|
+
Happy Seed
|
8
|
+
%h2{"data-scroll-reveal"=>"enter bottom but wait 1s over 1s"}
|
9
|
+
Quickly setup a Rails app
|
10
|
+
%h2{"data-scroll-reveal"=>"enter bottom but wait 1.5s over 1.5s"}
|
11
|
+
with awesome plugins
|
12
|
+
%h2{"data-scroll-reveal"=>"enter bottom but wait 4s over 2s"}
|
13
|
+
= "...and get all the pesky details right"
|
14
|
+
#bottom{ "data-scroll-reveal" => "wait 6s and then ease-in-out 100px" }
|
15
|
+
%a{ :href => "#what"}
|
16
|
+
%span.glyphicon.glyphicon-chevron-down
|
17
|
+
|
18
|
+
%section#what.light
|
19
|
+
.container
|
20
|
+
.row
|
21
|
+
.col-sm-4
|
22
|
+
%h2 Solid Gems
|
23
|
+
%p.lead Stand on the shoulders of giants.
|
24
|
+
%ul
|
25
|
+
%li
|
26
|
+
Follows
|
27
|
+
= link_to "12 factors", "http://12factor.net/"
|
28
|
+
%li
|
29
|
+
Can easily be deployed to
|
30
|
+
= link_to "heroku", "http://heroku.com"
|
31
|
+
with foreman/Profile
|
32
|
+
%li
|
33
|
+
= link_to "bootstrap", "http://getbootstrap.com/"
|
34
|
+
with clean layout structure
|
35
|
+
%li
|
36
|
+
= link_to "haml", "http://haml.info"
|
37
|
+
templates, upgraded rails scaffold templates to work with bootstap
|
38
|
+
%li
|
39
|
+
= link_to "metatag", "https://github.com/kpumuk/meta-tags"
|
40
|
+
setup for SEO
|
41
|
+
%li
|
42
|
+
= link_to "devise", "https://github.com/plataformatec/devise"
|
43
|
+
for user authentication
|
44
|
+
%li
|
45
|
+
= link_to "omniauth", "https://github.com/intridea/omniauth"
|
46
|
+
for oauth support
|
47
|
+
%li
|
48
|
+
= link_to "angular", "https://angularjs.org"
|
49
|
+
installer that fits with the rails asset pipeline
|
50
|
+
%li
|
51
|
+
= link_to "active_admin", "http://activeadmin.info"
|
52
|
+
for admin panel
|
53
|
+
|
54
|
+
.col-sm-4
|
55
|
+
%h2 Sensible Defaults
|
56
|
+
%p.lead Get it working quickly and start customizing
|
57
|
+
%ul
|
58
|
+
%li
|
59
|
+
= link_to "unicorn", "http://unicorn.bogomips.org"
|
60
|
+
configured
|
61
|
+
%li
|
62
|
+
Basic layout/navbar structure include
|
63
|
+
%li
|
64
|
+
Devise user models
|
65
|
+
%li
|
66
|
+
Omniauth Callback Controller
|
67
|
+
%li
|
68
|
+
Twitter, Facebook, Instrgram integration optionally wired up
|
69
|
+
%li
|
70
|
+
Site nav structure
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
.col-sm-4
|
75
|
+
%h2 More awesome stuff
|
76
|
+
%p.lead Why stop there?
|
77
|
+
|
78
|
+
%ul
|
79
|
+
%li Splash page template
|
80
|
+
%li Mailchimp signup form
|
81
|
+
%li
|
82
|
+
= link_to "rspec", "http://rspec.info"
|
83
|
+
%li
|
84
|
+
= link_to "factory_girl", "https://github.com/thoughtbot/factory_girl"
|
85
|
+
%li
|
86
|
+
= link_to "webmock", "https://github.com/bblimke/webmock"
|
87
|
+
%li
|
88
|
+
= link_to "autotest", "http://autotest.github.io"
|
89
|
+
|
90
|
+
|
91
|
+
%section#why
|
92
|
+
.container
|
93
|
+
.row
|
94
|
+
.col-sm-12.text-center
|
95
|
+
%h1 Why
|
96
|
+
|
97
|
+
.row
|
98
|
+
.col-sm-4.col-sm-offset-1
|
99
|
+
%p.lead We like to try out lots of different ideas, and we build a lot of apps for clients.
|
100
|
+
.col-sm-4.col-sm-offset-2
|
101
|
+
%p.lead The ruby community has tons of great gems out there that have save a huge amount of time.
|
102
|
+
|
103
|
+
.row
|
104
|
+
.col-sm-6.col-sm-offset-3
|
105
|
+
%p.lead
|
106
|
+
But everytime I started a project I found myself doing the same stuff over and over.
|
107
|
+
|
108
|
+
%p Figuring out exactly how I wanted to configure a particular gem for a particular problem, even though I was more interested in creating a new product with particular functionality I was spending a lot of time doing "plumbing".
|
109
|
+
|
110
|
+
.row
|
111
|
+
.col-sm-8.col-sm-offset-2
|
112
|
+
%h2
|
113
|
+
Why not make it really easy to get through the plumbing, so I can focus on the part that makes the application different rather than the stuff that makes it the same?
|
114
|
+
|
115
|
+
%section#how.light
|
116
|
+
.container
|
117
|
+
.row
|
118
|
+
.col-sm-12
|
119
|
+
%h1.text-center How
|
120
|
+
|
121
|
+
.row
|
122
|
+
.col-sm-4.col-sm-offset-1
|
123
|
+
%p.lead Install the gem
|
124
|
+
|
125
|
+
%pre="$ gem install happy_seed"
|
126
|
+
|
127
|
+
.col-sm-4.col-sm-offset-1
|
128
|
+
%p.lead This create the rails plugin on your system.
|
129
|
+
|
130
|
+
%p
|
131
|
+
There is a small application template that is used to start the app, which itself includes the happy_seed gem. This exposes the rail generators and templates to your project, which is how functionality gets installed.
|
132
|
+
|
133
|
+
.row
|
134
|
+
.col-sm-4.col-sm-offset-1
|
135
|
+
%p.lead Generate a new app
|
136
|
+
%pre="$ happy_seed app_name"
|
137
|
+
|
138
|
+
.col-sm-4.col-sm-offset-1
|
139
|
+
%p.lead Now create!
|
140
|
+
|
141
|
+
%p You will get prompted for what you want to install.
|
142
|
+
|
143
|
+
%p The current generators are:
|
144
|
+
|
145
|
+
%ul
|
146
|
+
%li The application template
|
147
|
+
%li= link_to "happy_seed:forman", "https://github.com/sublimeguile/happy_seed/blob/master/lib/generators/happy_seed/foreman/templates/docs/README.00.base.rdoc"
|
148
|
+
%li
|
149
|
+
= link_to "happy_seed:bootstrap", "https://github.com/sublimeguile/happy_seed/blob/master/lib/generators/happy_seed/bootstrap/templates/docs/README.01.bootstrap.rdoc"
|
150
|
+
%ul
|
151
|
+
%li= link_to "happy_seed:splash", "https://github.com/sublimeguile/happy_seed/blob/master/lib/generators/happy_seed/splash/templates/docs/README.02.splash.rdoc"
|
152
|
+
%li
|
153
|
+
= link_to "happy_seed:devise", "https://github.com/sublimeguile/happy_seed/blob/master/lib/generators/happy_seed/devise/templates/docs/README.03.devise.rdoc"
|
154
|
+
%ul
|
155
|
+
%li
|
156
|
+
= link_to "happy_seed:omniauth", "https://github.com/sublimeguile/happy_seed/blob/master/lib/generators/happy_seed/omniauth/templates/docs/README.04.omniauth.rdoc"
|
157
|
+
%li
|
158
|
+
= link_to "happy_seed:twitter", "https://github.com/sublimeguile/happy_seed/blob/master/lib/generators/happy_seed/twitter/templates/docs/README.05.twitter.rdoc"
|
159
|
+
%li
|
160
|
+
= link_to "happy_seed:facebook", "https://github.com/sublimeguile/happy_seed/blob/master/lib/generators/happy_seed/facebook/templates/docs/README.06.facebook.rdoc"
|
161
|
+
%li
|
162
|
+
= link_to "happy_seed:instagram", "https://github.com/sublimeguile/happy_seed/blob/master/lib/generators/happy_seed/instagram/templates/docs/README.05.instagram.rdoc"
|
163
|
+
%li
|
164
|
+
= link_to "happy_seed:admin", "https://github.com/sublimeguile/happy_seed/blob/master/lib/generators/happy_seed/admin/templates/docs/README.07.admin.rdoc"
|
165
|
+
|
166
|
+
%li
|
167
|
+
= link_to "happy_seed:angular_install", "https://github.com/sublimeguile/happy_seed/blob/master/lib/generators/happy_seed/angular_install/templates/docs/README.10.angular_install.rdoc"
|
168
|
+
|
169
|
+
|
170
|
+
%section#who
|
2
171
|
.container
|
3
172
|
.row
|
4
173
|
.col-md-8.col-md-offset-2
|
@@ -6,12 +175,15 @@
|
|
6
175
|
.panel-body
|
7
176
|
.row
|
8
177
|
.col-md-4.text-center.brand
|
9
|
-
%h1
|
10
|
-
%span.glyphicon.glyphicon-
|
178
|
+
%h1{"data-scroll-reveal"=>true}
|
179
|
+
%span.glyphicon.glyphicon-leaf
|
11
180
|
%br
|
12
|
-
|
181
|
+
Happy Seed
|
13
182
|
.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
|
183
|
+
%p.lead
|
184
|
+
Sign up for the
|
185
|
+
= link_to "HappyFunCorp", "http://happyfuncorp.com"
|
186
|
+
mailing list!.
|
15
187
|
= form_tag splash_signup_path, role: :form, :class=>'form-horizontal', :remote=>true do
|
16
188
|
.form-group#signup
|
17
189
|
.col-sm-12
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
RSpec.describe SplashController, :type => :controller do
|
4
|
+
it "should return the index page" do
|
5
|
+
get :index
|
6
|
+
expect(response).to render_template( :index )
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should not request authentication even if http_auth is set" do
|
10
|
+
ENV['HTTP_AUTH_USERNAME'] = "user"
|
11
|
+
ENV['HTTP_AUTH_PASSWORD'] = "pass"
|
12
|
+
|
13
|
+
get :index
|
14
|
+
expect(response).to render_template( :index )
|
15
|
+
|
16
|
+
ENV['HTTP_AUTH_USERNAME'] = nil
|
17
|
+
ENV['HTTP_AUTH_PASSWORD'] = nil
|
18
|
+
end
|
19
|
+
|
20
|
+
context "with views" do
|
21
|
+
render_views
|
22
|
+
it "should return the index page with the correct google tracking code" do
|
23
|
+
ENV['GOOGLE_ANALYTICS_SITE_ID'] = '123456'
|
24
|
+
|
25
|
+
get :index
|
26
|
+
expect( response.body ).to include( "['_setAccount','123456']" )
|
27
|
+
|
28
|
+
ENV['GOOGLE_ANALYTICS_SITE_ID'] = nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context "mailing list signup" do
|
33
|
+
it "should require mailchimp env to be setup" do
|
34
|
+
ENV["MAILCHIMP_SPLASH_SIGNUP_LIST_ID"] = nil
|
35
|
+
ENV["MAILCHIMP_API_KEY"] = nil
|
36
|
+
|
37
|
+
xhr :post, :signup
|
38
|
+
|
39
|
+
expect( assigns( :message) ).to include( "environment variables need to be set" )
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should talk to mail chimp if the ENV is set" do
|
43
|
+
ENV["MAILCHIMP_SPLASH_SIGNUP_LIST_ID"] = "1"
|
44
|
+
ENV["MAILCHIMP_API_KEY"] = "1"
|
45
|
+
# assign( :gibbon_api, double( "API" ) )
|
46
|
+
|
47
|
+
stub_request(:post, "https://api.mailchimp.com/2.0/lists/subscribe").
|
48
|
+
with(:body => "{\"apikey\":\"1\",\"id\":\"1\",\"email\":{\"email\":null},\"double_optin\":true}").
|
49
|
+
to_return(:status => 200, :body => "", :headers => {})
|
50
|
+
|
51
|
+
|
52
|
+
xhr :post, :signup, { :email => "wschenk@gmail.com" }
|
53
|
+
|
54
|
+
expect( assigns( :message) ).not_to include( "environment variables need to be set" )
|
55
|
+
|
56
|
+
ENV["MAILCHIMP_SPLASH_SIGNUP_LIST_ID"] = nil
|
57
|
+
ENV["MAILCHIMP_API_KEY"] = nil
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,398 @@
|
|
1
|
+
/*
|
2
|
+
_ _ _____ _ _
|
3
|
+
| | | __ \ | | (_)
|
4
|
+
___ ___ _ __ ___ | | | |__) |_____ _____ __ _| | _ ___
|
5
|
+
/ __|/ __| '__/ _ \| | | _ // _ \ \ / / _ \/ _` | | | / __|
|
6
|
+
\__ \ (__| | | (_) | | | | \ \ __/\ V / __/ (_| | |_| \__ \
|
7
|
+
|___/\___|_| \___/|_|_|_| \_\___| \_/ \___|\__,_|_(_) |___/ v.0.1.3
|
8
|
+
_/ |
|
9
|
+
|__/
|
10
|
+
|
11
|
+
"Declarative on-scroll reveal animations."
|
12
|
+
|
13
|
+
/*=============================================================================
|
14
|
+
|
15
|
+
scrollReveal.js was inspired by cbpScroller.js (c) 2014 Codrops.
|
16
|
+
|
17
|
+
Licensed under the MIT license.
|
18
|
+
http://www.opensource.org/licenses/mit-license.php
|
19
|
+
|
20
|
+
=============================================================================*/
|
21
|
+
|
22
|
+
/*! scrollReveal.js v0.1.3 (c) 2014 Julian Lloyd | MIT license */
|
23
|
+
|
24
|
+
/*===========================================================================*/
|
25
|
+
|
26
|
+
|
27
|
+
window.scrollReveal = (function (window) {
|
28
|
+
|
29
|
+
'use strict';
|
30
|
+
|
31
|
+
// generator (increments) for the next scroll-reveal-id
|
32
|
+
var nextId = 1;
|
33
|
+
|
34
|
+
/**
|
35
|
+
* RequestAnimationFrame polyfill
|
36
|
+
* @function
|
37
|
+
* @private
|
38
|
+
*/
|
39
|
+
var requestAnimFrame = (function () {
|
40
|
+
return window.requestAnimationFrame ||
|
41
|
+
window.webkitRequestAnimationFrame ||
|
42
|
+
window.mozRequestAnimationFrame ||
|
43
|
+
function (callback) {
|
44
|
+
window.setTimeout(callback, 1000 / 60);
|
45
|
+
};
|
46
|
+
}());
|
47
|
+
|
48
|
+
function scrollReveal(options) {
|
49
|
+
|
50
|
+
this.docElem = window.document.documentElement;
|
51
|
+
this.options = this.extend(this.defaults, options);
|
52
|
+
this.styleBank = {};
|
53
|
+
|
54
|
+
if (this.options.init == true) this.init();
|
55
|
+
}
|
56
|
+
|
57
|
+
scrollReveal.prototype = {
|
58
|
+
|
59
|
+
defaults: {
|
60
|
+
after: '0s',
|
61
|
+
enter: 'bottom',
|
62
|
+
move: '24px',
|
63
|
+
over: '0.66s',
|
64
|
+
easing: 'ease-in-out',
|
65
|
+
opacity: 0,
|
66
|
+
|
67
|
+
// if 0, the element is considered in the viewport as soon as it enters
|
68
|
+
// if 1, the element is considered in the viewport when it's fully visible
|
69
|
+
viewportFactor: 0.33,
|
70
|
+
|
71
|
+
// if false, animations occur only once
|
72
|
+
// if true, animations occur each time an element enters the viewport
|
73
|
+
reset: false,
|
74
|
+
|
75
|
+
// if true, scrollReveal.init() is automaticaly called upon instantiation
|
76
|
+
init: true
|
77
|
+
},
|
78
|
+
|
79
|
+
/*=============================================================================*/
|
80
|
+
|
81
|
+
init: function () {
|
82
|
+
|
83
|
+
this.scrolled = false;
|
84
|
+
|
85
|
+
var self = this;
|
86
|
+
|
87
|
+
// Check DOM for the data-scrollReveal attribute
|
88
|
+
// and initialize all found elements.
|
89
|
+
this.elems = Array.prototype.slice.call(this.docElem.querySelectorAll('[data-scroll-reveal]'));
|
90
|
+
this.elems.forEach(function (el, i) {
|
91
|
+
|
92
|
+
// Capture original style attribute
|
93
|
+
var id = el.getAttribute("data-scroll-reveal-id");
|
94
|
+
if (!id) {
|
95
|
+
id = nextId++;
|
96
|
+
el.setAttribute("data-scroll-reveal-id", id);
|
97
|
+
}
|
98
|
+
if (!self.styleBank[id]) {
|
99
|
+
self.styleBank[id] = el.getAttribute('style');
|
100
|
+
}
|
101
|
+
|
102
|
+
self.update(el);
|
103
|
+
});
|
104
|
+
|
105
|
+
var scrollHandler = function (e) {
|
106
|
+
// No changing, exit
|
107
|
+
if (!self.scrolled) {
|
108
|
+
self.scrolled = true;
|
109
|
+
requestAnimFrame(function () {
|
110
|
+
self._scrollPage();
|
111
|
+
});
|
112
|
+
}
|
113
|
+
};
|
114
|
+
|
115
|
+
var resizeHandler = function () {
|
116
|
+
|
117
|
+
// If we’re still waiting for settimeout, reset the timer.
|
118
|
+
if (self.resizeTimeout) {
|
119
|
+
clearTimeout(self.resizeTimeout);
|
120
|
+
}
|
121
|
+
function delayed() {
|
122
|
+
self._scrollPage();
|
123
|
+
self.resizeTimeout = null;
|
124
|
+
}
|
125
|
+
self.resizeTimeout = setTimeout(delayed, 200);
|
126
|
+
};
|
127
|
+
|
128
|
+
// captureScroll
|
129
|
+
window.addEventListener('scroll', scrollHandler, false);
|
130
|
+
window.addEventListener('resize', resizeHandler, false);
|
131
|
+
},
|
132
|
+
|
133
|
+
/*=============================================================================*/
|
134
|
+
|
135
|
+
_scrollPage: function () {
|
136
|
+
var self = this;
|
137
|
+
|
138
|
+
this.elems.forEach(function (el, i) {
|
139
|
+
self.update(el);
|
140
|
+
});
|
141
|
+
this.scrolled = false;
|
142
|
+
},
|
143
|
+
|
144
|
+
/*=============================================================================*/
|
145
|
+
|
146
|
+
parseLanguage: function (el) {
|
147
|
+
|
148
|
+
// Splits on a sequence of one or more commas or spaces.
|
149
|
+
var words = el.getAttribute('data-scroll-reveal').split(/[, ]+/),
|
150
|
+
parsed = {};
|
151
|
+
|
152
|
+
function filter (words) {
|
153
|
+
var ret = [],
|
154
|
+
|
155
|
+
blacklist = [
|
156
|
+
"from",
|
157
|
+
"the",
|
158
|
+
"and",
|
159
|
+
"then",
|
160
|
+
"but",
|
161
|
+
"with"
|
162
|
+
];
|
163
|
+
|
164
|
+
words.forEach(function (word, i) {
|
165
|
+
if (blacklist.indexOf(word) > -1) {
|
166
|
+
return;
|
167
|
+
}
|
168
|
+
ret.push(word);
|
169
|
+
});
|
170
|
+
|
171
|
+
return ret;
|
172
|
+
}
|
173
|
+
|
174
|
+
words = filter(words);
|
175
|
+
|
176
|
+
words.forEach(function (word, i) {
|
177
|
+
|
178
|
+
switch (word) {
|
179
|
+
case "enter":
|
180
|
+
parsed.enter = words[i + 1];
|
181
|
+
return;
|
182
|
+
|
183
|
+
case "after":
|
184
|
+
parsed.after = words[i + 1];
|
185
|
+
return;
|
186
|
+
|
187
|
+
case "wait":
|
188
|
+
parsed.after = words[i + 1];
|
189
|
+
return;
|
190
|
+
|
191
|
+
case "move":
|
192
|
+
parsed.move = words[i + 1];
|
193
|
+
return;
|
194
|
+
|
195
|
+
case "ease":
|
196
|
+
parsed.move = words[i + 1];
|
197
|
+
parsed.ease = "ease";
|
198
|
+
return;
|
199
|
+
|
200
|
+
case "ease-in":
|
201
|
+
parsed.move = words[i + 1];
|
202
|
+
parsed.easing = "ease-in";
|
203
|
+
return;
|
204
|
+
|
205
|
+
case "ease-in-out":
|
206
|
+
parsed.move = words[i + 1];
|
207
|
+
parsed.easing = "ease-in-out";
|
208
|
+
return;
|
209
|
+
|
210
|
+
case "ease-out":
|
211
|
+
parsed.move = words[i + 1];
|
212
|
+
parsed.easing = "ease-out";
|
213
|
+
return;
|
214
|
+
|
215
|
+
case "over":
|
216
|
+
parsed.over = words[i + 1];
|
217
|
+
return;
|
218
|
+
|
219
|
+
default:
|
220
|
+
return;
|
221
|
+
}
|
222
|
+
});
|
223
|
+
|
224
|
+
return parsed;
|
225
|
+
},
|
226
|
+
|
227
|
+
|
228
|
+
/*=============================================================================*/
|
229
|
+
|
230
|
+
update: function (el) {
|
231
|
+
|
232
|
+
var css = this.genCSS(el);
|
233
|
+
var style = this.styleBank[el.getAttribute("data-scroll-reveal-id")];
|
234
|
+
|
235
|
+
if (style != null) style += ";"; else style = "";
|
236
|
+
|
237
|
+
if (!el.getAttribute('data-scroll-reveal-initialized')) {
|
238
|
+
el.setAttribute('style', style + css.initial);
|
239
|
+
el.setAttribute('data-scroll-reveal-initialized', true);
|
240
|
+
}
|
241
|
+
|
242
|
+
if (!this.isElementInViewport(el, this.options.viewportFactor)) {
|
243
|
+
if (this.options.reset) {
|
244
|
+
el.setAttribute('style', style + css.initial + css.reset);
|
245
|
+
}
|
246
|
+
return;
|
247
|
+
}
|
248
|
+
|
249
|
+
if (el.getAttribute('data-scroll-reveal-complete')) return;
|
250
|
+
|
251
|
+
if (this.isElementInViewport(el, this.options.viewportFactor)) {
|
252
|
+
el.setAttribute('style', style + css.target + css.transition);
|
253
|
+
// Without reset enabled, we can safely remove the style tag
|
254
|
+
// to prevent CSS specificy wars with authored CSS.
|
255
|
+
if (!this.options.reset) {
|
256
|
+
setTimeout(function () {
|
257
|
+
if (style != "") {
|
258
|
+
el.setAttribute('style', style);
|
259
|
+
} else {
|
260
|
+
el.removeAttribute('style');
|
261
|
+
}
|
262
|
+
el.setAttribute('data-scroll-reveal-complete',true);
|
263
|
+
}, css.totalDuration);
|
264
|
+
}
|
265
|
+
return;
|
266
|
+
}
|
267
|
+
},
|
268
|
+
|
269
|
+
/*=============================================================================*/
|
270
|
+
|
271
|
+
genCSS: function (el) {
|
272
|
+
var parsed = this.parseLanguage(el),
|
273
|
+
enter,
|
274
|
+
axis;
|
275
|
+
|
276
|
+
if (parsed.enter) {
|
277
|
+
|
278
|
+
if (parsed.enter == "top" || parsed.enter == "bottom") {
|
279
|
+
enter = parsed.enter;
|
280
|
+
axis = "y";
|
281
|
+
}
|
282
|
+
|
283
|
+
if (parsed.enter == "left" || parsed.enter == "right") {
|
284
|
+
enter = parsed.enter;
|
285
|
+
axis = "x";
|
286
|
+
}
|
287
|
+
|
288
|
+
} else {
|
289
|
+
|
290
|
+
if (this.options.enter == "top" || this.options.enter == "bottom") {
|
291
|
+
enter = this.options.enter
|
292
|
+
axis = "y";
|
293
|
+
}
|
294
|
+
|
295
|
+
if (this.options.enter == "left" || this.options.enter == "right") {
|
296
|
+
enter = this.options.enter
|
297
|
+
axis = "x";
|
298
|
+
}
|
299
|
+
}
|
300
|
+
|
301
|
+
// After all values are parsed, let’s make sure our our
|
302
|
+
// pixel distance is negative for top and left entrances.
|
303
|
+
//
|
304
|
+
// ie. "move 25px from top" starts at 'top: -25px' in CSS.
|
305
|
+
|
306
|
+
if (enter == "top" || enter == "left") {
|
307
|
+
if (parsed.move) {
|
308
|
+
parsed.move = "-" + parsed.move;
|
309
|
+
}
|
310
|
+
else {
|
311
|
+
parsed.move = "-" + this.options.move;
|
312
|
+
}
|
313
|
+
}
|
314
|
+
|
315
|
+
var dist = parsed.move || this.options.move,
|
316
|
+
dur = parsed.over || this.options.over,
|
317
|
+
delay = parsed.after || this.options.after,
|
318
|
+
easing = parsed.easing || this.options.easing,
|
319
|
+
opacity = parsed.opacity || this.options.opacity;
|
320
|
+
|
321
|
+
var transition = "-webkit-transition: -webkit-transform " + dur + " " + easing + " " + delay + ", opacity " + dur + " " + easing + " " + delay + ";" +
|
322
|
+
"transition: transform " + dur + " " + easing + " " + delay + ", opacity " + dur + " " + easing + " " + delay + ";" +
|
323
|
+
"-webkit-perspective: 1000;" +
|
324
|
+
"-webkit-backface-visibility: hidden;";
|
325
|
+
|
326
|
+
// The same as transition, but removing the delay for elements fading out.
|
327
|
+
var reset = "-webkit-transition: -webkit-transform " + dur + " " + easing + " 0s, opacity " + dur + " " + easing + " " + delay + ";" +
|
328
|
+
"transition: transform " + dur + " " + easing + " 0s, opacity " + dur + " " + easing + " " + delay + ";" +
|
329
|
+
"-webkit-perspective: 1000;" +
|
330
|
+
"-webkit-backface-visibility: hidden;";
|
331
|
+
|
332
|
+
var initial = "-webkit-transform: translate" + axis + "(" + dist + ");" +
|
333
|
+
"transform: translate" + axis + "(" + dist + ");" +
|
334
|
+
"opacity: " + opacity + ";";
|
335
|
+
|
336
|
+
var target = "-webkit-transform: translate" + axis + "(0);" +
|
337
|
+
"transform: translate" + axis + "(0);" +
|
338
|
+
"opacity: 1;";
|
339
|
+
return {
|
340
|
+
transition: transition,
|
341
|
+
initial: initial,
|
342
|
+
target: target,
|
343
|
+
reset: reset,
|
344
|
+
totalDuration: ((parseFloat(dur) + parseFloat(delay)) * 1000)
|
345
|
+
};
|
346
|
+
},
|
347
|
+
|
348
|
+
getViewportH : function () {
|
349
|
+
var client = this.docElem['clientHeight'],
|
350
|
+
inner = window['innerHeight'];
|
351
|
+
|
352
|
+
return (client < inner) ? inner : client;
|
353
|
+
},
|
354
|
+
|
355
|
+
getOffset : function(el) {
|
356
|
+
var offsetTop = 0,
|
357
|
+
offsetLeft = 0;
|
358
|
+
|
359
|
+
do {
|
360
|
+
if (!isNaN(el.offsetTop)) {
|
361
|
+
offsetTop += el.offsetTop;
|
362
|
+
}
|
363
|
+
if (!isNaN(el.offsetLeft)) {
|
364
|
+
offsetLeft += el.offsetLeft;
|
365
|
+
}
|
366
|
+
} while (el = el.offsetParent)
|
367
|
+
|
368
|
+
return {
|
369
|
+
top: offsetTop,
|
370
|
+
left: offsetLeft
|
371
|
+
}
|
372
|
+
},
|
373
|
+
|
374
|
+
isElementInViewport : function(el, h) {
|
375
|
+
var scrolled = window.pageYOffset,
|
376
|
+
viewed = scrolled + this.getViewportH(),
|
377
|
+
elH = el.offsetHeight,
|
378
|
+
elTop = this.getOffset(el).top,
|
379
|
+
elBottom = elTop + elH,
|
380
|
+
h = h || 0;
|
381
|
+
|
382
|
+
return (elTop + elH * h) <= viewed
|
383
|
+
&& (elBottom) >= scrolled
|
384
|
+
|| (el.currentStyle? el.currentStyle : window.getComputedStyle(el, null)).position == 'fixed';
|
385
|
+
},
|
386
|
+
|
387
|
+
extend: function (a, b){
|
388
|
+
for (var key in b) {
|
389
|
+
if (b.hasOwnProperty(key)) {
|
390
|
+
a[key] = b[key];
|
391
|
+
}
|
392
|
+
}
|
393
|
+
return a;
|
394
|
+
}
|
395
|
+
}; // end scrollReveal.prototype
|
396
|
+
|
397
|
+
return scrollReveal;
|
398
|
+
})(window);
|
data/lib/happy_seed/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: happy_seed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Will Schenk
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-07-
|
12
|
+
date: 2014-07-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -29,14 +29,14 @@ dependencies:
|
|
29
29
|
name: sqlite3
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - '>='
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - '>='
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
description: HappySeed is a project that will build up a rails apps using some common
|
@@ -102,6 +102,8 @@ files:
|
|
102
102
|
- lib/generators/happy_seed/foreman/templates/application_controller.rb
|
103
103
|
- lib/generators/happy_seed/foreman/templates/config/unicorn.rb
|
104
104
|
- lib/generators/happy_seed/foreman/templates/docs/README.00.base.rdoc
|
105
|
+
- lib/generators/happy_seed/foreman/templates/spec/controllers/application_controller_spec.rb
|
106
|
+
- lib/generators/happy_seed/foreman/templates/spec/controllers/setup_controller_spec.rb
|
105
107
|
- lib/generators/happy_seed/happy_seed_generator.rb
|
106
108
|
- lib/generators/happy_seed/instagram/instagram_generator.rb
|
107
109
|
- lib/generators/happy_seed/instagram/templates/docs/README.05.instagram.rdoc
|
@@ -113,14 +115,18 @@ files:
|
|
113
115
|
- lib/generators/happy_seed/omniauth/templates/app/views/users/finish_signup.html.haml
|
114
116
|
- lib/generators/happy_seed/omniauth/templates/app/views/users/show.html.haml
|
115
117
|
- lib/generators/happy_seed/omniauth/templates/docs/README.04.omniauth.rdoc
|
118
|
+
- lib/generators/happy_seed/omniauth/templates/spec/models/identity_spec.rb
|
116
119
|
- lib/generators/happy_seed/omniauth/templates/user.rb
|
117
120
|
- lib/generators/happy_seed/splash/splash_generator.rb
|
121
|
+
- lib/generators/happy_seed/splash/templates/app/assets/stylesheets/splash.css.scss
|
118
122
|
- lib/generators/happy_seed/splash/templates/app/controllers/splash_controller.rb
|
119
123
|
- lib/generators/happy_seed/splash/templates/app/views/layouts/splash.html.haml
|
120
124
|
- lib/generators/happy_seed/splash/templates/app/views/splash/_environment_checks.html.haml
|
121
125
|
- lib/generators/happy_seed/splash/templates/app/views/splash/index.html.haml
|
122
126
|
- lib/generators/happy_seed/splash/templates/app/views/splash/signup.js.erb
|
123
127
|
- lib/generators/happy_seed/splash/templates/docs/README.02.splash.rdoc
|
128
|
+
- lib/generators/happy_seed/splash/templates/spec/controllers/splash_controller_spec.rb
|
129
|
+
- lib/generators/happy_seed/splash/templates/vendor/assets/javascripts/scrollReveal.js
|
124
130
|
- lib/generators/happy_seed/twitter/templates/docs/README.05.twitter.rdoc
|
125
131
|
- lib/generators/happy_seed/twitter/twitter_generator.rb
|
126
132
|
- lib/happy_seed.rb
|
@@ -161,7 +167,7 @@ files:
|
|
161
167
|
- test/dummy/public/favicon.ico
|
162
168
|
- test/seed_test.rb
|
163
169
|
- test/test_helper.rb
|
164
|
-
homepage:
|
170
|
+
homepage: http://seed.happyfuncorp.com
|
165
171
|
licenses:
|
166
172
|
- MIT
|
167
173
|
metadata: {}
|
@@ -171,17 +177,17 @@ require_paths:
|
|
171
177
|
- lib
|
172
178
|
required_ruby_version: !ruby/object:Gem::Requirement
|
173
179
|
requirements:
|
174
|
-
- -
|
180
|
+
- - '>='
|
175
181
|
- !ruby/object:Gem::Version
|
176
182
|
version: '0'
|
177
183
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
178
184
|
requirements:
|
179
|
-
- -
|
185
|
+
- - '>='
|
180
186
|
- !ruby/object:Gem::Version
|
181
187
|
version: '0'
|
182
188
|
requirements: []
|
183
189
|
rubyforge_project:
|
184
|
-
rubygems_version: 2.
|
190
|
+
rubygems_version: 2.2.2
|
185
191
|
signing_key:
|
186
192
|
specification_version: 4
|
187
193
|
summary: HappySeed is a project that will build up a rails apps using some common
|