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.
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "0.0.18"
2
+ VERSION = "0.0.19"
3
3
  end
@@ -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
- migration_template 'create_roles_migration.rb', "db/migrate/create_roles.rb"
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
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 18
9
- version: 0.0.18
8
+ - 19
9
+ version: 0.0.19
10
10
  platform: ruby
11
11
  authors:
12
12
  - Avocado