tool-shed 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/Gemfile +3 -1
  2. data/Gemfile.lock +82 -0
  3. data/README.md +7 -5
  4. data/bin/as-asset-detector +0 -0
  5. data/lib/shed/asdoc_package.rb +1 -1
  6. data/lib/shed/manifest.rb +12 -4
  7. data/lib/shed/opts/manifest_opts.rb +11 -4
  8. data/lib/shed/opts/tool_opts.rb +8 -5
  9. data/lib/shed/opts/unused_asset_opts.rb +1 -1
  10. data/lib/shed/opts/unused_class_opts.rb +16 -1
  11. data/lib/shed/opts/unused_style_opts.rb +1 -1
  12. data/lib/shed/search.rb +6 -5
  13. data/lib/shed/tool.rb +16 -3
  14. data/lib/shed/unused_asset.rb +37 -12
  15. data/lib/shed/unused_class.rb +4 -4
  16. data/lib/shed/version.rb +1 -1
  17. data/rakefile.rb +20 -84
  18. data/test/fixtures/unused-asset/src/org/helvector/ToolBox.mxml +4 -0
  19. data/test/test_helper.rb +13 -0
  20. data/test/unit/test_manifest.rb +23 -2
  21. data/test/unit/test_manifest_opts.rb +15 -0
  22. data/test/unit/test_search.rb +16 -4
  23. data/test/unit/test_unused_asset.rb +24 -14
  24. data/test/unit/test_unused_class_opts.rb +28 -1
  25. metadata +41 -69
  26. data/coverage/unit/index.html +0 -330
  27. data/coverage/unit/jquery-1.3.2.min.js +0 -19
  28. data/coverage/unit/jquery.tablesorter.min.js +0 -15
  29. data/coverage/unit/lib-hel-asdoc_package_rb.html +0 -447
  30. data/coverage/unit/lib-hel-manifest_rb.html +0 -555
  31. data/coverage/unit/lib-hel-opts-asdoc_package_opts_rb.html +0 -195
  32. data/coverage/unit/lib-hel-opts-manifest_opts_rb.html +0 -195
  33. data/coverage/unit/lib-hel-opts-tool_opts_rb.html +0 -531
  34. data/coverage/unit/lib-hel-opts-unused_class_opts_rb.html +0 -207
  35. data/coverage/unit/lib-hel-opts-unused_style_opts_rb.html +0 -201
  36. data/coverage/unit/lib-hel-project_tools_rb.html +0 -423
  37. data/coverage/unit/lib-hel-search_rb.html +0 -363
  38. data/coverage/unit/lib-hel-stripper_rb.html +0 -357
  39. data/coverage/unit/lib-hel-tool_rb.html +0 -423
  40. data/coverage/unit/lib-hel-unused_class_rb.html +0 -675
  41. data/coverage/unit/lib-hel-unused_style_rb.html +0 -747
  42. data/coverage/unit/lib-hel-version_rb.html +0 -135
  43. data/coverage/unit/lib-hel_tools_rb.html +0 -165
  44. data/coverage/unit/print.css +0 -12
  45. data/coverage/unit/rcov.js +0 -42
  46. data/coverage/unit/screen.css +0 -270
  47. data/coverage.data +0 -0
  48. data/rdoc/classes/ASDocPackage.html +0 -281
  49. data/rdoc/classes/ASDocPackageOpts.html +0 -204
  50. data/rdoc/classes/Manifest.html +0 -323
  51. data/rdoc/classes/ManifestOpts.html +0 -205
  52. data/rdoc/classes/ProjectTools.html +0 -302
  53. data/rdoc/classes/Search.html +0 -203
  54. data/rdoc/classes/Stripper.html +0 -223
  55. data/rdoc/classes/Tool.html +0 -313
  56. data/rdoc/classes/ToolOpts.html +0 -297
  57. data/rdoc/classes/UnusedClass.html +0 -258
  58. data/rdoc/classes/UnusedClassOpts.html +0 -206
  59. data/rdoc/classes/UnusedStyle.html +0 -277
  60. data/rdoc/classes/UnusedStyleOpts.html +0 -205
  61. data/rdoc/created.rid +0 -1
  62. data/rdoc/files/LICENSE.html +0 -129
  63. data/rdoc/files/README_md.html +0 -138
  64. data/rdoc/files/lib/hel/asdoc_package_rb.html +0 -107
  65. data/rdoc/files/lib/hel/manifest_rb.html +0 -107
  66. data/rdoc/files/lib/hel/opts/asdoc_package_opts_rb.html +0 -107
  67. data/rdoc/files/lib/hel/opts/manifest_opts_rb.html +0 -107
  68. data/rdoc/files/lib/hel/opts/tool_opts_rb.html +0 -114
  69. data/rdoc/files/lib/hel/opts/unused_class_opts_rb.html +0 -107
  70. data/rdoc/files/lib/hel/opts/unused_style_opts_rb.html +0 -107
  71. data/rdoc/files/lib/hel/project_tools_rb.html +0 -107
  72. data/rdoc/files/lib/hel/search_rb.html +0 -114
  73. data/rdoc/files/lib/hel/stripper_rb.html +0 -107
  74. data/rdoc/files/lib/hel/tool_rb.html +0 -107
  75. data/rdoc/files/lib/hel/unused_class_rb.html +0 -107
  76. data/rdoc/files/lib/hel/unused_style_rb.html +0 -107
  77. data/rdoc/files/lib/hel/version_rb.html +0 -107
  78. data/rdoc/files/lib/hel_tools_rb.html +0 -127
  79. data/rdoc/fr_class_index.html +0 -39
  80. data/rdoc/fr_file_index.html +0 -43
  81. data/rdoc/fr_method_index.html +0 -75
  82. data/rdoc/index.html +0 -24
  83. data/rdoc/rdoc-style.css +0 -208
  84. data/tool-shed-0.0.3.gem +0 -0
  85. data/tool-shed.gemspec +0 -41
