rtrain 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +42 -0
- data/docs-img/quick_demo_inputs.md +36 -0
- data/docs-img/rtrain-placeholder.png +0 -0
- data/lib/generators/controllers/main_controller.rb +5 -0
- data/lib/generators/controllers/sessions_app_controller.rb +11 -0
- data/lib/generators/controllers/user_sessions_controller.rb +27 -0
- data/lib/generators/controllers/users_controller.rb +21 -0
- data/lib/generators/models/user.rb +5 -0
- data/lib/generators/models/user_session.rb +2 -0
- data/lib/generators/rtrain/install_generator.rb +312 -0
- data/lib/generators/sessions/sessions_routes.rb +6 -0
- data/lib/generators/shared/_errors.html.erb +13 -0
- data/lib/generators/templates/forms.scss +35 -0
- data/lib/generators/templates/home.html.erb +21 -0
- data/lib/generators/templates/nav-bar.scss +25 -0
- data/lib/generators/templates/rtrain-application.html.erb +18 -0
- data/lib/generators/templates/rtrain_scaffold.scss +135 -0
- data/lib/generators/templates/sign-in.scss +31 -0
- data/lib/generators/user_sessions/new.html.erb +22 -0
- data/lib/generators/users/new.html.erb +22 -0
- data/lib/rtrain.rb +2 -0
- data/rtrain-0.0.1.gem +0 -0
- data/rtrain-0.0.2.gem +0 -0
- data/rtrain-0.0.3.gem +0 -0
- data/rtrain-0.0.4.gem +0 -0
- data/rtrain-0.0.5.gem +0 -0
- data/rtrain-0.0.6.gem +0 -0
- data/rtrain-0.0.7.gem +0 -0
- data/rtrain-0.0.8.gem +0 -0
- data/rtrain-0.0.9.gem +0 -0
- data/rtrain-0.1.0.gem +0 -0
- data/rtrain-0.1.1.gem +0 -0
- data/rtrain-0.1.2.gem +0 -0
- data/rtrain-0.1.3.gem +0 -0
- data/rtrain-0.1.4.gem +0 -0
- data/rtrain-0.1.5.gem +0 -0
- data/rtrain-0.1.6.gem +0 -0
- data/rtrain-0.1.7.gem +0 -0
- data/rtrain-0.1.8.gem +0 -0
- data/rtrain-0.1.9.gem +0 -0
- data/rtrain-0.2.0.gem +0 -0
- data/rtrain-0.2.1.gem +0 -0
- data/rtrain.gemspec +3 -3
- metadata +44 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94f1bc600ff9450c89a489f4f547fa4957fad68e
|
4
|
+
data.tar.gz: 3c7da35368abb22c13614a4451256d22caacf2df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4765bf65f7dd6a37ecf22a203a4013bdad59c5dc1381d5e9b5feba7341888285604e8acd4e055f66320d84f23c84df33abb0c82f75336dcad584e7d7c544af1b
|
7
|
+
data.tar.gz: 7abad4ec8840712f3ac0d645c054590bf0c9187d60c50a0980b7f7b9dadf533a4baa1b9076cc044e2cee8ee10dda334c7c34196b1a7c5906b293c45ef54af2ef
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# RTrain
|
2
|
+
![Ugh](http://www.heyridge.com/wp-content/uploads/2015/03/File-2012-12-29-R-train.jpg)
|
3
|
+
_Ugh._
|
4
|
+
|
5
|
+
#Rails Downloadable Content (DLC) Expansion Pack
|
6
|
+
Adds better CSS to scaffold, HTML navigation, more features are in the pipe, so stay tuned ... _DLC Season Pass Coming Soon Too!_
|
7
|
+
|
8
|
+
|
9
|
+
#How to use RTrain
|
10
|
+
|
11
|
+
_It is HIGHLY recommended that developers using RTrain execute these generator commands in sequence, and to always scaffold generate all models!!!_
|
12
|
+
|
13
|
+
**Put this in your Gemfile**
|
14
|
+
```
|
15
|
+
gem 'rtrain', '~> 0.2.0'
|
16
|
+
```
|
17
|
+
Then `bundle install`
|
18
|
+
|
19
|
+
**After generating a scaffold, enter any of these into the command line:**
|
20
|
+
|
21
|
+
```
|
22
|
+
rails generate rtrain:install --copy_css
|
23
|
+
```
|
24
|
+
![Ugh](http://i.imgur.com/xzbeMWC.png)
|
25
|
+
_Oooooooooooooo!_
|
26
|
+
|
27
|
+
Turns your basic scaffold into something that's at least tolerable to look at!
|
28
|
+
|
29
|
+
**Add a sweet nav bar!**
|
30
|
+
```
|
31
|
+
rails generate rtrain:install --copy_css
|
32
|
+
```
|
33
|
+
![Ugh](http://i.imgur.com/hywhd0t.png)
|
34
|
+
|
35
|
+
**Add a home page controller and view, and set it as the root**
|
36
|
+
```
|
37
|
+
rails generate rtrain:install --add_homepage
|
38
|
+
```
|
39
|
+
![Ugh](http://i.imgur.com/LuNqg3O.png)
|
40
|
+
|
41
|
+
|
42
|
+
More to come! Stay tuned!
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#Quick Demo Inputs
|
2
|
+
|
3
|
+
Use these commands to spin up some dummy data using the FFaker Gem (with Hipster Ipsum)
|
4
|
+
|
5
|
+
In the command line:
|
6
|
+
```
|
7
|
+
gem install ffaker
|
8
|
+
|
9
|
+
```
|
10
|
+
|
11
|
+
In your Rails app's Gemfile add
|
12
|
+
|
13
|
+
```
|
14
|
+
require 'ffaker'
|
15
|
+
```
|
16
|
+
|
17
|
+
Go back to the command line
|
18
|
+
|
19
|
+
```
|
20
|
+
rails g scaffold contacts name:string address:string phone:string email_address:string about:string
|
21
|
+
|
22
|
+
rake db:create db:migrate
|
23
|
+
|
24
|
+
rails g scaffold comments subject:string content:text
|
25
|
+
|
26
|
+
rake db:migrate
|
27
|
+
```
|
28
|
+
|
29
|
+
In Rails Console ($rails c)
|
30
|
+
```
|
31
|
+
40.times do Contact.create(name: FFaker::Name.name, address: FFaker::AddressUS.street_address + ", " + FFaker::AddressUS.city + ", " + FFaker::AddressUS.state + " " + FFaker::AddressUS.zip_code, phone: FFaker::PhoneNumber.short_phone_number,email_address: FFaker::Internet.email, about: FFaker::HipsterIpsum.phrase)end
|
32
|
+
|
33
|
+
40.times do Comment.create(subject: FFaker::HipsterIpsum.phrase, content: FFaker::HipsterIpsum.paragraph)end
|
34
|
+
```
|
35
|
+
|
36
|
+
Now you've got some bangin' filler data!
|
Binary file
|
@@ -0,0 +1,11 @@
|
|
1
|
+
def current_user_session
|
2
|
+
return @current_user_session if defined?(@current_user_session)
|
3
|
+
@current_user_session = UserSession.find
|
4
|
+
end
|
5
|
+
|
6
|
+
def current_user
|
7
|
+
return @current_user if defined?(@current_user)
|
8
|
+
@current_user = current_user_session && current_user_session.user
|
9
|
+
end
|
10
|
+
|
11
|
+
helper_method :current_user_session, :current_user
|
@@ -0,0 +1,27 @@
|
|
1
|
+
class UserSessionsController < ApplicationController
|
2
|
+
def new
|
3
|
+
@user_session = UserSession.new
|
4
|
+
end
|
5
|
+
|
6
|
+
def create
|
7
|
+
@user_session = UserSession.new(user_session_params)
|
8
|
+
if @user_session.save
|
9
|
+
flash[:success] = "Welcome back!"
|
10
|
+
redirect_to root_path
|
11
|
+
else
|
12
|
+
render :new
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def destroy
|
17
|
+
current_user_session.destroy
|
18
|
+
flash[:success] = "Goodbye!"
|
19
|
+
redirect_to root_path
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def user_session_params
|
25
|
+
params.require(:user_session).permit(:email, :password, :remember_me)
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class UsersController < ApplicationController
|
2
|
+
def new
|
3
|
+
@user = User.new
|
4
|
+
end
|
5
|
+
|
6
|
+
def create
|
7
|
+
@user = User.new(users_params)
|
8
|
+
if @user.save
|
9
|
+
flash[:success] = "Account registered!"
|
10
|
+
redirect_to root_path
|
11
|
+
else
|
12
|
+
render :new
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def users_params
|
19
|
+
params.require(:user).permit(:email, :password, :password_confirmation)
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,312 @@
|
|
1
|
+
module Rtrain
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
desc "Creates a generator for Rtrain to style scaffold tables."
|
5
|
+
class_option :copy_css, type: :boolean, desc: 'Write some nice CSS for scaffold, comments out original scaffold css'
|
6
|
+
class_option :add_nav, type: :boolean, desc: 'Makes a wicked sweet nav bar for your rails app'
|
7
|
+
class_option :add_homepage, type: :boolean, desc: 'Adds a home page controller and view and updates it to be the root URL'
|
8
|
+
class_option :add_user_sessions, type: :boolean, desc: 'Builds user and user sessions models, adds Sign-up and sign-in links to application layout, requires login before records can be added to a form'
|
9
|
+
|
10
|
+
def gem_info
|
11
|
+
return if options.copy_css? || options.add_nav? || options.add_homepage? || options.add_user_sessions?
|
12
|
+
puts "
|
13
|
+
----------------------------------------------------
|
14
|
+
Rtrain needs an argument to continue.
|
15
|
+
Please re-run the install generator with one of the
|
16
|
+
following options:
|
17
|
+
\n
|
18
|
+
--copy_css
|
19
|
+
--add_nav
|
20
|
+
--add_homepage
|
21
|
+
--add_user_sessions
|
22
|
+
\n
|
23
|
+
Refer to the README at https://github.com/lynnd335/rtrain
|
24
|
+
for details and illustrations of each option's executions
|
25
|
+
----------------------------------------------------
|
26
|
+
"
|
27
|
+
end
|
28
|
+
|
29
|
+
def run_rtrain
|
30
|
+
dir = File.dirname(__FILE__)
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
##create rtrain logfile or open it if it already exists
|
35
|
+
if !File.exist?("rtrain_log.txt")
|
36
|
+
rtrain_log = File.new("rtrain_log.txt", "a")
|
37
|
+
puts "\n
|
38
|
+
----------------------------------------------------
|
39
|
+
Rtrain logfile created in main directory of app
|
40
|
+
----------------------------------------------------
|
41
|
+
\n
|
42
|
+
"
|
43
|
+
else
|
44
|
+
rtrain_log = open("rtrain_log.txt", "a")
|
45
|
+
end
|
46
|
+
rtrain_log_read = open(rtrain_log).read
|
47
|
+
##end create rtrain logfile
|
48
|
+
|
49
|
+
##add lines to config/routes.rb for auth
|
50
|
+
routes_rb = open("config/routes.rb").read
|
51
|
+
if !routes_rb.match("#session routes here")
|
52
|
+
routes_rb[routes_rb.index('#')] = "\n#session routes here\n"
|
53
|
+
end
|
54
|
+
|
55
|
+
##end
|
56
|
+
|
57
|
+
##Begin Copy CSS
|
58
|
+
|
59
|
+
if options[:copy_css]
|
60
|
+
stylesheets = "app/assets/stylesheets/"
|
61
|
+
new_css = ["../templates/rtrain_scaffold.scss","../templates/forms.scss"]
|
62
|
+
|
63
|
+
new_css.each do |n|
|
64
|
+
new_css_path = File.join(dir, n)
|
65
|
+
FileUtils.cp(new_css_path, stylesheets)
|
66
|
+
end
|
67
|
+
if !rtrain_log_read.match('_copy_css_run')
|
68
|
+
scaffold = open("app/assets/stylesheets/scaffolds.scss").read
|
69
|
+
old_css = open("app/assets/stylesheets/scaffolds.scss", "w")
|
70
|
+
old_css.write("/*\n" + scaffold + "\n*/")
|
71
|
+
old_css.close
|
72
|
+
end
|
73
|
+
puts "
|
74
|
+
----------------------------------------------------
|
75
|
+
Rtrain Scaffold and forms css documents now active in app/assets/stylesheets/
|
76
|
+
----------------------------------------------------
|
77
|
+
"
|
78
|
+
|
79
|
+
open(rtrain_log, 'a') { |f| f.puts Time.now().to_s() + "_copy_css_run\n"}
|
80
|
+
end
|
81
|
+
|
82
|
+
##end copy css
|
83
|
+
|
84
|
+
##begin add nvigation bar
|
85
|
+
|
86
|
+
if options[:add_nav]
|
87
|
+
read_applayout = open("app/views/layouts/application.html.erb").read
|
88
|
+
app_name = read_applayout.split("<title>")[1].split("</title>")[0]
|
89
|
+
app_name = "\n<h1>"+app_name+"</h1>\n"
|
90
|
+
tables = ActiveRecord::Base.connection.tables[1..-1]
|
91
|
+
list_items = []
|
92
|
+
tables.each do |t|
|
93
|
+
if t != 'users'
|
94
|
+
link = "<li><%=link_to '" + t.titleize + "'," + t + "_path%></li>"
|
95
|
+
list_items.push(link)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
nav = "\n<div id='main-navbar'>\n\t<ul id='menu'>\n\t\t" + list_items.join("\n\t\t") + "\n\t</ul>\n</div>\t\n\n\n"
|
100
|
+
|
101
|
+
|
102
|
+
##check to see if add_nav has already been run, update via overwrite if true, add if else
|
103
|
+
|
104
|
+
if rtrain_log_read.match('_nav_added')
|
105
|
+
old_menu = read_applayout.split("<ul id='menu'>")[1].split("</ul>")[0]
|
106
|
+
if rtrain_log_read.match('_main_view_controller_added')
|
107
|
+
list_items.unshift("<%=link_to 'Main', '/'%></li>")
|
108
|
+
end
|
109
|
+
new_menu = list_items.join("\n\t\t")
|
110
|
+
read_applayout [old_menu] = new_menu
|
111
|
+
new_applayout = open("app/views/layouts/application.html.erb", "w")
|
112
|
+
new_applayout.write(read_applayout)
|
113
|
+
new_applayout.close
|
114
|
+
open(rtrain_log, 'a') { |f| f.puts Time.now().to_s() + "_nav_updated-" + tables.to_s() + "\n"}
|
115
|
+
puts "
|
116
|
+
----------------------------------------------------
|
117
|
+
Rtrain Nav Bar updated app/views/layouts/application.html.erb\n
|
118
|
+
----------------------------------------------------
|
119
|
+
"
|
120
|
+
else
|
121
|
+
new_layout = read_applayout.split("<body>")
|
122
|
+
read_applayout = open("app/views/layouts/application.html.erb", "w")
|
123
|
+
read_applayout.write(new_layout[0] + "<body>" + app_name + nav + new_layout[1])
|
124
|
+
read_applayout.close
|
125
|
+
###
|
126
|
+
nav_css = "../templates/nav-bar.scss"
|
127
|
+
nav_css_path = File.join(dir, nav_css)
|
128
|
+
stylesheets = "app/assets/stylesheets/"
|
129
|
+
FileUtils.cp(nav_css_path, stylesheets)
|
130
|
+
puts "
|
131
|
+
----------------------------------------------------
|
132
|
+
Rtrain Nav Bar and App Title now active in app/views/layouts/application.html.erb\n
|
133
|
+
|
134
|
+
IMPORTANT! Be extra careful re-running this command, as it will overwrite to the default styling
|
135
|
+
----------------------------------------------------
|
136
|
+
"
|
137
|
+
open(rtrain_log, 'a') { |f| f.puts Time.now().to_s() + "_nav_added-" + tables.to_s() + "\n"}
|
138
|
+
end
|
139
|
+
# new_applayout.close
|
140
|
+
end
|
141
|
+
|
142
|
+
##end add navigation bar
|
143
|
+
|
144
|
+
##begin add main page
|
145
|
+
|
146
|
+
if options[:add_homepage]
|
147
|
+
FileUtils.mkdir("app/views/main/")
|
148
|
+
|
149
|
+
home_page = "../templates/home.html.erb"
|
150
|
+
home_page_path = File.join(dir, home_page)
|
151
|
+
main_view_dir = "app/views/main/"
|
152
|
+
FileUtils.cp(home_page_path, main_view_dir)
|
153
|
+
|
154
|
+
main = "../controllers/main_controller.rb"
|
155
|
+
main_path = File.join(dir, main)
|
156
|
+
controllers = "app/controllers"
|
157
|
+
FileUtils.cp(main_path, controllers)
|
158
|
+
|
159
|
+
root = open("config/routes.rb").read
|
160
|
+
root ["# root 'welcome#index'"] = "root 'main#show', page: 'home'
|
161
|
+
get '/main/:page' => 'pages#show'"
|
162
|
+
routes = open("config/routes.rb","w")
|
163
|
+
routes.write(root)
|
164
|
+
routes.close
|
165
|
+
|
166
|
+
puts "
|
167
|
+
----------------------------------------------------
|
168
|
+
Rtrain Homepage Now Active and set as root URL, re-run '--add_nav' to have link appear in nav bar
|
169
|
+
----------------------------------------------------
|
170
|
+
"
|
171
|
+
open(rtrain_log, 'a') { |f| f.puts Time.now().to_s() + "_main_view_controller_added" + "\n"}
|
172
|
+
end
|
173
|
+
|
174
|
+
##end add homepage
|
175
|
+
|
176
|
+
##begin add sessions
|
177
|
+
|
178
|
+
|
179
|
+
if options[:add_user_sessions]
|
180
|
+
if !rtrain_log_read.match('_nav_added')
|
181
|
+
|
182
|
+
FileUtils.mkdir("app/views/users/")
|
183
|
+
new_users = "../users/new.html.erb"
|
184
|
+
new_users_path = File.join(dir, new_users)
|
185
|
+
new_users_dir = "app/views/users/"
|
186
|
+
FileUtils.cp(new_users_path, new_users_dir)
|
187
|
+
|
188
|
+
FileUtils.mkdir("app/views/user_sessions/")
|
189
|
+
new_user_sessions = "../user_sessions/new.html.erb"
|
190
|
+
new_user_sessions_path = File.join(dir, new_user_sessions)
|
191
|
+
new_user_sessions_dir = "app/views/user_sessions/"
|
192
|
+
FileUtils.cp(new_user_sessions_path, new_user_sessions_dir)
|
193
|
+
|
194
|
+
FileUtils.mkdir("app/views/shared/")
|
195
|
+
errors = "../shared/_errors.html.erb"
|
196
|
+
errors_path = File.join(dir, errors)
|
197
|
+
errors_dir = "app/views/shared/"
|
198
|
+
FileUtils.cp(errors_path, errors_dir)
|
199
|
+
|
200
|
+
models = ["../models/user.rb","../models/user_session.rb"]
|
201
|
+
controllers = ["../controllers/users_controller.rb","../controllers/user_sessions_controller.rb","../controllers/sessions_app_controller.rb"]
|
202
|
+
|
203
|
+
models.each do |m|
|
204
|
+
models_path = File.join(dir, m)
|
205
|
+
models_dir = "app/models/"
|
206
|
+
FileUtils.cp(models_path, models_dir)
|
207
|
+
end
|
208
|
+
|
209
|
+
controllers.each do |c|
|
210
|
+
controllers_path = File.join(dir, c)
|
211
|
+
controllers_dir = "app/controllers/"
|
212
|
+
FileUtils.cp(controllers_path, controllers_dir)
|
213
|
+
end
|
214
|
+
|
215
|
+
sessions_app_controller = open("app/controllers/sessions_app_controller.rb").read
|
216
|
+
app_controller = open("app/controllers/application_controller.rb").read
|
217
|
+
|
218
|
+
if app_controller.match("private")
|
219
|
+
app_controller ["private"] = "private" + "\n" + sessions_app_controller
|
220
|
+
else
|
221
|
+
app_controller[app_controller.rindex('end')...(app_controller.rindex('end') + 'end'.length)] = "test"
|
222
|
+
end
|
223
|
+
|
224
|
+
current_app_controller = open("app/controllers/application_controller.rb", "w")
|
225
|
+
current_app_controller.write(app_controller)
|
226
|
+
current_app_controller.close
|
227
|
+
|
228
|
+
|
229
|
+
session_css = "../templates/sign-in.scss"
|
230
|
+
session_css_path = File.join(dir, session_css)
|
231
|
+
stylesheets = "app/assets/stylesheets/"
|
232
|
+
FileUtils.cp(session_css_path, stylesheets)
|
233
|
+
applayout = open("app/views/layouts/application.html.erb").read
|
234
|
+
new_layout = applayout.split("<body>")
|
235
|
+
session_links = "
|
236
|
+
<div id='signin-bar'>
|
237
|
+
<% if current_user %>
|
238
|
+
<span><%= current_user.email %></span> |
|
239
|
+
<%= link_to 'Sign Out', sign_out_path, method: :delete %>
|
240
|
+
<% else %>
|
241
|
+
<%=link_to 'Sign Up', new_user_path%> |
|
242
|
+
<%= link_to 'Sign In', sign_in_path %>
|
243
|
+
<% end %>
|
244
|
+
</div>\n"
|
245
|
+
new_applayout = open("app/views/layouts/application.html.erb", "w")
|
246
|
+
new_applayout.write(new_layout[0] + "<body>\n" + session_links + new_layout[1])
|
247
|
+
new_applayout.close
|
248
|
+
forms = Dir.glob("app/**/_form.html.erb")
|
249
|
+
session_check = "
|
250
|
+
<%if !current_user%>
|
251
|
+
<div id='blank'>
|
252
|
+
<div id='alert'>
|
253
|
+
<h3>Must be SIGNED IN to add item!</h3>
|
254
|
+
</div>
|
255
|
+
</div>
|
256
|
+
<%end%>\n"
|
257
|
+
|
258
|
+
forms.each do |f|
|
259
|
+
content = open(f).read
|
260
|
+
form_erb = open(f,"w")
|
261
|
+
form_erb.write(session_check + content)
|
262
|
+
form_erb.close
|
263
|
+
end
|
264
|
+
|
265
|
+
sesh = "
|
266
|
+
resources :users, only: [:new, :create]
|
267
|
+
|
268
|
+
resources :user_sessions, only: [:create, :destroy]
|
269
|
+
|
270
|
+
delete '/sign_out', to: 'user_sessions#destroy', as: :sign_out
|
271
|
+
get '/sign_in', to: 'user_sessions#new', as: :sign_in
|
272
|
+
"
|
273
|
+
|
274
|
+
sesh_route = open("config/routes.rb").read
|
275
|
+
sesh_route ["#session routes here"] = sesh
|
276
|
+
routes = open("config/routes.rb","w")
|
277
|
+
routes.write(sesh_route)
|
278
|
+
routes.close
|
279
|
+
|
280
|
+
system("bin/rails g migration CreateUser email:string crypted_password:string password_salt:string persistence_token:string")
|
281
|
+
mig = Dir.glob("db/migrate/**.rb")[-1]
|
282
|
+
mig_read = open(mig).read
|
283
|
+
mig_read ["end"] = "\nt.timestamps null: false
|
284
|
+
end
|
285
|
+
add_index :users, :email, unique: true"
|
286
|
+
mig_write = open(mig, 'w')
|
287
|
+
mig_write.write(mig_read)
|
288
|
+
mig_write.close
|
289
|
+
|
290
|
+
|
291
|
+
system("bundle exec rake db:migrate")
|
292
|
+
puts "
|
293
|
+
----------------------------------------------------
|
294
|
+
Rtrain User Sessions Now Active
|
295
|
+
----------------------------------------------------
|
296
|
+
"
|
297
|
+
open(rtrain_log, 'a') { |f| f.puts Time.now().to_s() + "_user_sessions_added" + "\n"}
|
298
|
+
else
|
299
|
+
puts "
|
300
|
+
----------------------------------------------------
|
301
|
+
Rtrain User Sessions Already Active - Cannot re-run!
|
302
|
+
----------------------------------------------------
|
303
|
+
"
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
##end users sessions install
|
308
|
+
rtrain_log.close
|
309
|
+
end
|
310
|
+
end
|
311
|
+
end
|
312
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<% if object.errors.any? %>
|
2
|
+
<div class="panel panel-warning errors">
|
3
|
+
<div class="panel-heading">
|
4
|
+
<h5><i class="glyphicon glyphicon-exclamation-sign"></i> Found errors while saving</h5>
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<ul class="panel-body">
|
8
|
+
<% object.errors.full_messages.each do |msg| %>
|
9
|
+
<li><%= msg %></li>
|
10
|
+
<% end %>
|
11
|
+
</ul>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
label{
|
2
|
+
font-size: 16px;
|
3
|
+
font-weight: bold;
|
4
|
+
margin-top: 4px;
|
5
|
+
}
|
6
|
+
|
7
|
+
input[type=text], select {
|
8
|
+
width: 90%;
|
9
|
+
padding: 12px 20px;
|
10
|
+
display: inline-block;
|
11
|
+
border: 1px solid #ccc;
|
12
|
+
border-radius: 4px;
|
13
|
+
box-sizing: border-box;
|
14
|
+
}
|
15
|
+
textarea{
|
16
|
+
width: 90%;
|
17
|
+
height: 150px;
|
18
|
+
padding: 12px 20px;
|
19
|
+
box-sizing: border-box;
|
20
|
+
border: 2px solid #ccc;
|
21
|
+
border-radius: 4px;
|
22
|
+
resize: none;
|
23
|
+
}
|
24
|
+
input[type=submit] {
|
25
|
+
width: 90%;
|
26
|
+
background-color: #3a3a3a;
|
27
|
+
color: white;
|
28
|
+
padding: 14px 20px;
|
29
|
+
border: none;
|
30
|
+
border-radius: 4px;
|
31
|
+
cursor: pointer;
|
32
|
+
font-weight: bold;
|
33
|
+
font-size: 16px;
|
34
|
+
margin-top: 8px;
|
35
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<div style="width:80%;left:10%;position:absolute">
|
2
|
+
|
3
|
+
<h1>Main Page</h1>
|
4
|
+
<h3>Hey there! Welcome to my new Rails app! I'm coding up something pretty cool, so check back soon!</h3>
|
5
|
+
|
6
|
+
<img width="100%" src="http://i.imgur.com/3qtQMoS.png">
|
7
|
+
<hr>
|
8
|
+
<h3>FILLER TEXT - PLEASE REPLACE UNLESS YOU LIKE HIPSTER IPSUM</h3>
|
9
|
+
<p>
|
10
|
+
Neutra farm-to-table schlitz slow-carb, pinterest pabst helvetica man bun PBR&B deep v salvia small batch brooklyn. Locavore swag artisan single-origin coffee. Neutra selvage waistcoat, pitchfork chia PBR&B thundercats skateboard meditation flannel chillwave organic pinterest. Keffiyeh freegan cray PBR&B mlkshk. Pop-up cronut freegan, cornhole venmo whatever brunch four dollar toast iPhone pitchfork chillwave. Banjo direct trade yr banh mi tacos. Bushwick photo booth next level typewriter squid ugh.
|
11
|
+
</p>
|
12
|
+
<p>
|
13
|
+
Pitchfork letterpress direct trade migas, gochujang chia austin crucifix green juice. Sustainable beard swag, kogi next level wolf hoodie mlkshk ethical thundercats DIY bicycle rights 8-bit gluten-free brooklyn. Narwhal humblebrag +1 keytar cardigan pickled. Synth fixie slow-carb letterpress echo park drinking vinegar. Lo-fi blog pitchfork sartorial, before they sold out bushwick vegan sustainable polaroid lomo kitsch craft beer. Pitchfork vinyl scenester trust fund, ethical food truck slow-carb. Church-key pop-up portland keffiyeh, flannel aesthetic ramps gentrify cronut.
|
14
|
+
</p>
|
15
|
+
<p>
|
16
|
+
Brooklyn pork belly farm-to-table, semiotics YOLO locavore tacos swag franzen hammock stumptown bushwick blue bottle next level. Shoreditch everyday carry pickled, etsy synth typewriter craft beer. Butcher pabst wayfarers, pitchfork kogi vegan chambray. Butcher master cleanse vinyl dreamcatcher, salvia irony 3 wolf moon whatever keffiyeh messenger bag typewriter. Kinfolk dreamcatcher chambray, ethical meggings kickstarter man braid swag seitan flannel fashion axe tilde readymade venmo. Yr pour-over cardigan organic, gastropub quinoa actually jean shorts typewriter bespoke. Selfies XOXO tacos plaid, brooklyn cred schlitz.
|
17
|
+
</p>
|
18
|
+
<p>
|
19
|
+
Truffaut farm-to-table raw denim lumbersexual. Kitsch biodiesel venmo kickstarter. Pour-over kombucha street art tumblr. Jean shorts banh mi flexitarian lo-fi letterpress shabby chic. Fingerstache meditation quinoa farm-to-table, kogi vice whatever etsy. Tousled organic brunch, deep v pour-over literally schlitz bitters mumblecore pug cray next level. Meggings vegan tattooed farm-to-table affogato.
|
20
|
+
</p>
|
21
|
+
</div>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#main-navbar{
|
2
|
+
height: 25px;
|
3
|
+
width: 95%;
|
4
|
+
background-color: black
|
5
|
+
}
|
6
|
+
ul#menu {
|
7
|
+
bottom: -10%;
|
8
|
+
position: relative;
|
9
|
+
}
|
10
|
+
|
11
|
+
ul#menu li {
|
12
|
+
display: inline;
|
13
|
+
}
|
14
|
+
|
15
|
+
ul#menu li a {
|
16
|
+
background-color: black;
|
17
|
+
color: white;
|
18
|
+
text-decoration: none;
|
19
|
+
padding: 0px 35px;
|
20
|
+
font-size: 18px;
|
21
|
+
}
|
22
|
+
|
23
|
+
ul#menu li a:hover {
|
24
|
+
background-color: orange;
|
25
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
|
5
|
+
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
|
6
|
+
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
|
7
|
+
<title>app-name</title>
|
8
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
|
9
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
|
10
|
+
<%= csrf_meta_tags %>
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
|
14
|
+
<%= yield %>
|
15
|
+
|
16
|
+
</body>
|
17
|
+
</html>
|
18
|
+
|
@@ -0,0 +1,135 @@
|
|
1
|
+
body {
|
2
|
+
background-color: #fff;
|
3
|
+
color: #333;
|
4
|
+
}
|
5
|
+
|
6
|
+
body, p, ol, ul, td {
|
7
|
+
font-family: helvetica, verdana, arial, sans-serif;
|
8
|
+
font-size: 13px;
|
9
|
+
line-height: 18px;
|
10
|
+
margin: 33px;
|
11
|
+
}
|
12
|
+
|
13
|
+
pre {
|
14
|
+
background-color: #eee;
|
15
|
+
padding: 10px;
|
16
|
+
font-size: 11px;
|
17
|
+
}
|
18
|
+
|
19
|
+
a {
|
20
|
+
color: #000;
|
21
|
+
}
|
22
|
+
|
23
|
+
a:visited {
|
24
|
+
color: #666;
|
25
|
+
}
|
26
|
+
a:hover {
|
27
|
+
color: #fff;
|
28
|
+
background-color: #000;
|
29
|
+
}
|
30
|
+
|
31
|
+
table{
|
32
|
+
border: 1px solid #cccccc;
|
33
|
+
border-spacing: 0px;
|
34
|
+
width: 95%;
|
35
|
+
left: 10%;
|
36
|
+
}
|
37
|
+
th {
|
38
|
+
border-bottom: 1px solid #cccccc;
|
39
|
+
height: 15px;
|
40
|
+
}
|
41
|
+
|
42
|
+
td {
|
43
|
+
padding-bottom: 7px;
|
44
|
+
padding-left: 5px;
|
45
|
+
padding-right: 5px;
|
46
|
+
font-family: helvetica, verdana, arial, sans-serif;
|
47
|
+
border-left: none;
|
48
|
+
border-bottom: 1px solid #cccccc;
|
49
|
+
border-right: 1px solid #cccccc;
|
50
|
+
vertical-align: top;
|
51
|
+
font-size: 13px;
|
52
|
+
color: inherit;
|
53
|
+
border-top: solid 1px transparent;
|
54
|
+
white-space: normal;
|
55
|
+
}
|
56
|
+
|
57
|
+
tr:nth-child(even) {
|
58
|
+
background: #f2f2f2
|
59
|
+
}
|
60
|
+
tr:nth-child(odd) {
|
61
|
+
background: #FFF
|
62
|
+
}
|
63
|
+
tr:hover{
|
64
|
+
background: rgba(209, 209, 224, 0.5);
|
65
|
+
}
|
66
|
+
|
67
|
+
div.field,
|
68
|
+
div.actions {
|
69
|
+
margin-bottom: 10px;
|
70
|
+
}
|
71
|
+
|
72
|
+
#notice {
|
73
|
+
color: green;
|
74
|
+
}
|
75
|
+
|
76
|
+
.field_with_errors {
|
77
|
+
padding: 2px;
|
78
|
+
background-color: red;
|
79
|
+
display: table;
|
80
|
+
}
|
81
|
+
|
82
|
+
#error_explanation {
|
83
|
+
width: 450px;
|
84
|
+
border: 2px solid red;
|
85
|
+
padding: 7px;
|
86
|
+
padding-bottom: 0;
|
87
|
+
margin-bottom: 20px;
|
88
|
+
background-color: #f0f0f0;
|
89
|
+
}
|
90
|
+
|
91
|
+
#error_explanation h2 {
|
92
|
+
text-align: left;
|
93
|
+
font-weight: bold;
|
94
|
+
padding: 5px 5px 5px 15px;
|
95
|
+
font-size: 12px;
|
96
|
+
margin: -7px;
|
97
|
+
margin-bottom: 0;
|
98
|
+
background-color: #c00;
|
99
|
+
color: #fff;
|
100
|
+
}
|
101
|
+
|
102
|
+
#error_explanation ul li {
|
103
|
+
font-size: 12px;
|
104
|
+
list-style: square;
|
105
|
+
}
|
106
|
+
|
107
|
+
label {
|
108
|
+
display: block;
|
109
|
+
}
|
110
|
+
#view-info{
|
111
|
+
width: 90%;
|
112
|
+
}
|
113
|
+
#view-info h2{
|
114
|
+
top: 0%;
|
115
|
+
left: 0%;
|
116
|
+
display: inline-block;
|
117
|
+
position: relative;
|
118
|
+
}
|
119
|
+
#view-info button{
|
120
|
+
top: 0%;
|
121
|
+
float: right;
|
122
|
+
background-color: #3a3a3a;
|
123
|
+
border-radius: 4px;
|
124
|
+
border: none;
|
125
|
+
color: white;
|
126
|
+
padding: 7px 18px;
|
127
|
+
display: inline-block;
|
128
|
+
font-size: 16px;
|
129
|
+
|
130
|
+
}
|
131
|
+
#view-info a{
|
132
|
+
color: white;
|
133
|
+
text-decoration: none;
|
134
|
+
font-weight: bold;
|
135
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#signin-bar{
|
2
|
+
height: 25px;
|
3
|
+
width: 95%;
|
4
|
+
background-color: transparent;
|
5
|
+
color: black;
|
6
|
+
text-align: right;
|
7
|
+
padding-right: 5px;
|
8
|
+
}
|
9
|
+
#signin-bar a{
|
10
|
+
text-decoration: none;
|
11
|
+
color: black;
|
12
|
+
}
|
13
|
+
#signin-bar a:hover{
|
14
|
+
text-decoration: none;
|
15
|
+
color: white;
|
16
|
+
}
|
17
|
+
#blank{
|
18
|
+
width: 100%;
|
19
|
+
height: 100%;
|
20
|
+
opacity: 50%;
|
21
|
+
background-color: white;
|
22
|
+
z-index: 999;
|
23
|
+
position: absolute;
|
24
|
+
}
|
25
|
+
#alert{
|
26
|
+
width:90%;
|
27
|
+
border:2px solid #000;
|
28
|
+
z-index: 1000;
|
29
|
+
position: absolute;
|
30
|
+
text-align: center;
|
31
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<h1>Sign In</h1></div>
|
2
|
+
|
3
|
+
<%= form_for @user_session do |f| %>
|
4
|
+
<%= render 'shared/errors', object: @user_session %>
|
5
|
+
|
6
|
+
<div class="form-group">
|
7
|
+
<%= f.label :email %>
|
8
|
+
<%= f.email_field :email, class: 'form-control' %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="form-group">
|
12
|
+
<%= f.label :password %>
|
13
|
+
<%= f.password_field :password, class: 'form-control' %>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<div class="form-group">
|
17
|
+
<%= f.label :remember_me %>
|
18
|
+
<%= f.check_box :remember_me %>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<%= f.submit "Log in!", class: 'btn btn-primary btn-lg' %>
|
22
|
+
<% end %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<div class="page-header"><h1>Register</h1></div>
|
2
|
+
|
3
|
+
<%= form_for @user do |f| %>
|
4
|
+
<%= render 'shared/errors', object: @user %>
|
5
|
+
|
6
|
+
<div class="form-group">
|
7
|
+
<%= f.label :email %>
|
8
|
+
<%= f.email_field :email, class: 'form-control' %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="form-group">
|
12
|
+
<%= f.label :password %>
|
13
|
+
<%= f.password_field :password, class: 'form-control' %>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<div class="form-group">
|
17
|
+
<%= f.label :password_confirmation %>
|
18
|
+
<%= f.password_field :password_confirmation, class: 'form-control' %>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<%= f.submit 'Register', class: 'btn btn-primary btn-lg' %>
|
22
|
+
<% end %>
|
data/lib/rtrain.rb
ADDED
data/rtrain-0.0.1.gem
ADDED
Binary file
|
data/rtrain-0.0.2.gem
ADDED
Binary file
|
data/rtrain-0.0.3.gem
ADDED
Binary file
|
data/rtrain-0.0.4.gem
ADDED
Binary file
|
data/rtrain-0.0.5.gem
ADDED
Binary file
|
data/rtrain-0.0.6.gem
ADDED
Binary file
|
data/rtrain-0.0.7.gem
ADDED
Binary file
|
data/rtrain-0.0.8.gem
ADDED
Binary file
|
data/rtrain-0.0.9.gem
ADDED
Binary file
|
data/rtrain-0.1.0.gem
ADDED
Binary file
|
data/rtrain-0.1.1.gem
ADDED
Binary file
|
data/rtrain-0.1.2.gem
ADDED
Binary file
|
data/rtrain-0.1.3.gem
ADDED
Binary file
|
data/rtrain-0.1.4.gem
ADDED
Binary file
|
data/rtrain-0.1.5.gem
ADDED
Binary file
|
data/rtrain-0.1.6.gem
ADDED
Binary file
|
data/rtrain-0.1.7.gem
ADDED
Binary file
|
data/rtrain-0.1.8.gem
ADDED
Binary file
|
data/rtrain-0.1.9.gem
ADDED
Binary file
|
data/rtrain-0.2.0.gem
ADDED
Binary file
|
data/rtrain-0.2.1.gem
ADDED
Binary file
|
data/rtrain.gemspec
CHANGED
@@ -4,13 +4,13 @@ $LOAD_PATH.push File.expand_path("../lib", __FILE__)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = 'rtrain'
|
7
|
-
s.version = '0.2.
|
8
|
-
s.date = '2016-05-
|
7
|
+
s.version = '0.2.2'
|
8
|
+
s.date = '2016-05-31'
|
9
9
|
s.summary = "Nicer Scaffolds,nav bar, static homepage for Rails"
|
10
10
|
s.description = "Rails UI Booster - More info @ https://github.com/lynnd335/rtrain"
|
11
11
|
s.authors = ["Dan Lynn"]
|
12
12
|
s.email = 'lynnd335@gmail.com'
|
13
|
-
s.files = Dir['**/*']
|
13
|
+
s.files = Dir['**/*']
|
14
14
|
s.homepage = 'http://rubygems.org/gems/rtrain'
|
15
15
|
s.license = 'MIT'
|
16
16
|
s.add_runtime_dependency 'authlogic', '~> 3.4', '>= 3.4.6'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rtrain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Lynn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: authlogic
|
@@ -36,6 +36,48 @@ executables: []
|
|
36
36
|
extensions: []
|
37
37
|
extra_rdoc_files: []
|
38
38
|
files:
|
39
|
+
- README.md
|
40
|
+
- docs-img/quick_demo_inputs.md
|
41
|
+
- docs-img/rtrain-placeholder.png
|
42
|
+
- lib/generators/controllers/main_controller.rb
|
43
|
+
- lib/generators/controllers/sessions_app_controller.rb
|
44
|
+
- lib/generators/controllers/user_sessions_controller.rb
|
45
|
+
- lib/generators/controllers/users_controller.rb
|
46
|
+
- lib/generators/models/user.rb
|
47
|
+
- lib/generators/models/user_session.rb
|
48
|
+
- lib/generators/rtrain/install_generator.rb
|
49
|
+
- lib/generators/sessions/sessions_routes.rb
|
50
|
+
- lib/generators/shared/_errors.html.erb
|
51
|
+
- lib/generators/templates/forms.scss
|
52
|
+
- lib/generators/templates/home.html.erb
|
53
|
+
- lib/generators/templates/nav-bar.scss
|
54
|
+
- lib/generators/templates/rtrain-application.html.erb
|
55
|
+
- lib/generators/templates/rtrain_scaffold.scss
|
56
|
+
- lib/generators/templates/sign-in.scss
|
57
|
+
- lib/generators/user_sessions/new.html.erb
|
58
|
+
- lib/generators/users/new.html.erb
|
59
|
+
- lib/rtrain.rb
|
60
|
+
- rtrain-0.0.1.gem
|
61
|
+
- rtrain-0.0.2.gem
|
62
|
+
- rtrain-0.0.3.gem
|
63
|
+
- rtrain-0.0.4.gem
|
64
|
+
- rtrain-0.0.5.gem
|
65
|
+
- rtrain-0.0.6.gem
|
66
|
+
- rtrain-0.0.7.gem
|
67
|
+
- rtrain-0.0.8.gem
|
68
|
+
- rtrain-0.0.9.gem
|
69
|
+
- rtrain-0.1.0.gem
|
70
|
+
- rtrain-0.1.1.gem
|
71
|
+
- rtrain-0.1.2.gem
|
72
|
+
- rtrain-0.1.3.gem
|
73
|
+
- rtrain-0.1.4.gem
|
74
|
+
- rtrain-0.1.5.gem
|
75
|
+
- rtrain-0.1.6.gem
|
76
|
+
- rtrain-0.1.7.gem
|
77
|
+
- rtrain-0.1.8.gem
|
78
|
+
- rtrain-0.1.9.gem
|
79
|
+
- rtrain-0.2.0.gem
|
80
|
+
- rtrain-0.2.1.gem
|
39
81
|
- rtrain.gemspec
|
40
82
|
homepage: http://rubygems.org/gems/rtrain
|
41
83
|
licenses:
|