padrino-admin 0.9.7 → 0.9.9
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.
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/lib/padrino-admin/generators/actions.rb +1 -1
- data/lib/padrino-admin/generators/admin_app.rb +14 -13
- data/lib/padrino-admin/generators/admin_page.rb +16 -14
- data/lib/padrino-admin/generators/orm.rb +4 -4
- data/lib/padrino-admin/generators/templates/app/app.rb +1 -1
- data/lib/padrino-admin/generators/templates/assets/stylesheets/base.css +5 -5
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/amro/style.css +1 -1
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/bec-green/style.css +1 -1
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/bec/style.css +1 -1
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/blue/style.css +1 -1
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/default/style.css +2 -2
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/djime-cerulean/style.css +1 -1
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/kathleene/style.css +1 -1
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/olive/style.css +1 -1
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/reidb-greenish/style.css +1 -1
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/ruby/style.css +1 -1
- data/lib/padrino-admin/generators/templates/assets/stylesheets/themes/warehouse/style.css +2 -2
- data/lib/padrino-admin/helpers/authentication_helpers.rb +3 -3
- data/padrino-admin.gemspec +11 -11
- data/test/generators/test_admin_app_generator.rb +1 -1
- data/test/generators/test_admin_page_generator.rb +39 -5
- data/test/test_admin_application.rb +1 -1
- metadata +9 -9
data/Rakefile
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.9.
|
|
1
|
+
0.9.9
|
|
@@ -22,7 +22,7 @@ module Padrino
|
|
|
22
22
|
#
|
|
23
23
|
def add_project_module(controller)
|
|
24
24
|
permission = " role.project_module :#{controller}, \"/#{controller}\"\n"
|
|
25
|
-
inject_into_file destination_root("/admin/app.rb"), permission, :after => "access_control.roles_for :admin do |role
|
|
25
|
+
inject_into_file destination_root("/admin/app.rb"), permission, :after => "access_control.roles_for :admin do |role|\n"
|
|
26
26
|
end
|
|
27
27
|
end # Actions
|
|
28
28
|
end # Admin
|
|
@@ -16,7 +16,7 @@ module Padrino
|
|
|
16
16
|
include Padrino::Generators::Actions
|
|
17
17
|
include Padrino::Generators::Admin::Actions
|
|
18
18
|
|
|
19
|
-
desc "Description:\n\n\tpadrino-gen admin generates a new Padrino Admin"
|
|
19
|
+
desc "Description:\n\n\tpadrino-gen admin generates a new Padrino Admin application"
|
|
20
20
|
|
|
21
21
|
class_option :skip_migration, :aliases => "-s", :default => false, :type => :boolean
|
|
22
22
|
class_option :root, :desc => "The root destination", :aliases => '-r', :default => ".", :type => :string
|
|
@@ -30,7 +30,7 @@ module Padrino
|
|
|
30
30
|
if in_app_root?
|
|
31
31
|
|
|
32
32
|
unless supported_orm.include?(orm)
|
|
33
|
-
say "<=
|
|
33
|
+
say "<= At the moment, Padrino only supports #{supported_orm.join(" or ")}. Sorry!"
|
|
34
34
|
raise SystemExit
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -54,16 +54,16 @@ module Padrino
|
|
|
54
54
|
column = Struct.new(:name, :type)
|
|
55
55
|
columns = [:id, :name, :surname, :email].map { |col| column.new(col) }
|
|
56
56
|
column_fields = [
|
|
57
|
-
{ :name => :name,
|
|
58
|
-
{ :name => :surname,
|
|
59
|
-
{ :name => :email,
|
|
60
|
-
{ :name => :password,
|
|
61
|
-
{ :name => :password_confirmation, :field_type => :
|
|
62
|
-
{ :name => :role,
|
|
57
|
+
{ :name => :name, :field_type => :text_field },
|
|
58
|
+
{ :name => :surname, :field_type => :text_field },
|
|
59
|
+
{ :name => :email, :field_type => :text_field },
|
|
60
|
+
{ :name => :password, :field_type => :password_field },
|
|
61
|
+
{ :name => :password_confirmation, :field_type => :password_field },
|
|
62
|
+
{ :name => :role, :field_type => :text_field }
|
|
63
63
|
]
|
|
64
64
|
|
|
65
65
|
admin_app = Padrino::Generators::AdminPage.new(["account"], :root => options[:root])
|
|
66
|
-
admin_app.
|
|
66
|
+
admin_app.default_orm = Padrino::Admin::Generators::Orm.new(:account, orm, columns, column_fields)
|
|
67
67
|
admin_app.invoke
|
|
68
68
|
|
|
69
69
|
template "templates/account/#{orm}.rb.tt", destination_root("app", "models", "account.rb"), :force => true
|
|
@@ -76,15 +76,16 @@ module Padrino
|
|
|
76
76
|
add_project_module :accounts
|
|
77
77
|
append_file destination_root("config/apps.rb"), "\nPadrino.mount(\"Admin\").to(\"/admin\")"
|
|
78
78
|
gsub_file destination_root("admin/views/accounts/_form.#{ext}"), "f.text_field :role, :class => :text_field", "f.select :role, :options => access_control.roles"
|
|
79
|
-
|
|
79
|
+
gsub_file destination_root("admin/controllers/accounts.rb"), "if account.destroy", "if account != current_account && account.destroy"
|
|
80
80
|
return if self.behavior == :revoke
|
|
81
81
|
say (<<-TEXT).gsub(/ {10}/,'')
|
|
82
82
|
|
|
83
83
|
=================================================================
|
|
84
|
-
|
|
84
|
+
The admin panel has been mounted! Next, follow these steps:
|
|
85
85
|
=================================================================
|
|
86
|
-
1) Run migrations
|
|
87
|
-
2) Run padrino rake seed
|
|
86
|
+
1) Run migrations (if necessary)
|
|
87
|
+
2) Run 'padrino rake seed'
|
|
88
|
+
3) Visit the admin panel in the browser at '/admin'
|
|
88
89
|
=================================================================
|
|
89
90
|
|
|
90
91
|
TEXT
|
|
@@ -2,7 +2,7 @@ module Padrino
|
|
|
2
2
|
module Generators
|
|
3
3
|
|
|
4
4
|
class AdminPage < Thor::Group
|
|
5
|
-
attr_accessor :
|
|
5
|
+
attr_accessor :default_orm
|
|
6
6
|
|
|
7
7
|
# Add this generator to our padrino-gen
|
|
8
8
|
Padrino::Generators.add_generator(:admin_page, self)
|
|
@@ -16,8 +16,8 @@ module Padrino
|
|
|
16
16
|
include Padrino::Generators::Actions
|
|
17
17
|
include Padrino::Generators::Admin::Actions
|
|
18
18
|
|
|
19
|
-
desc "Description:\n\n\tpadrino-gen admin_page
|
|
20
|
-
argument :
|
|
19
|
+
desc "Description:\n\n\tpadrino-gen admin_page model(s)"
|
|
20
|
+
argument :models, :desc => "The name(s) of your model(s)", :type => :array
|
|
21
21
|
class_option :skip_migration, :aliases => "-s", :default => false, :type => :boolean
|
|
22
22
|
class_option :root, :desc => "The root destination", :aliases => '-r', :type => :string
|
|
23
23
|
class_option :destroy, :aliases => '-d', :default => false, :type => :boolean
|
|
@@ -29,17 +29,19 @@ module Padrino
|
|
|
29
29
|
def create_controller
|
|
30
30
|
self.destination_root = options[:root]
|
|
31
31
|
if in_app_root?
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
models.each do |model|
|
|
33
|
+
@orm = default_orm || Padrino::Admin::Generators::Orm.new(model, adapter)
|
|
34
|
+
self.behavior = :revoke if options[:destroy]
|
|
35
|
+
ext = fetch_component_choice(:renderer)
|
|
36
|
+
|
|
37
|
+
template "templates/page/controller.rb.tt", destination_root("/admin/controllers/#{@orm.name_plural}.rb")
|
|
38
|
+
template "templates/#{ext}/page/_form.#{ext}.tt", destination_root("/admin/views/#{@orm.name_plural}/_form.#{ext}")
|
|
39
|
+
template "templates/#{ext}/page/edit.#{ext}.tt", destination_root("/admin/views/#{@orm.name_plural}/edit.#{ext}")
|
|
40
|
+
template "templates/#{ext}/page/index.#{ext}.tt", destination_root("/admin/views/#{@orm.name_plural}/index.#{ext}")
|
|
41
|
+
template "templates/#{ext}/page/new.#{ext}.tt", destination_root("/admin/views/#{@orm.name_plural}/new.#{ext}")
|
|
42
|
+
|
|
43
|
+
add_project_module(@orm.name_plural)
|
|
44
|
+
end
|
|
43
45
|
else
|
|
44
46
|
say "You are not at the root of a Padrino application! (config/boot.rb not found)" and return unless in_app_root?
|
|
45
47
|
end
|
|
@@ -14,7 +14,7 @@ module Padrino
|
|
|
14
14
|
@orm = orm.to_sym
|
|
15
15
|
@columns = columns
|
|
16
16
|
@column_fields = column_fields
|
|
17
|
-
raise OrmError, "Model #{name} not found!" if @columns.nil? && @klass.nil?
|
|
17
|
+
raise OrmError, "Model #{name} was not found!" if @columns.nil? && @klass.nil?
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def field_type(type)
|
|
@@ -33,7 +33,7 @@ module Padrino
|
|
|
33
33
|
when :datamapper then @klass.properties
|
|
34
34
|
when :mongoid then @klass.fields.values
|
|
35
35
|
when :mongomapper then @klass.keys.values.reject { |key| key.name == "_id" } # On MongoMapper keys are an hash
|
|
36
|
-
else raise OrmError, "Adapter #{orm} not yet supported!"
|
|
36
|
+
else raise OrmError, "Adapter #{orm} is not yet supported!"
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
|
|
@@ -54,7 +54,7 @@ module Padrino
|
|
|
54
54
|
case orm
|
|
55
55
|
when :activerecord, :mongomapper, :mongoid then "#{klass_name}.find(#{params})"
|
|
56
56
|
when :datamapper then "#{klass_name}.get(#{params})"
|
|
57
|
-
else raise OrmError, "Adapter #{orm} not yet supported!"
|
|
57
|
+
else raise OrmError, "Adapter #{orm} is not yet supported!"
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
60
|
|
|
@@ -74,7 +74,7 @@ module Padrino
|
|
|
74
74
|
case orm
|
|
75
75
|
when :activerecord, :mongomapper, :mongoid then "#{name_singular}.update_attributes(#{params})"
|
|
76
76
|
when :datamapper then "#{name_singular}.update(#{params})"
|
|
77
|
-
else raise OrmError, "Adapter #{orm} not yet supported!"
|
|
77
|
+
else raise OrmError, "Adapter #{orm} is not yet supported!"
|
|
78
78
|
end
|
|
79
79
|
end
|
|
80
80
|
|
|
@@ -61,21 +61,21 @@ body{font-size:12px;font-family:sans-serif;}
|
|
|
61
61
|
.table td{padding:10px;}
|
|
62
62
|
.table td.last{text-align:right;}
|
|
63
63
|
/* forms */
|
|
64
|
-
input.
|
|
64
|
+
input.check_box{margin:0;padding:0;}
|
|
65
65
|
.form .group{margin-bottom:15px;}
|
|
66
66
|
.form div.left{width:20%;float:left;}
|
|
67
67
|
.form div.right{width:75%;float:right;}
|
|
68
68
|
.form .columns .column{width:48%;}
|
|
69
69
|
.form .columns .left{float:left;}
|
|
70
70
|
.form .columns .right{float:right;}
|
|
71
|
-
.form label,.form input.text_field,.form textarea.text_area{font-size:1.0em;padding:2px 0;margin:0;color:#36393D;}
|
|
71
|
+
.form label,.form input.text_field,.form input.password_field,.form textarea.text_area{font-size:1.0em;padding:2px 0;margin:0;color:#36393D;}
|
|
72
72
|
.form label.right{text-align:right;}
|
|
73
|
-
.form input.
|
|
74
|
-
.form label.
|
|
73
|
+
.form input.check_box,.form input.radio{margin-right:5px;}
|
|
74
|
+
.form label.check_box,.form label.radio{line-height:1.5em;}
|
|
75
75
|
.form label{padding-bottom:2px;font-weight:bold;}
|
|
76
76
|
.form .error{color:red;}
|
|
77
77
|
.form a{color:red;font-size:14px;}
|
|
78
|
-
.form input.text_field,.form textarea.text_area{width:100%;border-width:1px;border-style:solid;}
|
|
78
|
+
.form input.text_field,.form input.password_field,.form textarea.text_area{width:100%;border-width:1px;border-style:solid;}
|
|
79
79
|
.button_to{display:inline;}
|
|
80
80
|
.button_to input{background:none;border:none;display:inline;font-size:12px;color:#A72D2E;cursor:pointer;}
|
|
81
81
|
/* lists */
|
|
@@ -239,7 +239,7 @@ hr {
|
|
|
239
239
|
/* tables */
|
|
240
240
|
|
|
241
241
|
.table th {
|
|
242
|
-
background: #36393d;
|
|
242
|
+
background: #36393d;
|
|
243
243
|
color: #FFF;
|
|
244
244
|
}
|
|
245
245
|
|
|
@@ -257,7 +257,7 @@ hr {
|
|
|
257
257
|
color: #666666;
|
|
258
258
|
}
|
|
259
259
|
|
|
260
|
-
.form input.text_field, .form textarea.text_area {
|
|
260
|
+
.form input.text_field, .form input.password_field, .form textarea.text_area {
|
|
261
261
|
width: 100%;
|
|
262
262
|
border: 1px solid #cfcfcf;
|
|
263
263
|
}
|
|
@@ -17,7 +17,7 @@ p {
|
|
|
17
17
|
line-height: 20px;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
input.
|
|
20
|
+
input.check_box {
|
|
21
21
|
vertical-align:middle;
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -309,7 +309,7 @@ input.checkbox {
|
|
|
309
309
|
width:99%;
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
-
.form input.text_field, .form textarea.text_area {
|
|
312
|
+
.form input.text_field, .form input.password_field, .form textarea.text_area {
|
|
313
313
|
border-right: 1px solid #ddd;
|
|
314
314
|
border-bottom: 1px solid #ddd;
|
|
315
315
|
border-top: 2px solid #ccc;
|
|
@@ -24,7 +24,7 @@ module Padrino
|
|
|
24
24
|
# set_current_account(Account.authenticate(params[:email], params[:password])
|
|
25
25
|
#
|
|
26
26
|
def set_current_account(account=nil)
|
|
27
|
-
session[
|
|
27
|
+
session[settings.session_id] = account ? account.id : nil
|
|
28
28
|
@current_account = account
|
|
29
29
|
end
|
|
30
30
|
|
|
@@ -86,11 +86,11 @@ module Padrino
|
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
def login_page
|
|
89
|
-
|
|
89
|
+
settings.login_page rescue nil
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
def store_location
|
|
93
|
-
|
|
93
|
+
settings.store_location rescue nil
|
|
94
94
|
end
|
|
95
95
|
|
|
96
96
|
def login_from_session
|
data/padrino-admin.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = %q{padrino-admin}
|
|
8
|
-
s.version = "0.9.
|
|
8
|
+
s.version = "0.9.9"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
|
|
12
|
-
s.date = %q{2010-03-
|
|
12
|
+
s.date = %q{2010-03-29}
|
|
13
13
|
s.description = %q{Admin View for Padrino applications}
|
|
14
14
|
s.email = %q{padrinorb@gmail.com}
|
|
15
15
|
s.extra_rdoc_files = [
|
|
@@ -94,18 +94,18 @@ Gem::Specification.new do |s|
|
|
|
94
94
|
s.specification_version = 3
|
|
95
95
|
|
|
96
96
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
|
97
|
-
s.add_runtime_dependency(%q<padrino-core>, ["= 0.9.
|
|
98
|
-
s.add_runtime_dependency(%q<padrino-gen>, ["= 0.9.
|
|
99
|
-
s.add_runtime_dependency(%q<padrino-helpers>, ["= 0.9.
|
|
97
|
+
s.add_runtime_dependency(%q<padrino-core>, ["= 0.9.9"])
|
|
98
|
+
s.add_runtime_dependency(%q<padrino-gen>, ["= 0.9.9"])
|
|
99
|
+
s.add_runtime_dependency(%q<padrino-helpers>, ["= 0.9.9"])
|
|
100
100
|
s.add_development_dependency(%q<haml>, [">= 2.2.1"])
|
|
101
101
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
|
102
102
|
s.add_development_dependency(%q<mocha>, [">= 0.9.7"])
|
|
103
103
|
s.add_development_dependency(%q<rack-test>, [">= 0.5.0"])
|
|
104
104
|
s.add_development_dependency(%q<webrat>, [">= 0.5.1"])
|
|
105
105
|
else
|
|
106
|
-
s.add_dependency(%q<padrino-core>, ["= 0.9.
|
|
107
|
-
s.add_dependency(%q<padrino-gen>, ["= 0.9.
|
|
108
|
-
s.add_dependency(%q<padrino-helpers>, ["= 0.9.
|
|
106
|
+
s.add_dependency(%q<padrino-core>, ["= 0.9.9"])
|
|
107
|
+
s.add_dependency(%q<padrino-gen>, ["= 0.9.9"])
|
|
108
|
+
s.add_dependency(%q<padrino-helpers>, ["= 0.9.9"])
|
|
109
109
|
s.add_dependency(%q<haml>, [">= 2.2.1"])
|
|
110
110
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
|
111
111
|
s.add_dependency(%q<mocha>, [">= 0.9.7"])
|
|
@@ -113,9 +113,9 @@ Gem::Specification.new do |s|
|
|
|
113
113
|
s.add_dependency(%q<webrat>, [">= 0.5.1"])
|
|
114
114
|
end
|
|
115
115
|
else
|
|
116
|
-
s.add_dependency(%q<padrino-core>, ["= 0.9.
|
|
117
|
-
s.add_dependency(%q<padrino-gen>, ["= 0.9.
|
|
118
|
-
s.add_dependency(%q<padrino-helpers>, ["= 0.9.
|
|
116
|
+
s.add_dependency(%q<padrino-core>, ["= 0.9.9"])
|
|
117
|
+
s.add_dependency(%q<padrino-gen>, ["= 0.9.9"])
|
|
118
|
+
s.add_dependency(%q<padrino-helpers>, ["= 0.9.9"])
|
|
119
119
|
s.add_dependency(%q<haml>, [">= 2.2.1"])
|
|
120
120
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
|
121
121
|
s.add_dependency(%q<mocha>, [">= 0.9.7"])
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require File.dirname(__FILE__) + '/../helper'
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../helper')
|
|
2
2
|
require 'thor/group'
|
|
3
3
|
require 'fakeweb'
|
|
4
4
|
require 'padrino-gen/generators/actions'
|
|
@@ -10,6 +10,12 @@ class Person
|
|
|
10
10
|
end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
+
class Page
|
|
14
|
+
def self.properties
|
|
15
|
+
[:id, :name, :body].map { |c| OpenStruct.new(:name => c) }
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
13
19
|
class TestAdminPageGenerator < Test::Unit::TestCase
|
|
14
20
|
|
|
15
21
|
def setup
|
|
@@ -34,8 +40,7 @@ class TestAdminPageGenerator < Test::Unit::TestCase
|
|
|
34
40
|
assert_raise(Padrino::Admin::Generators::OrmError) { @page.start(['foo', '-r=/tmp/sample_project']) }
|
|
35
41
|
end
|
|
36
42
|
|
|
37
|
-
should '
|
|
38
|
-
'Person'.classify.constantize
|
|
43
|
+
should 'correctly generate a new padrino admin application default renderer' do
|
|
39
44
|
silence_logger { @project.start(['sample_project', '--root=/tmp', '-d=datamapper']) }
|
|
40
45
|
silence_logger { @admin.start(['--root=/tmp/sample_project']) }
|
|
41
46
|
silence_logger { @model.start(['person', "name:string", "age:integer", "email:string", '-root=/tmp/sample_project']) }
|
|
@@ -52,8 +57,7 @@ class TestAdminPageGenerator < Test::Unit::TestCase
|
|
|
52
57
|
assert_match_in_file 'role.project_module :people, "/people"', '/tmp/sample_project/admin/app.rb'
|
|
53
58
|
end
|
|
54
59
|
|
|
55
|
-
should '
|
|
56
|
-
'Person'.classify.constantize
|
|
60
|
+
should 'correctly generate a new padrino admin application with erb renderer' do
|
|
57
61
|
silence_logger { @project.start(['sample_project', '--root=/tmp', '-d=datamapper', '-e=erb']) }
|
|
58
62
|
silence_logger { @admin.start(['--root=/tmp/sample_project']) }
|
|
59
63
|
silence_logger { @model.start(['person', "name:string", "age:integer", "email:string", '-root=/tmp/sample_project']) }
|
|
@@ -69,5 +73,35 @@ class TestAdminPageGenerator < Test::Unit::TestCase
|
|
|
69
73
|
end
|
|
70
74
|
assert_match_in_file 'role.project_module :people, "/people"', '/tmp/sample_project/admin/app.rb'
|
|
71
75
|
end
|
|
76
|
+
|
|
77
|
+
should 'correctly generate a new padrino admin application with multiple models' do
|
|
78
|
+
silence_logger { @project.start(['sample_project', '--root=/tmp', '-d=datamapper']) }
|
|
79
|
+
silence_logger { @admin.start(['--root=/tmp/sample_project']) }
|
|
80
|
+
silence_logger { @model.start(['person', "name:string", "age:integer", "email:string", '-root=/tmp/sample_project']) }
|
|
81
|
+
silence_logger { @model.start(['page', "name:string", "body:string", '-root=/tmp/sample_project']) }
|
|
82
|
+
silence_logger { @page.start(['person', 'page', '--root=/tmp/sample_project']) }
|
|
83
|
+
# For Person
|
|
84
|
+
assert_file_exists '/tmp/sample_project/admin/controllers/people.rb'
|
|
85
|
+
assert_file_exists '/tmp/sample_project/admin/views/people/_form.haml'
|
|
86
|
+
assert_file_exists '/tmp/sample_project/admin/views/people/edit.haml'
|
|
87
|
+
assert_file_exists '/tmp/sample_project/admin/views/people/index.haml'
|
|
88
|
+
assert_file_exists '/tmp/sample_project/admin/views/people/new.haml'
|
|
89
|
+
%w(name age email).each do |field|
|
|
90
|
+
assert_match_in_file "label :#{field}", '/tmp/sample_project/admin/views/people/_form.haml'
|
|
91
|
+
assert_match_in_file "text_field :#{field}", '/tmp/sample_project/admin/views/people/_form.haml'
|
|
92
|
+
end
|
|
93
|
+
assert_match_in_file 'role.project_module :people, "/people"', '/tmp/sample_project/admin/app.rb'
|
|
94
|
+
# For Page
|
|
95
|
+
assert_file_exists '/tmp/sample_project/admin/controllers/pages.rb'
|
|
96
|
+
assert_file_exists '/tmp/sample_project/admin/views/pages/_form.haml'
|
|
97
|
+
assert_file_exists '/tmp/sample_project/admin/views/pages/edit.haml'
|
|
98
|
+
assert_file_exists '/tmp/sample_project/admin/views/pages/index.haml'
|
|
99
|
+
assert_file_exists '/tmp/sample_project/admin/views/pages/new.haml'
|
|
100
|
+
%w(name body).each do |field|
|
|
101
|
+
assert_match_in_file "label :#{field}", '/tmp/sample_project/admin/views/pages/_form.haml'
|
|
102
|
+
assert_match_in_file "text_field :#{field}", '/tmp/sample_project/admin/views/pages/_form.haml'
|
|
103
|
+
end
|
|
104
|
+
assert_match_in_file 'role.project_module :pages, "/pages"', '/tmp/sample_project/admin/app.rb'
|
|
105
|
+
end
|
|
72
106
|
end
|
|
73
107
|
end
|
metadata
CHANGED
|
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
|
5
5
|
segments:
|
|
6
6
|
- 0
|
|
7
7
|
- 9
|
|
8
|
-
-
|
|
9
|
-
version: 0.9.
|
|
8
|
+
- 9
|
|
9
|
+
version: 0.9.9
|
|
10
10
|
platform: ruby
|
|
11
11
|
authors:
|
|
12
12
|
- Padrino Team
|
|
@@ -17,7 +17,7 @@ autorequire:
|
|
|
17
17
|
bindir: bin
|
|
18
18
|
cert_chain: []
|
|
19
19
|
|
|
20
|
-
date: 2010-03-
|
|
20
|
+
date: 2010-03-29 00:00:00 -07:00
|
|
21
21
|
default_executable:
|
|
22
22
|
dependencies:
|
|
23
23
|
- !ruby/object:Gem::Dependency
|
|
@@ -30,8 +30,8 @@ dependencies:
|
|
|
30
30
|
segments:
|
|
31
31
|
- 0
|
|
32
32
|
- 9
|
|
33
|
-
-
|
|
34
|
-
version: 0.9.
|
|
33
|
+
- 9
|
|
34
|
+
version: 0.9.9
|
|
35
35
|
type: :runtime
|
|
36
36
|
version_requirements: *id001
|
|
37
37
|
- !ruby/object:Gem::Dependency
|
|
@@ -44,8 +44,8 @@ dependencies:
|
|
|
44
44
|
segments:
|
|
45
45
|
- 0
|
|
46
46
|
- 9
|
|
47
|
-
-
|
|
48
|
-
version: 0.9.
|
|
47
|
+
- 9
|
|
48
|
+
version: 0.9.9
|
|
49
49
|
type: :runtime
|
|
50
50
|
version_requirements: *id002
|
|
51
51
|
- !ruby/object:Gem::Dependency
|
|
@@ -58,8 +58,8 @@ dependencies:
|
|
|
58
58
|
segments:
|
|
59
59
|
- 0
|
|
60
60
|
- 9
|
|
61
|
-
-
|
|
62
|
-
version: 0.9.
|
|
61
|
+
- 9
|
|
62
|
+
version: 0.9.9
|
|
63
63
|
type: :runtime
|
|
64
64
|
version_requirements: *id003
|
|
65
65
|
- !ruby/object:Gem::Dependency
|