omniauth-scaffold 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +3 -16
- data/LICENSE +22 -0
- data/README.md +92 -51
- data/Rakefile +2 -49
- data/lib/omniauth-scaffold/templates/README.md +80 -0
- data/lib/{generators/omniauth/scaffold/templates/app/views/layouts → omniauth-scaffold/templates}/application.html.erb +7 -7
- data/lib/{generators/omniauth/scaffold/templates/app/controllers → omniauth-scaffold/templates}/application_controller.rb +7 -7
- data/lib/{generators/omniauth/scaffold/templates/app/assets/stylesheets → omniauth-scaffold/templates}/base.css.scss +0 -1
- data/lib/{generators/omniauth/scaffold/templates/db/migrate → omniauth-scaffold/templates}/create_users.rb +0 -0
- data/lib/omniauth-scaffold/templates/index.html.erb +2 -0
- data/lib/{generators/omniauth/scaffold/templates/config/locales → omniauth-scaffold/templates}/ja.yml +3 -3
- data/lib/omniauth-scaffold/templates/omniauth.rb +10 -0
- data/lib/omniauth-scaffold/templates/rails_config/development.yml +0 -0
- data/lib/omniauth-scaffold/templates/rails_config/production.yml +11 -0
- data/lib/omniauth-scaffold/templates/rails_config/rails_config.rb +3 -0
- data/lib/omniauth-scaffold/templates/rails_config/settings.local.yml +3 -0
- data/lib/omniauth-scaffold/templates/rails_config/settings.yml +11 -0
- data/lib/omniauth-scaffold/templates/rails_config/test.yml +0 -0
- data/lib/{generators/omniauth/scaffold/templates/app/assets/stylesheets → omniauth-scaffold/templates}/scaffolds.css.scss +27 -13
- data/lib/{generators/omniauth/scaffold/templates/app/controllers → omniauth-scaffold/templates}/sessions_controller.rb +0 -0
- data/lib/{generators/omniauth/scaffold/templates/app/controllers → omniauth-scaffold/templates}/top_controller.rb +0 -0
- data/lib/{generators/omniauth/scaffold/templates/app/models → omniauth-scaffold/templates}/user.rb +1 -1
- data/lib/omniauth-scaffold/version.rb +5 -0
- data/lib/omniauth-scaffold.rb +92 -0
- data/omniauth-scaffold.gemspec +13 -73
- metadata +31 -129
- data/.document +0 -5
- data/.rspec +0 -1
- data/VERSION +0 -1
- data/lib/generators/omniauth/scaffold/scaffold_generator.rb +0 -93
- data/lib/generators/omniauth/scaffold/templates/README.md +0 -64
- data/lib/generators/omniauth/scaffold/templates/app/views/top/index.html.erb +0 -2
- data/lib/generators/omniauth/scaffold/templates/config/initializers/constants.rb +0 -19
- data/lib/generators/omniauth/scaffold/templates/config/initializers/local_setting.rb +0 -13
- data/lib/generators/omniauth/scaffold/templates/config/initializers/omniauth.rb +0 -6
- data/spec/omniauth-scaffold_spec.rb +0 -7
- data/spec/spec_helper.rb +0 -12
@@ -0,0 +1,92 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
require "omniauth-scaffold/version"
|
3
|
+
require 'rails/generators'
|
4
|
+
|
5
|
+
module Omniauth
|
6
|
+
module Generators
|
7
|
+
class ScaffoldGenerator < ::Rails::Generators::Base
|
8
|
+
source_root File.expand_path("../omniauth-scaffold", __FILE__)
|
9
|
+
desc "This generator scaffold for OmniAuth"
|
10
|
+
|
11
|
+
#-------------------#
|
12
|
+
# generate_scaffold #
|
13
|
+
#-------------------#
|
14
|
+
def generate_scaffold
|
15
|
+
# ----- rails_config ----- #
|
16
|
+
copy_file( "templates/rails_config/rails_config.rb", "config/initializers/rails_config.rb" )
|
17
|
+
copy_file( "templates/rails_config/settings.yml", "config/settings.yml" )
|
18
|
+
copy_file( "templates/rails_config/settings.local.yml", "config/settings.local.yml" )
|
19
|
+
copy_file( "templates/rails_config/development.yml", "config/settings/development.yml" )
|
20
|
+
copy_file( "templates/rails_config/production.yml", "config/settings/production.yml" )
|
21
|
+
copy_file( "templates/rails_config/test.yml", "config/settings/test.yml" )
|
22
|
+
|
23
|
+
# ----- omniauth ----- #
|
24
|
+
copy_file( "templates/omniauth.rb", "config/initializers/omniauth.rb" )
|
25
|
+
|
26
|
+
# ----- routes.rb ----- #
|
27
|
+
content = "\n # For OmniAuth\n"
|
28
|
+
content += " match \"/auth/:provider/callback\" => \"sessions#callback\"\n"
|
29
|
+
content += " match \"/auth/failure\" => \"sessions#failure\"\n"
|
30
|
+
content += " match \"/logout\" => \"sessions#destroy\", :as => :logout\n"
|
31
|
+
insert_into_file( "config/routes.rb", content.force_encoding('ASCII-8BIT'), after: "# first created -> highest priority.\n" )
|
32
|
+
insert_into_file( "config/routes.rb", " root to: 'top#index'\n", after: "# root :to => 'welcome#index'\n" )
|
33
|
+
insert_into_file( "config/routes.rb", " match ':controller(/:action(/:id))(.:format)'\n", after: "# match ':controller(/:action(/:id))(.:format)'\n" )
|
34
|
+
|
35
|
+
# ----- application.rb ----- #
|
36
|
+
content = " config.time_zone = 'Tokyo'\n"
|
37
|
+
content += " config.active_record.default_timezone = :local\n"
|
38
|
+
insert_into_file( "config/application.rb", content.force_encoding('ASCII-8BIT'), after: "# config.time_zone = 'Central Time (US & Canada)'\n" )
|
39
|
+
insert_into_file( "config/application.rb", " config.i18n.default_locale = :ja\n", after: "# config.i18n.default_locale = :de\n" )
|
40
|
+
content = "\n # For Heroku\n"
|
41
|
+
content += " config.assets.initialize_on_precompile = false\n"
|
42
|
+
insert_into_file( "config/application.rb", content.force_encoding('ASCII-8BIT'), after: "config.assets.version = '1.0'\n" )
|
43
|
+
|
44
|
+
# ----- development.rb ----- #
|
45
|
+
gsub_file "config/environments/development.rb", /(config.assets.debug = true)+/, "# config.assets.debug = true"
|
46
|
+
insert_into_file( "config/environments/development.rb", " config.assets.debug = false\n", after: "config.assets.debug = true\n" )
|
47
|
+
|
48
|
+
# ----- ja.yml ----- #
|
49
|
+
copy_file( "templates/ja.yml", "config/locales/ja.yml" )
|
50
|
+
|
51
|
+
# ----- create_users.rb ----- #
|
52
|
+
copy_file( "templates/create_users.rb", "db/migrate/20000101000000_create_users.rb" )
|
53
|
+
|
54
|
+
# ----- models ----- #
|
55
|
+
copy_file( "templates/user.rb", "app/models/user.rb" )
|
56
|
+
|
57
|
+
# ----- 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
|
+
copy_file( "templates/sessions_controller.rb", "app/controllers/sessions_controller.rb" )
|
61
|
+
copy_file( "templates/top_controller.rb", "app/controllers/top_controller.rb" )
|
62
|
+
|
63
|
+
# ----- 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
|
+
copy_file( "templates/index.html.erb", "app/views/top/index.html.erb" )
|
67
|
+
|
68
|
+
# ----- assets ----- #
|
69
|
+
copy_file( "templates/base.css.scss", "app/assets/stylesheets/base.css.scss" )
|
70
|
+
copy_file( "templates/scaffolds.css.scss", "app/assets/stylesheets/scaffolds.css.scss" )
|
71
|
+
|
72
|
+
# ----- public ----- #
|
73
|
+
remove_file( 'public/index.html' )
|
74
|
+
|
75
|
+
# ----- README ----- #
|
76
|
+
remove_file( 'README.rdoc' )
|
77
|
+
copy_file( "templates/README.md", "README.md" )
|
78
|
+
|
79
|
+
# ----- .gitignore ----- #
|
80
|
+
content = "\n# Add\n"
|
81
|
+
content += ".DS_Store\n"
|
82
|
+
content += "vendor/bundle\n"
|
83
|
+
content += "\n# rails_config\n"
|
84
|
+
content += "config/settings.local.yml\n"
|
85
|
+
content += "config/settings/*.local.yml\n"
|
86
|
+
content += "config/environments/*.local.yml\n"
|
87
|
+
append_file( ".gitignore", content.force_encoding('ASCII-8BIT') )
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
92
|
+
end
|
data/omniauth-scaffold.gemspec
CHANGED
@@ -1,77 +1,17 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/omniauth-scaffold/version', __FILE__)
|
5
3
|
|
6
|
-
Gem::Specification.new do |
|
7
|
-
|
8
|
-
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["shu0115"]
|
6
|
+
gem.email = ["raisondetre0115@gmail.com"]
|
7
|
+
gem.description = %q{Scaffold for OmniAuth.}
|
8
|
+
gem.summary = %q{OmniAuth Scaffold}
|
9
|
+
gem.homepage = "https://github.com/shu0115/omniauth-scaffold"
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
"README.md"
|
17
|
-
]
|
18
|
-
s.files = [
|
19
|
-
".document",
|
20
|
-
".rspec",
|
21
|
-
"Gemfile",
|
22
|
-
"README.md",
|
23
|
-
"Rakefile",
|
24
|
-
"VERSION",
|
25
|
-
"lib/generators/omniauth/scaffold/scaffold_generator.rb",
|
26
|
-
"lib/generators/omniauth/scaffold/templates/README.md",
|
27
|
-
"lib/generators/omniauth/scaffold/templates/app/assets/stylesheets/base.css.scss",
|
28
|
-
"lib/generators/omniauth/scaffold/templates/app/assets/stylesheets/scaffolds.css.scss",
|
29
|
-
"lib/generators/omniauth/scaffold/templates/app/controllers/application_controller.rb",
|
30
|
-
"lib/generators/omniauth/scaffold/templates/app/controllers/sessions_controller.rb",
|
31
|
-
"lib/generators/omniauth/scaffold/templates/app/controllers/top_controller.rb",
|
32
|
-
"lib/generators/omniauth/scaffold/templates/app/models/user.rb",
|
33
|
-
"lib/generators/omniauth/scaffold/templates/app/views/layouts/application.html.erb",
|
34
|
-
"lib/generators/omniauth/scaffold/templates/app/views/top/index.html.erb",
|
35
|
-
"lib/generators/omniauth/scaffold/templates/config/initializers/constants.rb",
|
36
|
-
"lib/generators/omniauth/scaffold/templates/config/initializers/local_setting.rb",
|
37
|
-
"lib/generators/omniauth/scaffold/templates/config/initializers/omniauth.rb",
|
38
|
-
"lib/generators/omniauth/scaffold/templates/config/locales/ja.yml",
|
39
|
-
"lib/generators/omniauth/scaffold/templates/db/migrate/create_users.rb",
|
40
|
-
"omniauth-scaffold.gemspec",
|
41
|
-
"spec/omniauth-scaffold_spec.rb",
|
42
|
-
"spec/spec_helper.rb"
|
43
|
-
]
|
44
|
-
s.homepage = "http://github.com/shu0115/omniauth-scaffold"
|
45
|
-
s.licenses = ["CC BY-NC-SA 2.1"]
|
46
|
-
s.require_paths = ["lib"]
|
47
|
-
s.rubygems_version = "1.8.23"
|
48
|
-
s.summary = "OmniAuth Scaffold"
|
49
|
-
|
50
|
-
if s.respond_to? :specification_version then
|
51
|
-
s.specification_version = 3
|
52
|
-
|
53
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
54
|
-
s.add_runtime_dependency(%q<omniauth-twitter>, [">= 0"])
|
55
|
-
s.add_runtime_dependency(%q<omniauth-github>, [">= 0"])
|
56
|
-
s.add_runtime_dependency(%q<omniauth-facebook>, [">= 0"])
|
57
|
-
s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
|
58
|
-
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
59
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
60
|
-
else
|
61
|
-
s.add_dependency(%q<omniauth-twitter>, [">= 0"])
|
62
|
-
s.add_dependency(%q<omniauth-github>, [">= 0"])
|
63
|
-
s.add_dependency(%q<omniauth-facebook>, [">= 0"])
|
64
|
-
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
65
|
-
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
66
|
-
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
67
|
-
end
|
68
|
-
else
|
69
|
-
s.add_dependency(%q<omniauth-twitter>, [">= 0"])
|
70
|
-
s.add_dependency(%q<omniauth-github>, [">= 0"])
|
71
|
-
s.add_dependency(%q<omniauth-facebook>, [">= 0"])
|
72
|
-
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
73
|
-
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
74
|
-
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
75
|
-
end
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "omniauth-scaffold"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Omniauth::Scaffold::VERSION
|
76
17
|
end
|
77
|
-
|
metadata
CHANGED
@@ -1,146 +1,51 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-scaffold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
-
|
8
|
+
- shu0115
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
13
|
-
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: omniauth-twitter
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: omniauth-github
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '0'
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: omniauth-facebook
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
|
-
type: :runtime
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: rspec
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ~>
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: 2.8.0
|
70
|
-
type: :development
|
71
|
-
prerelease: false
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: 2.8.0
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: rdoc
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ~>
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '3.12'
|
86
|
-
type: :development
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ~>
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '3.12'
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: jeweler
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
|
-
requirements:
|
99
|
-
- - ~>
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: 1.8.3
|
102
|
-
type: :development
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ~>
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: 1.8.3
|
12
|
+
date: 2012-07-04 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
110
14
|
description: Scaffold for OmniAuth.
|
111
|
-
email:
|
15
|
+
email:
|
16
|
+
- raisondetre0115@gmail.com
|
112
17
|
executables: []
|
113
18
|
extensions: []
|
114
|
-
extra_rdoc_files:
|
115
|
-
- README.md
|
19
|
+
extra_rdoc_files: []
|
116
20
|
files:
|
117
|
-
- .
|
118
|
-
- .rspec
|
21
|
+
- .gitignore
|
119
22
|
- Gemfile
|
23
|
+
- LICENSE
|
120
24
|
- README.md
|
121
25
|
- Rakefile
|
122
|
-
-
|
123
|
-
- lib/
|
124
|
-
- lib/
|
125
|
-
- lib/
|
126
|
-
- lib/
|
127
|
-
- lib/
|
128
|
-
- lib/
|
129
|
-
- lib/
|
130
|
-
- lib/
|
131
|
-
- lib/
|
132
|
-
- lib/
|
133
|
-
- lib/
|
134
|
-
- lib/
|
135
|
-
- lib/
|
136
|
-
- lib/
|
137
|
-
- lib/
|
26
|
+
- lib/omniauth-scaffold.rb
|
27
|
+
- lib/omniauth-scaffold/templates/README.md
|
28
|
+
- lib/omniauth-scaffold/templates/application.html.erb
|
29
|
+
- lib/omniauth-scaffold/templates/application_controller.rb
|
30
|
+
- lib/omniauth-scaffold/templates/base.css.scss
|
31
|
+
- lib/omniauth-scaffold/templates/create_users.rb
|
32
|
+
- lib/omniauth-scaffold/templates/index.html.erb
|
33
|
+
- lib/omniauth-scaffold/templates/ja.yml
|
34
|
+
- lib/omniauth-scaffold/templates/omniauth.rb
|
35
|
+
- lib/omniauth-scaffold/templates/rails_config/development.yml
|
36
|
+
- lib/omniauth-scaffold/templates/rails_config/production.yml
|
37
|
+
- lib/omniauth-scaffold/templates/rails_config/rails_config.rb
|
38
|
+
- lib/omniauth-scaffold/templates/rails_config/settings.local.yml
|
39
|
+
- lib/omniauth-scaffold/templates/rails_config/settings.yml
|
40
|
+
- lib/omniauth-scaffold/templates/rails_config/test.yml
|
41
|
+
- lib/omniauth-scaffold/templates/scaffolds.css.scss
|
42
|
+
- lib/omniauth-scaffold/templates/sessions_controller.rb
|
43
|
+
- lib/omniauth-scaffold/templates/top_controller.rb
|
44
|
+
- lib/omniauth-scaffold/templates/user.rb
|
45
|
+
- lib/omniauth-scaffold/version.rb
|
138
46
|
- omniauth-scaffold.gemspec
|
139
|
-
|
140
|
-
|
141
|
-
homepage: http://github.com/shu0115/omniauth-scaffold
|
142
|
-
licenses:
|
143
|
-
- CC BY-NC-SA 2.1
|
47
|
+
homepage: https://github.com/shu0115/omniauth-scaffold
|
48
|
+
licenses: []
|
144
49
|
post_install_message:
|
145
50
|
rdoc_options: []
|
146
51
|
require_paths:
|
@@ -151,9 +56,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
151
56
|
- - ! '>='
|
152
57
|
- !ruby/object:Gem::Version
|
153
58
|
version: '0'
|
154
|
-
segments:
|
155
|
-
- 0
|
156
|
-
hash: -2153492965234191673
|
157
59
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
60
|
none: false
|
159
61
|
requirements:
|
data/.document
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.1.10
|
@@ -1,93 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
require 'rails/generators'
|
3
|
-
|
4
|
-
module Omniauth
|
5
|
-
module Generators
|
6
|
-
class ScaffoldGenerator < ::Rails::Generators::Base
|
7
|
-
|
8
|
-
source_root File.expand_path("../templates", __FILE__)
|
9
|
-
desc "This generator scaffold for OmniAuth"
|
10
|
-
|
11
|
-
def generate_scaffold
|
12
|
-
# Config
|
13
|
-
# initializers/local_setting.rb
|
14
|
-
if File.exist?('config/initializers/local_setting.rb')
|
15
|
-
content = "\n# Twitter\n"
|
16
|
-
content += "ENV['TWITTER_KEY'] = \"YOUR_CONSUMER_KEY\"\n"
|
17
|
-
content += "ENV['TWITTER_SECRET'] = \"YOUR_CONSUMER_SECRET\"\n\n"
|
18
|
-
content += "# GitHub\n"
|
19
|
-
content += "#ENV['GITHUB_CLIENT_ID'] = \"YOUR_CLIENT_ID\"\n"
|
20
|
-
content += "#ENV['GITHUB_SECRET'] = \"YOUR_SECRET\"\n\n"
|
21
|
-
content += "# Facebook\n"
|
22
|
-
content += "#ENV['FACEBOOK_APP_ID'] = \"YOUR_APP_ID\"\n"
|
23
|
-
content += "#ENV['FACEBOOK_APP_SECRET'] = \"YOUR_APP_SECRET\"\n"
|
24
|
-
|
25
|
-
append_file( "config/initializers/local_setting.rb", content.force_encoding('ASCII-8BIT') )
|
26
|
-
else
|
27
|
-
copy_file( "config/initializers/local_setting.rb", "config/initializers/local_setting.rb" )
|
28
|
-
end
|
29
|
-
|
30
|
-
# initializers/constants.rb
|
31
|
-
if File.exist?( 'config/initializers/constants.rb' )
|
32
|
-
content = "\n# OmniAuth Provider\n"
|
33
|
-
content += "# Production環境\n"
|
34
|
-
content += "if Rails.env.production?\n"
|
35
|
-
content += " DEFAULT_PROVIDER = \"twitter\"\n"
|
36
|
-
content += " # DEFAULT_PROVIDER = \"facebook\"\n"
|
37
|
-
content += " # DEFAULT_PROVIDER = \"github\"\n"
|
38
|
-
content += "\n"
|
39
|
-
content += "# Production環境以外\n"
|
40
|
-
content += "else\n"
|
41
|
-
content += " # DEFAULT_PROVIDER = \"developer\"\n"
|
42
|
-
content += " DEFAULT_PROVIDER = \"twitter\"\n"
|
43
|
-
content += " # DEFAULT_PROVIDER = \"facebook\"\n"
|
44
|
-
content += " # DEFAULT_PROVIDER = \"github\"\n"
|
45
|
-
content += "end\n"
|
46
|
-
content += "\n"
|
47
|
-
content += "# アプリケーション名\n"
|
48
|
-
content += "APP_NAME = \"YOUR_APP_NAME\"\n"
|
49
|
-
|
50
|
-
append_file( "config/initializers/constants.rb", content.force_encoding('ASCII-8BIT') )
|
51
|
-
else
|
52
|
-
copy_file( "config/initializers/constants.rb", "config/initializers/constants.rb" )
|
53
|
-
end
|
54
|
-
|
55
|
-
copy_file( "config/initializers/omniauth.rb", "config/initializers/omniauth.rb" )
|
56
|
-
|
57
|
-
insert_into_file( "config/routes.rb", " match \"/auth/:provider/callback\" => \"sessions#callback\"\n match \"/auth/failure\" => \"sessions#failure\"\n match \"/logout\" => \"sessions#destroy\", :as => :logout\n", after: "# first created -> highest priority.\n" )
|
58
|
-
insert_into_file( "config/routes.rb", " root to: 'top#index'\n", after: "# root :to => 'welcome#index'\n" )
|
59
|
-
insert_into_file( "config/routes.rb", " match ':controller(/:action(/:id))(.:format)'\n", after: "# match ':controller(/:action(/:id))(.:format)'\n" )
|
60
|
-
insert_into_file( "config/application.rb", " config.time_zone = 'Tokyo'\n config.active_record.default_timezone = :local\n", after: "# config.time_zone = 'Central Time (US & Canada)'\n" )
|
61
|
-
insert_into_file( "config/application.rb", " config.i18n.default_locale = :ja\n", after: "# config.i18n.default_locale = :de\n" )
|
62
|
-
|
63
|
-
copy_file( "config/locales/ja.yml", "config/locales/ja.yml" )
|
64
|
-
|
65
|
-
# DB
|
66
|
-
copy_file( "db/migrate/create_users.rb", "db/migrate/20000101000000_create_users.rb" )
|
67
|
-
|
68
|
-
# App
|
69
|
-
copy_file( "app/models/user.rb", "app/models/user.rb" )
|
70
|
-
|
71
|
-
copy_file( "app/controllers/sessions_controller.rb", "app/controllers/sessions_controller.rb" )
|
72
|
-
copy_file( "app/controllers/application_controller.rb", "app/controllers/application_controller.rb" )
|
73
|
-
copy_file( "app/controllers/top_controller.rb", "app/controllers/top_controller.rb" )
|
74
|
-
|
75
|
-
copy_file( "app/views/layouts/application.html.erb", "app/views/layouts/application.html.erb" )
|
76
|
-
copy_file( "app/views/top/index.html.erb", "app/views/top/index.html.erb" )
|
77
|
-
|
78
|
-
copy_file( "app/assets/stylesheets/base.css.scss", "app/assets/stylesheets/base.css.scss" )
|
79
|
-
copy_file( "app/assets/stylesheets/scaffolds.css.scss", "app/assets/stylesheets/scaffolds.css.scss" )
|
80
|
-
|
81
|
-
# public
|
82
|
-
remove_file( 'public/index.html' )
|
83
|
-
|
84
|
-
# README
|
85
|
-
remove_file( 'README.rdoc' )
|
86
|
-
copy_file( "README.md", "README.md" )
|
87
|
-
|
88
|
-
# gitignore
|
89
|
-
insert_into_file( ".gitignore", "\n# Add\n.DS_Store\n/config/initializers/local_setting.rb\n", after: "/tmp\n" )
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
# APP_NAME
|
2
|
-
|
3
|
-
APP_DESCRIPTION.
|
4
|
-
|
5
|
-
## Local Setting
|
6
|
-
|
7
|
-
### GitHub上でFork
|
8
|
-
|
9
|
-
https://github.com/USER_NAME/APP_NAME/
|
10
|
-
|
11
|
-
### リポジトリをローカルへ作成
|
12
|
-
|
13
|
-
$ cd ~/WORK_DIRECTORY
|
14
|
-
$ git clone git@github.com:YOUR_USER_NAME/APP_NAME.git
|
15
|
-
$ cd APP_NAME
|
16
|
-
|
17
|
-
### ブランチ作成
|
18
|
-
|
19
|
-
$ git checkout -b YOUR_NEW_BRANCH
|
20
|
-
|
21
|
-
### Twitterアプリ登録
|
22
|
-
|
23
|
-
<a href="https://dev.twitter.com/apps/new" target="_blank">Twitter Create an application</a>
|
24
|
-
|
25
|
-
Name: [ (アプリケーションの名前) ]
|
26
|
-
Description: [ (アプリケーションの説明) ]
|
27
|
-
WebSite: [ http://0.0.0.0:3000/ ]
|
28
|
-
Callback URL: [ http://0.0.0.0:3000/ ] ※登録しないと動かない
|
29
|
-
|
30
|
-
□ Yes, I agree <= チェック
|
31
|
-
|
32
|
-
CAPTCHA入力後「Create your Twitter application」を押下
|
33
|
-
|
34
|
-
### ローカル用Twitterキー設定
|
35
|
-
|
36
|
-
Create: config/initializers/local_setting.rb
|
37
|
-
|
38
|
-
# Twitter OAuth Local Setting
|
39
|
-
ENV['TWITTER_KEY'] = "YOUR_CONSUMER_KEY"
|
40
|
-
ENV['TWITTER_SECRET'] = "YOUR_CONSUMER_SECRET"
|
41
|
-
|
42
|
-
※Twitterアプリ登録完了後に表示された「Consumer key」を「YOUR_CONSUMER_KEY」に、「Consumer secret」を「YOUR\_CONSUMER_SECRET」にそれぞれ入力
|
43
|
-
|
44
|
-
### Rails起動
|
45
|
-
|
46
|
-
Gemインストール
|
47
|
-
|
48
|
-
bundle install --without production
|
49
|
-
|
50
|
-
ローカルDB作成
|
51
|
-
|
52
|
-
rake db:migrate
|
53
|
-
|
54
|
-
ローカルサーバ起動
|
55
|
-
|
56
|
-
bundle exec rails s
|
57
|
-
|
58
|
-
ページアクセス
|
59
|
-
|
60
|
-
http://0.0.0.0:3000/
|
61
|
-
|
62
|
-
## Copyright
|
63
|
-
|
64
|
-
Copyright (c) 2012 MY_NAME. <a href="http://creativecommons.org/licenses/by-nc-sa/2.1/jp/" target="_blank">CC BY-NC-SA 2.1</a>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
# OmniAuth Provider
|
4
|
-
# Production環境
|
5
|
-
if Rails.env.production?
|
6
|
-
DEFAULT_PROVIDER = "twitter"
|
7
|
-
# DEFAULT_PROVIDER = "facebook"
|
8
|
-
# DEFAULT_PROVIDER = "github"
|
9
|
-
|
10
|
-
# Production環境以外
|
11
|
-
else
|
12
|
-
# DEFAULT_PROVIDER = "developer"
|
13
|
-
DEFAULT_PROVIDER = "twitter"
|
14
|
-
# DEFAULT_PROVIDER = "facebook"
|
15
|
-
# DEFAULT_PROVIDER = "github"
|
16
|
-
end
|
17
|
-
|
18
|
-
# アプリケーション名
|
19
|
-
APP_NAME = "YOUR_APP_NAME"
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
# Twitter
|
4
|
-
ENV['TWITTER_KEY'] = "YOUR_CONSUMER_KEY"
|
5
|
-
ENV['TWITTER_SECRET'] = "YOUR_CONSUMER_SECRET"
|
6
|
-
|
7
|
-
# GitHub
|
8
|
-
#ENV['GITHUB_CLIENT_ID'] = "YOUR_CLIENT_ID"
|
9
|
-
#ENV['GITHUB_SECRET'] = "YOUR_SECRET"
|
10
|
-
|
11
|
-
# Facebook
|
12
|
-
#ENV['FACEBOOK_APP_ID'] = "YOUR_APP_ID"
|
13
|
-
#ENV['FACEBOOK_APP_SECRET'] = "YOUR_APP_SECRET"
|
@@ -1,6 +0,0 @@
|
|
1
|
-
Rails.application.config.middleware.use OmniAuth::Builder do
|
2
|
-
# provider :developer unless Rails.env.production?
|
3
|
-
provider :twitter, ENV['TWITTER_KEY'], ENV['TWITTER_SECRET']
|
4
|
-
# provider :github, ENV['GITHUB_CLIENT_ID'], ENV['GITHUB_SECRET']
|
5
|
-
# provider :facebook, ENV['FACEBOOK_APP_ID'], ENV['FACEBOOK_APP_SECRET']
|
6
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
-
require 'rspec'
|
4
|
-
require 'omniauth-scaffold'
|
5
|
-
|
6
|
-
# Requires supporting files with custom matchers and macros, etc,
|
7
|
-
# in ./support/ and its subdirectories.
|
8
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
9
|
-
|
10
|
-
RSpec.configure do |config|
|
11
|
-
|
12
|
-
end
|