ez 1.9.5 → 1.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 23741b055d44d8d123491ccd2a7676adb29e9628
4
- data.tar.gz: 6aa4ee49e84f7292d1bd15ba75137d9252998bb1
3
+ metadata.gz: 0d5f08d735f9d0fcb9f1e403ffefefbd428d73df
4
+ data.tar.gz: 1e14407a8a84fd64cd0fd6a0d5d2d9c7c8386e52
5
5
  SHA512:
6
- metadata.gz: ce7f8f3d5a37df1ef946eb7c61af86f198b384b888f355672899f81c7a134598da0843c884ac24a1f2230d44f75a175043fd10d902df6533d61843303bc3cd9e
7
- data.tar.gz: a957967674e15ccd67462a47be72d8dfa25b7d95db7a9b77563396da63dc525c2ee632138530763af338c6629219abbc87e40cca5c32b6dd549c991cd5b6e538
6
+ metadata.gz: 1545fd8ce47e83a19bf548b243946990bf2da2bd4855e4c90e16d00ece86b8fc3b1691b109700959252c9f5b1c169958db02b06f2eece06423d4ff881aa18171
7
+ data.tar.gz: 95e42626242635526809c63146e2f6b6fa80207a1fda82cd262fffccc60f4734c1470fe5aff0f8b5f008f812ad329960d06ccd955f6e66f2c4a3004915a4d406
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Easy domain modeling in Rails without migrations.
4
4
 
5
- **Version 1.9.4**
5
+ **Version 1.9.6**
6
6
 
7
7
  *For educational purposes only.*
8
8
 
@@ -13,9 +13,10 @@ _NOTE: For Rails < 5.0, use version 1.3_.
13
13
  ### Highlights
14
14
 
15
15
  * Applies schema changes based on a file named `db/models.yml`.
16
- * Schema changes are applied by running `rails server`, `rails console`, or `reload!` in the console.
17
- * Diffs are determined automatically and applied to the database.
18
- * Embraces Rails' column naming conventions by inferring columns types based on the name.
16
+ * Schema migrations are determined automatically and applied to the database.
17
+ * Optionally generates routes, controllers, and/or views based on the models.
18
+ * Schema migrations are applied by running `rails server`, `rails console`, or by typing `reload!` in the console. `rails db:migrate` is not affected.
19
+ * Embraces Rails column naming conventions by inferring columns types based on the name.
19
20
  * Enhances the Rails Console with customized AwesomePrint and Hirb integration
20
21
  * Adds two new ActiveRecord methods: `.sample(n = 1)` and `.none?`
21
22
 
@@ -27,11 +28,14 @@ gem 'ez'
27
28
  ```
28
29
 
29
30
  Start the server or console to force the initial generation of
30
- `db/models.yml` and a hidden configuration file named `.ez`.
31
+ `db/models.yml`.
31
32
 
32
- Alternatively, you can run `rails db:migrate` to generate these files without running your app.
33
+ If a file named `.ez` in the project directory is present, or in the user's home folder,
34
+ it controls the behavior of the gem.
33
35
 
34
- ### Usage
36
+ Alternatively, you can run `rails ez:generate_yml` to generate these files without running your app.
37
+
38
+ ### Usage and Configuration
35
39
 
36
40
  1. Use `db/models.yml` to define your schema. Database schema changes are applied directly without affecting migrations. (`rails db:migrate` will also trigger the changes).
37
41
  2. Foreign-key indexes are generated automatically.
@@ -48,7 +52,7 @@ Alternatively, you can run `rails db:migrate` to generate these files without ru
48
52
  |controllers|true|Generates one controller per model with 7 empty methods.
49
53
  |views|true|Generates the view folder for each model, with 7 empty views.
50
54
 
51
- ## Development vs Production
55
+ ## WARNING! Development vs Production
52
56
 
53
57
  Renaming a column in `db/models.yml` appear to the gem as if you dropped
54
58
  the old column and created a new column. **You will lose any data you
@@ -56,8 +60,9 @@ had in that column**. Same goes for renaming models: the old table
56
60
  will be dropped.
57
61
 
58
62
  In production, this could be catastrophic. Therefore, this gem will
59
- not delete tables or columns in production, only add tables and add
60
- columns. This could be problematic but is hopefully the 1% case.
63
+ **not delete tables or columns in production**, but only add tables and add
64
+ columns. This could be problematic for apps that need to drop tables
65
+ or columns from the production database, but this hopefully an edge case.
61
66
 
62
67
 
63
68
  ## Syntax Guide for `db/models.yml`
@@ -151,9 +156,20 @@ to control the schema. It is ok to use both migrations
151
156
  and `models.yml`, but be aware of the following:
152
157
 
153
158
  * If at least one migration file is detected, this gem will not
154
- removing tables that would normally removed via `models.yml` since
155
- it's not possible to know if the table is supposed to be there or not.
156
- * Where possible, it's best to translate a migration required for
159
+ remove tables in development mode that would normally removed via `models.yml` because
160
+ it is not possible to know if the table is controlled by migrations or not.
161
+ * Wherever possible, it's best to translate a migration required for
157
162
  a third-party gem (say, for Devise) into an entry in models.yml
158
163
  so that everything is managed in one place.
159
- Pull requests for integrating such features into `ez` are encouraged.
164
+ * Pull requests for integrating new features into `ez` are encouraged.
165
+
166
+ ### Switching To Rails Migrations
167
+
168
+ There will (hopefully) come a time when the student wishes to graduate to
169
+ proper database migrations, probably for managing a production application.
170
+ To switch to normal Rails migrations:
171
+
172
+ 1. Remove the `ez` gem and run `bundle install`
173
+ 2. Delete any `.ez` file in the project root
174
+
175
+ From this point forward, migrations can be used as expected.
@@ -31,7 +31,7 @@ module EZ
31
31
  if @changed
32
32
  puts "\n(No changes were actually made)" if @dry_run
33
33
  else
34
- puts "All tables are up-to-date."
34
+ # puts "All tables are up-to-date."
35
35
  if @dry_run
36
36
  puts "\nNo changes would be made."
37
37
  end
data/lib/ez/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module EZ
2
- VERSION = "1.9.5"
2
+ VERSION = "1.9.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ez
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.5
4
+ version: 1.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Cohen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-07 00:00:00.000000000 Z
11
+ date: 2018-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print