ld 0.2.11 → 0.2.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ld/project/project.rb +5 -3
- data/lib/ld/project/tables.rb +3 -2
- data/lib/ld/version.rb +1 -1
- data/lib/ld.rb +2 -0
- 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: 943882473a9692a4d7f2d4b252a265fc2be5ecf1
|
4
|
+
data.tar.gz: 84628f8a632eef44e823054c2e7b787fd61ba974
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dd9a46b132a984271cdffa46fbeae3ca1c30d2d7d5987d06c2cf60dee8d0a07dd83a5179648bac6ae37b8147222004b13f945b0bc8a4566b45a6df33604620e
|
7
|
+
data.tar.gz: 67fb81e856dd560aa0fbdec6893458d12ca0e63d75878169602a871778d5807b05bf0fe63187d7955b209eee4d50c2f402a8b145b3cee6a3bfb6763bb2e01837
|
data/lib/ld/project/project.rb
CHANGED
@@ -2,14 +2,16 @@ class Ld::Project
|
|
2
2
|
|
3
3
|
attr_accessor :root, :tables, :models, :controllers, :views, :routes
|
4
4
|
|
5
|
-
def initialize table_hash = {},
|
6
|
-
@root = Ld::File.new
|
5
|
+
def initialize table_hash = {}, project_root_path = Rails.root.to_s
|
6
|
+
@root = Ld::File.new project_root_path
|
7
7
|
@table_hash = table_hash
|
8
|
+
@schema = @root.db.find('schema.rb')
|
9
|
+
raise "schema.rb文件缺失\n请运行命令(rake db:schema:dump)或手动添加此文件" if @schema.nil?
|
10
|
+
@tables = Ld::Tables.new @root, nil
|
8
11
|
parse_project
|
9
12
|
end
|
10
13
|
|
11
14
|
def parse_project
|
12
|
-
@tables = Ld::Tables.new @root, nil
|
13
15
|
@models = Ld::Models.new @root, @tables, @table_hash
|
14
16
|
@routes = Ld::Routes.new @root, @models
|
15
17
|
@tables = Ld::Tables.new @root, @models
|
data/lib/ld/project/tables.rb
CHANGED
@@ -2,9 +2,10 @@ class Ld::Tables
|
|
2
2
|
|
3
3
|
attr_accessor :headings, :rows, :tables
|
4
4
|
|
5
|
-
def initialize root, models
|
5
|
+
def initialize root, models, schema
|
6
6
|
@root = root
|
7
7
|
@models = models
|
8
|
+
@schema = schema
|
8
9
|
parse
|
9
10
|
end
|
10
11
|
|
@@ -12,7 +13,7 @@ class Ld::Tables
|
|
12
13
|
tables = {}
|
13
14
|
read_flag = false
|
14
15
|
table = ""
|
15
|
-
@
|
16
|
+
@schema.lines.each do |l|
|
16
17
|
if l.split(' ')[0] == 'end'
|
17
18
|
read_flag = false
|
18
19
|
end
|
data/lib/ld/version.rb
CHANGED
data/lib/ld.rb
CHANGED