ez 0.8.7 → 0.9.0
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 +4 -4
- data/lib/ez.rb +14 -12
- data/lib/ez/schema_modifier.rb +2 -5
- data/lib/ez/version.rb +1 -1
- data/lib/tasks/ez_tasks.rake +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: 16c7b16c893b65e45e3261b8c9e71c7bf14da0c6
|
|
4
|
+
data.tar.gz: 546f01535e552ed763b5487176109c1b853f872a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3212cb743e5346d611dd94a02aaa798e1bce0f5939debd000e326d810ac3349a7e9c4fabfc8051e40054ce87bac8fc69dc7642e255e7ad49512ff8f61f3415fe
|
|
7
|
+
data.tar.gz: 06ee3f279e4d1b6385b026ba0e10b3c3b7335b6d324913072164d04b7fc6a35ffbcf80c7b081d8b7d9bb90ecff09bcc824db36b5ea3dc15c58e2ba477e0d589a
|
data/lib/ez.rb
CHANGED
|
@@ -15,7 +15,7 @@ module EZ
|
|
|
15
15
|
end
|
|
16
16
|
|
|
17
17
|
console do
|
|
18
|
-
Hirb.enable if defined?(Hirb)
|
|
18
|
+
Hirb.enable if Rails.env.development? && defined?(Hirb)
|
|
19
19
|
# context.back_trace_limit = 0
|
|
20
20
|
|
|
21
21
|
I18n.enforce_available_locales = false
|
|
@@ -53,18 +53,20 @@ module EZ
|
|
|
53
53
|
# end
|
|
54
54
|
# end
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if output.is_a?(ActiveRecord::Base)
|
|
65
|
-
Hash
|
|
56
|
+
if Rails.env.development?
|
|
57
|
+
module ::Hirb
|
|
58
|
+
# A Formatter object formats an output object (using Formatter.format_output) into a string based on the views defined
|
|
59
|
+
# for its class and/or ancestry.
|
|
60
|
+
class Formatter
|
|
61
|
+
def determine_output_class(output)
|
|
62
|
+
if output.respond_to?(:to_a) && to_a_classes.any? {|e| output.is_a?(e) }
|
|
63
|
+
Array(output)[0].class
|
|
66
64
|
else
|
|
67
|
-
output.
|
|
65
|
+
if output.is_a?(ActiveRecord::Base)
|
|
66
|
+
Hash
|
|
67
|
+
else
|
|
68
|
+
output.class
|
|
69
|
+
end
|
|
68
70
|
end
|
|
69
71
|
end
|
|
70
72
|
end
|
data/lib/ez/schema_modifier.rb
CHANGED
|
@@ -85,7 +85,7 @@ module EZ
|
|
|
85
85
|
end
|
|
86
86
|
end
|
|
87
87
|
filename = "app/models/#{model_name.underscore}.rb"
|
|
88
|
-
unless File.exists?(filename)
|
|
88
|
+
unless Rails.env.production? || File.exists?(filename)
|
|
89
89
|
display_change "Creating new model file: #{filename}"
|
|
90
90
|
File.open(filename, "w") do |f|
|
|
91
91
|
f.puts "class #{model_name} < ActiveRecord::Base"
|
|
@@ -139,10 +139,7 @@ module EZ
|
|
|
139
139
|
end
|
|
140
140
|
|
|
141
141
|
def connect_to_database
|
|
142
|
-
ActiveRecord::Base.establish_connection
|
|
143
|
-
adapter: 'sqlite3',
|
|
144
|
-
database: "db/development.sqlite3",
|
|
145
|
-
})
|
|
142
|
+
ActiveRecord::Base.establish_connection
|
|
146
143
|
@db = ActiveRecord::Base.connection
|
|
147
144
|
end
|
|
148
145
|
|
data/lib/ez/version.rb
CHANGED
data/lib/tasks/ez_tasks.rake
CHANGED
|
@@ -29,7 +29,7 @@ EOS
|
|
|
29
29
|
task :tables => :environment do
|
|
30
30
|
if File.exists?('db/models.yml')
|
|
31
31
|
EZ::DomainModeler.update_tables
|
|
32
|
-
Rake::Task["db:schema:dump"].invoke
|
|
32
|
+
Rake::Task["db:schema:dump"].invoke unless Rails.env.production?
|
|
33
33
|
else
|
|
34
34
|
emit_help_page
|
|
35
35
|
Rake::Task["ez:generate_yml"].invoke
|