ld 0.2.11 → 0.2.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aab0b3194ac0f73c3943487d79a47cdf6f61626f
4
- data.tar.gz: 11aa1a0722f3b6e95d7d7ddc51eca4ea8cba2361
3
+ metadata.gz: 943882473a9692a4d7f2d4b252a265fc2be5ecf1
4
+ data.tar.gz: 84628f8a632eef44e823054c2e7b787fd61ba974
5
5
  SHA512:
6
- metadata.gz: 111b5650e76a1d7e67a52fadaa3e37d88d191b4fb7193fe8ad574184c5ca5dba93fe83fbeef98e3216c26b9d0dfd42f92e2861fc93ca9256a11b96fc6d90afb8
7
- data.tar.gz: c9d427643cd034fd07a1529611055c8f68a496b142175ac2230332ea0edb27d683380259a240113a7bf078ec0a43dfe3e5519a21487f8a2bcbd4212064a33ab5
6
+ metadata.gz: 3dd9a46b132a984271cdffa46fbeae3ca1c30d2d7d5987d06c2cf60dee8d0a07dd83a5179648bac6ae37b8147222004b13f945b0bc8a4566b45a6df33604620e
7
+ data.tar.gz: 67fb81e856dd560aa0fbdec6893458d12ca0e63d75878169602a871778d5807b05bf0fe63187d7955b209eee4d50c2f402a8b145b3cee6a3bfb6763bb2e01837
@@ -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 = {}, path = Rails.root.to_s
6
- @root = Ld::File.new path
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
@@ -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
- @root.db.find('schema.rb').lines.each do |l|
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
@@ -1,3 +1,3 @@
1
1
  module Ld
2
- VERSION = "0.2.11"
2
+ VERSION = "0.2.12"
3
3
  end
data/lib/ld.rb CHANGED
@@ -18,3 +18,5 @@ require "ld/excel/sheet"
18
18
 
19
19
  require "ld/print/print"
20
20
 
21
+
22
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ld
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liu Dong