rails-maker 0.1.1 → 0.1.7
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 +7 -0
- data/lib/rails-maker/cli.rb +2 -1
- data/lib/rails-maker/version.rb +1 -1
- data/templates/default/bootstrap.rb +34 -60
- data/templates/default/lib/admin.rb +9 -9
- data/templates/default/lib/admin/layout.rb +49 -62
- data/templates/default/lib/application_layout.rb +64 -81
- data/templates/default/lib/authentication.rb +17 -104
- data/templates/default/lib/authentication/header_login_items.rb +24 -0
- data/templates/default/lib/authentication/migrations.rb +50 -0
- data/templates/default/lib/authentication/omniauth.rb +0 -0
- data/templates/default/lib/authentication/user_auth_model.rb +94 -0
- data/templates/default/lib/authentication/user_model.rb +62 -0
- data/templates/default/lib/authorization.rb +20 -52
- data/templates/default/lib/css.rb +2 -0
- data/templates/default/lib/db.rb +25 -2
- data/templates/default/lib/gemfile.rb +60 -64
- data/templates/default/lib/{rails_clean.rb → general.rb} +8 -5
- data/templates/default/lib/git.rb +39 -0
- data/templates/default/lib/home_controller.rb +3 -9
- data/templates/default/lib/initializers.rb +9 -0
- data/templates/default/lib/routes.rb +30 -0
- data/templates/default/lib/test_suite.rb +2 -9
- metadata +14 -27
- data/templates/default/lib/admin/sass.rb +0 -43
- data/templates/default/lib/haml_generator.rb +0 -13
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: 1f17f2ca99a5193c6d19db65c73087559df95154
|
4
|
+
data.tar.gz: 4c86713d6c2a43900aee81a5b168eca7dfd1039b
|
5
|
+
!binary "U0hBNTEy":
|
6
|
+
metadata.gz: ea21b8a0fa59c64c514f613a83b3a3de931f4c86f0316f702f6e24958ad12750a22846c387a1faeaa092ada63f1a7aad39459ae422f41c3d440d1c264a966774
|
7
|
+
data.tar.gz: 08d9790b892def204769c7b8775493ca0254da2dd3ab9dd2d174426018c6ce5562a480b63bcc7e75fb9b49eb890170aab6205ecc472b2f3f4fdbe47fc631dab8
|
data/lib/rails-maker/cli.rb
CHANGED
data/lib/rails-maker/version.rb
CHANGED
@@ -1,76 +1,50 @@
|
|
1
|
-
require "net/http"
|
2
|
-
require "net/https"
|
3
|
-
require "uri"
|
4
|
-
require 'rbconfig'
|
5
1
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
tmp/**/*
|
28
|
-
config/database.yml
|
29
|
-
db/*.sqlite3
|
30
|
-
public/system/**/**/**/*
|
31
|
-
.idea/*
|
32
|
-
.sass-cache/**/*
|
33
|
-
*.swp
|
34
|
-
public/uploads
|
35
|
-
FILE
|
36
|
-
end
|
37
|
-
|
38
|
-
files = %w{
|
39
|
-
gemfile
|
40
|
-
haml_generator
|
41
|
-
rails_clean
|
42
|
-
application_layout
|
43
|
-
home_controller
|
44
|
-
css
|
45
|
-
test_suite
|
46
|
-
authentication
|
47
|
-
authorization
|
48
|
-
admin
|
49
|
-
db
|
50
|
-
db_seed
|
51
|
-
}
|
2
|
+
#require "net/http"
|
3
|
+
#require "net/https"
|
4
|
+
#require "uri"
|
5
|
+
#require 'rbconfig'
|
6
|
+
|
7
|
+
say 'Building Application with the rails-maker...'
|
8
|
+
|
9
|
+
files = []
|
10
|
+
files << 'general'
|
11
|
+
files << 'git'
|
12
|
+
files << 'gemfile'
|
13
|
+
files << 'db'
|
14
|
+
files << 'application_layout'
|
15
|
+
#files << 'home_controller'
|
16
|
+
files << 'css'
|
17
|
+
#files << 'test_suite'
|
18
|
+
#files << 'authentication'
|
19
|
+
#files << 'authorization'
|
20
|
+
#files << 'admin'
|
21
|
+
files << 'routes'
|
22
|
+
files << 'initializers'
|
52
23
|
|
53
24
|
files.each do |file|
|
54
25
|
apply File.expand_path("../lib/#{file}.rb", __FILE__)
|
55
26
|
end
|
56
27
|
|
57
|
-
|
58
|
-
|
28
|
+
## INITIAL COMMIT
|
29
|
+
git add: "."
|
30
|
+
git commit: "-a -m 'Initial commit'"
|
31
|
+
|
32
|
+
## FURTHER INSTRUCTIONS
|
59
33
|
say <<-D
|
60
34
|
|
61
|
-
|
62
35
|
########################################################################
|
63
36
|
|
64
37
|
The rails-maker just added like 6 hours to your life.
|
65
38
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
39
|
+
Next:
|
40
|
+
1 - copy content of config/example-databse.yml to config/database.yml
|
41
|
+
2 - write your username and password for database access, write your database names or leave default for all environments in database.yml
|
42
|
+
3 - run 'rake db:create'
|
43
|
+
4 - write your secret, public keys and appid in initializers/raven.rb
|
44
|
+
5 - generate and copy newrelic.yml file to config directory
|
45
|
+
6 - run 'rails s' from your project directory
|
72
46
|
|
73
|
-
|
47
|
+
Login to admin with email admin@local.host and password admin123
|
74
48
|
|
75
49
|
########################################################################
|
76
50
|
D
|
@@ -1,21 +1,22 @@
|
|
1
|
-
say
|
1
|
+
say '## ADMIN >>'
|
2
|
+
|
2
3
|
generate(:controller, "admin/dashboard index")
|
3
|
-
route("match 'admin' => 'admin/dashboard#index'")
|
4
4
|
|
5
5
|
# Do layout and SASS stuff
|
6
|
-
apply File.expand_path("../admin/sass.rb", __FILE__)
|
6
|
+
#apply File.expand_path("../admin/sass.rb", __FILE__)
|
7
7
|
apply File.expand_path("../admin/layout.rb", __FILE__)
|
8
8
|
|
9
9
|
create_file 'app/controllers/admin/base_controller.rb' do
|
10
10
|
<<-RUBY
|
11
11
|
class Admin::BaseController < ApplicationController
|
12
|
+
|
12
13
|
layout 'admin'
|
13
|
-
before_filter :authenticate_user!
|
14
14
|
before_filter :verify_admin
|
15
15
|
|
16
16
|
private
|
17
|
+
|
17
18
|
def verify_admin
|
18
|
-
redirect_to root_url unless current_user.
|
19
|
+
redirect_to root_url unless current_user.has_role? :admin
|
19
20
|
end
|
20
21
|
end
|
21
22
|
RUBY
|
@@ -23,7 +24,6 @@ end
|
|
23
24
|
|
24
25
|
gsub_file 'app/controllers/admin/dashboard_controller.rb', /ApplicationController/, 'Admin::BaseController'
|
25
26
|
|
26
|
-
#
|
27
|
-
apply File.expand_path("../admin/
|
28
|
-
apply File.expand_path("../admin/
|
29
|
-
apply File.expand_path("../admin/users_spec.rb", __FILE__)
|
27
|
+
#apply File.expand_path("../admin/users.rb", __FILE__)
|
28
|
+
#apply File.expand_path("../admin/dashboard_spec.rb", __FILE__)
|
29
|
+
#apply File.expand_path("../admin/users_spec.rb", __FILE__)
|
@@ -1,79 +1,66 @@
|
|
1
|
-
remove_file 'app/views/admin/dashboard/index.html.haml'
|
2
|
-
create_file 'app/views/admin/dashboard/index.html.haml' do
|
3
|
-
<<-FILE
|
4
|
-
%h1 #{app_name.humanize} Admin
|
5
|
-
FILE
|
6
|
-
end
|
7
|
-
|
8
1
|
run 'mkdir app/views/admin/shared'
|
9
2
|
|
10
3
|
create_file 'app/views/admin/shared/_header.html.haml' do
|
11
|
-
<<-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
4
|
+
<<-HAML
|
5
|
+
|
6
|
+
.navbar.navbar-fixed-top
|
7
|
+
.navbar-inner
|
8
|
+
.container
|
9
|
+
%a.btn.btn-navbar{ "data-target" => ".nav-collapse", "data-toggle" => "collapse" }
|
10
|
+
%span.icon-bar
|
11
|
+
%span.icon-bar
|
12
|
+
%span.icon-bar
|
13
|
+
%a.brand{ href: root_path } #{app_name.humanize}
|
14
|
+
.nav-collapse
|
15
|
+
=render partial: 'shared/top_navigation'
|
16
|
+
HAML
|
21
17
|
end
|
22
18
|
|
23
|
-
create_file 'app/views/admin/shared/
|
24
|
-
<<-
|
25
|
-
-
|
26
|
-
|
27
|
-
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
FILE
|
19
|
+
create_file 'app/views/admin/shared/_flash_messages.html.haml' do
|
20
|
+
<<-HAML
|
21
|
+
- flash.each do |key, value|
|
22
|
+
.alert{ class: "alert-" + key.to_s }
|
23
|
+
%button{ type: "button", class: "close", "data-dismiss" => "alert"}
|
24
|
+
×
|
25
|
+
= value
|
26
|
+
HAML
|
32
27
|
end
|
33
28
|
|
34
29
|
create_file 'app/views/admin/shared/_footer.html.haml' do
|
35
|
-
<<-
|
36
|
-
|
37
|
-
FILE
|
30
|
+
<<-HAML
|
31
|
+
HAML
|
38
32
|
end
|
39
33
|
|
40
|
-
create_file 'app/views/admin/shared/
|
41
|
-
<<-
|
42
|
-
|
43
|
-
|
34
|
+
create_file 'app/views/admin/shared/_navigation_menu.html.haml' do
|
35
|
+
<<-HAML
|
36
|
+
%ul.nav
|
37
|
+
= nav_link "Dashboard", admin_root_path
|
38
|
+
HAML
|
44
39
|
end
|
45
40
|
|
41
|
+
run 'rm app/views/layouts/admin.html.erb'
|
46
42
|
create_file 'app/views/layouts/admin.html.haml' do
|
47
|
-
<<-
|
43
|
+
<<-HAML
|
48
44
|
!!! 5
|
49
|
-
|
50
|
-
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
|
51
|
-
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
|
52
|
-
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
|
53
|
-
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
|
54
|
-
<!--[if (gte IE 9)|!(IE)]><!-->
|
55
|
-
%html.no-js{ :lang => "en" }
|
56
|
-
<!--<![endif]-->
|
45
|
+
%html{ lang: I18n.locale }
|
57
46
|
%head
|
58
|
-
%meta{
|
59
|
-
%
|
60
|
-
%
|
61
|
-
#{app_name.humanize}
|
62
|
-
= yield(:title)
|
63
|
-
%meta{:name => 'viewport', :content => 'width=device-width initial-scale=1.0 maximum-scale=1.0'}
|
64
|
-
%meta{:name => 'apple-mobile-web-app-capable', :content => 'yes'}
|
47
|
+
%meta{ charset: 'utf-8'}
|
48
|
+
%title #{app_name.humanize} - AdminPanel
|
49
|
+
%link{ rel: "shortcut icon", href: "/favicon.ico" }
|
65
50
|
= csrf_meta_tag
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
=
|
71
|
-
|
72
|
-
|
73
|
-
=
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
=
|
78
|
-
|
51
|
+
= stylesheet_link_tag "admin"
|
52
|
+
|
53
|
+
%body{ "data-locale" => I18n.locale }
|
54
|
+
|
55
|
+
=render partial: 'admin/shared/header'
|
56
|
+
|
57
|
+
.container
|
58
|
+
=render partial: 'admin/shared/flash_messages'
|
59
|
+
|
60
|
+
= yield
|
61
|
+
|
62
|
+
= javascript_include_tag "admin"
|
63
|
+
|
64
|
+
//= debug params if Rails.env.development?
|
65
|
+
HAML
|
79
66
|
end
|
@@ -1,38 +1,48 @@
|
|
1
|
+
say '## APPLICATION LAYOUT >>'
|
2
|
+
|
1
3
|
run 'mkdir app/views/shared'
|
2
4
|
|
3
5
|
create_file 'app/views/shared/_header.html.haml' do
|
6
|
+
<<-HAML
|
7
|
+
|
8
|
+
.navbar.navbar-fixed-top
|
9
|
+
.navbar-inner
|
10
|
+
.container
|
11
|
+
%a.btn.btn-navbar{ "data-target" => ".nav-collapse", "data-toggle" => "collapse" }
|
12
|
+
%span.icon-bar
|
13
|
+
%span.icon-bar
|
14
|
+
%span.icon-bar
|
15
|
+
%a#logo.brand{ href: root_path } #{app_name.humanize}
|
16
|
+
.nav-collapse
|
17
|
+
=render partial: 'shared/navigation_menu'
|
18
|
+
HAML
|
19
|
+
end
|
20
|
+
|
21
|
+
create_file 'app/views/shared/_flash_messages.html.haml' do
|
4
22
|
<<-FILE
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
%li= link_to 'Home', root_path
|
23
|
+
- flash.each do |key, value|
|
24
|
+
.alert{ class: "alert-" + key.to_s }
|
25
|
+
%button{ type: "button", class: "close", "data-dismiss" => "alert"}
|
26
|
+
×
|
27
|
+
= value
|
11
28
|
FILE
|
12
29
|
end
|
13
30
|
|
14
|
-
create_file 'app/views/shared/
|
31
|
+
create_file 'app/views/shared/_footer.html.haml' do
|
15
32
|
<<-FILE
|
16
|
-
|
17
|
-
%div#messenger{:class => "flasher"}= flash[:notice]
|
18
|
-
- if flash[:error]
|
19
|
-
%div#error{:class => "flasher"}= flash[:error]
|
20
|
-
- if flash[:alert]
|
21
|
-
%div#alert{:class => "flasher"}= flash[:alert]
|
33
|
+
|
22
34
|
FILE
|
23
35
|
end
|
24
36
|
|
25
|
-
create_file 'app/views/shared/
|
37
|
+
create_file 'app/views/shared/_navigation_menu.html.haml' do
|
26
38
|
<<-FILE
|
27
|
-
%
|
39
|
+
%ul.nav
|
40
|
+
= nav_link "Home", root_path
|
28
41
|
FILE
|
29
42
|
end
|
30
43
|
|
31
44
|
create_file 'app/views/shared/_end_scripts.html.haml' do
|
32
45
|
<<-FILE
|
33
|
-
= include_javascripts :common
|
34
|
-
= yield(:end_scripts)
|
35
|
-
- if Rails.env == 'production'
|
36
46
|
:javascript
|
37
47
|
var _gaq = [['_setAccount', 'UA-XXXXX-X'], ['_trackPageview']];
|
38
48
|
(function(d, t) {
|
@@ -47,72 +57,45 @@ end
|
|
47
57
|
|
48
58
|
run 'rm app/views/layouts/application.html.erb'
|
49
59
|
create_file 'app/views/layouts/application.html.haml' do
|
50
|
-
<<-
|
60
|
+
<<-HAML
|
51
61
|
!!! 5
|
52
|
-
|
53
|
-
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
|
54
|
-
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]-->
|
55
|
-
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]-->
|
56
|
-
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]-->
|
57
|
-
<!--[if (gte IE 9)|!(IE)]><!-->
|
58
|
-
%html.no-js{ :lang => "en" }
|
59
|
-
<!--<![endif]-->
|
62
|
+
%html{ lang: I18n.locale }
|
60
63
|
%head
|
61
|
-
%meta{
|
62
|
-
%
|
63
|
-
%
|
64
|
-
#{app_name.humanize}
|
65
|
-
= yield(:title)
|
66
|
-
%meta{:name => 'description', :content => ''}
|
67
|
-
%meta{:name => 'author', :content => ''}
|
68
|
-
%meta{:name => 'viewport', :content => 'width=device-width initial-scale=1.0 maximum-scale=1.0'}
|
69
|
-
%meta{:name => 'apple-mobile-web-app-capable', :content => 'yes'}
|
64
|
+
%meta{ charset: 'utf-8'}
|
65
|
+
%title #{app_name.humanize}
|
66
|
+
%link{ rel: "shortcut icon", href: "/favicon.ico" }
|
70
67
|
= csrf_meta_tag
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
=
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
=
|
83
|
-
= render :
|
84
|
-
|
68
|
+
= stylesheet_link_tag "application"
|
69
|
+
|
70
|
+
%body{ "data-locale" => I18n.locale }
|
71
|
+
|
72
|
+
=render partial: 'shared/header'
|
73
|
+
|
74
|
+
.container
|
75
|
+
=render partial: 'shared/flash_messages'
|
76
|
+
|
77
|
+
= yield
|
78
|
+
|
79
|
+
= javascript_include_tag "application"
|
80
|
+
= render partial: 'shared/analytics' if Rails.env.production?
|
81
|
+
|
82
|
+
//= debug params if Rails.env.development?
|
83
|
+
HAML
|
85
84
|
end
|
86
85
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
<title>#{app_name.humanize} is down for maintenance</title>
|
101
|
-
<meta content='width=device-width initial-scale=1.0 maximum-scale=1.0' name='viewport'>
|
102
|
-
<link href='/favicon.ico' rel='shortcut icon' type='image/x-icon'>
|
103
|
-
<!--[if lt IE 9]>
|
104
|
-
<script src='/javascripts/shiv.js' type='text/javascript'></script>
|
105
|
-
<![endif]-->
|
106
|
-
<link href="/stylesheets/reset.css" media="all" rel="stylesheet" type="text/css" />
|
107
|
-
<link href="/stylesheets/main.css" media="all" rel="stylesheet" type="text/css" />
|
108
|
-
</head>
|
109
|
-
<body>
|
110
|
-
<div id='container'>
|
111
|
-
<section id='content'>
|
112
|
-
<h1>#{app_name.humanize} is down for maintenance</h1>
|
113
|
-
</section>
|
114
|
-
</div>
|
115
|
-
</body>
|
116
|
-
</html>
|
117
|
-
FILE
|
86
|
+
run 'rm app/helpers/application_helper.rb'
|
87
|
+
create_file 'app/helpers/application_helper.rb' do
|
88
|
+
<<-RUBY
|
89
|
+
module ApplicationHelper
|
90
|
+
|
91
|
+
def nav_link(link_text, link_path)
|
92
|
+
class_name = current_page?(link_path) ? 'current' : ''
|
93
|
+
|
94
|
+
content_tag(:li, :class => class_name) do
|
95
|
+
link_to link_text, link_path
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
118
99
|
end
|
100
|
+
RUBY
|
101
|
+
end
|