omniauth-scaffold 0.1.11 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -6,16 +6,17 @@ Scaffold for OmniAuth.
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
- ```ruby
9
+ ```
10
10
  vi Gemfile
11
- ----------
11
+ ```
12
+
13
+ ```ruby
12
14
  # For OmniAuth
13
15
  gem 'rails_config'
14
16
  gem 'omniauth-scaffold', :group => :development
15
17
  gem 'omniauth-twitter'
16
18
  #gem 'omniauth-github'
17
19
  #gem 'omniauth-facebook'
18
- ----------
19
20
  ```
20
21
 
21
22
  And then execute:
@@ -80,9 +81,9 @@ app_name: "YOUR_APP_NAME"
80
81
 
81
82
  ### Keys
82
83
 
83
- <a href="https://dev.twitter.com/apps/new" target="_blank">Twitter</a>
84
- <a href="https://github.com/settings/applications/new" target="_blank">GitHub</a>
85
- <a href="https://developers.facebook.com/apps" target="_blank">Facebook</a>
84
+ <a href="https://dev.twitter.com/apps/new" target="_blank">Twitter</a><br />
85
+ <a href="https://github.com/settings/applications/new" target="_blank">GitHub</a><br />
86
+ <a href="https://developers.facebook.com/apps" target="_blank">Facebook</a><br />
86
87
 
87
88
  ### Development Setting
88
89
 
@@ -5,13 +5,15 @@ require 'rails/generators'
5
5
  module Omniauth
6
6
  module Generators
7
7
  class ScaffoldGenerator < ::Rails::Generators::Base
8
- source_root File.expand_path("../omniauth-scaffold", __FILE__)
8
+ @@gem_path = source_root File.expand_path("../omniauth-scaffold", __FILE__)
9
9
  desc "This generator scaffold for OmniAuth"
10
10
 
11
11
  #-------------------#
12
12
  # generate_scaffold #
13
13
  #-------------------#
14
14
  def generate_scaffold
15
+ app_name = Rails.application.class.name.split('::').first
16
+
15
17
  # ----- rails_config ----- #
16
18
  copy_file( "templates/rails_config/rails_config.rb", "config/initializers/rails_config.rb" )
17
19
  copy_file( "templates/rails_config/settings.yml", "config/settings.yml" )
@@ -55,14 +57,15 @@ module Omniauth
55
57
  copy_file( "templates/user.rb", "app/models/user.rb" )
56
58
 
57
59
  # ----- controllers ----- #
58
- FileUtils.mv( "app/controllers/application_controller.rb", "app/controllers/application_controller_ORIGINAL.rb" )
59
- copy_file( "templates/application_controller.rb", "app/controllers/application_controller.rb" )
60
+ content = File.read( "#{@@gem_path}/templates/application_controller.rb", encoding: Encoding::UTF_8 )
61
+ gsub_file "app/controllers/application_controller.rb", /(class ApplicationController < ActionController::Base\n protect_from_forgery\nend\n)+/, content.force_encoding('ASCII-8BIT')
60
62
  copy_file( "templates/sessions_controller.rb", "app/controllers/sessions_controller.rb" )
61
63
  copy_file( "templates/top_controller.rb", "app/controllers/top_controller.rb" )
62
64
 
63
65
  # ----- views ----- #
64
- FileUtils.mv( "app/views/layouts/application.html.erb", "app/views/layouts/application_ORIGINAL.html.erb" )
65
- copy_file( "templates/application.html.erb", "app/views/layouts/application.html.erb" )
66
+ content = File.read( "#{@@gem_path}/templates/application.html.erb", encoding: Encoding::UTF_8 )
67
+ gsub_file "app/views/layouts/application.html.erb", /(<%= yield %>)+/, content.force_encoding('ASCII-8BIT')
68
+ gsub_file "app/views/layouts/application.html.erb", Regexp.new("<title>#{app_name}</title>"), "<title><%= Settings.app_name %></title>"
66
69
  copy_file( "templates/index.html.erb", "app/views/top/index.html.erb" )
67
70
 
68
71
  # ----- assets ----- #
@@ -1,13 +1,3 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title><%= Settings.app_name %></title>
5
- <%= stylesheet_link_tag "application", :media => "all" %>
6
- <%= javascript_include_tag "application" %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
1
  <% if current_user %>
12
2
  <%# ログイン済み %>
13
3
  <%= link_to_unless( current_user.screen_name.blank?, image_tag( current_user.image, size: "20x20" ), "https://twitter.com/#!/#{current_user.screen_name}", target: "_blank" ) %>
@@ -31,7 +21,4 @@
31
21
  Developed by <a href="https://twitter.com/#!/<%= Settings.programmer_twitter_id %>/" target="_blank">@<%= Settings.programmer_twitter_id %></a>,
32
22
  Designed by <a href="https://twitter.com/#!/<%= Settings.designer_twitter_id %>/" target="_blank">@<%= Settings.designer_twitter_id %></a>,
33
23
  Licence by <a href="https://creativecommons.org/licenses/by-nc-sa/2.1/jp/" target="_blank">CC BY-NC-SA 2.1</a>
34
- </center>
35
-
36
- </body>
37
- </html>
24
+ </center>
@@ -1,5 +1,14 @@
1
1
  # From https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/ja.yml
2
2
  ja:
3
+ # Add
4
+ menu:
5
+ show: Show
6
+ edit: Edit
7
+ destroy: Delete
8
+ new: New
9
+ top: Top
10
+ list: List
11
+
3
12
  date:
4
13
  abbr_day_names:
5
14
  - 日
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Scaffold
3
- VERSION = "0.1.11"
3
+ VERSION = "0.1.12"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-scaffold
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-04 00:00:00.000000000 Z
12
+ date: 2012-07-09 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Scaffold for OmniAuth.
15
15
  email: