migration_and_model 0.1.0 → 0.2.0
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d70ea6f283ec89d477f1e26cff6ee3470fb12d6e599ca242caead34c180f3a39
|
4
|
+
data.tar.gz: 0535731aed7cb141a2d24a36880a8df3d6d26f0c3ecceaba4ea498a4b101e028
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6558ad0fe30cdc5f7948f8f2d084332d0d8f26cc46a6703abca3568011f8aecd69c17b402f179dc5cc81894ef746333855a7250c7e01813deb2dfe3e8b791e30
|
7
|
+
data.tar.gz: af9bd0a290a500ed7e903eae7b2bd2b71ea6f9b7ece17b99261849f90f30b251b91e3a7747eea16fe75325814ddd29e7071e450c5279eab34a99135c7eec2181
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module MigrationAndModel
|
2
|
+
class InstallGenerator < Rails::Generators::NamedBase
|
3
|
+
source_root File.expand_path('templates', __dir__)
|
4
|
+
include Rails::Generators::Migration
|
5
|
+
|
6
|
+
desc "Create your own migrations"
|
7
|
+
|
8
|
+
def self.next_migration_number(path)
|
9
|
+
next_migration_number = current_migration_number(path) + 1
|
10
|
+
ActiveRecord::Migration.next_migration_number(next_migration_number)
|
11
|
+
end
|
12
|
+
|
13
|
+
def copy_migrations
|
14
|
+
migration_template "my_migration.rb", "db/migrate/create_#{file_name.pluralize}.rb"
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_model
|
18
|
+
create_file "app/models/#{file_name}.rb", <<-FILE
|
19
|
+
class #{class_name} < ApplicationRecord
|
20
|
+
end
|
21
|
+
FILE
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: migration_and_model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shivam Jain
|
@@ -69,8 +69,11 @@ files:
|
|
69
69
|
- Rakefile
|
70
70
|
- bin/console
|
71
71
|
- bin/setup
|
72
|
+
- lib/generators/migration_and_model/install_generator.rb
|
73
|
+
- lib/generators/migration_and_model/templates/my_migration.rb
|
72
74
|
- lib/migration_and_model.rb
|
73
75
|
- lib/migration_and_model/version.rb
|
76
|
+
- migration_and_model-0.1.0.gem
|
74
77
|
- migration_and_model.gemspec
|
75
78
|
homepage: https://www.github.com/shivamvinsol
|
76
79
|
licenses:
|