kwatable 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/COPYING +340 -0
  2. data/ChangeLog.txt +27 -0
  3. data/README.txt +81 -0
  4. data/bin/kwatable +20 -0
  5. data/examples/ex1/Makefile +34 -0
  6. data/examples/ex1/example1.yaml +85 -0
  7. data/examples/ex2/Makefile +34 -0
  8. data/examples/ex2/example2.yaml +94 -0
  9. data/kwatable.gemspec +48 -0
  10. data/lib/kwatable.rb +31 -0
  11. data/lib/kwatable/error-msg.rb +37 -0
  12. data/lib/kwatable/kwatable.schema.yaml +133 -0
  13. data/lib/kwatable/main-program.rb +197 -0
  14. data/lib/kwatable/manufactory.rb +213 -0
  15. data/lib/kwatable/templates/ddl-mysql.eruby +169 -0
  16. data/lib/kwatable/templates/ddl-postgresql.eruby +153 -0
  17. data/lib/kwatable/templates/defaults.yaml +87 -0
  18. data/lib/kwatable/templates/dto-java.eruby +204 -0
  19. data/lib/kwatable/templates/dto-ruby.eruby +180 -0
  20. data/setup.rb +1331 -0
  21. data/test/assert-diff.rb +44 -0
  22. data/test/test.rb +202 -0
  23. data/test/test1/test1.ddl-mysql.expected +22 -0
  24. data/test/test1/test1.ddl-postgresql.expected +22 -0
  25. data/test/test1/test1.dto-java.Group.expected +32 -0
  26. data/test/test1/test1.dto-java.User.expected +59 -0
  27. data/test/test1/test1.dto-ruby.Group.expected +21 -0
  28. data/test/test1/test1.dto-ruby.User.expected +36 -0
  29. data/test/test1/test1.yaml +85 -0
  30. data/test/test2/test2.ddl-mysql.expected +49 -0
  31. data/test/test2/test2.ddl-postgresql.expected +49 -0
  32. data/test/test2/test2.dto-java.Address.expected +42 -0
  33. data/test/test2/test2.dto-java.Customer.expected +49 -0
  34. data/test/test2/test2.dto-java.Item.expected +37 -0
  35. data/test/test2/test2.dto-java.SalesOrder.expected +50 -0
  36. data/test/test2/test2.dto-java.SalesOrderLine.expected +56 -0
  37. data/test/test2/test2.dto-ruby.Address.expected +25 -0
  38. data/test/test2/test2.dto-ruby.Customer.expected +32 -0
  39. data/test/test2/test2.dto-ruby.Item.expected +23 -0
  40. data/test/test2/test2.dto-ruby.SalesOrder.expected +32 -0
  41. data/test/test2/test2.dto-ruby.SalesOrderLine.expected +39 -0
  42. data/test/test2/test2.yaml +94 -0
  43. metadata +91 -0