@@ -13,6 +13,7 @@ class ManifestOptTest < Test::Unit::TestCase
13
13
  assert_equal 'manifest.xml', opts[:output]
14
14
  assert_equal '.', opts[:src]
15
15
  assert_equal false, opts[:verbose]
16
+
16
17
  end
17
18
 
18
19
  should "display a name" do
@@ -23,6 +24,20 @@ class ManifestOptTest < Test::Unit::TestCase
23
24
  assert_match(/\w+/, ManifestOpts.description)
24
25
  end
25
26
 
27
+ should "define a filter when -f is set" do
28
+ fltr = 'org.helvector'
29
+ opts = ManifestOpts.parse ['-f', fltr]
30
+
31
+ assert_equal fltr, opts[:filter]
32
+ end
33
+
34
+ should "define a filter when --filter is set" do
35
+ fltr = 'org'
36
+ opts = ManifestOpts.parse ['--filter', fltr]
37
+
38
+ assert_equal fltr, opts[:filter]
39
+ end
40
+
26
41
  end
27
42
 
28
43
  end
@@ -52,16 +52,28 @@ class SearchTest < Test::Unit::TestCase
52
52
 
53
53
  should "list all directories in a sub tree that are empty" do
54
54
  Search.for_empties(@path) { |f| @found << f }
55
- assert_equal(4, @found.length)
56
- assert_match(/(b|x|z)org/, @found.to_s)
55
+ assert_equal(6, @found.length)
56
+ assert_match(/(b|s|g|x|z)org/, @found.to_s)
57
57
  end
58
58
 
59
59
  should "list all directories in a sub tree that are empty but skipping specified exclusions" do
60
- Search.for_empties(@path, ['org']) { |f| @found << f }
61
- assert_equal(3, @found.length)
60
+ Search.for_empties(@path, ['org', '.svn', '.git']) { |f| @found << f }
61
+ assert_equal(5, @found.length)
62
62
  assert_match(/(b|x|z)org/, @found.to_s)
63
63
  end
64
64
 
65
+ context "finding hidden directories by default" do
66
+
67
+ should "not recurse into svn directories" do
68
+ Search.for_empties(@path) { |f| @found << f }
69
+ assert_equal(6, @found.length)
70
+ end
71
+
72
+ should "not recurse into git directories" do
73
+ Search.for_empties(@path) { |f| @found << f }
74
+ assert_equal(6, @found.length)
75
+ end
76
+ end
65
77
  end
