rtrain 0.1.7 → 0.1.8
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 +32 -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/rtrain/install_generator.rb +121 -0
- data/lib/generators/templates/home.html.erb +0 -0
- data/lib/generators/templates/nav-bar.scss +25 -0
- data/lib/generators/templates/rtrain-application.html.erb +18 -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.gemspec +14 -0
- metadata +29 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c613bcfa59a0adca71000dc85adf7f43fd08ec0
|
4
|
+
data.tar.gz: 8c91fc0cc97b9066ca4c3dfb34519a4c7c103b36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b69d2280ca2a238c153d930ca4fd954c39cf648aedcffd3bca0d20cf5078502d0652ba4b130e3bff8798df124a43564fd6e6ed196722978093203d4c7875f41
|
7
|
+
data.tar.gz: afa0434e22ea7d60f4a3adb45d27a4271ed226b403c4b8d779b9385439172897b92b1ec5fca0fdad6ff2e201d3a1a3cb4b4cff081d19536c13be8b1925284019
|
data/README.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# RTrain
|
2
|
+

|
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
|
+
How to use RTrain
|
9
|
+
|
10
|
+
**Put this in your Gemfile**
|
11
|
+
```
|
12
|
+
gem 'rtrain', '~> 0.1.6'
|
13
|
+
```
|
14
|
+
Then `bundle install`
|
15
|
+
|
16
|
+
**After generating a scaffold, enter any of these into the command line:**
|
17
|
+
|
18
|
+
```
|
19
|
+
rails generate rtrain:install --copy_css
|
20
|
+
```
|
21
|
+

|
22
|
+
_Oooooooooooooo!_
|
23
|
+
|
24
|
+
Turns your basic scaffold into something that's at least tolerable to look at!
|
25
|
+
|
26
|
+
**New! Add a sweet nav bar!**
|
27
|
+
```
|
28
|
+
rails generate rtrain:install --copy_css
|
29
|
+
```
|
30
|
+