@@ -0,0 +1,32 @@
1
+ ##
2
+ ## DTO for Ruby
3
+ ## generated by kwatable with template 'dto-ruby.eruby'
4
+ ##
5
+ require 'Address'
6
+
7
+ ## Customer master table
8
+ class Customer
9
+
10
+ def initialize(id, name, tel, email, address_id)
11
+ @id = id
12
+ @name = name
13
+ @tel = tel
14
+ @email = email
15
+ @address_id = address_id
16
+ end
17
+
18
+ attr_accessor :id #
19
+ attr_accessor :name #
20
+ attr_accessor :tel #
21
+ attr_accessor :email #
22
+ attr_accessor :address_id #
23
+
24
+ // -----------
25
+
26
+ attr_reader :address
27
+ def address=(address)
28
+ @address = address
29
+ @address_id = address.id
30
+ end
31
+
32
+ end
@@ -0,0 +1,23 @@
1
+ ##
2
+ ## DTO for Ruby
3
+ ## generated by kwatable with template 'dto-ruby.eruby'
4
+ ##
5
+
6
+ ## Item master table
7
+ class Item
8
+
9
+ def initialize(id, name, desc, price)
10
+ @id = id
11
+ @name = name
12
+ @desc = desc
13
+ @price = price
14
+ end
15
+
16
+ attr_accessor :id #
17
+ attr_accessor :name #
18
+ attr_accessor :desc #
19
+ attr_accessor :price #
20
+
21
+ // -----------
22
+
23
+ end
@@ -0,0 +1,32 @@
1
+ ##
2
+ ## DTO for Ruby
3
+ ## generated by kwatable with template 'dto-ruby.eruby'
4
+ ##
5
+ require 'Customer'
6
+
7
+ ## Sales order master table
8
+ class SalesOrder
9
+
10
+ def initialize(id, customer_id, ordered_date, delivery_date, amount)
11
+ @id = id
12
+ @customer_id = customer_id
13
+ @ordered_date = ordered_date
14
+ @delivery_date = delivery_date
15
+ @amount = amount
16
+ end
17
+
18
+ attr_accessor :id #
19
+ attr_accessor :customer_id #
20
+ attr_accessor :ordered_date #
21
+ attr_accessor :delivery_date #
22
+ attr_accessor :amount #
23
+
24
+ // -----------
25
+
26
+ attr_reader :customer
27
+ def customer=(customer)
28
+ @customer = customer
29
+ @customer_id = customer.id
30
+ end
31
+
32
+ end
@@ -0,0 +1,39 @@
1
+ ##
2
+ ## DTO for Ruby
3
+ ## generated by kwatable with template 'dto-ruby.eruby'
4
+ ##
5
+ require 'SalesOrder'
6
+ require 'Item'
7
+
8
+ ## Sales Order detail lines
9
+ class SalesOrderLine
10
+
11
+ def initialize(num, order_id, item_id, price, quantity)
12
+ @num = num
13
+ @order_id = order_id
14
+ @item_id = item_id
15
+ @price = price
16
+ @quantity = quantity
17
+ end
18
+
19
+ attr_accessor :num #
20
+ attr_accessor :order_id #
21
+ attr_accessor :item_id #
22
+ attr_accessor :price #
23
+ attr_accessor :quantity #
24
+
25
+ // -----------
26
+
27
+ attr_reader :order
28
+ def order=(order)
29
+ @order = order
30
+ @order_id = order.id
31
+ end
32
+
33
+ attr_reader :item
34
+ def item=(item)
35
+ @item = item
36
+ @item_id = item.id
37
+ end
38
+
39
+ end
@@ -0,0 +1,94 @@
1
+ columns:
2
+ - name: id
3
+ type: int
4
+ primary-key: yes
5
+ serial: yes
6
+
7
+ - name: name
8
+ type: str
9
+ not-null: yes
10
+
11
+ - name: desc
12
+ type: str
13
+
14
+
15
+ tables:
16
+
17
+ - name: addresses
18
+ class: Address
19
+ desc: Address master table
20
+ columns:
21
+ - name: id
22
+ - name: zipcode
23
+ type: str
24
+ width: 8
25
+ pattern: /^\d+-\d+$/
26
+ - name: addr1
27
+ type: str
28
+ - name: addr2
29
+ type: str
30
+ - name: addr3
31
+ type: str
32
+
33
+ - name: customers
34
+ class: Customer
35
+ desc: Customer master table
36
+ columns:
37
+ - name: id
38
+ - name: name
39
+ - name: tel
40
+ type: str
41
+ - name: email
42
+ type: str
43
+ - name: address_id
44
+ ref: addresses.id
45
+ not-null: yes
46
+
47
+ - name: items
48
+ class: Item
49
+ desc: Item master table
50
+ columns:
51
+ - name: id
52
+ - name: name
53
+ - name: desc
54
+ - name: price
55
+ type: money
56
+ not-null: yes
57
+
58
+ - name: sales_orders
59
+ class: SalesOrder
60
+ desc: Sales order master table
61
+ columns:
62
+ - name: id
63
+ - name: customer_id
64
+ ref: customers.id
65
+ not-null: yes
66
+ - name: ordered_date
67
+ type: date
68
+ not-null: yes
69
+ - name: delivery_date
70
+ type: date
71
+ - name: amount
72
+ type: money
73
+
74
+ - name: sales_order_lines
75
+ class: SalesOrderLine
76
+ desc: Sales Order detail lines
77
+ columns:
78
+ - name: num
79
+ type: int
80
+ not-null: yes
81
+ - name: order_id
82
+ ref: sales_orders.id
83
+ not-null: yes
84
+ - name: item_id
85
+ ref: items.id
86
+ not-null: yes
87
+ - name: price
88
+ type: money
89
+ not-null: yes
90
+ - name: quantity
91
+ type: int
92
+ not-null: yes
93
+ primary-keys: [ order_id, item_id ]
94
+
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.11
3
+ specification_version: 1
4
+ name: kwatable
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.0.1
7
+ date: 2005-09-12 00:00:00 +09:00
8
+ summary: SQL and DTO generator from table definition
9
+ require_paths:
10
+ - lib
11
+ email:
12
+ homepage: http://www.kuwata-lab.com/kwatable
13
+ rubyforge_project:
14
+ description: "Kwatable is a pretty tool to generate SQL and DTO from database table
15
+ definition. Kwatable reads table definition written in YAML, and generates
16
+ 'create table' SQL script for MySQL and PostgreSQL, or generates DTO class file
17
+ for Java and Ruby. You can add your own eRuby template."
18
+ autorequire:
19
+ default_executable:
20
+ bindir: bin
21
+ has_rdoc: false
22
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
23
+ requirements:
24
+ -
25
+ - ">"
26
+ - !ruby/object:Gem::Version
27
+ version: 0.0.0
28
+ version:
29
+ platform: ruby
30
+ signing_key:
31
+ cert_chain:
32
+ authors:
33
+ - makoto kuwata
34
+ files:
35
+ - lib/kwatable
36
+ - lib/kwatable.rb
37
+ - lib/kwatable/error-msg.rb
38
+ - lib/kwatable/kwatable.schema.yaml
39
+ - lib/kwatable/main-program.rb
40
+ - lib/kwatable/manufactory.rb
41
+ - lib/kwatable/templates
42
+ - lib/kwatable/templates/ddl-mysql.eruby
43
+ - lib/kwatable/templates/ddl-postgresql.eruby
44
+ - lib/kwatable/templates/defaults.yaml
45
+ - lib/kwatable/templates/dto-java.eruby
46
+ - lib/kwatable/templates/dto-ruby.eruby
47
+ - bin/kwatable
48
+ - examples/ex1
49
+ - examples/ex2
50
+ - examples/ex1/example1.yaml
51
+ - examples/ex1/Makefile
52
+ - examples/ex2/example2.yaml
53
+ - examples/ex2/Makefile
54
+ - test/assert-diff.rb
55
+ - test/test.rb
56
+ - test/test1
57
+ - test/test2
58
+ - test/test1/test1.ddl-mysql.expected
59
+ - test/test1/test1.ddl-postgresql.expected
60
+ - test/test1/test1.dto-java.Group.expected
61
+ - test/test1/test1.dto-java.User.expected
62
+ - test/test1/test1.dto-ruby.Group.expected
63
+ - test/test1/test1.dto-ruby.User.expected
64
+ - test/test1/test1.yaml
65
+ - test/test2/test2.ddl-mysql.expected
66
+ - test/test2/test2.ddl-postgresql.expected
67
+ - test/test2/test2.dto-java.Address.expected
68
+ - test/test2/test2.dto-java.Customer.expected
69
+ - test/test2/test2.dto-java.Item.expected
70
+ - test/test2/test2.dto-java.SalesOrder.expected
71
+ - test/test2/test2.dto-java.SalesOrderLine.expected
72
+ - test/test2/test2.dto-ruby.Address.expected
73
+ - test/test2/test2.dto-ruby.Customer.expected
74
+ - test/test2/test2.dto-ruby.Item.expected
75
+ - test/test2/test2.dto-ruby.SalesOrder.expected
76
+ - test/test2/test2.dto-ruby.SalesOrderLine.expected
77
+ - test/test2/test2.yaml
78
+ - README.txt
79
+ - ChangeLog.txt
80
+ - COPYING
81
+ - setup.rb
82
+ - kwatable.gemspec
83
+ test_files:
84
+ - test/test.rb
85
+ rdoc_options: []
86
+ extra_rdoc_files: []
87
+ executables:
88
+ - kwatable
89
+ extensions: []
90
+ requirements: []
91
+ dependencies: []