comfy-admin-constructor 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -25,7 +25,6 @@ Upcoming Features
|
|
25
25
|
----------------
|
26
26
|
|
27
27
|
* Basic, passing tests will be generated for you
|
28
|
-
* The ability to force rake db:migrate, instead of having to run it manually
|
29
28
|
|
30
29
|
Quick Start Guide
|
31
30
|
-----------------
|
@@ -61,12 +60,16 @@ So, what happened there?
|
|
61
60
|
|
62
61
|
* CAC checked which admin_prefix we are using in CMS. (Defaults to **cms-admin**)
|
63
62
|
* The EventListing model was generated
|
64
|
-
* A migration was generated to create the necessary table for our database
|
63
|
+
* A migration was generated to create the necessary table for our database.
|
65
64
|
* A controller, complete with ActiveRecord rescues, success/failure flash messages, and more.
|
66
65
|
* Views for all the operations we'll need, along with a form. (Uses HAML if available, ERB if not)
|
67
66
|
* Added a new route
|
68
67
|
* Appended a new link to the navigation template
|
69
68
|
|
69
|
+
If you'd like the generated migration to be run automatically (along with any other pending migrations), simply include _migrate_ on the command line. Like so:
|
70
|
+
|
71
|
+
rails g cms_admin EventListing migrate title:string starts_at:datetime ends_at:datetime description:text location:string
|
72
|
+
|
70
73
|
That's it! CAC gives you all the basics. If you need to do something a little more complicated, it's easy to make any changes you like.
|
71
74
|
|
72
75
|
---
|
@@ -8,6 +8,7 @@ class CmsAdminGenerator < Rails::Generators::Base
|
|
8
8
|
source_root File.expand_path('../templates', __FILE__)
|
9
9
|
|
10
10
|
argument :model_name, :type => :string, :required => true
|
11
|
+
argument :do_migration, :type => :string, :required => true
|
11
12
|
argument :args_for_c_m, :type => :array, :required => true
|
12
13
|
|
13
14
|
def initialize(*args, &block)
|
@@ -22,6 +23,10 @@ class CmsAdminGenerator < Rails::Generators::Base
|
|
22
23
|
end
|
23
24
|
|
24
25
|
@model_attributes.uniq!
|
26
|
+
|
27
|
+
if do_migration == "migrate"
|
28
|
+
@do_migration = "migrate"
|
29
|
+
end
|
25
30
|
end
|
26
31
|
|
27
32
|
def create_model
|
@@ -69,6 +74,12 @@ class CmsAdminGenerator < Rails::Generators::Base
|
|
69
74
|
File.open(destination_path("app/views/#{admin_prefix}/_navigation#{template_file_type}"), "a") {|f| f.write(append)}
|
70
75
|
end
|
71
76
|
|
77
|
+
def do_migration_if_needed
|
78
|
+
if @do_migration == "migrate"
|
79
|
+
exec "rake db:migrate"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
72
83
|
private
|
73
84
|
|
74
85
|
def model_path
|