ld 0.1.11 → 0.2.1
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 +4 -4
- data/README.md +29 -4
- data/lib/ld/{table.rb → print/print.rb} +1 -1
- data/lib/ld/project/parse.rb +110 -0
- data/lib/ld/project/structure.rb +57 -0
- data/lib/ld/version.rb +1 -1
- data/lib/ld.rb +31 -8
- metadata +10 -10
- data/lib/ld/project.rb +0 -205
- data/lib/ld/search_module.rb +0 -3
- /data/lib/ld/{excel.rb → excel/excel.rb} +0 -0
- /data/lib/ld/{sheet.rb → excel/sheet.rb} +0 -0
- /data/lib/ld/{dir.rb → file/dir.rb} +0 -0
- /data/lib/ld/{file.rb → file/file.rb} +0 -0
- /data/lib/ld/{files.rb → file/files.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2acbbafdf3e01f577026de5c256f855e1df73292
|
4
|
+
data.tar.gz: 218fbc767629bd56444da6fc2daa5d4e583c0922
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 188cd278cc8181e2e88ef61da49ab0e3d854578926a64e67c67563c9686b2248dce840335e20f3ad87fa4f7930e24937a54f10c58c9a3c74986a87526dc6b2e3
|
7
|
+
data.tar.gz: e82c382dba6355c86d7357fbba66b0c0e2ccd2d6ce8fbb95bd22726601b7f0567daa6224a3ce71839ddc02d204d51eb6e04ab2eb950f176adc3f41875b359eee
|
data/README.md
CHANGED
@@ -5,18 +5,39 @@ For the sake of efficiency,
|
|
5
5
|
The Module is my name abbreviations LD,
|
6
6
|
Basically has the following Class.
|
7
7
|
|
8
|
+
|
8
9
|
```ruby
|
9
10
|
module Ld
|
10
|
-
class
|
11
|
+
class Excel
|
12
|
+
end
|
13
|
+
class Sheets
|
11
14
|
end
|
12
|
-
|
15
|
+
|
16
|
+
class File
|
13
17
|
end
|
14
|
-
class
|
18
|
+
class Files
|
15
19
|
end
|
16
|
-
|
20
|
+
|
21
|
+
class Print
|
22
|
+
end
|
23
|
+
|
24
|
+
module Project
|
25
|
+
class Structure
|
26
|
+
end
|
27
|
+
class Parse
|
28
|
+
end
|
17
29
|
end
|
18
30
|
end
|
19
31
|
```
|
32
|
+
## Introduction to the
|
33
|
+
|
34
|
+
设计这个gem,我希望可以帮助大家在开发简单rails应用时,可以帮助大家完成50%以上的简单而重复的工作
|
35
|
+
我会提供一些类与方法,在console中使用,调用它们会生成项目结构xls文件,生成的这个xls文件中的数据,类似于一个小型文件数据库
|
36
|
+
然后我们可以以此为基础,查询项目中的一些信息.我想这样会有助于我们快速理解一个项目的基本结构,与重要文件在哪
|
37
|
+
也可以在修复bug时对bug相关文件与方法,起到快速定位的作用
|
38
|
+
这是我设计本gem的初衷,未来应该会持续更新这个gem,让它变得更加强大与方便
|
39
|
+
最终的目的是,希望这个gem可以起到快速搭建简单rails应用的作用,提升工作效率,节省时间
|
40
|
+
比如我们可以集成一些常用的模块到这个gem中,在搭建项目时只需要执行一条简单的命令就可以创建
|
20
41
|
|
21
42
|
## Installation
|
22
43
|
|
@@ -63,6 +84,10 @@ Ld::Excel.open('/Users/liudong/Desktop/excel_test.xls').read('sheet1?a1:e10')
|
|
63
84
|
|
64
85
|
# Read Dir
|
65
86
|
Ld::File.open_dir('dir_path').children.each{|f| puts f.path}
|
87
|
+
|
88
|
+
# Project details to xls 查看项目详情,会生成xls文件,在: config/project.xls
|
89
|
+
Ld::Project.new
|
90
|
+
|
66
91
|
```
|
67
92
|
|
68
93
|
## Development
|
@@ -0,0 +1,110 @@
|
|
1
|
+
module Ld::Project::Parse
|
2
|
+
|
3
|
+
def parse_routes root
|
4
|
+
system "rake routes > #{root.path}/routes.txt"
|
5
|
+
rows = root.find('routes.txt').lines.map{|line|
|
6
|
+
arr = line.split(' ')
|
7
|
+
arr.unshift(nil) if arr.size == 3
|
8
|
+
arr
|
9
|
+
}
|
10
|
+
.delete_if{|arr| arr.size >= 5 or arr.size <= 2 }
|
11
|
+
.map{|row|
|
12
|
+
controller, action = row[3].split('#')
|
13
|
+
type = row[1]
|
14
|
+
help_method = row[0]
|
15
|
+
uri = row[2]
|
16
|
+
#
|
17
|
+
[controller, action, type, uri, help_method]
|
18
|
+
}
|
19
|
+
File.delete("#{root.path}/routes.txt") if File.exist? "#{root.path}/routes.txt"
|
20
|
+
{
|
21
|
+
:headings => ['控制器', 'action', '请求类型','URI','帮助方法'],
|
22
|
+
:rows => rows
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
def parse_schema root
|
27
|
+
lines = root.db.find('schema.rb').lines
|
28
|
+
tables = {}
|
29
|
+
read_flag = false
|
30
|
+
table = ""
|
31
|
+
lines.each do |l|
|
32
|
+
if l.lstrip.rstrip.split('end').size == 0
|
33
|
+
read_flag = false
|
34
|
+
end
|
35
|
+
if l.match(/create_table /) and l.match(/ do /)
|
36
|
+
read_flag = true
|
37
|
+
table = l.split('"')[1]
|
38
|
+
tables[table] = []
|
39
|
+
end
|
40
|
+
if read_flag
|
41
|
+
tables[table] << l
|
42
|
+
end
|
43
|
+
end
|
44
|
+
rows = tables.map{|k, v|
|
45
|
+
v.delete_at(0)
|
46
|
+
[k, v.join(':')]
|
47
|
+
}
|
48
|
+
{
|
49
|
+
:headings => ['tables', 'comment'],
|
50
|
+
:rows => rows
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
54
|
+
def parse_models root
|
55
|
+
rows = []
|
56
|
+
@models = root.app.models.search_files(/.rb$/)
|
57
|
+
@controllers = root.app.controllers.search_files(/_controller.rb$/)
|
58
|
+
@views = root.app.views.search_dirs
|
59
|
+
@tables = parse_schema
|
60
|
+
@models.each do |model_file|
|
61
|
+
model_name = model_file.name.split('.')[0]
|
62
|
+
next if !@tables[model_name.pluralize]
|
63
|
+
model_lines = model_file.lines
|
64
|
+
actions_full_name = model_lines.map{|l| l.split('def ')[1] if l.match(/def /)}.compact
|
65
|
+
actions = actions_full_name.map{|action| action.split(' ')[0]}
|
66
|
+
model_instance = eval("#{model_name.camelize}.new")
|
67
|
+
fields = model_instance.attributes.keys
|
68
|
+
|
69
|
+
controller = find_controller model_name.pluralize
|
70
|
+
if controller
|
71
|
+
controller_lines = controller.lines
|
72
|
+
controller_methods = controller_lines.map{|l| l.split('def ')[1] if l.match(/def /)}.compact
|
73
|
+
end
|
74
|
+
|
75
|
+
view = find_view model_name.pluralize
|
76
|
+
if view
|
77
|
+
views = view.search_files(/.html/)
|
78
|
+
end
|
79
|
+
|
80
|
+
rows << [
|
81
|
+
model_name, # 模型
|
82
|
+
model_name.camelize, # 类
|
83
|
+
model_lines.size, # 模型lines
|
84
|
+
model_file.path, # 模型文件
|
85
|
+
(controller.nil? ? '' : controller.path), # 控制器文件
|
86
|
+
(controller.nil? ? 0 : controller_lines.size),# 控制器lines
|
87
|
+
actions.size, # 模型方法size
|
88
|
+
actions.join(','), # 模型方法
|
89
|
+
fields.size, # 字段size
|
90
|
+
fields.join(','), # 字段
|
91
|
+
(views.nil? ? 0 : views.size), # 视图size
|
92
|
+
(views.nil? ? '' : views.map{|v| "#{v.name.split('.')[0]}-#{v.path}"}.join(',')), # 视图
|
93
|
+
(controller_methods.nil? ? 0 : controller_methods.size), # action-size
|
94
|
+
(controller_methods.nil? ? '' : controller_methods.join(',')) # actions
|
95
|
+
]
|
96
|
+
end
|
97
|
+
rows = rows.compact.sort{|a,b| b[2] <=> a[2]} # 按 模型文件行数 排序
|
98
|
+
{
|
99
|
+
:headings => ['模型','类',
|
100
|
+
'模型lines','模型文件',
|
101
|
+
'控制器文件','控制器lines',
|
102
|
+
'模型方法size','模型方法',
|
103
|
+
'字段size','字段',
|
104
|
+
'视图size', '视图',
|
105
|
+
'action-size','actions'],
|
106
|
+
:rows => rows
|
107
|
+
}
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
class Ld::Project::Structure
|
2
|
+
include Ld::Project::Parse
|
3
|
+
attr_accessor :root, :name, :path
|
4
|
+
|
5
|
+
def initialize path = Rails.root.to_s
|
6
|
+
@root = Ld::File.new path
|
7
|
+
@name = @root.name
|
8
|
+
@path = @root.path
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
def generate path = "#{@root.path}/project.xls"
|
14
|
+
Ld::Excel.create path do |excel|
|
15
|
+
# sheet.set_format({color: :black, font_size: 14, font: '微软雅黑'})
|
16
|
+
excel.write_sheet 'routes' do |sheet|
|
17
|
+
@routes = parse_routes @root
|
18
|
+
sheet.set_headings @routes[:headings]
|
19
|
+
sheet.set_rows @routes[:rows]
|
20
|
+
end
|
21
|
+
excel.write_sheet 'tables' do |sheet|
|
22
|
+
@tables = parse_schema @root
|
23
|
+
sheet.set_headings @tables[:headings]
|
24
|
+
sheet.set_rows @tables[:rows]
|
25
|
+
end
|
26
|
+
excel.write_sheet 'models' do |sheet|
|
27
|
+
@models = parse_models @root
|
28
|
+
sheet.set_headings @models[:headings]
|
29
|
+
sheet.set_rows @models[:rows]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def find_controller model_name
|
35
|
+
@controllers.each do |c|
|
36
|
+
if c.name.split('_controller.rb')[0] == model_name
|
37
|
+
return c
|
38
|
+
end
|
39
|
+
end
|
40
|
+
nil
|
41
|
+
end
|
42
|
+
|
43
|
+
def find_view model_name
|
44
|
+
@views.each do |v|
|
45
|
+
if v.name == model_name
|
46
|
+
return v
|
47
|
+
end
|
48
|
+
end
|
49
|
+
nil
|
50
|
+
end
|
51
|
+
|
52
|
+
def camelize name
|
53
|
+
name.camelize
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
end
|
data/lib/ld/version.rb
CHANGED
data/lib/ld.rb
CHANGED
@@ -1,12 +1,35 @@
|
|
1
1
|
require "ld/version"
|
2
2
|
|
3
|
-
module Ld
|
4
|
-
end
|
5
3
|
|
6
|
-
|
7
|
-
|
4
|
+
class Excel
|
5
|
+
end
|
6
|
+
class Sheets
|
7
|
+
end
|
8
|
+
|
9
|
+
class File
|
10
|
+
end
|
11
|
+
class Files
|
12
|
+
end
|
13
|
+
|
14
|
+
class Print
|
15
|
+
end
|
16
|
+
|
17
|
+
module Project
|
18
|
+
module Parse
|
19
|
+
end
|
20
|
+
class Structure
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
require "ld/file/file"
|
26
|
+
require "ld/file/files"
|
27
|
+
|
28
|
+
require "ld/project/parse"
|
29
|
+
require "ld/project/structure"
|
30
|
+
|
31
|
+
require "ld/excel/excel"
|
32
|
+
require "ld/excel/sheet"
|
33
|
+
|
34
|
+
require "ld/print/table"
|
8
35
|
|
9
|
-
require "ld/excel"
|
10
|
-
require "ld/sheet"
|
11
|
-
require "ld/table"
|
12
|
-
require "ld/project"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ld
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Liu Dong
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: terminal-table
|
@@ -92,14 +92,14 @@ files:
|
|
92
92
|
- bin/setup
|
93
93
|
- ld.gemspec
|
94
94
|
- lib/ld.rb
|
95
|
-
- lib/ld/
|
96
|
-
- lib/ld/excel.rb
|
97
|
-
- lib/ld/file.rb
|
98
|
-
- lib/ld/
|
99
|
-
- lib/ld/
|
100
|
-
- lib/ld/
|
101
|
-
- lib/ld/
|
102
|
-
- lib/ld/
|
95
|
+
- lib/ld/excel/excel.rb
|
96
|
+
- lib/ld/excel/sheet.rb
|
97
|
+
- lib/ld/file/dir.rb
|
98
|
+
- lib/ld/file/file.rb
|
99
|
+
- lib/ld/file/files.rb
|
100
|
+
- lib/ld/print/print.rb
|
101
|
+
- lib/ld/project/parse.rb
|
102
|
+
- lib/ld/project/structure.rb
|
103
103
|
- lib/ld/version.rb
|
104
104
|
homepage: https://github.com/18810625123/ld
|
105
105
|
licenses:
|
data/lib/ld/project.rb
DELETED
@@ -1,205 +0,0 @@
|
|
1
|
-
class Ld::Project
|
2
|
-
|
3
|
-
attr_accessor :app, :name, :models, :views_dir, :views, :controllers, :routes
|
4
|
-
|
5
|
-
def initialize
|
6
|
-
@@root = Ld::File.new Rails.root.to_s
|
7
|
-
system "rake routes > #{@@root.config.path}/routes.txt"
|
8
|
-
Ld::Excel.create "#{@@root.config.path}/project.xls" do |excel|
|
9
|
-
excel.write_sheet 'routes' do |sheet|
|
10
|
-
sheet.set_format({color: :black, font_size: 14, font: '微软雅黑'})
|
11
|
-
sheet.set_headings ['控制器', 'action', '请求类型','URI','帮助方法']
|
12
|
-
sheet.set_point 'a1'
|
13
|
-
sheet.set_rows @@root.config.find('routes.txt').lines
|
14
|
-
.map{|line|
|
15
|
-
arr = line.split(' ')
|
16
|
-
arr.unshift(nil) if arr.size == 3
|
17
|
-
arr
|
18
|
-
}
|
19
|
-
.delete_if{|arr| arr.size >= 5 or arr.size <= 2 }
|
20
|
-
.map{|row|
|
21
|
-
controller, action = row[3].split('#')
|
22
|
-
type = row[1]
|
23
|
-
help_method = row[0]
|
24
|
-
uri = row[2]
|
25
|
-
[controller, action, type, uri, help_method]
|
26
|
-
}
|
27
|
-
end
|
28
|
-
excel.write_sheet 'tables' do |sheet|
|
29
|
-
sheet.set_format({color: :black, font_size: 14, font: '微软雅黑'})
|
30
|
-
sheet.set_headings ['tables', 'commit']
|
31
|
-
sheet.set_point 'a1'
|
32
|
-
lines = @@root.db.find('schema.rb').lines
|
33
|
-
@tables = {}
|
34
|
-
read_flag = false
|
35
|
-
table = ""
|
36
|
-
lines.each do |l|
|
37
|
-
if l.lstrip.rstrip.split('end').size == 0
|
38
|
-
read_flag = false
|
39
|
-
end
|
40
|
-
if l.match(/create_table /) and l.match(/ do /)
|
41
|
-
read_flag = true
|
42
|
-
table = l.split('"')[1]
|
43
|
-
@tables[table] = []
|
44
|
-
end
|
45
|
-
if read_flag
|
46
|
-
@tables[table] << l
|
47
|
-
end
|
48
|
-
end
|
49
|
-
@tables.each do |k, v|
|
50
|
-
v.delete_at(0)
|
51
|
-
sheet.set_row [k, v.join(':')]
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
excel.write_sheet 'models' do |sheet|
|
56
|
-
sheet.set_format({color: :black, font_size: 14, font: '微软雅黑'})
|
57
|
-
sheet.set_point 'a1'
|
58
|
-
|
59
|
-
@models = @@root.app.models.search_files(/.rb$/)
|
60
|
-
@controllers = @@root.app.controllers.search_files(/_controller.rb$/)
|
61
|
-
@views = @@root.app.views.search_dirs
|
62
|
-
|
63
|
-
rows = []
|
64
|
-
@models.each do |model_file|
|
65
|
-
model_name = model_file.name.split('.')[0]
|
66
|
-
next if @tables[model_name.pluralize].nil?
|
67
|
-
|
68
|
-
model_lines = model_file.lines
|
69
|
-
actions_full_name = model_lines.map{|l| l.split('def ')[1] if l.match(/def /)}.compact
|
70
|
-
actions = actions_full_name.map{|action| action.split(' ')[0]}
|
71
|
-
model_instance = eval("#{model_name.camelize}.new")
|
72
|
-
fields = model_instance.attributes.keys
|
73
|
-
|
74
|
-
|
75
|
-
controller = find_controller model_name.pluralize
|
76
|
-
if controller
|
77
|
-
controller_lines = controller.lines
|
78
|
-
controller_methods = controller_lines.map{|l| l.split('def ')[1] if l.match(/def /)}.compact
|
79
|
-
end
|
80
|
-
|
81
|
-
view = find_view model_name.pluralize
|
82
|
-
if view
|
83
|
-
views = view.search_files(/.html/)
|
84
|
-
end
|
85
|
-
|
86
|
-
rows << [
|
87
|
-
model_name, # 模型
|
88
|
-
model_name.camelize, # 类
|
89
|
-
model_lines.size, # 模型lines
|
90
|
-
model_file.path, # 模型文件
|
91
|
-
(controller.nil? ? '' : controller.path), # 控制器文件
|
92
|
-
(controller.nil? ? 0 : controller_lines.size),# 控制器lines
|
93
|
-
actions.size, # 模型方法size
|
94
|
-
actions.join(','), # 模型方法
|
95
|
-
fields.size, # 字段size
|
96
|
-
fields.join(','), # 字段
|
97
|
-
(views.nil? ? 0 : views.size), # 视图size
|
98
|
-
(views.nil? ? '' : views.map{|v| "#{v.name.split('.')[0]}-#{v.path}"}.join(',')), # 视图
|
99
|
-
(controller_methods.nil? ? 0 : controller_methods.size), # action-size
|
100
|
-
(controller_methods.nil? ? '' : controller_methods.join(',')) # actions
|
101
|
-
]
|
102
|
-
end
|
103
|
-
rows = rows.compact.sort{|a,b| b[2] <=> a[2]} # 按 模型文件行数 排序
|
104
|
-
sheet.set_rows rows
|
105
|
-
|
106
|
-
sheet.set_row []
|
107
|
-
sheet.set_row []
|
108
|
-
sheet.set_headings ['模型','类',
|
109
|
-
'模型lines','模型文件',
|
110
|
-
'控制器文件','控制器lines',
|
111
|
-
'模型方法size','模型方法',
|
112
|
-
'字段size','字段',
|
113
|
-
'视图size', '视图',
|
114
|
-
'action-size','actions']
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
def find_controller model_name
|
120
|
-
@controllers.each do |c|
|
121
|
-
if c.name.split('_controller.rb')[0] == model_name
|
122
|
-
return c
|
123
|
-
end
|
124
|
-
end
|
125
|
-
nil
|
126
|
-
end
|
127
|
-
def find_view model_name
|
128
|
-
@views.each do |v|
|
129
|
-
if v.name == model_name
|
130
|
-
return v
|
131
|
-
end
|
132
|
-
end
|
133
|
-
nil
|
134
|
-
end
|
135
|
-
def camelize name
|
136
|
-
name.camelize
|
137
|
-
end
|
138
|
-
def name
|
139
|
-
@@root.name
|
140
|
-
end
|
141
|
-
def path
|
142
|
-
@@root.path
|
143
|
-
end
|
144
|
-
|
145
|
-
|
146
|
-
def self.save_info
|
147
|
-
@@p ||= Ld::Project.new(Rails.root.to_s)
|
148
|
-
|
149
|
-
end
|
150
|
-
|
151
|
-
def self.get_routes
|
152
|
-
@@p ||= Ld::Project.new(Rails.root.to_s)
|
153
|
-
file = Ld::File.new @@p.config.path + '/routes.txt'
|
154
|
-
system "rake routes > #{file.path}"
|
155
|
-
file.lines.map{|line| arr = line.split(' '); arr.size == 3 ? arr.unshift(nil) : arr}
|
156
|
-
t.headings = ['controller', 'action', 'type']
|
157
|
-
arrs.map{|arr| controller,action = arr[3].split('#'); [controller, action, arr[1]]}
|
158
|
-
.each{|arr| t.add_row arr}
|
159
|
-
end
|
160
|
-
|
161
|
-
def self.p model = :all
|
162
|
-
@@p ||= Ld::Project.new(Rails.root.to_s)
|
163
|
-
|
164
|
-
t = Terminal::Table.new
|
165
|
-
case model.to_s
|
166
|
-
when 'all'
|
167
|
-
t.title = "project:#{@@root.name}"
|
168
|
-
t.headings = ['models', 'views', 'controllers', 'routes']
|
169
|
-
t.add_row [@@p.models.size, @@p.views.size, @@p.controllers.size, @@p.routes.lines.size]
|
170
|
-
when 'models'
|
171
|
-
t.title = 'models'
|
172
|
-
t.headings = ['name', 'action-size', 'line-size', 'routes']
|
173
|
-
@@p.models.map{|f| [f.name.split('.')[0], f.lines.map{|l| l if l.match(/def /)}.compact.size, f.lines.size, nil] }
|
174
|
-
.sort{|a,b| b[1]-a[1]}.each{|i| t.add_row i}
|
175
|
-
when 'controllers'
|
176
|
-
t.title = 'controllers'
|
177
|
-
t.headings = ['name', 'action-size', 'line-size']
|
178
|
-
@@p.controllers.map{|f| [f.name.split('.')[0], f.lines.map{|l| l if l.match(/def /)}.compact.size, f.lines.size] }
|
179
|
-
.sort{|a,b| b[1]-a[1]}.each{|i| t.add_row i}
|
180
|
-
when 'views'
|
181
|
-
t.title = 'views'
|
182
|
-
t.headings = ['name', 'file-size', 'html']
|
183
|
-
@@p.app.views.children('shared')
|
184
|
-
.map{|f| htmls = f.search(/.html/);[f.name, htmls.size, htmls.map{|f2| f2.name.split('.')[0]}.join(' ')]}
|
185
|
-
.sort{|a,b| b[1]-a[1]}
|
186
|
-
.each{|arr| t.add_row arr}
|
187
|
-
when 'routes'
|
188
|
-
file = Ld::File.new @@root.path + '/routes.txt'
|
189
|
-
if !file.exist?
|
190
|
-
system "rake routes > #{@@root.path + '/routes.txt'}"
|
191
|
-
end
|
192
|
-
arrs = file.lines.map{|l| lines = l.split(' '); lines.size == 3 ? lines.unshift(nil) : lines}
|
193
|
-
arrs.delete_at 0
|
194
|
-
t.title = 'routes'
|
195
|
-
t.headings = ['controller', 'action', 'type']
|
196
|
-
arrs.map{|arr| controller,action = arr[3].split('#'); [controller, action, arr[1]]}
|
197
|
-
.each{|arr| t.add_row arr}
|
198
|
-
else
|
199
|
-
puts '(models/controllers/views)'
|
200
|
-
return
|
201
|
-
end
|
202
|
-
puts t
|
203
|
-
end
|
204
|
-
|
205
|
-
end
|
data/lib/ld/search_module.rb
DELETED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|