ez 0.9.5 → 0.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: 5cf4b1d3d88ed176c6158aa4a3d36bcf9839f7a6
4
- data.tar.gz: c883f390a67350f0eff832ae33c8d309ad50d24a
3
+ metadata.gz: d449963f12ea32f503884e2724536171d3a60406
4
+ data.tar.gz: d9ec82e7a73e827c5f515f32f63fb2a9203ad434
5
5
  SHA512:
6
- metadata.gz: 2504acb195bd45a35c4119049e5f289a345da9dfffb8add1ce47ca4ac0ed512bd9c8d619a50b92c7352ebac8a270e02f653ede15ac0d3792686c33b759e3591b
7
- data.tar.gz: 6c5b356cf56615a97e2bba4221a2c7e2ecc07587117642fba3fad44ed45ad3e4d5f61b5314d5c78a0963a296119174139b917278b6c576059edf0d7d85b1960d
6
+ metadata.gz: e396c4c062e446c78c3883da24fe501aed94b0c80e9996c49550bac0e5bfc581397d75307bcc5ad86e4a8b9c4ef2ea0de493509d76ab6968a6564581036a88fe
7
+ data.tar.gz: ab3b3e4f867a8f4b55621886c8269e3d88fad5bf7c56b0c5939d3fa0ee0e9fe016e79722f7b298c38b53dbac4c122c5280a1307e0dafb8c8555923c0e8754915
data/README.md CHANGED
@@ -2,10 +2,11 @@
2
2
 
3
3
  **Version 0.9.8**
4
4
 
5
- For educational purposes only, but I'm now using it on small production apps with no problems. Would love to get more real-world feedback.
6
-
7
5
  Makes domain modeling in Rails more beginner-friendly by avoiding migrations.
8
6
 
7
+ For educational purposes only.
8
+
9
+
9
10
  ## Usage
10
11
 
11
12
  ```ruby
@@ -138,6 +139,7 @@ Author
138
139
  * Shows helpful instructions when console starts, including the list of model classes found in the application.
139
140
  * Uses Hirb for table-like display. (Requires Hirb ~> 0.7.1)
140
141
  * Patches Hirb to allow nice table output for `ActiveRecord::Relation` lists (i.e. result of `.all`, `.where`) and hash-like output for single ActiveRecord objects, such as the result of `.find_by(:title => 'Apollo 13')`.
142
+ * `reload!` will automatically trigger the table updates from the console.
141
143
 
142
144
 
143
145
  ### 4. Controller and View Enhancements
data/lib/ez.rb CHANGED
@@ -17,6 +17,13 @@ module EZ
17
17
  Rake::Task["db:migrate"].enhance ["ez:tables"]
18
18
  end
19
19
 
20
+ config.to_prepare do
21
+ Rails.cache.fetch('ez-generate-yml-flag') do
22
+ EZ::DomainModeler.generate_models_yml
23
+ end
24
+ EZ::DomainModeler.update_tables
25
+ end
26
+
20
27
  console do |app|
21
28
  Hirb.enable(pager: false) if Rails.env.development? && defined?(Hirb)
22
29
 
@@ -27,10 +34,10 @@ module EZ
27
34
  tables = ActiveRecord::Base.connection.tables - ['schema_migrations']
28
35
  models = tables.map { |t| t.classify }
29
36
  if models.any?
30
- puts "Use this console to add, update, and delete rows from the database."
31
- puts
32
37
  puts "Models: #{models.to_sentence}"
33
38
  puts
39
+ puts "Use this console to add, update, and delete rows from the database."
40
+ puts
34
41
  puts "HINTS:"
35
42
  puts "* Type 'exit' (or press Ctrl-D) to when you're done."
36
43
  puts "* Press Ctrl-C if things seem to get stuck."
@@ -139,20 +139,14 @@ module EZ
139
139
 
140
140
  dead_tables.each do |table_name|
141
141
  model_name = table_name.classify
142
- display_change "Yo"
143
- display_change "Dropping model #{model_name}"
142
+ display_change "Dropping table #{table_name}"
144
143
  db.drop_table(table_name)
145
144
  begin
146
145
  filename = "app/models/#{model_name.underscore}.rb"
147
146
  code = IO.read(filename)
148
- matched = IO.read(filename) =~ /\s*class #{model_name} < ActiveRecord::Base\s+end\s*/
147
+ is_empty = IO.read(filename) =~ /\s*class #{model_name} < ActiveRecord::Base\s+end\s*/
149
148
 
150
- display_change "-" * 20
151
- display_change matched
152
- display_change code
153
- display_change "-" * 20
154
-
155
- if matched
149
+ if is_empty
156
150
  display_change "Deleting file #{filename}"
157
151
  File.unlink(filename)
158
152
  end
@@ -1,3 +1,3 @@
1
1
  module EZ
2
- VERSION = "0.9.5"
2
+ VERSION = "0.9.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ez
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Cohen