ez 0.9.9 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -7
- data/lib/ez/domain_modeler.rb +7 -3
- data/lib/ez/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc7371a54621cea994857087bcf5d613e717247c
|
4
|
+
data.tar.gz: 97ba31197de369c56fa907d157508ac5a82b3da4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b579317552b30d8b6619ca7ad3cd03768e1a5cb036ba1779fd7c8d9fab8fa307039df0bc92faf43098a29f1a47032eb6fbb05e2bd6f0ce072b148dc187f9ed6
|
7
|
+
data.tar.gz: 5273b89d19801fcfb4844672bf401be35f8da0e4a0ba9bf9c74ba64629ce7227d8dd88959921870eab9d508a98f68af9fd7403db77b18cfd10c8a8b33c517be7
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# EZ
|
2
2
|
|
3
|
-
**Version 0.9.
|
3
|
+
**Version 0.9.9**
|
4
4
|
|
5
5
|
*For educational purposes only.*
|
6
6
|
|
@@ -22,11 +22,11 @@ Then:
|
|
22
22
|
|
23
23
|
## Summary of Best Practices
|
24
24
|
|
25
|
-
1. Use `db/models.yml` to define your schema. Foreign-key indexes will be generated automatically. (This should cover 100% of what most beginners will ever need to do.)
|
25
|
+
1. Use `db/models.yml` to define your schema. Foreign-key indexes will be generated automatically. (This step by itself should cover 100% of what most beginners will ever need to do.)
|
26
26
|
|
27
27
|
2. Use Rails migrations for any additional indexes, database constraints, etc.
|
28
28
|
|
29
|
-
3.
|
29
|
+
3. Overall, just use `rake db:migrate` as usual.
|
30
30
|
|
31
31
|
|
32
32
|
|
@@ -38,11 +38,10 @@ Then:
|
|
38
38
|
* Enables **instant domain modeling without migrations** by using a file named `db/models.yml`.
|
39
39
|
* No new rake tasks to learn. This gem enhances `db:migrate` to incorporate the `db/models.yml` file automatically.
|
40
40
|
* You can run `rake db:migrate` to initially generate a file named `db/models.yml`. It will have some self-documenting comments inside of it.
|
41
|
-
* In development mode, there's no need to ever run `rake db:migrate`! Every
|
41
|
+
* In development mode, there's no need to ever run `rake db:migrate`! Every browser request will trigger automatic table updates.
|
42
42
|
* In the rails console, 'reload!' will also trigger table updates.
|
43
|
-
* If you prefer,
|
44
|
-
* `rake db:migrate` will run any pending migrations *after*
|
45
|
-
|
43
|
+
* If you prefer, just run `rake db:migrate` whenever you modify `db/models.yml`.
|
44
|
+
* `rake db:migrate` will run any pending migrations *after* any table updates from the `db/models.yml` file.
|
46
45
|
|
47
46
|
|
48
47
|
**Syntax Guide for `db/models.yml`**
|
data/lib/ez/domain_modeler.rb
CHANGED
@@ -89,8 +89,8 @@ module EZ
|
|
89
89
|
parse_model_spec
|
90
90
|
|
91
91
|
# puts "@spec:"
|
92
|
-
puts @spec.inspect
|
93
|
-
puts "-" * 10
|
92
|
+
# puts @spec.inspect
|
93
|
+
# puts "-" * 10
|
94
94
|
end
|
95
95
|
|
96
96
|
def load_model_specs(filename = "db/models.yml")
|
@@ -136,11 +136,15 @@ module EZ
|
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
139
|
-
default_column_value =
|
139
|
+
default_column_value = nil
|
140
140
|
DEFAULT_VALUE_REGEXES.each { |r| default_column_value = $1 if column_type.sub!(r, '') }
|
141
141
|
default_column_value = default_column_value.to_i if column_type == 'integer'
|
142
142
|
default_column_value = default_column_value.to_f if column_type == 'float'
|
143
143
|
|
144
|
+
if column_type == 'boolean'
|
145
|
+
default_column_value = default_column_value.present? && default_column_value.downcase.strip == 'true'
|
146
|
+
end
|
147
|
+
|
144
148
|
@spec[model][column_name] = { type: column_type, default: default_column_value}
|
145
149
|
@spec[model][column_name][:index] = true if column_name =~ /_id$/
|
146
150
|
end
|
data/lib/ez/version.rb
CHANGED