acts_as_hoc_avatarable 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/acts_as_hoc_avatarable/version.rb +1 -1
- data/lib/generators/install_generator.rb +14 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34e8b628f9935328c889ec5a6b5265714bfa5fc7
|
4
|
+
data.tar.gz: 28ef27baf47306c51db7f332952cb57b6b53c628
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a79bb9770d8d0ccfaca7313d6ce3016093d89ca9532dc35d5134e8d63308a28795f27a76d20ef0d75c20a5bf140e0f22bdda29059e77d07742de7ce561a3f1fb
|
7
|
+
data.tar.gz: b6f53392bc3918d5851a23243841ee10a99388b05bf7323ea7f03124e17074562f61aafc1951ddecd3578d338dbb97288c046b867ba7f091818e7b33abd978fe
|
@@ -1,6 +1,8 @@
|
|
1
|
+
require 'rails/generators/migration'
|
1
2
|
module ActsAsHocAvatarable
|
2
|
-
|
3
|
+
module Generators
|
3
4
|
class InstallGenerator < Rails::Generators::Base
|
5
|
+
include Rails::Generators::Migration
|
4
6
|
source_root File.expand_path('../templates', __FILE__)
|
5
7
|
|
6
8
|
def copy_initializer_file
|
@@ -10,6 +12,16 @@ module ActsAsHocAvatarable
|
|
10
12
|
def install_active_storage
|
11
13
|
rails_command 'activestorage::install'
|
12
14
|
end
|
15
|
+
|
16
|
+
def self.next_migration_number(dirname)
|
17
|
+
if ActiveRecord::Base.timestamped_migrations
|
18
|
+
sleep 1 # make sure each time we get a different timestamp
|
19
|
+
Time.new.utc.strftime("%Y%m%d%H%M%S")
|
20
|
+
else
|
21
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
13
25
|
end
|
14
|
-
|
26
|
+
end
|
15
27
|
end
|