ez_model 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +19 -10
- data/ez_model.gemspec +15 -6
- data/lib/ez_model/version.rb +1 -1
- metadata +41 -12
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# EZModel
|
2
|
-
Generate models and schema.rb from existing database just in one command line. If you prefer design ER diagram and export scripts to generate database schema, or if you have to work with a legacy database, this can save you
|
2
|
+
Generate models and schema.rb from existing database just in one command line. If you prefer design ER diagram and export scripts to generate database schema, or if you have to work with a legacy database, this can save you insane amount of time. All you need to do is to have a database.yml configuraiton file in ~/config/. Besides creating all models it sets proper table name and primary key if tables and columns naming doesn’t follow Rails convention. It also tries to read all foreign keys data from a database.
|
3
3
|
|
4
4
|
It uses [Rmre](https://github.com/bosko/rmre "Rmre") as underlying reverse engine to generate models. I made some modifications to Rmre to support mysql2 adapter, and had those auto-generated model files placed in a subfolder inside ~/app/models/ez_models/ instead of the default ~/app/models/, so that regenerating models will not overwrite the existing ones. Over the times, db schema can ge changed, all it needs is to run the command again to regenerate models, developers can feel free to add methods to the models classes in ~/app/models/ without worrying about being overwritten.
|
5
5
|
|
@@ -39,22 +39,31 @@ checkout mysql-workbench and its forward-engineering feature for more details ab
|
|
39
39
|
socket: /var/run/mysqld/mysqld.sock
|
40
40
|
|
41
41
|
###Generate models
|
42
|
-
|
43
|
-
|
42
|
+
cd to rails root directory
|
43
|
+
|
44
|
+
cd /path_to_rails_root
|
45
|
+
|
46
|
+
generate model files
|
47
|
+
it will take development as default db environment when environment is not specified
|
48
|
+
|
44
49
|
ezmodel -g
|
45
|
-
|
50
|
+
or
|
51
|
+
|
46
52
|
ezmodel -g -e development
|
47
53
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
54
|
+
generate model files and overwrite existing ones in ~/app/models/
|
55
|
+
use this command only if the model files in ~/app/models/ don't inherit EZModel::ActiveRecord
|
56
|
+
backup your models files is strongly suggested if you are not sure what it is doing
|
57
|
+
use it at your own risk
|
58
|
+
|
52
59
|
ezmodel -g -o
|
53
60
|
|
54
|
-
|
61
|
+
see help
|
62
|
+
|
55
63
|
ezmodel -h
|
56
64
|
|
57
|
-
|
65
|
+
see version
|
66
|
+
|
58
67
|
ezmodel -v
|
59
68
|
|
60
69
|
## Installation
|
data/ez_model.gemspec
CHANGED
@@ -6,24 +6,33 @@ require "rmre/version"
|
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
|
9
|
-
#
|
9
|
+
# Gem info
|
10
10
|
s.name = "ez_model"
|
11
11
|
s.version = ::EZModel::VERSION
|
12
12
|
s.platform = Gem::Platform::RUBY
|
13
|
-
s.date = "2012-04-
|
14
|
-
s.summary = "Generate model files just in one command line"
|
15
|
-
s.description = "Generate models and schema.rb from existing database just in one command line. If you prefer design ER diagram and export scripts to generate database schema, or if you have to work with a legacy database, this can save you
|
13
|
+
s.date = "2012-04-08"
|
14
|
+
s.summary = "%q{Generate model files just in one command line}"
|
15
|
+
s.description = "%q{ Generate models and schema.rb from existing database just in one command line. If you prefer design ER diagram and export scripts to generate database schema, or if you have to work with a legacy database, this can save you insane amount of time. All you need to do is to have a database.yml configuraiton file in ~/config/. Besides creating all models it sets proper table name and primary key if tables and columns naming doesn’t follow Rails convention. It also tries to read all foreign keys data from a database.
|
16
|
+
It uses Rmre as underlying reverse engine to generate models. I made some modifications to Rmre to support mysql2 adapter, and had those auto-generated model files placed in a subfolder inside ~/app/models/ez_models/ instead of the default ~/app/models/, so that regenerating models will not overwrite the existing ones. Over the times, db schema can ge changed, all it needs is to run the command again to regenerate models, developers can feel free to add methods to the models classes in ~/app/models/ without worrying about being overwritten.}"
|
17
|
+
|
18
|
+
# Author info
|
16
19
|
s.authors = ["Tianyu Huang"]
|
17
20
|
s.email = ["tianhsky@yahoo.com"]
|
18
21
|
s.homepage = "http://rubygems.org/gems/ez_model"
|
19
22
|
|
20
23
|
# Dependencies
|
21
|
-
|
24
|
+
s.required_rubygems_version = ">= 1.3.6"
|
25
|
+
s.add_dependency "activerecord", ">= 3.0.0"
|
26
|
+
s.add_dependency "erubis", "~> 2.6.6"
|
27
|
+
#s.add_development_dependency "rspec"
|
22
28
|
|
23
29
|
# Files
|
24
30
|
s.files = `git ls-files`.split("\n")
|
25
|
-
s.
|
31
|
+
s.require_paths = ["lib"]
|
26
32
|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
33
|
+
s.extra_rdoc_files = ["README.md", "LICENSE"]
|
34
|
+
|
35
|
+
|
27
36
|
|
28
37
|
|
29
38
|
end
|
data/lib/ez_model/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ez_model
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,15 +9,43 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
13
|
-
dependencies:
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
12
|
+
date: 2012-04-08 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activerecord
|
16
|
+
requirement: &72362480 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.0.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *72362480
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: erubis
|
27
|
+
requirement: &72362180 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.6.6
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *72362180
|
36
|
+
description: ! "%q{\tGenerate models and schema.rb from existing database just in
|
37
|
+
one command line. If you prefer design ER diagram and export scripts to generate
|
38
|
+
database schema, or if you have to work with a legacy database, this can save you
|
39
|
+
insane amount of time. All you need to do is to have a database.yml configuraiton
|
40
|
+
file in ~/config/. Besides creating all models it sets proper table name and primary
|
41
|
+
key if tables and columns naming doesn’t follow Rails convention. It also tries
|
42
|
+
to read all foreign keys data from a database.\n\tIt uses Rmre as underlying reverse
|
43
|
+
engine to generate models. I made some modifications to Rmre to support mysql2 adapter,
|
44
|
+
and had those auto-generated model files placed in a subfolder inside ~/app/models/ez_models/
|
45
|
+
instead of the default ~/app/models/, so that regenerating models will not overwrite
|
46
|
+
the existing ones. Over the times, db schema can ge changed, all it needs is to
|
47
|
+
run the command again to regenerate models, developers can feel free to add methods
|
48
|
+
to the models classes in ~/app/models/ without worrying about being overwritten.}"
|
21
49
|
email:
|
22
50
|
- tianhsky@yahoo.com
|
23
51
|
executables:
|
@@ -25,6 +53,7 @@ executables:
|
|
25
53
|
extensions: []
|
26
54
|
extra_rdoc_files:
|
27
55
|
- README.md
|
56
|
+
- LICENSE
|
28
57
|
files:
|
29
58
|
- .gitignore
|
30
59
|
- LICENSE
|
@@ -59,12 +88,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
59
88
|
requirements:
|
60
89
|
- - ! '>='
|
61
90
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
91
|
+
version: 1.3.6
|
63
92
|
requirements: []
|
64
93
|
rubyforge_project:
|
65
94
|
rubygems_version: 1.8.17
|
66
95
|
signing_key:
|
67
96
|
specification_version: 3
|
68
|
-
summary: Generate model files just in one command line
|
97
|
+
summary: ! '%q{Generate model files just in one command line}'
|
69
98
|
test_files: []
|
70
99
|
has_rdoc:
|