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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 06c7be23c7ae10ec7453fe2723556fa905027526
4
- data.tar.gz: f0ea206ff784742568a3e369fd03e25cf81b4be6
3
+ metadata.gz: c8c35162a53ed94b31f3e8219b487a76c6a0c826
4
+ data.tar.gz: daa652e57924b66ef4f68057b2ae22746c6ac5ba
5
5
  SHA512:
6
- metadata.gz: 892478245fcc3bc6969d89ae96c9094cc33cf39df3b1e421f144fbd6d7aea871ee61b8c93baef3630ccc1ed3e00061d323fc566cad89d02677a0ae21383b5130
7
- data.tar.gz: afdec5b62e8b640ae3c219dd626e8976811d40e15b1c2e206591481a07161addb7dbe3dbf2685cdbfdb0d30a9d3a3fa49239df1826429e3c16d1c7556384627a
6
+ metadata.gz: a7b90b2228eebaf966571fae839131277d8dbe27d316fcd170b34ab25761a1df414a309f04bdb968818519b431156543720d9f511b4635db35398f7c9d92740d
7
+ data.tar.gz: 7287233f2f10854768fadb6c8419e5a21f3fb1a369f286971fa60a0a4907d988ba82a7103a9b3bd06dd18810b5a02b2209a5b39b5dc1a4ae929a5e54609860fc
@@ -5,15 +5,14 @@ require "atchu/model"
5
5
  module Atchu
6
6
  extend self
7
7
 
8
- def load db_config
8
+ def for_db db_config
9
9
  Connection.connect db_config
10
- generate_models
10
+ self
11
11
  end
12
12
 
13
- private
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 "tmp"}
16
+ models.each{|model|ModelFileMaker.new(model).write_to output_folder}
18
17
  end
19
18
  end
@@ -1,4 +1,5 @@
1
1
  require "yaml"
2
+ require "active_record"
2
3
 
3
4
  module Atchu
4
5
  module Connection
@@ -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 "id" == primary_key || primary_key.nil? %>
4
+ <% unless primary_key.blank? %>
7
5
  <%= "self.primary_key = #{primary_key}" -%>
8
6
  <% end %>
9
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atchu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Deepak