66
78
 
67
79
  end
@@ -12,46 +12,56 @@ class TestUnusedAsset < Test::Unit::TestCase
12
12
 
13
13
  context "with correct arguments" do
14
14
  setup do
15
- opt = { :src => "#{fix}/src",
16
- :css_dir => "#{fix}/assets" }
15
+ opt = { :project_dir => "#{fix}" }
17
16
 
18
17
  @out = StringIO.new
19
18
  @tool = UnusedAsset.new(opt,@out)
20
19
  end
21
20
 
22
21
  should "find all assets in the project" do
23
- #store list
22
+ assert_equal(6, @tool.assets.length)
23
+ assert_match(/\.jpg/, @tool.assets.to_s)
24
+ assert_match(/\.png/, @tool.assets.to_s)
25
+ assert_match(/\.otf/, @tool.assets.to_s)
24
26
  end
25
27
 
26
- should "load all src files in the project" do
27
- #css
28
- #mxml
29
- #as
28
+ should "locate all src files in the project" do
29
+ assert_equal(4, @tool.src_files.length)
30
+ assert_match(/\.mxml/, @tool.src_files.to_s)
31
+ assert_match(/\.as/, @tool.src_files.to_s)
32
+ assert_match(/\.css/, @tool.src_files.to_s)
30
33
  end
31
34
 
32
35
  should "search all loaded src files for asset references and store them in a list" do
33
- #store list
36
+ assert_equal(3, @tool.declared.length)
37
+ assert_match('referenced.otf', @tool.declared.to_s)
38
+ assert_match('referenced.jpg', @tool.declared.to_s)
39
+ assert_match('referenced.png', @tool.declared.to_s)
34
40
  end
35
41
 
36
- should "produce a list of assets found in the project which are not referenced in the project src" do
37
- #print list..
42
+ should "produce a list of assets found in the project directory which are not referenced in the project src" do
43
+ assert_equal(3, @tool.unused.length)
44
+ assert_match('un-referenced.otf', @tool.unused.to_s)
45
+ assert_match('un-referenced.jpg', @tool.unused.to_s)
46
+ assert_match('un-referenced.png', @tool.unused.to_s)
38
47
  end
39
48
 
40
49
  should "load the project link report and look for assets compiled into the application" do
41
-
50
+ #TODO
51
+ #flunk
42
52
  end
43
53
 
44
54
  end
45
55
 
46
56
  context "with incorrect arguments" do
47
57
  setup do
48
- opt = {:manifest => "INVALID", :output => '/tmp/unused-asset-tool.txt'}
58
+ opt = {:project_dir => "INVALID"}
49
59
  @out = StringIO.new
50
- @tool = UnusedClass.new(opt,@out)
60
+ @tool = UnusedAsset.new(opt,@out)
51
61
  end
52
62
 
53
63
  should "fail with a warning message" do
