turbolog 0.1.2 → 0.1.3
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/README.md +4 -5
- data/lib/generators/turbolog/config_generator.rb +36 -22
- data/lib/generators/turbolog/install_generator.rb +13 -7
- data/lib/tasks/turbolog.rake +1 -3
- data/lib/turbolog/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f665c3ae262f53daf379f7ee4c1570e9219ddeb8c74af3fcd465e327e0efa384
|
4
|
+
data.tar.gz: 02f2b1fc62190b6264f78a1dbc374da0670d27ddad1035580edc20388bdc4a8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a403b3ee7d5c6dc91f4f583599bf6018da8a8579864246c9f15aefdbf83aa1f2894c18f2e748ac15bde7d281794fe7953ded9251541904cd9897f57b7dfed7f5
|
7
|
+
data.tar.gz: 3248f14ff7af5b92673106bc90a9b4bd6d7d09528e6a893f043baae9677269b2fdc75d0bb82d8de8b9baf0d7048755a25bd031612ea709e4ce9e351ca900e89b
|
data/README.md
CHANGED
@@ -45,17 +45,16 @@ Step 3/3 execute :
|
|
45
45
|
|
46
46
|
It will run mongoid:config, devise install, devise Users and config omniauth and generate scaffold welcome as an example
|
47
47
|
|
48
|
-
## Usage
|
49
|
-
|
50
|
-
Your rails app will have Log In/Log Out with Facebook authentication as a template for your modification.
|
51
|
-
|
52
48
|
Additional Setup For Facebook in .env
|
53
49
|
for example
|
54
50
|
FACEBOOK_API="xxxxxxxxxxxxxxxxx"
|
55
51
|
FACEBOOK_SECRET="xxxxxxxxxxxxxxxxxxxxxxxxxx"
|
52
|
+
## Usage
|
56
53
|
|
54
|
+
1. Create new rails app
|
57
55
|
|
58
|
-
|
56
|
+
$ rails new sample -B -O -T
|
57
|
+
2. Follow Installation 3 steps above
|
59
58
|
|
60
59
|
Other command:
|
61
60
|
|
@@ -5,56 +5,69 @@ module Turbolog
|
|
5
5
|
File.dirname(__FILE__) + "/templates"
|
6
6
|
end
|
7
7
|
|
8
|
+
def self.blue(mytext)
|
9
|
+
"\e[34m#{mytext}\e[0m".center(40)
|
10
|
+
end
|
11
|
+
|
8
12
|
desc "Config mongoid"
|
13
|
+
puts ConfigGenerator.blue(" .................run mongoid:config....................\n")
|
14
|
+
|
9
15
|
def config_mongoid
|
10
16
|
run "rails g mongoid:config"
|
11
17
|
end
|
12
18
|
|
13
|
-
def
|
14
|
-
|
19
|
+
def sethost_mongoid
|
20
|
+
puts ConfigGenerator.blue("..............change localhost to 127.0.0.1.............\n")
|
21
|
+
gsub_file 'config/mongoid.yml','localhost:27017','127.0.0.1:27017'
|
15
22
|
end
|
16
23
|
|
17
24
|
desc "Configure Devise"
|
18
25
|
def config_devise
|
19
|
-
puts "rails g devise:install
|
26
|
+
puts ConfigGenerator.blue("..................rails g devise:install................\n")
|
20
27
|
run "rails generate devise:install"
|
21
|
-
puts "rails g devise User
|
28
|
+
puts ConfigGenerator.blue("....................rails g devise User.................\n")
|
22
29
|
run "rails generate devise User"
|
23
|
-
#remove another devise from rails g devise User
|
30
|
+
# remove another devise from rails g devise User
|
24
31
|
gsub_file 'config/routes.rb',/devise_for :users\n/,''
|
25
|
-
|
32
|
+
|
26
33
|
end
|
27
|
-
|
34
|
+
|
35
|
+
desc "Create Initial Controller"
|
36
|
+
puts ConfigGenerator.blue(".............Create Welcome Initial Controller..........\n")
|
37
|
+
def create_welcome
|
38
|
+
run "rails g scaffold welcome greeting:text"
|
39
|
+
end
|
40
|
+
|
41
|
+
def config_welcome
|
42
|
+
# set root to Welcome
|
43
|
+
puts ConfigGenerator.blue("................Set root to: welcomes#index ...........\n")
|
44
|
+
gsub_file 'config/routes.rb',/root.*/,'root to: \'welcomes#index\''
|
28
45
|
inject_into_file 'config/routes.rb', :after => 'Rails.application.routes.draw do' do
|
29
46
|
"\n get 'welcomes/index'\n"
|
30
47
|
end
|
31
48
|
end
|
32
49
|
|
33
|
-
desc "
|
34
|
-
# def backup_files
|
35
|
-
# inside("app/controllers") {(File.file? "Users/omniauth_callbacks_controller.rb") ? (mv omniauth_callbacks_controller.rb omniauth_callbacks_controller.rb.bak) : (puts "Backup omniauth_callbacks_controller.rb")}
|
36
|
-
# end
|
37
|
-
|
50
|
+
desc "authenticate_user"
|
38
51
|
def authenticate_user
|
39
|
-
puts "
|
52
|
+
puts ConfigGenerator.blue("..............Authenticate user in application..........\n")
|
40
53
|
inject_into_file 'app/controllers/application_controller.rb', :after => 'class ApplicationController < ActionController::Base' do
|
41
54
|
"\n before_action :authenticate_user!\n"
|
42
55
|
end
|
43
56
|
end
|
44
57
|
|
45
|
-
def
|
46
|
-
puts "
|
58
|
+
def setup_routes_users
|
59
|
+
puts ConfigGenerator.blue(".................Setup routes for Users.................\n")
|
47
60
|
route "devise_for :users, :controllers => { :omniauth_callbacks => \"users/omniauth_callbacks\" }"
|
48
61
|
end
|
49
62
|
|
50
63
|
|
51
64
|
desc "Set up omniauth config"
|
52
65
|
def setup_omniauth
|
53
|
-
puts "config devise for facebook
|
66
|
+
puts ConfigGenerator.blue("...............config devise for facebook...............\n")
|
54
67
|
inject_into_file 'config/initializers/devise.rb', :after => 'Devise.setup do |config|' do
|
55
68
|
"\n config.omniauth :facebook, ENV['FACEBOOK_API'], ENV['FACEBOOK_SECRET']\n"
|
56
69
|
end
|
57
|
-
puts "config user for facebook
|
70
|
+
puts ConfigGenerator.blue("..............config user model for facebook............\n")
|
58
71
|
inject_into_file 'app/models/user.rb', :after => 'include Mongoid::Document' do
|
59
72
|
"\n\n include Mongoid::Attributes::Dynamic" +
|
60
73
|
"\n devise :omniauthable, :omniauth_providers => [:facebook]" +
|
@@ -66,15 +79,15 @@ module Turbolog
|
|
66
79
|
"\n end\n"
|
67
80
|
end
|
68
81
|
|
69
|
-
puts "Add field provider to
|
82
|
+
puts ConfigGenerator.blue("...........Add field [provider] to user model...........\n")
|
70
83
|
inject_into_file 'app/models/user.rb', :after => ' field :encrypted_password, type: String, default: ""' do
|
71
84
|
"\n field :provider, type: String, default: \"\"\n"
|
72
85
|
end
|
73
86
|
|
74
87
|
end
|
75
88
|
|
76
|
-
desc "Add Log In/Log Out
|
77
|
-
puts "Add Log In/Log Out
|
89
|
+
desc "Add Log In/Log Out View in application.html.erb"
|
90
|
+
puts ConfigGenerator.blue("......Add Log In/Log Out View in application.html.......\n")
|
78
91
|
|
79
92
|
def log_in_out
|
80
93
|
inject_into_file 'app/views/layouts/application.html.erb', :after => '<body>' do
|
@@ -90,9 +103,10 @@ module Turbolog
|
|
90
103
|
end
|
91
104
|
|
92
105
|
def finish
|
93
|
-
puts " Finished Configured devise omniauth for Facebook.\n"
|
94
106
|
puts "\n"
|
95
|
-
|
107
|
+
puts ConfigGenerator.blue("........................................................\n")
|
108
|
+
puts ConfigGenerator.blue("....................Finished Step 3/3...................\n")
|
109
|
+
puts ConfigGenerator.blue("........................................................\n")
|
96
110
|
end
|
97
111
|
end
|
98
112
|
end
|
@@ -5,8 +5,12 @@ module Turbolog
|
|
5
5
|
def self.source_root
|
6
6
|
File.dirname(__FILE__) + "/templates"
|
7
7
|
end
|
8
|
+
def self.blue(mytext)
|
9
|
+
"\e[34m#{mytext}\e[0m".center(40)
|
10
|
+
end
|
8
11
|
|
9
12
|
def setup_gems
|
13
|
+
puts InstallGenerator.blue(" ....................Insert Gems....................\n")
|
10
14
|
gem 'devise'
|
11
15
|
gem 'mongo', '~> 2.2'
|
12
16
|
gem 'bson', '~> 4.0'
|
@@ -34,6 +38,7 @@ module Turbolog
|
|
34
38
|
end
|
35
39
|
|
36
40
|
def backup_files
|
41
|
+
puts InstallGenerator.blue(" ...................Backup Filess....................\n")
|
37
42
|
inside("app/controllers") {(File.file? "Users/omniauth_callbacks_controller.rb") ? (run "mv omniauth_callbacks_controller.rb omniauth_callbacks_controller.rb.bak") : (puts "No omniauth_callbacks_controller.rb")}
|
38
43
|
inside("config/initializers") {(File.file? "devise.rb") ? (run "mv devise.rb devise.rb.bak") : (puts "No devise.rb")}
|
39
44
|
inside("app/models") {(File.file? "user.rb") ? (run "mv user.rb user.rb.bak") : (puts "No user.rb")}
|
@@ -42,22 +47,23 @@ module Turbolog
|
|
42
47
|
directory "app"
|
43
48
|
end
|
44
49
|
def remove_devise
|
50
|
+
puts InstallGenerator.blue(" ..............Remove devise from routes.............\n")
|
45
51
|
gsub_file 'config/routes.rb',/devise_for.*\n/,''
|
46
52
|
end
|
47
53
|
def create_welcome
|
54
|
+
puts InstallGenerator.blue(" ................Create Sample: Welcome..............\n")
|
48
55
|
run "rails g scaffold welcome greeting:text"
|
49
56
|
end
|
50
57
|
|
51
58
|
|
52
59
|
def finish
|
53
60
|
puts "\n"
|
54
|
-
puts "
|
55
|
-
puts "
|
56
|
-
puts "
|
57
|
-
puts "
|
58
|
-
puts "
|
59
|
-
puts "
|
60
|
-
puts "----------------------------------------\n"
|
61
|
+
puts InstallGenerator.blue(" ....................Finish Step 1/3..................\n")
|
62
|
+
puts "Next: Please run the following commands:\n"
|
63
|
+
puts InstallGenerator.blue("......................................................\n")
|
64
|
+
puts "$ bundle install\n"
|
65
|
+
puts "$ rails generate turbolog:config\n"
|
66
|
+
puts InstallGenerator.blue("......................................................\n")
|
61
67
|
end
|
62
68
|
end
|
63
69
|
end
|
data/lib/tasks/turbolog.rake
CHANGED
data/lib/turbolog/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbolog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Prateep Kul
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|