bootstrap-on 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +90 -0
- data/LICENSE.txt +20 -0
- data/README.md +98 -0
- data/Rakefile +38 -0
- data/VERSION +1 -0
- data/bootstrap-on.gemspec +127 -0
- data/lib/bootstrap-on.rb +6 -0
- data/lib/bootstrap-on/bs_admin.rb +138 -0
- data/lib/bootstrap-on/bs_admin_page.rb +55 -0
- data/lib/bootstrap-on/templates/.DS_Store +0 -0
- data/lib/bootstrap-on/templates/account/.DS_Store +0 -0
- data/lib/bootstrap-on/templates/account/activerecord.rb.tt +38 -0
- data/lib/bootstrap-on/templates/account/couchrest.rb.tt +66 -0
- data/lib/bootstrap-on/templates/account/datamapper.rb.tt +55 -0
- data/lib/bootstrap-on/templates/account/mini_record.rb.tt +41 -0
- data/lib/bootstrap-on/templates/account/mongoid.rb.tt +53 -0
- data/lib/bootstrap-on/templates/account/mongomapper.rb.tt +46 -0
- data/lib/bootstrap-on/templates/account/seeds.rb.tt +28 -0
- data/lib/bootstrap-on/templates/account/sequel.rb.tt +52 -0
- data/lib/bootstrap-on/templates/app.rb.tt +36 -0
- data/lib/bootstrap-on/templates/app/controllers/base.rb +6 -0
- data/lib/bootstrap-on/templates/app/controllers/sessions.rb.tt +26 -0
- data/lib/bootstrap-on/templates/app/helpers/application_helper.rb +23 -0
- data/lib/bootstrap-on/templates/assets/.DS_Store +0 -0
- data/lib/bootstrap-on/templates/assets/css/bootstrap-responsive.css +815 -0
- data/lib/bootstrap-on/templates/assets/css/bootstrap-responsive.min.css +9 -0
- data/lib/bootstrap-on/templates/assets/css/bootstrap.css +4983 -0
- data/lib/bootstrap-on/templates/assets/css/bootstrap.min.css +9 -0
- data/lib/bootstrap-on/templates/assets/ico/apple-touch-icon-114-precomposed.png +0 -0
- data/lib/bootstrap-on/templates/assets/ico/apple-touch-icon-144-precomposed.png +0 -0
- data/lib/bootstrap-on/templates/assets/ico/apple-touch-icon-57-precomposed.png +0 -0
- data/lib/bootstrap-on/templates/assets/ico/apple-touch-icon-72-precomposed.png +0 -0
- data/lib/bootstrap-on/templates/assets/ico/favicon.ico +0 -0
- data/lib/bootstrap-on/templates/assets/img/glyphicons-halflings-white.png +0 -0
- data/lib/bootstrap-on/templates/assets/img/glyphicons-halflings.png +0 -0
- data/lib/bootstrap-on/templates/assets/js/.DS_Store +0 -0
- data/lib/bootstrap-on/templates/assets/js/bootstrap.js +1825 -0
- data/lib/bootstrap-on/templates/assets/js/bootstrap.min.js +6 -0
- data/lib/bootstrap-on/templates/assets/js/jquery-min.js +4 -0
- data/lib/bootstrap-on/templates/assets/js/jquery-ujs.js +92 -0
- data/lib/bootstrap-on/templates/assets/js/jquery.js +9404 -0
- data/lib/bootstrap-on/templates/erb/app/base/index.erb.tt +16 -0
- data/lib/bootstrap-on/templates/erb/app/layouts/application.erb.tt +79 -0
- data/lib/bootstrap-on/templates/erb/app/sessions/new.erb.tt +98 -0
- data/lib/bootstrap-on/templates/erb/page/_form.erb.tt +16 -0
- data/lib/bootstrap-on/templates/erb/page/edit.erb.tt +26 -0
- data/lib/bootstrap-on/templates/erb/page/index.erb.tt +41 -0
- data/lib/bootstrap-on/templates/erb/page/new.erb.tt +23 -0
- data/lib/bootstrap-on/templates/haml/app/base/index.haml.tt +23 -0
- data/lib/bootstrap-on/templates/haml/app/layouts/application.haml.tt +31 -0
- data/lib/bootstrap-on/templates/haml/app/sessions/new.haml.tt +30 -0
- data/lib/bootstrap-on/templates/haml/page/_form.haml.tt +12 -0
- data/lib/bootstrap-on/templates/haml/page/edit.haml.tt +15 -0
- data/lib/bootstrap-on/templates/haml/page/index.haml.tt +29 -0
- data/lib/bootstrap-on/templates/haml/page/new.haml.tt +14 -0
- data/lib/bootstrap-on/templates/page/controller.rb.tt +47 -0
- data/lib/bootstrap-on/templates/slim/app/base/index.slim.tt +23 -0
- data/lib/bootstrap-on/templates/slim/app/layouts/application.slim.tt +31 -0
- data/lib/bootstrap-on/templates/slim/app/sessions/new.slim.tt +31 -0
- data/lib/bootstrap-on/templates/slim/page/_form.slim.tt +14 -0
- data/lib/bootstrap-on/templates/slim/page/edit.slim.tt +16 -0
- data/lib/bootstrap-on/templates/slim/page/index.slim.tt +30 -0
- data/lib/bootstrap-on/templates/slim/page/new.slim.tt +15 -0
- data/test/bootstrap-on/test_bs_admin_generator.rb +332 -0
- data/test/bootstrap-on/test_bs_admin_page_generator.rb +132 -0
- data/test/helper.rb +98 -0
- data/test/load_paths.rb +6 -0
- data/test/test_bootstrap-on.rb +15 -0
- metadata +240 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
.block
|
2
|
+
.secondary-navigation
|
3
|
+
%ul.wat-cf
|
4
|
+
%li.first=link_to pat(:list), url(:<%= @orm.name_plural %>, :index)
|
5
|
+
%li.active=link_to pat(:new), url(:<%= @orm.name_plural %>, :new)
|
6
|
+
.content
|
7
|
+
%h2.title
|
8
|
+
=pat(:new)
|
9
|
+
=mt(:<%= @orm.name_singular %>)
|
10
|
+
.inner
|
11
|
+
-form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :create), :class => :form do |f|
|
12
|
+
=partial "<%= @orm.name_plural %>/form", :locals => { :f => f }
|
13
|
+
|
14
|
+
-content_for :sidebar, partial("base/sidebar")
|
@@ -0,0 +1,47 @@
|
|
1
|
+
Admin.controllers :<%= @orm.name_plural %> do
|
2
|
+
|
3
|
+
get :index do
|
4
|
+
@<%= @orm.name_plural %> = <%= @orm.all %>
|
5
|
+
render '<%= @orm.name_plural %>/index'
|
6
|
+
end
|
7
|
+
|
8
|
+
get :new do
|
9
|
+
@<%= @orm.name_singular %> = <%= @orm.build %>
|
10
|
+
render '<%= @orm.name_plural %>/new'
|
11
|
+
end
|
12
|
+
|
13
|
+
post :create do
|
14
|
+
@<%= @orm.name_singular %> = <%= @orm.build("params[:#{@orm.name_singular}]") %>
|
15
|
+
if <%= @orm.save %>
|
16
|
+
flash[:notice] = '<%= @orm.klass_name %> was successfully created.'
|
17
|
+
redirect url(:<%= @orm.name_plural %>, :edit, :id => @<%= @orm.name_singular%>.id)
|
18
|
+
else
|
19
|
+
render '<%= @orm.name_plural %>/new'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
get :edit, :with => :id do
|
24
|
+
@<%= @orm.name_singular %> = <%= @orm.find("params[:id]") %>
|
25
|
+
render '<%= @orm.name_plural %>/edit'
|
26
|
+
end
|
27
|
+
|
28
|
+
put :update, :with => :id do
|
29
|
+
@<%= @orm.name_singular %> = <%= @orm.find("params[:id]") %>
|
30
|
+
if <%= @orm.update_attributes("params[:#{@orm.name_singular}]") %>
|
31
|
+
flash[:notice] = '<%= @orm.klass_name %> was successfully updated.'
|
32
|
+
redirect url(:<%= @orm.name_plural %>, :edit, :id => @<%= @orm.name_singular %>.id)
|
33
|
+
else
|
34
|
+
render '<%= @orm.name_plural %>/edit'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
delete :destroy, :with => :id do
|
39
|
+
<%= @orm.name_singular %> = <%= @orm.find("params[:id]") %>
|
40
|
+
if <%= @orm.destroy %>
|
41
|
+
flash[:notice] = '<%= @orm.klass_name %> was successfully destroyed.'
|
42
|
+
else
|
43
|
+
flash[:error] = 'Unable to destroy <%= @orm.klass_name %>!'
|
44
|
+
end
|
45
|
+
redirect url(:<%= @orm.name_plural %>, :index)
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
#block-text.block
|
2
|
+
.content
|
3
|
+
h2.title Dashboard
|
4
|
+
.inner
|
5
|
+
p.first
|
6
|
+
' Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
7
|
+
' Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
8
|
+
' Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
9
|
+
span.hightlight
|
10
|
+
| Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
11
|
+
p
|
12
|
+
span.small
|
13
|
+
| Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore
|
14
|
+
p
|
15
|
+
span.gray
|
16
|
+
| Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore
|
17
|
+
hr
|
18
|
+
p
|
19
|
+
' Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
20
|
+
' Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
21
|
+
' Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
22
|
+
span.hightlight
|
23
|
+
| Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
|
@@ -0,0 +1,31 @@
|
|
1
|
+
doctype html
|
2
|
+
html lang='en' xmlns='http://www.w3.org/1999/xhtml'
|
3
|
+
head
|
4
|
+
meta content='text/html; charset=utf-8' http-equiv='Content-Type'
|
5
|
+
title Padrino Admin
|
6
|
+
== stylesheet_link_tag 'base', 'themes/<%= options[:theme] %>/style'
|
7
|
+
|
8
|
+
body
|
9
|
+
#container
|
10
|
+
#header
|
11
|
+
h1 == link_to 'Padrino Admin', url(:base_index)
|
12
|
+
#user-navigation
|
13
|
+
ul.wat-cf
|
14
|
+
li == link_to pat(:profile), url(:<%= @model_plural %>, :edit, :id => current_account.id)
|
15
|
+
li == button_to pat(:logout), url(:sessions, :destroy), :method => :delete, :class => :button_to
|
16
|
+
#main-navigation
|
17
|
+
ul.wat-cf
|
18
|
+
- project_modules.each do |project_module|
|
19
|
+
li class=(:active if request.path_info =~ /^#{project_module.path}/)
|
20
|
+
== link_to project_module.human_name, project_module.path('/admin')
|
21
|
+
#wrapper.wat-cf
|
22
|
+
.flash == [:error, :warning, :notice].map { |type| flash_tag(type, :class => "message #{type}") }.join
|
23
|
+
#main
|
24
|
+
== yield
|
25
|
+
#footer
|
26
|
+
.block
|
27
|
+
p
|
28
|
+
' Copyright © #{Time.now.year} Your Site - Powered by
|
29
|
+
== link_to "Padrino v.#{Padrino.version}", 'http://www.padrinorb.com', :target => :_blank
|
30
|
+
#sidebar
|
31
|
+
== yield_content :sidebar
|
@@ -0,0 +1,31 @@
|
|
1
|
+
doctype html
|
2
|
+
html lang='en' xmlns='http://www.w3.org/1999/xhtml'
|
3
|
+
head
|
4
|
+
meta content='text/html; charset=utf-8' http-equiv='Content-Type'
|
5
|
+
title Padrino Admin
|
6
|
+
== stylesheet_link_tag 'base', 'themes/<%= options[:theme] %>/style'
|
7
|
+
|
8
|
+
body
|
9
|
+
#container
|
10
|
+
#box
|
11
|
+
h1 Padrino Admin
|
12
|
+
#block-login.block
|
13
|
+
h2 Login Box
|
14
|
+
.content.login
|
15
|
+
.flash == [:error, :warning, :notice].map { |type| flash_tag(type, :class => "message #{type}") }.join
|
16
|
+
- form_tag url(:sessions, :create), :class => 'form login' do
|
17
|
+
.group.wat-cf
|
18
|
+
.left
|
19
|
+
label.label.right Login
|
20
|
+
.right == text_field_tag :email, :value => params[:email], :class => :text_field
|
21
|
+
.group.wat-cf
|
22
|
+
.left
|
23
|
+
label.label.right Password
|
24
|
+
.right == password_field_tag :password, :value => params[:password], :class => :text_field
|
25
|
+
- if Padrino.env == :development
|
26
|
+
.group.wat-cf
|
27
|
+
.left
|
28
|
+
label.label.right Bypass login?
|
29
|
+
.right == check_box_tag :bypass
|
30
|
+
.group.navform.wat-cf
|
31
|
+
.right == submit_tag 'Sign In', :class => :button
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<%- @orm.column_fields.each do |column| -%>
|
2
|
+
.group
|
3
|
+
== f.label :<%= column[:name] %>
|
4
|
+
== f.error_message_on :<%= column[:name] %>
|
5
|
+
== f.<%= column[:field_type] %> :<%= column[:name] %>, :class => :<%= column[:field_type] %>
|
6
|
+
br
|
7
|
+
span.description Ex: a simple text
|
8
|
+
|
9
|
+
<%- end -%>
|
10
|
+
|
11
|
+
.group.navform.wat-cf
|
12
|
+
== f.submit pat(:save), :class => :button
|
13
|
+
== " "
|
14
|
+
== f.submit pat(:cancel), :onclick => "window.location='#{url(:<%= @orm.name_plural %>, :index)}';return false", :class => :button
|
@@ -0,0 +1,16 @@
|
|
1
|
+
.block
|
2
|
+
.secondary-navigation
|
3
|
+
ul.wat-cf
|
4
|
+
li.first == link_to pat(:list), url(:<%= @orm.name_plural %>, :index)
|
5
|
+
li == link_to pat(:new), url(:<%= @orm.name_plural %>, :new)
|
6
|
+
li.active == link_to pat(:edit), url(:<%= @orm.name_plural %>, :edit, :id => @<%= @orm.name_singular %>.id)
|
7
|
+
.content
|
8
|
+
h2.title
|
9
|
+
= pat(:edit)
|
10
|
+
== " "
|
11
|
+
= mt(:<%= @orm.name_singular %>)
|
12
|
+
.inner
|
13
|
+
== form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :update, :id => @<%= @orm.name_singular %>.id), :method => :put, :class => :form do |f|
|
14
|
+
== partial '<%= @orm.name_plural %>/form', :locals => { :f => f }
|
15
|
+
|
16
|
+
- content_for :sidebar, partial("base/sidebar")
|
@@ -0,0 +1,30 @@
|
|
1
|
+
.block
|
2
|
+
.secondary-navigation
|
3
|
+
ul.wat-cf
|
4
|
+
li.first.active == link_to pat(:list), url(:<%= @orm.name_plural %>, :index)
|
5
|
+
li == link_to pat(:new), url(:<%= @orm.name_plural %>, :new)
|
6
|
+
.content
|
7
|
+
h2.title
|
8
|
+
== pat(:all)
|
9
|
+
== ' '
|
10
|
+
== mt(:<%= @orm.name_plural %>)
|
11
|
+
.inner
|
12
|
+
table.table
|
13
|
+
tr
|
14
|
+
<%- @orm.columns.each_with_index do |column, i| -%>
|
15
|
+
th<%= ".first" if i==0 %>=mat(:<%= @orm.name_singular %>, :<%= column.name %>)
|
16
|
+
<%- end -%>
|
17
|
+
th.last == ' '
|
18
|
+
- @<%= @orm.name_plural %>.each do |<%= @orm.name_singular %>|
|
19
|
+
tr
|
20
|
+
<%- @orm.columns.each_with_index do |column, i| -%>
|
21
|
+
td<%= ".first" if i==0 %>=<%= @orm.name_singular %>.<%= column.name %>
|
22
|
+
<%- end -%>
|
23
|
+
td.last
|
24
|
+
== button_to pat(:edit), url(:<%= @orm.name_plural %>, :edit, :id => <%= @orm.name_singular %>.id), :method => :get, :class => :button_to
|
25
|
+
== ' | '
|
26
|
+
== button_to pat(:delete), url(:<%= @orm.name_plural %>, :destroy, :id => <%= @orm.name_singular %>.id), :method => :delete, :class => :button_to, :onsubmit => "return confirm('#{pat(:confirm)}')"
|
27
|
+
.actions-bar.wat-cf
|
28
|
+
.actions == ' '
|
29
|
+
|
30
|
+
-content_for :sidebar, partial("base/sidebar")
|
@@ -0,0 +1,15 @@
|
|
1
|
+
.block
|
2
|
+
.secondary-navigation
|
3
|
+
ul.wat-cf
|
4
|
+
li.first == link_to pat(:list), url(:<%= @orm.name_plural %>, :index)
|
5
|
+
li.active == link_to pat(:new), url(:<%= @orm.name_plural %>, :new)
|
6
|
+
.content
|
7
|
+
h2.title
|
8
|
+
= pat(:new)
|
9
|
+
== ' '
|
10
|
+
= mt(:<%= @orm.name_singular %>)
|
11
|
+
.inner
|
12
|
+
- form_for :<%= @orm.name_singular %>, url(:<%= @orm.name_plural %>, :create), :class => :form do |f|
|
13
|
+
== partial "<%= @orm.name_plural %>/form", :locals => { :f => f }
|
14
|
+
|
15
|
+
- content_for :sidebar, partial("base/sidebar")
|
@@ -0,0 +1,332 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe "BsAdminGenerator" do
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@apptmp = "#{Dir.tmpdir}/padrino-tests/#{UUID.new.generate}"
|
7
|
+
`mkdir -p #{@apptmp}`
|
8
|
+
end
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
`rm -rf #{@apptmp}`
|
12
|
+
end
|
13
|
+
|
14
|
+
describe 'the admin app generator' do
|
15
|
+
|
16
|
+
it 'should fail outside app root' do
|
17
|
+
out, err = capture_io { generate(:bs_admin, "-r=#{@apptmp}") }
|
18
|
+
assert_match(/not at the root/, out)
|
19
|
+
assert_no_file_exists('/tmp/admin')
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should fail if we don't specify an orm" do
|
23
|
+
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '-e=haml') }
|
24
|
+
assert_raises(SystemExit) { @out, @err = capture_io { generate(:bs_admin, "-r=#{@apptmp}/sample_project") } }
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should correctly generate a new padrino admin application with default renderer' do
|
28
|
+
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '-d=activerecord', '-e=haml') }
|
29
|
+
capture_io { generate(:bs_admin, "--root=#{@apptmp}/sample_project") }
|
30
|
+
assert_file_exists("#{@apptmp}/sample_project")
|
31
|
+
assert_file_exists("#{@apptmp}/sample_project/admin")
|
32
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/app.rb")
|
33
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers")
|
34
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers/accounts.rb")
|
35
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers/base.rb")
|
36
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers/sessions.rb")
|
37
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views")
|
38
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/_form.haml")
|
39
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/edit.haml")
|
40
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/index.haml")
|
41
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/new.haml")
|
42
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/base/index.haml")
|
43
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.haml")
|
44
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/base/index.haml")
|
45
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/layouts/application.haml")
|
46
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.haml")
|
47
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin")
|
48
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css")
|
49
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css/bootstrap.css")
|
50
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css/bootstrap.min.css")
|
51
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css/bootstrap-responsive.css")
|
52
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css/bootstrap-responsive.min.css")
|
53
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico")
|
54
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/apple-touch-icon-114-precomposed.png")
|
55
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/apple-touch-icon-144-precomposed.png")
|
56
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/apple-touch-icon-57-precomposed.png")
|
57
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/apple-touch-icon-72-precomposed.png")
|
58
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/favicon.ico")
|
59
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/img")
|
60
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/img/glyphicons-halflings-white.png")
|
61
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/img/glyphicons-halflings.png")
|
62
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js")
|
63
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/bootstrap.js")
|
64
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/bootstrap.min.js")
|
65
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/jquery-min.js")
|
66
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/jquery-ujs.js")
|
67
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/jquery.js")
|
68
|
+
assert_file_exists("#{@apptmp}/sample_project/models/account.rb")
|
69
|
+
assert_file_exists("#{@apptmp}/sample_project/db/seeds.rb")
|
70
|
+
assert_file_exists("#{@apptmp}/sample_project/db/migrate/001_create_accounts.rb")
|
71
|
+
assert_match_in_file 'Padrino.mount("Admin").to("/admin")', "#{@apptmp}/sample_project/config/apps.rb"
|
72
|
+
assert_match_in_file 'class Admin < Padrino::Application', "#{@apptmp}/sample_project/admin/app.rb"
|
73
|
+
assert_match_in_file 'role.project_module :accounts, \'/accounts\'', "#{@apptmp}/sample_project/admin/app.rb"
|
74
|
+
assert_match_in_file 'button_to pat(:logout)', "#{@apptmp}/sample_project/admin/views/layouts/application.haml"
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'should correctly generate a new padrino admin application with erb renderer' do
|
78
|
+
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '-d=activerecord', '-e=erb') }
|
79
|
+
capture_io { generate(:bs_admin, "--root=#{@apptmp}/sample_project") }
|
80
|
+
assert_file_exists("#{@apptmp}/sample_project")
|
81
|
+
assert_file_exists("#{@apptmp}/sample_project/admin")
|
82
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/app.rb")
|
83
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers")
|
84
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers/accounts.rb")
|
85
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers/base.rb")
|
86
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers/sessions.rb")
|
87
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views")
|
88
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/_form.erb")
|
89
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/edit.erb")
|
90
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/index.erb")
|
91
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/new.erb")
|
92
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/base/index.erb")
|
93
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.erb")
|
94
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/base/index.erb")
|
95
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/layouts/application.erb")
|
96
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.erb")
|
97
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin")
|
98
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css")
|
99
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css/bootstrap.css")
|
100
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css/bootstrap.min.css")
|
101
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css/bootstrap-responsive.css")
|
102
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css/bootstrap-responsive.min.css")
|
103
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico")
|
104
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/apple-touch-icon-114-precomposed.png")
|
105
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/apple-touch-icon-144-precomposed.png")
|
106
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/apple-touch-icon-57-precomposed.png")
|
107
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/apple-touch-icon-72-precomposed.png")
|
108
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/favicon.ico")
|
109
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/img")
|
110
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/img/glyphicons-halflings-white.png")
|
111
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/img/glyphicons-halflings.png")
|
112
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js")
|
113
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/bootstrap.js")
|
114
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/bootstrap.min.js")
|
115
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/jquery-min.js")
|
116
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/jquery-ujs.js")
|
117
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/jquery.js")
|
118
|
+
assert_file_exists("#{@apptmp}/sample_project/models/account.rb")
|
119
|
+
assert_file_exists("#{@apptmp}/sample_project/db/seeds.rb")
|
120
|
+
assert_file_exists("#{@apptmp}/sample_project/db/migrate/001_create_accounts.rb")
|
121
|
+
assert_match_in_file 'Padrino.mount("Admin").to("/admin")', "#{@apptmp}/sample_project/config/apps.rb"
|
122
|
+
assert_match_in_file 'class Admin < Padrino::Application', "#{@apptmp}/sample_project/admin/app.rb"
|
123
|
+
assert_match_in_file 'role.project_module :accounts, \'/accounts\'', "#{@apptmp}/sample_project/admin/app.rb"
|
124
|
+
assert_match_in_file 'link_to(\'Sign Out\', url(:sessions, :destroy)', "#{@apptmp}/sample_project/admin/views/layouts/application.erb"
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'should correctly generate a new padrino admin application with slim renderer' do
|
128
|
+
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '-d=activerecord', '-e=slim') }
|
129
|
+
capture_io { generate(:bs_admin, "--root=#{@apptmp}/sample_project") }
|
130
|
+
assert_file_exists("#{@apptmp}/sample_project")
|
131
|
+
assert_file_exists("#{@apptmp}/sample_project/admin")
|
132
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/app.rb")
|
133
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers")
|
134
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers/accounts.rb")
|
135
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers/base.rb")
|
136
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers/sessions.rb")
|
137
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views")
|
138
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/_form.slim")
|
139
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/edit.slim")
|
140
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/index.slim")
|
141
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/new.slim")
|
142
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/base/index.slim")
|
143
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.slim")
|
144
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/base/index.slim")
|
145
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/layouts/application.slim")
|
146
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.slim")
|
147
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin")
|
148
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css")
|
149
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css/bootstrap.css")
|
150
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css/bootstrap.min.css")
|
151
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css/bootstrap-responsive.css")
|
152
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css/bootstrap-responsive.min.css")
|
153
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico")
|
154
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/apple-touch-icon-114-precomposed.png")
|
155
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/apple-touch-icon-144-precomposed.png")
|
156
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/apple-touch-icon-57-precomposed.png")
|
157
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/apple-touch-icon-72-precomposed.png")
|
158
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/favicon.ico")
|
159
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/img")
|
160
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/img/glyphicons-halflings-white.png")
|
161
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/img/glyphicons-halflings.png")
|
162
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js")
|
163
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/bootstrap.js")
|
164
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/bootstrap.min.js")
|
165
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/jquery-min.js")
|
166
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/jquery-ujs.js")
|
167
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/jquery.js")
|
168
|
+
assert_file_exists("#{@apptmp}/sample_project/models/account.rb")
|
169
|
+
assert_file_exists("#{@apptmp}/sample_project/db/seeds.rb")
|
170
|
+
assert_file_exists("#{@apptmp}/sample_project/db/migrate/001_create_accounts.rb")
|
171
|
+
assert_match_in_file 'Padrino.mount("Admin").to("/admin")', "#{@apptmp}/sample_project/config/apps.rb"
|
172
|
+
assert_match_in_file 'class Admin < Padrino::Application', "#{@apptmp}/sample_project/admin/app.rb"
|
173
|
+
assert_match_in_file 'role.project_module :accounts, \'/accounts\'', "#{@apptmp}/sample_project/admin/app.rb"
|
174
|
+
assert_match_in_file 'button_to pat(:logout)', "#{@apptmp}/sample_project/admin/views/layouts/application.slim"
|
175
|
+
end
|
176
|
+
|
177
|
+
it 'should correctly generate a new padrino admin application with a custom model' do
|
178
|
+
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '-d=activerecord', '-e=slim') }
|
179
|
+
capture_io { generate(:bs_admin, "--root=#{@apptmp}/sample_project", '-m=User') }
|
180
|
+
assert_file_exists("#{@apptmp}/sample_project")
|
181
|
+
assert_file_exists("#{@apptmp}/sample_project/admin")
|
182
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/app.rb")
|
183
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers")
|
184
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers/users.rb")
|
185
|
+
assert_no_match_in_file(/[^_]account/i, "#{@apptmp}/sample_project/admin/controllers/users.rb")
|
186
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers/base.rb")
|
187
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers/sessions.rb")
|
188
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views")
|
189
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/users/_form.slim")
|
190
|
+
assert_no_match_in_file(/[^_]account/i, "#{@apptmp}/sample_project/admin/views/users/_form.slim")
|
191
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/users/edit.slim")
|
192
|
+
assert_no_match_in_file(/[^_]account/i, "#{@apptmp}/sample_project/admin/views/users/edit.slim")
|
193
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/users/index.slim")
|
194
|
+
assert_no_match_in_file(/[^_]account/i, "#{@apptmp}/sample_project/admin/views/users/index.slim")
|
195
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/users/new.slim")
|
196
|
+
assert_no_match_in_file(/[^_]account/i, "#{@apptmp}/sample_project/admin/views/users/new.slim")
|
197
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/base/index.slim")
|
198
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.slim")
|
199
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/base/index.slim")
|
200
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/layouts/application.slim")
|
201
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.slim")
|
202
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin")
|
203
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css")
|
204
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css/bootstrap.css")
|
205
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css/bootstrap.min.css")
|
206
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css/bootstrap-responsive.css")
|
207
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css/bootstrap-responsive.min.css")
|
208
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico")
|
209
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/apple-touch-icon-114-precomposed.png")
|
210
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/apple-touch-icon-144-precomposed.png")
|
211
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/apple-touch-icon-57-precomposed.png")
|
212
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/apple-touch-icon-72-precomposed.png")
|
213
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/favicon.ico")
|
214
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/img")
|
215
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/img/glyphicons-halflings-white.png")
|
216
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/img/glyphicons-halflings.png")
|
217
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js")
|
218
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/bootstrap.js")
|
219
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/bootstrap.min.js")
|
220
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/jquery-min.js")
|
221
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/jquery-ujs.js")
|
222
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/jquery.js")
|
223
|
+
assert_file_exists("#{@apptmp}/sample_project/models/user.rb")
|
224
|
+
assert_no_match_in_file(/Account/, "#{@apptmp}/sample_project/models/user.rb")
|
225
|
+
assert_file_exists("#{@apptmp}/sample_project/db/seeds.rb")
|
226
|
+
assert_file_exists("#{@apptmp}/sample_project/db/migrate/001_create_users.rb")
|
227
|
+
assert_no_match_in_file(/[^_]account/i, "#{@apptmp}/sample_project/db/migrate/001_create_users.rb")
|
228
|
+
assert_match_in_file 'Padrino.mount("Admin").to("/admin")', "#{@apptmp}/sample_project/config/apps.rb"
|
229
|
+
assert_match_in_file 'class Admin < Padrino::Application', "#{@apptmp}/sample_project/admin/app.rb"
|
230
|
+
assert_match_in_file 'role.project_module :users, \'/users\'', "#{@apptmp}/sample_project/admin/app.rb"
|
231
|
+
assert_match_in_file 'button_to pat(:logout)', "#{@apptmp}/sample_project/admin/views/layouts/application.slim"
|
232
|
+
end
|
233
|
+
|
234
|
+
it 'should correctly generate a new padrino admin application with model in non-default application path' do
|
235
|
+
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '-d=activerecord', '-e=haml') }
|
236
|
+
capture_io { generate(:bs_admin,"-a=/admin", "--root=#{@apptmp}/sample_project") }
|
237
|
+
assert_file_exists("#{@apptmp}/sample_project")
|
238
|
+
assert_file_exists("#{@apptmp}/sample_project/admin")
|
239
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/app.rb")
|
240
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers")
|
241
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers/accounts.rb")
|
242
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers/base.rb")
|
243
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/controllers/sessions.rb")
|
244
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views")
|
245
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/_form.haml")
|
246
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/edit.haml")
|
247
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/index.haml")
|
248
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/accounts/new.haml")
|
249
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/base/index.haml")
|
250
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.haml")
|
251
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/base/index.haml")
|
252
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/layouts/application.haml")
|
253
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/views/sessions/new.haml")
|
254
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin")
|
255
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css")
|
256
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css/bootstrap.css")
|
257
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css/bootstrap.min.css")
|
258
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css/bootstrap-responsive.css")
|
259
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/css/bootstrap-responsive.min.css")
|
260
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico")
|
261
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/apple-touch-icon-114-precomposed.png")
|
262
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/apple-touch-icon-144-precomposed.png")
|
263
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/apple-touch-icon-57-precomposed.png")
|
264
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/apple-touch-icon-72-precomposed.png")
|
265
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/ico/favicon.ico")
|
266
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/img")
|
267
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/img/glyphicons-halflings-white.png")
|
268
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/img/glyphicons-halflings.png")
|
269
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js")
|
270
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/bootstrap.js")
|
271
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/bootstrap.min.js")
|
272
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/jquery-min.js")
|
273
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/jquery-ujs.js")
|
274
|
+
assert_file_exists("#{@apptmp}/sample_project/public/admin/js/jquery.js")
|
275
|
+
assert_file_exists("#{@apptmp}/sample_project/admin/models/account.rb")
|
276
|
+
assert_no_file_exists("#{@apptmp}/sample_project/models/account.rb")
|
277
|
+
assert_file_exists("#{@apptmp}/sample_project/db/seeds.rb")
|
278
|
+
assert_file_exists("#{@apptmp}/sample_project/db/migrate/001_create_accounts.rb")
|
279
|
+
assert_match_in_file 'Padrino.mount("Admin").to("/admin")', "#{@apptmp}/sample_project/config/apps.rb"
|
280
|
+
assert_match_in_file 'class Admin < Padrino::Application', "#{@apptmp}/sample_project/admin/app.rb"
|
281
|
+
assert_match_in_file 'role.project_module :accounts, \'/accounts\'', "#{@apptmp}/sample_project/admin/app.rb"
|
282
|
+
assert_match_in_file 'button_to pat(:logout)', "#{@apptmp}/sample_project/admin/views/layouts/application.haml"
|
283
|
+
end
|
284
|
+
|
285
|
+
it 'should not add activerecord middleware for #datamapper' do
|
286
|
+
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '-d=datamapper', '-e=haml') }
|
287
|
+
capture_io { generate(:bs_admin,"-a=/admin", "--root=#{@apptmp}/sample_project") }
|
288
|
+
assert_no_match_in_file(/ use ActiveRecord::ConnectionAdapters::ConnectionManagemen/m, "#{@apptmp}/sample_project/admin/app.rb")
|
289
|
+
end
|
290
|
+
|
291
|
+
it 'should add activerecord middleware for #activerecord' do
|
292
|
+
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '-d=activerecord', '-e=haml') }
|
293
|
+
capture_io { generate(:bs_admin,"-a=/admin", "--root=#{@apptmp}/sample_project") }
|
294
|
+
assert_match_in_file(/ use ActiveRecord::ConnectionAdapters::ConnectionManagemen/m, "#{@apptmp}/sample_project/admin/app.rb")
|
295
|
+
end
|
296
|
+
|
297
|
+
it 'should add activerecord middleware for #mini_record' do
|
298
|
+
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '-d=mini_record', '-e=haml') }
|
299
|
+
capture_io { generate(:bs_admin,"-a=/admin", "--root=#{@apptmp}/sample_project") }
|
300
|
+
assert_match_in_file(/ use ActiveRecord::ConnectionAdapters::ConnectionManagemen/m, "#{@apptmp}/sample_project/admin/app.rb")
|
301
|
+
end
|
302
|
+
|
303
|
+
it 'should not conflict with existing seeds file' do
|
304
|
+
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", '-d=activerecord', '-e=erb') }
|
305
|
+
|
306
|
+
# Add seeds file
|
307
|
+
FileUtils.mkdir_p @apptmp + '/sample_project/db' unless File.exist?(@apptmp + '/sample_project/db')
|
308
|
+
File.open(@apptmp + '/sample_project/db/seeds.rb', 'w+') do |seeds_rb|
|
309
|
+
seeds_rb.puts "# Old Seeds Content"
|
310
|
+
end
|
311
|
+
|
312
|
+
capture_io do
|
313
|
+
# TODO: this doesn't work, so figure out why
|
314
|
+
# $stdout.expects(:print).with { |value| value =~ /Overwrite\s.*?\/db\/seeds.rb/ }.never
|
315
|
+
# $stdin.stubs(:gets).returns('y')
|
316
|
+
generate(:bs_admin, "--root=#{@apptmp}/sample_project")
|
317
|
+
end
|
318
|
+
|
319
|
+
assert_file_exists "#{@apptmp}/sample_project/db/seeds.old"
|
320
|
+
assert_match_in_file 'Account.create(', "#{@apptmp}/sample_project/db/seeds.rb"
|
321
|
+
end
|
322
|
+
|
323
|
+
it "should navigate completely inside an app with activerecord" do
|
324
|
+
capture_io { generate(:project, 'sample_project', "--root=#{@apptmp}", "-d=activerecord", "-e=haml", "--dev") }
|
325
|
+
capture_io { generate(:bs_admin, "--root=#{@apptmp}/sample_project") }
|
326
|
+
skip "Check bundle install and rake"
|
327
|
+
bundle(:install, :gemfile => "#{@apptmp}/sample_project/Gemfile", :path => "#{@apptmp}/bundle")
|
328
|
+
cli(:rake, '-T', "-c=#{@apptmp}/sample_project")
|
329
|
+
end
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|