54
- assert_match(/#{UnusedClass::INVALID_OPTS}/, @out.string)
64
+ assert_match(/#{UnusedAsset::INVALID_OPTS}/, @out.string)
55
65
  end
56
66
  end
57
67
  end
@@ -11,7 +11,7 @@ class UnusedClassOptsTest < Test::Unit::TestCase
11
11
  args = []
12
12
  opts = UnusedClassOpts.parse(args)
13
13
 
14
- assert_equal 'classes.txt', opts[:output]
14
+ assert_equal 'class-vaccum.txt', opts[:output]
15
15
  assert_equal 'manifest.xml', opts[:manifest]
16
16
  assert_equal 'link-report.xml', opts[:link_report]
17
17
  assert_equal '.', opts[:src]
@@ -27,6 +27,33 @@ class UnusedClassOptsTest < Test::Unit::TestCase
27
27
  assert_match(/\w+/, UnusedClassOpts.description)
28
28
  end
29
29
 
30
+ should "raise an exception if mandatory arguments are missing" do
31
+ #TODO assert_raise(Exception) { UnusedClassOpts.parse([]) }
32
+ end
33
+
34
+ should "exit with a useage message if mandatory options are not specified" do
35
+ #TODO: This is failing as the rescue is never entered.
36
+ #rescued = false;
37
+ #begin
38
+ # out = StringIO.new
39
+ # args = []
40
+ # opts = UnusedClassOpts.parse(args,out)
41
+ #rescue SystemExit => e
42
+ # assert_equal 0, e.status
43
+ # assert_match(/Usage/, out.string)
44
+ # rescued = true
45
+ #end
46
+ #flunk() unless rescued
47
+ end
48
+
49
+ should "set manifest and link-report properties" do
50
+ args = ['-m', 'custom-manifest.xml', '-l', 'custom-link-report.xml']
51
+ opts = UnusedClassOpts.parse(args)
52
+
53
+ assert_equal 'custom-manifest.xml', opts[:manifest]
54
+ assert_equal 'custom-link-report.xml', opts[:link_report]
55
+ end
56
+
30
57
  end
31
58
 
32
59
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tool-shed
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Simon Gregory
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-09 00:00:00 +01:00
18
+ date: 2010-11-25 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -33,7 +33,7 @@ dependencies:
33
33
  name: rake
34
34
  requirement: *id001
35
35
  - !ruby/object:Gem::Dependency
36
- type: :development
36
+ type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: &id002 !ruby/object:Gem::Requirement
39
39
  none: false
@@ -44,7 +44,7 @@ dependencies:
44
44
  segments:
45
45
  - 0
46
46
  version: "0"
47
- name: shoulda
47
+ name: i18n
48
48
  requirement: *id002
49
49
  - !ruby/object:Gem::Dependency
50
50
  type: :development
@@ -58,7 +58,7 @@ dependencies:
58
58
  segments:
59
59
  - 0
60
60
  version: "0"
61
- name: mocha
61
+ name: shoulda
62
62
  requirement: *id003
63
63
  - !ruby/object:Gem::Dependency
64
64
  type: :development
@@ -72,8 +72,36 @@ dependencies:
72
72
  segments:
73
73
  - 0
74
74
  version: "0"
75
- name: rcov
75
+ name: mocha
76
76
  requirement: *id004
77
+ - !ruby/object:Gem::Dependency
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: &id005 !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ name: metric_fu
90
+ requirement: *id005
91
+ - !ruby/object:Gem::Dependency
92
+ type: :development
93
+ prerelease: false
94
+ version_requirements: &id006 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ">="
98
+ - !ruby/object:Gem::Version
99
+ hash: 3
100
+ segments:
101
+ - 0
102
+ version: "0"
103
+ name: ci_reporter
104
+ requirement: *id006
77
105
  description: |
78
106
  Utility scripts for working with ActionScript and Flex projects.
79
107
 
@@ -94,29 +122,8 @@ files:
94
122
  - bin/as-docp
95
123
  - bin/as-manifest
96
124
  - bin/as-style-detector
97
- - coverage/unit/index.html
98
- - coverage/unit/jquery-1.3.2.min.js
99
- - coverage/unit/jquery.tablesorter.min.js
100
- - coverage/unit/lib-hel-asdoc_package_rb.html
101
- - coverage/unit/lib-hel-manifest_rb.html
102
- - coverage/unit/lib-hel-opts-asdoc_package_opts_rb.html
103
- - coverage/unit/lib-hel-opts-manifest_opts_rb.html
104
- - coverage/unit/lib-hel-opts-tool_opts_rb.html
105
- - coverage/unit/lib-hel-opts-unused_class_opts_rb.html
106
- - coverage/unit/lib-hel-opts-unused_style_opts_rb.html
107
- - coverage/unit/lib-hel-project_tools_rb.html
108
- - coverage/unit/lib-hel-search_rb.html
109
- - coverage/unit/lib-hel-stripper_rb.html
110
- - coverage/unit/lib-hel-tool_rb.html
111
- - coverage/unit/lib-hel-unused_class_rb.html
112
- - coverage/unit/lib-hel-unused_style_rb.html
113
- - coverage/unit/lib-hel-version_rb.html
114
- - coverage/unit/lib-hel_tools_rb.html
115
- - coverage/unit/print.css
116
- - coverage/unit/rcov.js
117
- - coverage/unit/screen.css
118
- - coverage.data
119
125
  - Gemfile
126
+ - Gemfile.lock
120
127
  - lib/shed/asdoc_package.rb
121
128
  - lib/shed/manifest.rb
122
129
  - lib/shed/opts/asdoc_package_opts.rb
@@ -136,42 +143,6 @@ files:
136
143
  - lib/tool_shed.rb
137
144
  - LICENSE
138
145
  - rakefile.rb
139
- - rdoc/classes/ASDocPackage.html
140
- - rdoc/classes/ASDocPackageOpts.html
141
- - rdoc/classes/Manifest.html
142
- - rdoc/classes/ManifestOpts.html
143
- - rdoc/classes/ProjectTools.html
144
- - rdoc/classes/Search.html
145
- - rdoc/classes/Stripper.html
146
- - rdoc/classes/Tool.html
147
- - rdoc/classes/ToolOpts.html
148
- - rdoc/classes/UnusedClass.html
149
- - rdoc/classes/UnusedClassOpts.html
150
- - rdoc/classes/UnusedStyle.html
151
- - rdoc/classes/UnusedStyleOpts.html
152
- - rdoc/created.rid
153
- - rdoc/files/lib/hel/asdoc_package_rb.html
154
- - rdoc/files/lib/hel/manifest_rb.html
155
- - rdoc/files/lib/hel/opts/asdoc_package_opts_rb.html
156
- - rdoc/files/lib/hel/opts/manifest_opts_rb.html
157
- - rdoc/files/lib/hel/opts/tool_opts_rb.html
158
- - rdoc/files/lib/hel/opts/unused_class_opts_rb.html
159
- - rdoc/files/lib/hel/opts/unused_style_opts_rb.html
160
- - rdoc/files/lib/hel/project_tools_rb.html
161
- - rdoc/files/lib/hel/search_rb.html
162
- - rdoc/files/lib/hel/stripper_rb.html
163
- - rdoc/files/lib/hel/tool_rb.html
164
- - rdoc/files/lib/hel/unused_class_rb.html
165
- - rdoc/files/lib/hel/unused_style_rb.html
166
- - rdoc/files/lib/hel/version_rb.html
167
- - rdoc/files/lib/hel_tools_rb.html
168
- - rdoc/files/LICENSE.html
169
- - rdoc/files/README_md.html
170
- - rdoc/fr_class_index.html
171
- - rdoc/fr_file_index.html
172
- - rdoc/fr_method_index.html
173
- - rdoc/index.html
174
- - rdoc/rdoc-style.css
175
146
  - README.md
176
147
  - test/fixtures/search/App.mxml
177
148
  - test/fixtures/search/hide/Hidden.as
@@ -193,6 +164,7 @@ files:
193
164
  - test/fixtures/unused-asset/assets/img/referenced.png
194
165
  - test/fixtures/unused-asset/assets/img/un-referenced.jpg
195
166
  - test/fixtures/unused-asset/assets/img/un-referenced.png
167
+ - test/fixtures/unused-asset/src/org/helvector/ToolBox.mxml
196
168
  - test/fixtures/unused-asset/src/org/helvector/ToolShed.as
197
169
  - test/fixtures/unused-cla/link-report.xml
198
170
  - test/fixtures/unused-cla/manifest.xml
@@ -219,8 +191,6 @@ files:
219
191
  - test/unit/test_unused_class_opts.rb
220
192
  - test/unit/test_unused_style.rb
221
193
  - test/unit/test_unused_style_opts.rb
222
- - tool-shed-0.0.3.gem
223
- - tool-shed.gemspec
224
194
  has_rdoc: true
225
195
  homepage: http://github.com/simongregory/tool-shed
226
196
  licenses: []
@@ -228,7 +198,9 @@ licenses: []
228
198
  post_install_message: |+
229
199
  Welcome to the Tool-Shed
230
200
  ========================
231
- Get Tooled Up 0.0.4. Kick off.
201
+ Get Tooled Up 0.0.5. Kick off.
202
+
203
+ Thanks for installing, the tools are under development. Don't expect reliability.
232
204
 
233
205
  rdoc_options:
234
206
  - --charset=UTF-8