models_generator 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +1 -0
- data/README.md +14 -4
- data/lib/generators/rails/models_generator.rb +1 -0
- data/lib/generators/rails/templates/fabricator.rb.erb +7 -0
- data/lib/models_generator/version.rb +1 -1
- metadata +26 -46
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 23198eef98a0da4b2cc59e387431362a69d9c9f3
|
4
|
+
data.tar.gz: 1f1f54f30d8efe9f84c260e4a867ae6523454e56
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bce181cf77d206bd367bd307835a30fc947aa7e66995c61eaecb96f41f0a243a891c1ecd5785a3fca97e5613a5f1365b56e4653c8de87728f8de3cb0792219ee
|
7
|
+
data.tar.gz: 5e31790e83aa48553b87b605e83c8c4be69b895c1b2a59d79a0935799b38a564498026c3d43cec5b4256b00afcf9486eda4a3352f4ffe81a362c892364b2aea7
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# ModelsGenerator
|
2
2
|
|
3
|
-
[![Build Status](https://secure.travis-ci.org/DianthuDia/models_generator.png)](http://travis-ci.org/DianthuDia/models_generator)
|
3
|
+
[![Build Status](https://secure.travis-ci.org/DianthuDia/models_generator.png)](http://travis-ci.org/DianthuDia/models_generator)
|
4
|
+
[![Dependency Status](https://gemnasium.com/DianthuDia/models_generator.png)](https://gemnasium.com/DianthuDia/models_generator)
|
5
|
+
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/DianthuDia/models_generator)
|
4
6
|
|
5
7
|
A model files generator plugin from migrate file
|
6
8
|
|
@@ -62,10 +64,18 @@ Run the following generator command, then edit the generated file.
|
|
62
64
|
|
63
65
|
`$ rails g models_generator:config`
|
64
66
|
|
67
|
+
## Recommend plugins
|
68
|
+
* [master_cache](https://rubygems.org/gems/master_cache)
|
69
|
+
* 'models_generator' plugin integrated 'master_cache'
|
70
|
+
|
71
|
+
* [schema_plus](https://rubygems.org/gems/schema_plus)
|
72
|
+
* [schema_associations](https://rubygems.org/gems/schema_associations)
|
73
|
+
* These plugin auto resolve relation (belongs_to, have_many...)
|
74
|
+
|
65
75
|
## Supported versions
|
66
76
|
|
67
|
-
* Ruby 1.8.7, 1.9.3
|
68
|
-
* ActiveRecord 3.x
|
77
|
+
* Ruby 1.8.7, 1.9.3, 2.1.0
|
78
|
+
* ActiveRecord 3.x, 4.x
|
69
79
|
|
70
80
|
## Contributing
|
71
81
|
|
@@ -77,4 +87,4 @@ Run the following generator command, then edit the generated file.
|
|
77
87
|
|
78
88
|
## License
|
79
89
|
|
80
|
-
MIT License. Copyright 2012 DianthuDia.
|
90
|
+
MIT License. Copyright 2012 DianthuDia.
|
@@ -23,6 +23,7 @@ class Rails::ModelsGenerator < ActiveRecord::Generators::ModelGenerator
|
|
23
23
|
clear_instance_variables pluralize_table_names? ? tbl_name.singularize : tbl_name
|
24
24
|
template 'model.rb.erb', File.join('app/models', class_path, "#{file_name}.rb")
|
25
25
|
template 'model_spec.rb.erb', File.join('spec/models', class_path, "#{file_name}_spec.rb")
|
26
|
+
template 'fabricator.rb.erb', File.join('spec/fabricators', class_path, "#{file_name}_fabricator.rb")
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
Fabricator(<%= class_name.match(/::/) ? "'#{class_name}'" : ":#{singular_name}" %>) do
|
3
|
+
<% width = attributes.map{|a| a.name.size }.max.to_i -%>
|
4
|
+
<% attributes.each do |attribute| -%>
|
5
|
+
<%= "%-#{width}s %s" % [attribute.name, attribute.default.inspect] %>
|
6
|
+
<% end -%>
|
7
|
+
end
|
metadata
CHANGED
@@ -1,126 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: models_generator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- DianthuDia
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-01-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activerecord
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 3.0.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ">="
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 3.0.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rspec
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: guard
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - ">="
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - ">="
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: rb-fsevent
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - ">="
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - ">="
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: guard-bundler
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - ">="
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '0'
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - ">="
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: '0'
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: guard-rspec
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - ">="
|
116
102
|
- !ruby/object:Gem::Version
|
117
103
|
version: '0'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- -
|
108
|
+
- - ">="
|
124
109
|
- !ruby/object:Gem::Version
|
125
110
|
version: '0'
|
126
111
|
description: A model files generator plugin from migrate file
|
@@ -130,9 +115,9 @@ executables: []
|
|
130
115
|
extensions: []
|
131
116
|
extra_rdoc_files: []
|
132
117
|
files:
|
133
|
-
- .gitignore
|
134
|
-
- .rspec
|
135
|
-
- .travis.yml
|
118
|
+
- ".gitignore"
|
119
|
+
- ".rspec"
|
120
|
+
- ".travis.yml"
|
136
121
|
- Gemfile
|
137
122
|
- Guardfile
|
138
123
|
- LICENSE.txt
|
@@ -141,6 +126,7 @@ files:
|
|
141
126
|
- lib/generators/master_cache/config_generator.rb
|
142
127
|
- lib/generators/master_cache/templates/models_generator_config.rb
|
143
128
|
- lib/generators/rails/models_generator.rb
|
129
|
+
- lib/generators/rails/templates/fabricator.rb.erb
|
144
130
|
- lib/generators/rails/templates/model.rb.erb
|
145
131
|
- lib/generators/rails/templates/model_spec.rb.erb
|
146
132
|
- lib/models_generator.rb
|
@@ -151,34 +137,28 @@ files:
|
|
151
137
|
- spec/spec_helper.rb
|
152
138
|
homepage: https://github.com/DianthuDia/models_generator
|
153
139
|
licenses: []
|
140
|
+
metadata: {}
|
154
141
|
post_install_message:
|
155
142
|
rdoc_options: []
|
156
143
|
require_paths:
|
157
144
|
- lib
|
158
145
|
required_ruby_version: !ruby/object:Gem::Requirement
|
159
|
-
none: false
|
160
146
|
requirements:
|
161
|
-
- -
|
147
|
+
- - ">="
|
162
148
|
- !ruby/object:Gem::Version
|
163
149
|
version: '0'
|
164
|
-
segments:
|
165
|
-
- 0
|
166
|
-
hash: -3608145962022338579
|
167
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
|
-
none: false
|
169
151
|
requirements:
|
170
|
-
- -
|
152
|
+
- - ">="
|
171
153
|
- !ruby/object:Gem::Version
|
172
154
|
version: '0'
|
173
|
-
segments:
|
174
|
-
- 0
|
175
|
-
hash: -3608145962022338579
|
176
155
|
requirements: []
|
177
156
|
rubyforge_project:
|
178
|
-
rubygems_version:
|
157
|
+
rubygems_version: 2.2.0
|
179
158
|
signing_key:
|
180
|
-
specification_version:
|
159
|
+
specification_version: 4
|
181
160
|
summary: models_generator generate app/modes/*.rb from migration file
|
182
161
|
test_files:
|
183
162
|
- spec/models_generator/config_spec.rb
|
184
163
|
- spec/spec_helper.rb
|
164
|
+
has_rdoc:
|