|
31
|
+
|
32
|
+
**That's it! Now your Rails application is equipped with an RTrain!**
|
@@ -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 Person name:string address:string phone:string email_address:string about:string
|
21
|
+
|
22
|
+
rake db:migrate
|
23
|
+
|
24
|
+
rails g scaffold posts subject:string content:text
|
25
|
+
|
26
|
+
rake db:migrate
|
27
|
+
```
|
28
|
+
|
29
|
+
In Rails Console ($rails c)
|
30
|
+
```
|
31
|
+
40.times do Person.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 Post.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,121 @@
|
|
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'
|
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
|
+
|
9
|
+
|
10
|
+
def gem_info
|
11
|
+
return if options.copy_css? || options.add_nav? || options.add_homepage?
|
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
|
+
\n
|
22
|
+
Refer to the README at https://github.com/lynnd335/rtrain
|
23
|
+
for details and illustrations of each option's executions
|
24
|
+
----------------------------------------------------
|
25
|
+
"
|
26
|
+
end
|
27
|
+
|
28
|
+
def run_rtrain
|
29
|
+
dir = File.dirname(__FILE__)
|
30
|
+
##Begin Copy CSS
|
31
|
+
|
32
|
+
if options[:copy_css]
|
33
|
+
|
34
|
+
scaffold_css = "../templates/rtrain_scaffold.scss"
|
35
|
+
new_css_path = File.join(dir, scaffold_css)
|
36
|
+
new_css = open(new_css_path).read
|
37
|
+
|
38
|
+
old_css = open("app/assets/stylesheets/scaffolds.scss", "w")
|
39
|
+
old_css.write(new_css)
|
40
|
+
old_css.close
|
41
|
+
puts "
|
42
|
+
----------------------------------------------------
|
43
|
+
Rtrain Scaffold CSS now active in app/assets/stylesheets/
|
44
|
+
----------------------------------------------------
|
45
|
+
"
|
46
|
+
end
|
47
|
+
|
48
|
+
##end copy css
|
49
|
+
|
50
|
+
##begin add nvigation bar
|
51
|
+
|
52
|
+
if options[:add_nav]
|
53
|
+
|
54
|
+
puts 'nav'
|
55
|
+
|
56
|
+
old_applayout = open("app/views/layouts/application.html.erb").read
|
57
|
+
app_name = old_applayout.split("<title>")[1].split("</title>")[0]
|
58
|
+
app_name = "\n<h1>"+app_name+"</h1>\n"
|
59
|
+
tables = ActiveRecord::Base.connection.tables[1..-1]
|
60
|
+
list_items = []
|
61
|
+
|
62
|
+
tables.each do |t|
|
63
|
+
link = "<li><%=link_to '" + t.titleize + "'," + t + "_path%></li>"
|
64
|
+
list_items.push(link)
|
65
|
+
end
|
66
|
+
|
67
|
+
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"
|
68
|
+
new_layout = old_applayout.split("<body>")
|
69
|
+
old_applayout = open("app/views/layouts/application.html.erb", "w")
|
70
|
+
old_applayout.write(new_layout[0] + "<body>" + app_name + nav + new_layout[1])
|
71
|
+
old_applayout.close
|
72
|
+
###
|
73
|
+
nav_css = "../templates/nav-bar.scss"
|
74
|
+
nav_css_path = File.join(dir, nav_css)
|
75
|
+
stylesheets = "app/assets/stylesheets/"
|
76
|
+
FileUtils.cp(nav_css_path, stylesheets)
|
77
|
+
puts "
|
78
|
+
----------------------------------------------------
|
79
|
+
Rtrain Nav Bar and App Title now active in app/views/layouts/application.html.erb\n
|
80
|
+
|
81
|
+
IMPORTANT! If re-running this command, be sure to remove the HTML for the previous nav bar
|
82
|
+
as it will be duplicated within the text of app/views/layouts/application.html.erb.
|
83
|
+
----------------------------------------------------
|
84
|
+
"
|
85
|
+
end
|
86
|
+
|
87
|
+
##end add navigation bar
|
88
|
+
|
89
|
+
##begin add main page
|
90
|
+
|
91
|
+
if options[:add_homepage]
|
92
|
+
home_page = "../templates/home.html.erb"
|
93
|
+
home_page_path = File.join(dir, home_page)
|
94
|
+
FileUtils.mkdir("app/views/main")
|
95
|
+
main_view = "app/views/main/"
|
96
|
+
FileUtils.cp(home_page_path, main_view)
|
97
|
+
|
98
|
+
main = "../controllers/main_controller.rb"
|
99
|
+
main_path = File.join(dir, main)
|
100
|
+
controllers = "app/controllers"
|
101
|
+
FileUtils.cp(main_path, controllers)
|
102
|
+
|
103
|
+
root = open("config/routes.rb").read
|
104
|
+
root ["# root 'welcome#index'"] = "root 'pages#show', page: 'home'
|
105
|
+
\nRails.application.routes.draw do
|
106
|
+
get '/pages/:page' => 'pages#show'
|
107
|
+
end"
|
108
|
+
routes = open("config/routes.rb","w")
|
109
|
+
routes.write(root)
|
110
|
+
routes.close
|
111
|
+
puts "
|
112
|
+
----------------------------------------------------
|
113
|
+
Rtrain Homepage Now Active and set as root URL
|
114
|
+
----------------------------------------------------
|
115
|
+
"
|
116
|
+
end
|
117
|
+
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
File without changes
|
@@ -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
|
+
|
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.gemspec
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'rtrain'
|
5
|
+
s.version = '0.1.8'
|
6
|
+
s.date = '2016-05-19'
|
7
|
+
s.summary = "Nicer Scaffolds,nav bar, static homepage for Rails"
|
8
|
+
s.description = "Rails UI Booster - More info @ https://github.com/lynnd335/rtrain"
|
9
|
+
s.authors = ["Dan Lynn"]
|
10
|
+
s.email = 'lynnd335@gmail.com'
|
11
|
+
s.files = Dir["**/*"]
|
12
|
+
s.homepage = 'http://rubygems.org/gems/rtrain'
|
13
|
+
s.license = 'MIT'
|
14
|
+
end
|
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.1.
|
4
|
+
version: 0.1.8
|
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-
|
11
|
+
date: 2016-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Rails UI Booster - More info @ https://github.com/lynnd335/rtrain
|
14
14
|
email: lynnd335@gmail.com
|
@@ -16,8 +16,34 @@ executables: []
|
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
|
+
- README.md
|
20
|
+
- docs-img/quick_demo_inputs.md
|
21
|
+
- docs-img/rtrain-placeholder.png
|
22
|
+
- lib/generators/controllers/main_controller.rb
|
23
|
+
- lib/generators/rtrain/install_generator.rb
|
24
|
+
- lib/generators/templates/home.html.erb
|
25
|
+
- lib/generators/templates/nav-bar.scss
|
26
|
+
- lib/generators/templates/rtrain-application.html.erb
|
19
27
|
- lib/generators/templates/rtrain_scaffold.scss
|
20
28
|
- lib/rtrain.rb
|
29
|
+
- rtrain-0.0.1.gem
|
30
|
+
- rtrain-0.0.2.gem
|
31
|
+
- rtrain-0.0.3.gem
|
32
|
+
- rtrain-0.0.4.gem
|
33
|
+
- rtrain-0.0.5.gem
|
34
|
+
- rtrain-0.0.6.gem
|
35
|
+
- rtrain-0.0.7.gem
|
36
|
+
- rtrain-0.0.8.gem
|
37
|
+
- rtrain-0.0.9.gem
|
38
|
+
- rtrain-0.1.0.gem
|
39
|
+
- rtrain-0.1.1.gem
|
40
|
+
- rtrain-0.1.2.gem
|
41
|
+
- rtrain-0.1.3.gem
|
42
|
+
- rtrain-0.1.4.gem
|
43
|
+
- rtrain-0.1.5.gem
|
44
|
+
- rtrain-0.1.6.gem
|
45
|
+
- rtrain-0.1.7.gem
|
46
|
+
- rtrain.gemspec
|
21
47
|
homepage: http://rubygems.org/gems/rtrain
|
22
48
|
licenses:
|
23
49
|
- MIT
|
@@ -41,5 +67,5 @@ rubyforge_project:
|
|
41
67
|
rubygems_version: 2.4.5.1
|
42
68
|
signing_key:
|
43
69
|
specification_version: 4
|
44
|
-
summary: Nicer Scaffolds
|
70
|
+
summary: Nicer Scaffolds,nav bar, static homepage for Rails
|
45
71
|
test_files: []
|