atchu 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/atchu.rb +4 -5
- data/lib/atchu/connection.rb +1 -0
- data/lib/atchu/template/model.eruby +1 -3
- 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: c8c35162a53ed94b31f3e8219b487a76c6a0c826
|
4
|
+
data.tar.gz: daa652e57924b66ef4f68057b2ae22746c6ac5ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7b90b2228eebaf966571fae839131277d8dbe27d316fcd170b34ab25761a1df414a309f04bdb968818519b431156543720d9f511b4635db35398f7c9d92740d
|
7
|
+
data.tar.gz: 7287233f2f10854768fadb6c8419e5a21f3fb1a369f286971fa60a0a4907d988ba82a7103a9b3bd06dd18810b5a02b2209a5b39b5dc1a4ae929a5e54609860fc
|
data/lib/atchu.rb
CHANGED
@@ -5,15 +5,14 @@ require "atchu/model"
|
|
5
5
|
module Atchu
|
6
6
|
extend self
|
7
7
|
|
8
|
-
def
|
8
|
+
def for_db db_config
|
9
9
|
Connection.connect db_config
|
10
|
-
|
10
|
+
self
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
def generate_models
|
13
|
+
def generate_models_at output_folder
|
15
14
|
tables = Connection.get.tables
|
16
15
|
models = tables.map{|table| Model.for_table(table)}
|
17
|
-
models.each{|model|ModelFileMaker.new(model).write_to
|
16
|
+
models.each{|model|ModelFileMaker.new(model).write_to output_folder}
|
18
17
|
end
|
19
18
|
end
|
data/lib/atchu/connection.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
class <%= class_name %> < ActiveRecord::Base
|
2
|
-
<% unless class_name == table_name %>
|
3
2
|
<%= "self.table_name = '#{table_name}'" -%>
|
4
|
-
<% end %>
|
5
3
|
|
6
|
-
<% unless
|
4
|
+
<% unless primary_key.blank? %>
|
7
5
|
<%= "self.primary_key = #{primary_key}" -%>
|
8
6
|
<% end %>
|
9
7
|
|