happy_seed 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/generators/happy_seed/bootstrap/templates/app/helpers/application_helper.rb +4 -0
- data/lib/generators/happy_seed/bootstrap/templates/app/views/application/_footer.html.haml +6 -7
- data/lib/generators/happy_seed/bootstrap/templates/app/views/application/_head.html.haml +1 -1
- data/lib/generators/happy_seed/bootstrap/templates/app/views/application/_header.html.haml +15 -16
- data/lib/generators/happy_seed/devise/devise_generator.rb +7 -6
- data/lib/generators/happy_seed/devise/templates/app/views/devise/registrations/new.html.haml +1 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/sessions/new.html.haml +1 -0
- data/lib/generators/happy_seed/happy_seed_generator.rb +11 -1
- data/lib/generators/happy_seed/omniauth/omniauth_generator.rb +2 -1
- data/lib/generators/happy_seed/omniauth/templates/app/controllers/omniauth_callbacks_controller.rb +2 -1
- data/lib/generators/happy_seed/omniauth/templates/app/models/identity.rb +2 -1
- data/lib/generators/happy_seed/omniauth/templates/app/views/users/finish_signup.html.haml +1 -1
- data/lib/happy_seed/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c2387bf98dd8eba98bb76cdba96ddb9e9c4b885
|
4
|
+
data.tar.gz: a15292d591236f761dbb84b612307e170bd7e8ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3bbf3a5bc46701938ab6d74c79466ed398f09b2347cfd241aa4321b861c3dfff510f15b954c2166d02bbd1ba78c1bbfa8b533e47752ab9684947af17dac86b1
|
7
|
+
data.tar.gz: 90802c40fa1e1c135a7cd74355ac777b1b755ab3ef66a1568ba4f8aae842cdbc24a1bdb5e2cd0f004f8c3006b725835fb63cf941ed753f1e2fb8a74e62b07e59
|
@@ -1,8 +1,7 @@
|
|
1
1
|
%footer#footer
|
2
|
-
.
|
3
|
-
.
|
4
|
-
|
5
|
-
|
6
|
-
.
|
7
|
-
|
8
|
-
T, Copyright © #{ Date.today.year }
|
2
|
+
.row
|
3
|
+
.col-xs-6
|
4
|
+
%h3 AppName
|
5
|
+
.col-xs-6.text-right
|
6
|
+
%small.copyright
|
7
|
+
T, Copyright © #{ Date.today.year }
|
@@ -2,7 +2,7 @@
|
|
2
2
|
%meta{ :charset => 'utf-8' }/
|
3
3
|
%meta{ 'http-equiv' => 'X-UA-Compatible', :content => 'IE=edge,chrome=1' }/
|
4
4
|
|
5
|
-
= display_meta_tags :site => '
|
5
|
+
= display_meta_tags :site => 'Seed Site', :title => page_title, :reverse => true
|
6
6
|
|
7
7
|
%meta{ :name => 'description', :content => '' }/
|
8
8
|
%meta{ :name => 'viewport', :content => 'width=device-width' }/
|
@@ -1,16 +1,15 @@
|
|
1
|
-
%header#top.navbar{:role=>:banner}
|
2
|
-
.
|
3
|
-
.navbar-
|
4
|
-
%
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
%nav.
|
13
|
-
%
|
14
|
-
|
15
|
-
|
16
|
-
/ USER NAV
|
1
|
+
%header#top.navbar.navbar-default{:role=>:banner}
|
2
|
+
.navbar-header
|
3
|
+
%button.navbar-toggle{:type=>:button, 'data-toggle'=>:collapse, 'data-target'=>'.navbar-collapse'}
|
4
|
+
%span.sr-only Toggle navigations
|
5
|
+
%span.icon-bar
|
6
|
+
%span.icon-bar
|
7
|
+
%span.icon-bar
|
8
|
+
= link_to root_path, :class=>'navbar-brand' do
|
9
|
+
%span.glyphicon.glyphicon-cloud
|
10
|
+
App name
|
11
|
+
%nav.collapse.navbar-collapse{:role=>:navigation}
|
12
|
+
%ul.nav.navbar-nav
|
13
|
+
%li= link_to 'Contact', '#'
|
14
|
+
%li= link_to 'Blog', '#'
|
15
|
+
/ USER NAV
|
@@ -21,6 +21,7 @@ module HappySeed
|
|
21
21
|
|
22
22
|
directory 'app'
|
23
23
|
directory 'docs'
|
24
|
+
directory 'test'
|
24
25
|
|
25
26
|
application(nil, env: "development") do
|
26
27
|
"config.action_mailer.default_url_options = { host: 'localhost:3000' }"
|
@@ -28,12 +29,12 @@ module HappySeed
|
|
28
29
|
|
29
30
|
gsub_file 'app/views/application/_header.html.haml', "/ USER NAV", <<-'RUBY'
|
30
31
|
%ul.nav.navbar-nav.navbar-right
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
- if user_signed_in?
|
33
|
+
%li= link_to 'Sign Out', destroy_user_session_path, :method=>:delete
|
34
|
+
- else
|
35
|
+
/ CONNECT
|
36
|
+
%li= link_to 'Sign In', new_user_session_path
|
37
|
+
%li= link_to 'Sign Up', new_user_registration_path
|
37
38
|
RUBY
|
38
39
|
end
|
39
40
|
end
|
@@ -27,10 +27,20 @@ module HappySeed
|
|
27
27
|
end
|
28
28
|
append_to_file ".env", "#{provider.upcase}_APP_ID=\n#{provider.upcase}_APP_SECRET=\n"
|
29
29
|
|
30
|
-
inject_into_file 'app/views/application/_header.html.haml', "
|
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
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
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
33
|
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
|
+
inject_into_file 'app/models/user.rb', :before => "\nend" do <<-"RUBY"
|
35
|
+
def #{provider}
|
36
|
+
identities.where( :provider => "#{provider}" ).first
|
37
|
+
end
|
38
|
+
|
39
|
+
def #{provider}_client
|
40
|
+
@#{provider}_client ||= #{provider.to_s.humanize}.client( access_token: #{provider}.accesstoken )
|
41
|
+
end
|
42
|
+
RUBY
|
43
|
+
end
|
34
44
|
end
|
35
45
|
|
36
46
|
def gem_available?(name)
|
@@ -25,7 +25,7 @@ module HappySeed
|
|
25
25
|
run "bundle install"
|
26
26
|
end
|
27
27
|
|
28
|
-
generate 'model identity user:references provider:string uid:string name:string email:string nickname:string image:string phone:string urls:string'
|
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
31
|
route "match '/profile/:id/finish_signup' => 'users#finish_signup', via: [:get, :patch], :as => :finish_signup"
|
@@ -35,6 +35,7 @@ module HappySeed
|
|
35
35
|
insert_into_file "app/models/user.rb", File.read( find_in_source_paths( "user.rb" ) ), :before => "\nend\n"
|
36
36
|
insert_into_file "app/views/application/_header.html.haml", " %li= link_to 'Account', user_path\n", after: " - if user_signed_in?\n"
|
37
37
|
gsub_file 'config/routes.rb', "devise_for :users\n", "devise_for :users, :controllers => { omniauth_callbacks: 'omniauth_callbacks' }\n"
|
38
|
+
|
38
39
|
directory "docs"
|
39
40
|
end
|
40
41
|
|
@@ -6,12 +6,13 @@ class Identity < ActiveRecord::Base
|
|
6
6
|
def self.find_for_oauth(auth)
|
7
7
|
identity = find_by(provider: auth.provider, uid: auth.uid)
|
8
8
|
identity = create(uid: auth.uid, provider: auth.provider) if identity.nil?
|
9
|
+
identity.accesstoken = auth.credentials.token
|
9
10
|
identity.name = auth.info.name
|
10
11
|
identity.email = auth.info.email
|
11
12
|
identity.nickname = auth.info.nickname
|
12
13
|
identity.image = auth.info.image
|
13
14
|
identity.phone = auth.info.phone
|
14
|
-
identity.urls = auth.info.urls
|
15
|
+
identity.urls = (auth.info.urls || "").to_json
|
15
16
|
identity.save
|
16
17
|
identity
|
17
18
|
end
|
@@ -15,7 +15,7 @@
|
|
15
15
|
%br
|
16
16
|
|
17
17
|
.form-group
|
18
|
-
= f.label :email
|
18
|
+
= f.label :email, :class=>'control-label col-sm-3'
|
19
19
|
.col-sm-9= f.text_field :email, :autofocus => true, :value => '', class: 'form-control input-lg', placeholder: 'Example: email@me.com'
|
20
20
|
|
21
21
|
%p.col-sm-9.help-block
|
data/lib/happy_seed/version.rb
CHANGED