rails-model_migrate 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +35 -0
- data/lib/rails-model_migrate.rb +6 -0
- data/lib/rails-model_migrate/active_record/generators/model_generator.rb +21 -0
- data/lib/rails-model_migrate/version.rb +3 -0
- data/rails-model_migrate.gemspec +23 -0
- metadata +66 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c74789e36c7849e201ed7bb933c299afcbd7e99b
|
4
|
+
data.tar.gz: a71782dcda04f9412c9f25c60ef04883ba314b5b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: eceeba256dd149763334f9f60674111fb4751f1d5196efda03b20ad421737f955ff90fae127bce253ea3a91ff4fdcfdf1874e9a7939662b1a1215bd8bad399c2
|
7
|
+
data.tar.gz: b49b0b78c52540fd1878e12480e8cf55cfd865303e46ea65ffc44aae1bf1cb0b4e4f933e29ef0165ea31b07f779c2974accd6d6ba5497b6eee959fdac04f5c75
|
data/.gitignore
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
*.rbc
|
2
|
+
*.sassc
|
3
|
+
.sass-cache
|
4
|
+
capybara-*.html
|
5
|
+
.rspec
|
6
|
+
.rvmrc
|
7
|
+
/.bundle
|
8
|
+
/vendor/bundle
|
9
|
+
/log/*
|
10
|
+
/tmp/*
|
11
|
+
/db/*.sqlite3
|
12
|
+
/public/system/*
|
13
|
+
/coverage/
|
14
|
+
/spec/tmp/*
|
15
|
+
**.orig
|
16
|
+
rerun.txt
|
17
|
+
pickle-email-*.html
|
18
|
+
.project
|
19
|
+
config/initializers/secret_token.rb
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 艾小童
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# rails-model_migrate
|
2
|
+
Automatic generation of migration directory.
|
3
|
+
|
4
|
+
## Requirements
|
5
|
+
|
6
|
+
* Ruby ~> 2.0.0
|
7
|
+
* Rails ~> 4.0.0
|
8
|
+
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Include the gem in your Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'rails-model_migrate'
|
16
|
+
```
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
```rails
|
20
|
+
g model data/article title:string
|
21
|
+
```
|
22
|
+
invoke active_record
|
23
|
+
create app/models/data/article.rb
|
24
|
+
create app/models/data.rb
|
25
|
+
create db/migrate/data/article/20140311041213_create_data_articles.rb
|
26
|
+
|
27
|
+
## Contributors
|
28
|
+
|
29
|
+
Special thanks to
|
30
|
+
|
31
|
+
* http://www.ihaveu.com/home team
|
32
|
+
|
33
|
+
## License
|
34
|
+
|
35
|
+
Copyright © 2014 Lijia Tong <user_tony@163.com> under The [MIT License](http://opensource.org/licenses/MIT).
|
@@ -0,0 +1,6 @@
|
|
1
|
+
require 'active_support'
|
2
|
+
require 'active_support/core_ext/module/aliasing'
|
3
|
+
require 'rails/generators'
|
4
|
+
require 'rails/generators/active_record'
|
5
|
+
require 'rails/generators/active_record/model/model_generator'
|
6
|
+
require 'rails-model_migrate/active_record/generators/model_generator'
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module ActiveRecord
|
2
|
+
module Generators # :nodoc:
|
3
|
+
class ModelGenerator < Base # :nodoc:
|
4
|
+
|
5
|
+
def create_migration_file_with_move
|
6
|
+
migration_template template_file, migration_file
|
7
|
+
end
|
8
|
+
|
9
|
+
protected
|
10
|
+
def template_file
|
11
|
+
# Rails.version.to_i < 4 ? 'migration.rb' : '../../migration/templates/create_table_migration.rb'
|
12
|
+
'../../migration/templates/create_table_migration.rb'
|
13
|
+
end
|
14
|
+
|
15
|
+
def migration_file
|
16
|
+
File.join(FileUtils.mkdir_p(File.join('db/migrate', class_path.join('/'), file_name)), "/create_#{table_name}.rb")
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
|
2
|
+
require 'rails-model_migrate/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = "rails-model_migrate"
|
6
|
+
s.version = RailsModelMigrate::VERSION
|
7
|
+
s.platform = Gem::Platform::RUBY
|
8
|
+
s.author = ['Lijia Tong']
|
9
|
+
s.email = ["user_tony@163.com"]
|
10
|
+
s.homepage = "https://github.com/user-tony/rails-model_migrate"
|
11
|
+
s.summary = "Automatic generation of migration directory."
|
12
|
+
s.description = ""
|
13
|
+
s.license = "MIT"
|
14
|
+
|
15
|
+
s.files = `git ls-files`.split("\n")
|
16
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
|
+
s.require_paths = %w[lib]
|
19
|
+
|
20
|
+
s.required_ruby_version = "~> 2.0.0"
|
21
|
+
s.add_dependency 'rails', '~> 4.0.0'
|
22
|
+
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails-model_migrate
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Lijia Tong
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.0.0
|
27
|
+
description: ''
|
28
|
+
email:
|
29
|
+
- user_tony@163.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- Gemfile
|
36
|
+
- LICENSE
|
37
|
+
- README.md
|
38
|
+
- lib/rails-model_migrate.rb
|
39
|
+
- lib/rails-model_migrate/active_record/generators/model_generator.rb
|
40
|
+
- lib/rails-model_migrate/version.rb
|
41
|
+
- rails-model_migrate.gemspec
|
42
|
+
homepage: https://github.com/user-tony/rails-model_migrate
|
43
|
+
licenses:
|
44
|
+
- MIT
|
45
|
+
metadata: {}
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options: []
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 2.0.0
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
requirements: []
|
61
|
+
rubyforge_project:
|
62
|
+
rubygems_version: 2.0.3
|
63
|
+
signing_key:
|
64
|
+
specification_version: 4
|
65
|
+
summary: Automatic generation of migration directory.
|
66
|
+
test_files: []
|