turboauth 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/turboauth.rb +12 -2
- metadata +1 -1
data/lib/turboauth.rb
CHANGED
@@ -3,6 +3,7 @@ class TurboAuth
|
|
3
3
|
|
4
4
|
def self.facebook
|
5
5
|
self.add_gems
|
6
|
+
self.add_jquery_turbolinks_to_application_js
|
6
7
|
self.add_to_gitignore
|
7
8
|
self.add_facebook_yml
|
8
9
|
self.add_routes
|
@@ -22,10 +23,19 @@ class TurboAuth
|
|
22
23
|
|
23
24
|
def self.add_gems
|
24
25
|
File.open('Gemfile', 'a') do |file|
|
25
|
-
file.puts "\n#omniauth gems\ngem 'omniauth'\ngem 'omniauth-facebook', '1.4.0'\n"
|
26
|
+
file.puts "\n#omniauth gems\ngem 'omniauth'\ngem 'omniauth-facebook', '1.4.0'\n\ngem 'jquery-turbolinks'\n"
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
30
|
+
def self.add_jquery_turbolinks_to_application_js
|
31
|
+
File.open('app/assets/javascripts/application.js', 'a+') { |source_file|
|
32
|
+
contents = source_file.read
|
33
|
+
newlines = "require turbolinks\n//= require jquery.turbolinks\n"
|
34
|
+
contents.gsub!(/[r][e][q][u][i][r][e][ ][t][u][r][b][o][l][i][n][k][s]/, newlines)
|
35
|
+
File.open('config/routes.rb', "w+") { |f| f.write(contents) }
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
29
39
|
def self.add_to_gitignore
|
30
40
|
File.open('.gitignore', 'a') do |file|
|
31
41
|
file.puts "\n#ignore file with facebook keys\nfacebook.yml\n"
|
@@ -120,7 +130,7 @@ class TurboAuth
|
|
120
130
|
end
|
121
131
|
|
122
132
|
def self.migrate
|
123
|
-
system ( "rake db:migrate" )
|
133
|
+
system ( "bundle exec rake db:migrate" )
|
124
134
|
end
|
125
135
|
|
126
136
|
def self.bundle
|