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.
Files changed (4) hide show
  1. data/README.md +19 -10
  2. data/ez_model.gemspec +15 -6
  3. data/lib/ez_model/version.rb +1 -1
  4. 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 insame 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.
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
- # generate model files
43
- # it will take development as default db environment when environment is not specified
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
- #or
50
+ or
51
+
46
52
  ezmodel -g -e development
47
53
 
48
- # generate model files and overwrite existing ones in ~/app/models/
49
- # use this command only if the model files in ~/app/models/ don't inherit EZModel::ActiveRecord
50
- # backup your models files is strongly suggested if you are not sure what it is doing
51
- # use it at your own risk
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
- # see help
61
+ see help
62
+
55
63
  ezmodel -h
56
64
 
57
- # see version
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
- # Basic info
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-10"
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 insame 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."
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
- # s.required_rubygems_version = ">= 1.3.6"
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.extra_rdoc_files = ["README.md"]
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
@@ -1,3 +1,3 @@
1
1
  module EZModel
2
- VERSION = "1.0.1" unless defined?(::EZModel::VERSION)
2
+ VERSION = "1.0.2" unless defined?(::EZModel::VERSION)
3
3
  end
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.1
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-10 00:00:00.000000000 Z
13
- dependencies: []
14
- description: Generate models and schema.rb from existing database just in one command
15
- line. If you prefer design ER diagram and export scripts to generate database schema,
16
- or if you have to work with a legacy database, this can save you insame amount of
17
- time. All you need to do is to have a database.yml configuraiton file in ~/config/.
18
- Besides creating all models it sets proper table name and primary key if tables
19
- and columns naming doesn’t follow Rails convention. It also tries to read all foreign
20
- keys data from a database.
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: '0'
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: