avo-setup 0.0.18 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/avo-setup/version.rb +1 -1
- data/lib/generators/avo/setup_generator.rb +13 -1
- metadata +2 -2
data/lib/avo-setup/version.rb
CHANGED
@@ -2,6 +2,7 @@ module Avo
|
|
2
2
|
module Generators
|
3
3
|
class SetupGenerator < Rails::Generators::Base
|
4
4
|
source_root File.expand_path("../templates", __FILE__)
|
5
|
+
include Rails::Generators::Migration
|
5
6
|
|
6
7
|
def setup
|
7
8
|
if yes?("Would you like to generate a layout?")
|
@@ -17,7 +18,7 @@ module Avo
|
|
17
18
|
if yes?("Would you like to use CanCan")
|
18
19
|
gem("cancan")
|
19
20
|
copy_file "ability.rb", "models/ability.rb"
|
20
|
-
|
21
|
+
migration_template 'create_roles_migration.rb', "db/migrate/create_roles.rb"
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
@@ -26,6 +27,17 @@ module Avo
|
|
26
27
|
def file_name
|
27
28
|
layout_name.underscore
|
28
29
|
end
|
30
|
+
|
31
|
+
def self.next_migration_number(dirname)
|
32
|
+
if ActiveRecord::Base.timestamped_migrations
|
33
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
34
|
+
else
|
35
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
|
29
41
|
end
|
30
42
|
end
|
31
43
|
end
|