tool-shed 0.0.5 → 0.0.7

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.
Files changed (50) hide show
  1. data/README.md +45 -22
  2. data/bin/{as-asset-detector → as-asset-vacuum} +2 -2
  3. data/bin/{as-class-detector → as-class-vacuum} +2 -2
  4. data/bin/{as-style-detector → as-style-vacuum} +2 -2
  5. data/bin/as-vacuum +16 -0
  6. data/lib/shed/asdoc_package.rb +11 -11
  7. data/lib/shed/asset_vacuum.rb +85 -0
  8. data/lib/shed/{unused_class.rb → class_vacuum.rb} +18 -19
  9. data/lib/shed/manifest.rb +11 -12
  10. data/lib/shed/opts/asdoc_package_opts.rb +1 -1
  11. data/lib/shed/opts/asset_vacuum_opts.rb +22 -0
  12. data/lib/shed/opts/{unused_class_opts.rb → class_vacuum_opts.rb} +9 -12
  13. data/lib/shed/opts/manifest_opts.rb +2 -2
  14. data/lib/shed/opts/style_vacuum_opts.rb +31 -0
  15. data/lib/shed/opts/tool_opts.rb +8 -8
  16. data/lib/shed/style_vacuum.rb +92 -0
  17. data/lib/shed/tool.rb +43 -6
  18. data/lib/shed/version.rb +1 -1
  19. data/lib/tool_shed.rb +6 -6
  20. data/test/fixtures/unused-asset/assets/audio/referenced.mp3 +0 -0
  21. data/test/fixtures/unused-asset/assets/audio/un-referenced.mp3 +0 -0
  22. data/test/fixtures/unused-asset/assets/css/referenced-in-mxml.css +0 -0
  23. data/test/fixtures/unused-asset/assets/css/referenced.css +12 -0
  24. data/test/fixtures/unused-asset/assets/css/un-referenced.css +7 -0
  25. data/test/fixtures/unused-asset/assets/fonts/referenced-in-css.ttf +0 -0
  26. data/test/fixtures/unused-asset/assets/fonts/referenced-in-unused-css.ttf +0 -0
  27. data/test/fixtures/unused-asset/assets/img/referenced.gif +0 -0
  28. data/test/fixtures/unused-asset/assets/img/referenced.svg +0 -0
  29. data/test/fixtures/unused-asset/assets/img/un-referenced.gif +0 -0
  30. data/test/fixtures/unused-asset/assets/img/un-referenced.svg +0 -0
  31. data/test/fixtures/unused-asset/assets/swf/referenced-in-css.swf +0 -0
  32. data/test/fixtures/unused-asset/assets/swf/referenced.swf +0 -0
  33. data/test/fixtures/unused-asset/assets/swf/un-referenced.swf +0 -0
  34. data/test/fixtures/unused-asset/src/org/helvector/ToolBox.mxml +5 -0
  35. data/test/fixtures/unused-asset/src/org/helvector/ToolShed.as +7 -2
  36. data/test/unit/test_asdoc_package_opts.rb +1 -1
  37. data/test/unit/test_asset_vacuum.rb +77 -0
  38. data/test/unit/{test_unused_asset_opts.rb → test_asset_vacuum_opts.rb} +5 -7
  39. data/test/unit/{test_unused_class.rb → test_class_vacuum.rb} +7 -7
  40. data/test/unit/test_class_vacuum_opts.rb +51 -0
  41. data/test/unit/{test_unused_style.rb → test_style_vacuum.rb} +21 -15
  42. data/test/unit/test_style_vacuum_opts.rb +46 -0
  43. metadata +36 -22
  44. data/lib/shed/opts/unused_asset_opts.rb +0 -24
  45. data/lib/shed/opts/unused_style_opts.rb +0 -23
  46. data/lib/shed/unused_asset.rb +0 -93
  47. data/lib/shed/unused_style.rb +0 -114
  48. data/test/unit/test_unused_asset.rb +0 -69
  49. data/test/unit/test_unused_class_opts.rb +0 -59
  50. data/test/unit/test_unused_style_opts.rb +0 -31
data/lib/shed/tool.rb CHANGED
@@ -14,7 +14,7 @@ class Tool
14
14
  @output = opt[:output] || 'tool-shed.txt'
15
15
  @verbose = opt[:verbose] || false
16
16
  @silent = opt[:silent] || false
17
- @excludes = opt[:excludes] || ['.svn','.git']
17
+ @excludes = opt[:excludes] || ['.svn','.git', 'bin', 'bin-debug']
18
18
  @out = out
19
19
 
20
20
  add_sigint_handler
@@ -45,10 +45,10 @@ class Tool
45
45
  # Write the requested string to the output file.
46
46
  #
47
47
  def to_disk(str)
48
- f = File.open(@output, "w")
49
- f.puts str
50
- f.flush
51
- f.close
48
+ file = File.open(@output, "w")
49
+ file.puts str
50
+ file.flush
51
+ file.close
52
52
 
53
53
  puts "Saved result to #{File.expand_path(@output)}."
54
54
  end
@@ -57,7 +57,7 @@ class Tool
57
57
  # Generate a timestamp to include in reports.
58
58
  #
59
59
  def generated_at
60
- "Generated at" + Time.now.strftime(" [%m/%d/%Y %H:%M:%S] ")
60
+ "Generated at " + Time.now.strftime("[%m/%d/%Y %H:%M:%S]")
61
61
  end
62
62
 
63
63
  #
@@ -70,4 +70,41 @@ class Tool
70
70
  end
71
71
  end
72
72
 
73
+ protected
74
+
75
+ #
76
+ # Describes a list of collected data.
77
+ #
78
+ def add_desc(heading,list)
79
+ description = "\n\n#{heading}: #{list.length.to_s}\n\n\t"
80
+ description << list.join("\n\t") unless list.empty?
81
+ description
82
+ end
83
+
84
+ #
85
+ # Opens the document specified by path and returns a list of all first capture
86
+ # group matches, after stripping comments.
87
+ #
88
+ def scan_doc(path,regex)
89
+ caputres = []
90
+ file = File.open(path,"r").read.strip
91
+ file = Stripper.comments(file)
92
+ file.scan(regex) { caputres << $1 }
93
+ caputres
94
+ end
95
+
96
+ #
97
+ # Scans directories for all files that match the regex, and for each match
98
+ # goes on to scan that document for items matching the syntax regex.
99
+ #
100
+ def scan_dirs(extension,dir,syntax_regex)
101
+ declarations = []
102
+
103
+ Search.find_all(extension,dir,@excludes) do |path|
104
+ declarations << scan_doc(path,syntax_regex)
105
+ end
106
+
107
+ declarations.flatten!.sort!.uniq! unless declarations.empty?
108
+ declarations
109
+ end
73
110
  end
data/lib/shed/version.rb CHANGED
@@ -5,7 +5,7 @@ module ToolShed #:nodoc:
5
5
  module VERSION #:nodoc:
6
6
  MAJOR = 0
7
7
  MINOR = 0
8
- TINY = 5
8
+ TINY = 7
9
9
 
10
10
  STRING = [MAJOR, MINOR, TINY].join('.')
11
11
  end
data/lib/tool_shed.rb CHANGED
@@ -7,13 +7,13 @@ require 'shed/asdoc_package'
7
7
  require 'shed/manifest'
8
8
  require 'shed/opts/asdoc_package_opts'
9
9
  require 'shed/opts/manifest_opts'
10
- require 'shed/opts/unused_asset_opts'
11
- require 'shed/opts/unused_class_opts'
12
- require 'shed/opts/unused_style_opts'
10
+ require 'shed/opts/asset_vacuum_opts'
11
+ require 'shed/opts/class_vacuum_opts'
12
+ require 'shed/opts/style_vacuum_opts'
13
13
  require 'shed/project_tools'
14
14
  require 'shed/search'
15
15
  require 'shed/stripper'
16
- require 'shed/unused_asset'
17
- require 'shed/unused_class'
18
- require 'shed/unused_style'
16
+ require 'shed/asset_vacuum'
17
+ require 'shed/class_vacuum'
18
+ require 'shed/style_vacuum'
19
19
  require 'shed/version'
@@ -0,0 +1,12 @@
1
+
2
+ @font-face {
3
+ src : url("/../assets/fonts/referenced-in-css.ttf");
4
+ fontFamily : Phwack;
5
+ fontWeight : Semibold;
6
+ unicode-range : "Basic Latin";
7
+ }
8
+
9
+ Thwacker
10
+ {
11
+ thwackSkin : Embed(source="/../assets/swf/referenced-in-css.swf", symbol="ThwackerDisabledSkin");
12
+ }
@@ -0,0 +1,7 @@
1
+
2
+ @font-face {
3
+ src : url("/../assets/fonts/referenced-in-unused-css.ttf");
4
+ fontFamily : Phwack;
5
+ fontWeight : Semibold;
6
+ unicode-range : "Basic Latin";
7
+ }
@@ -1,4 +1,9 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml">
3
+
4
+ <mx:Style source="/../assets/css/referenced-in-mxml.css"/>
5
+
6
+ <mx:Image source="@Embed('/../assets/img/referenced.gif')"/>
7
+ <mx:Image source='@Embed("/../assets/img/referenced.svg")'/>
3
8
 
4
9
  </mx:Canvas>
@@ -21,9 +21,14 @@ public class ToolShed extends Object
21
21
  [Embed(source='/../assets/img/referenced.jpg')]
22
22
  private var jpgEg:Class;
23
23
 
24
- [Embed(source='/../assets/img/referenced.png')]
25
- private var pngEG:Class
24
+ [Embed(source="/../assets/img/referenced.png")]
25
+ private var pngEG:Class;
26
26
 
27
+ [Embed(source='/../assets/swf/referenced.swf')]
28
+ private var swfEG:Class;
29
+
30
+ [Embed(source='/../assets/audio/referenced.mp3')]
31
+ private var mp3Eg:Class;
27
32
 
28
33
  }
29
34
 
@@ -10,7 +10,7 @@ class ASDocPackageOptsTest < Test::Unit::TestCase
10
10
  args = []
11
11
  opts = ASDocPackageOpts.parse(args)
12
12
 
13
- assert_equal 'package-asdoc.xml', opts[:output]
13
+ assert_equal 'asdoc-package-config.xml', opts[:output]
14
14
  assert_equal '.', opts[:src]
15
15
  assert_equal false, opts[:verbose]
16
16
  end
@@ -0,0 +1,77 @@
1
+ # encoding: utf-8
2
+
3
+ require File.join(File.dirname(__FILE__), "/../test_helper")
4
+
5
+ class TestAssetVacuum < Test::Unit::TestCase
6
+
7
+ def fix
8
+ File.expand_path(File.dirname(__FILE__)+ "/../fixtures/unused-asset")
9
+ end
10
+
11
+ context "A asset vacuum tool" do
12
+
13
+ context "with correct arguments" do
14
+ setup do
15
+ opt = { :src => "#{fix}",
16
+ :output => "/tmp/as-asset-vacuum.txt" }
17
+
18
+ @out = StringIO.new
19
+ @tool = AssetVacuum.new(opt,@out)
20
+ end
21
+
22
+ should "find all assets in the project" do
23
+ assert_match(/\.gif/, @tool.assets.to_s)
24
+ assert_match(/\.jpg/, @tool.assets.to_s)
25
+ assert_match(/\.mp3/, @tool.assets.to_s)
26
+ assert_match(/\.otf/, @tool.assets.to_s)
27
+ assert_match(/\.png/, @tool.assets.to_s)
28
+ assert_match(/\.svg/, @tool.assets.to_s)
29
+ assert_match(/\.swf/, @tool.assets.to_s)
30
+ assert_match(/\.ttf/, @tool.assets.to_s)
31
+ assert_equal(17, @tool.assets.length)
32
+ end
33
+
34
+ should "search all loaded src files for asset references and store them in a list" do
35
+ assert_match('referenced.gif', @tool.declared.to_s)
36
+ assert_match('referenced.jpg', @tool.declared.to_s)
37
+ assert_match('referenced.mp3', @tool.declared.to_s)
38
+ assert_match('referenced.otf', @tool.declared.to_s)
39
+ assert_match('referenced.png', @tool.declared.to_s)
40
+ assert_match('referenced.svg', @tool.declared.to_s)
41
+ assert_match('referenced.swf', @tool.declared.to_s)
42
+ assert_match('referenced-in-css.swf', @tool.declared.to_s)
43
+ assert_match('referenced-in-css.ttf', @tool.declared.to_s)
44
+ assert_match('referenced-in-unused-css.ttf', @tool.declared.to_s)
45
+ assert_equal(10, @tool.declared.length)
46
+ end
47
+
48
+ should "produce a list of assets found in the project directory which are not referenced in the project src" do
49
+ assert_match('un-referenced.jpg', @tool.unused.to_s)
50
+ assert_match('un-referenced.gif', @tool.unused.to_s)
51
+ assert_match('un-referenced.mp3', @tool.unused.to_s)
52
+ assert_match('un-referenced.otf', @tool.unused.to_s)
53
+ assert_match('un-referenced.png', @tool.unused.to_s)
54
+ assert_match('un-referenced.svg', @tool.unused.to_s)
55
+ assert_match('un-referenced.swf', @tool.unused.to_s)
56
+ assert_equal(7, @tool.unused.length)
57
+ end
58
+
59
+ should "only search css files referenced in as/mxml for asset references" do
60
+ #Tecnically yes. Sounds like a pain in the ass to me though.
61
+ end
62
+ end
63
+
64
+ context "with incorrect arguments" do
65
+ setup do
66
+ opt = {:src => "INVALID", :output => "/tmp/as-asset-vacuum.txt"}
67
+ @out = StringIO.new
68
+ @tool = AssetVacuum.new(opt,@out)
69
+ end
70
+
71
+ should "fail with a warning message" do
72
+ assert_match(/#{AssetVacuum::INVALID_OPTS}/, @out.string)
73
+ end
74
+ end
75
+ end
76
+
77
+ end
@@ -2,29 +2,27 @@
2
2
 
3
3
  require File.join(File.dirname(__FILE__), "/../test_helper")
4
4
 
5
- class UnusedAssetOptsTest < Test::Unit::TestCase
5
+ class TestAssetVacuumOpts < Test::Unit::TestCase
6
6
 
7
- context "A Unused Asset Tool Options Parser" do
7
+ context "An Asset Vacuum Tool Options Parser" do
8
8
 
9
9
  should "return default hash if no arguments are specified" do
10
10
 
11
11
  args = []
12
- opts = UnusedAssetOpts.parse(args)
12
+ opts = AssetVacuumOpts.parse(args)
13
13
 
14
14
  assert_equal 'assets.txt', opts[:output]
15
- assert_equal 'manifest.xml', opts[:manifest]
16
- assert_equal 'link-report.xml', opts[:link_report]
17
15
  assert_equal '.', opts[:src]
18
16
  assert_equal false, opts[:verbose]
19
17
 
20
18
  end
21
19
 
22
20
  should "display a name" do
23
- assert_match(/\w+/, UnusedAssetOpts.name)
21
+ assert_match(/\w+/, AssetVacuumOpts.name)
24
22
  end
25
23
 
26
24
  should "describe itself" do
27
- assert_match(/\w+/, UnusedAssetOpts.description)
25
+ assert_match(/\w+/, AssetVacuumOpts.description)
28
26
  end
29
27
 
30
28
  end
@@ -2,9 +2,9 @@
2
2
 
3
3
  require File.join(File.dirname(__FILE__), "/../test_helper")
4
4
 
5
- class TestUnusedClass < Test::Unit::TestCase
5
+ class TestClassVacuum < Test::Unit::TestCase
6
6
 
7
- context "A unused class detector" do
7
+ context "A class vacuum tool" do
8
8
 
9
9
  context "with correct arguments" do
10
10
  setup do
@@ -12,10 +12,10 @@ class TestUnusedClass < Test::Unit::TestCase
12
12
  opt = { :src => "#{fix}/src",
13
13
  :manifest => "#{fix}/manifest.xml",
14
14
  :link_report => "#{fix}/link-report.xml",
15
- :output => '/tmp/hel-unused-class-tool.txt' }
15
+ :output => '/tmp/as-class-vacuum.txt' }
16
16
 
17
17
  @out = StringIO.new
18
- @tool = UnusedClass.new(opt,@out)
18
+ @tool = ClassVacuum.new(opt,@out)
19
19
  end
20
20
 
21
21
  should "find unused classes" do
@@ -35,13 +35,13 @@ class TestUnusedClass < Test::Unit::TestCase
35
35
 
36
36
  context "with incorrect arguments" do
37
37
  setup do
38
- opt = {:manifest => "INVALID", :output => '/tmp/unused-class-tool.txt'}
38
+ opt = {:manifest => "INVALID", :output => '/tmp/as-class-vacuum.txt'}
39
39
  @out = StringIO.new
40
- @tool = UnusedClass.new(opt,@out)
40
+ @tool = ClassVacuum.new(opt,@out)
41
41
  end
42
42
 
43
43
  should "fail with a warning message" do
44
- assert_match(/#{UnusedClass::INVALID_OPTS}/, @out.string)
44
+ assert_match(/#{ClassVacuum::INVALID_OPTS}/, @out.string)
45
45
  end
46
46
  end
47
47
 
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+
3
+ require File.join(File.dirname(__FILE__), "/../test_helper")
4
+
5
+ class TestClassVacuumOpts < Test::Unit::TestCase
6
+
7
+ context "A Class Vacuum Tool Options Parser" do
8
+
9
+ should "return default hash if no arguments are specified" do
10
+ args = []
11
+ opts = ClassVacuumOpts.parse(args)
12
+
13
+ assert_equal 'class-vacuum.txt', opts[:output]
14
+ assert_equal 'manifest.xml', opts[:manifest]
15
+ assert_equal 'link-report.xml', opts[:link_report]
16
+ assert_equal '.', opts[:src]
17
+ assert_equal false, opts[:verbose]
18
+ end
19
+
20
+ should "display a name" do
21
+ assert_match(/\w+/, ClassVacuumOpts.name)
22
+ end
23
+
24
+ should "describe itself" do
25
+ assert_match(/\w+/, ClassVacuumOpts.description)
26
+ end
27
+
28
+ should "raise an exception if mandatory arguments are missing" do
29
+ assert_raise(OptionParser::MissingArgument) { ClassVacuumOpts.parse(['-m']) }
30
+ assert_raise(OptionParser::MissingArgument) { ClassVacuumOpts.parse(['--manifest']) }
31
+ assert_raise(OptionParser::MissingArgument) { ClassVacuumOpts.parse(['-l']) }
32
+ assert_raise(OptionParser::MissingArgument) { ClassVacuumOpts.parse(['--link-report']) }
33
+ end
34
+
35
+ should "raise an exception if incorrect arguments are specified" do
36
+ assert_raise(OptionParser::InvalidOption) { ClassVacuumOpts.parse(['-z']) }
37
+ assert_raise(OptionParser::InvalidOption) { ClassVacuumOpts.parse(['--kapow']) }
38
+ assert_raise(OptionParser::InvalidOption) { ClassVacuumOpts.parse(['--shlock']) }
39
+ end
40
+
41
+ should "set manifest and link-report properties" do
42
+ args = ['-m', 'custom-manifest.xml', '-l', 'custom-link-report.xml']
43
+ opts = ClassVacuumOpts.parse(args)
44
+
45
+ assert_equal 'custom-manifest.xml', opts[:manifest]
46
+ assert_equal 'custom-link-report.xml', opts[:link_report]
47
+ end
48
+
49
+ end
50
+
51
+ end
@@ -2,21 +2,22 @@
2
2
 
3
3
  require File.join(File.dirname(__FILE__), "/../test_helper")
4
4
 
5
- class TestUnusedStyle < Test::Unit::TestCase
5
+ class TestStyleVacuum < Test::Unit::TestCase
6
6
 
7
7
  def fix
8
8
  File.expand_path(File.dirname(__FILE__)+ "/../fixtures/unused-css")
9
9
  end
10
10
 
11
- context "A unused style detector" do
11
+ context "A style vacuum tool" do
12
12
 
13
13
  context "with correct arguments" do
14
14
  setup do
15
15
  opt = { :src => "#{fix}/src",
16
- :css_dir => "#{fix}/css" }
16
+ :css_dir => "#{fix}/css",
17
+ :output => '/tmp/as-style-vacuum.txt' }
17
18
 
18
19
  @out = StringIO.new
19
- @tool = UnusedStyle.new(opt,@out)
20
+ @tool = StyleVacuum.new(opt,@out)
20
21
  end
21
22
 
22
23
  should "find declared styles" do
@@ -36,14 +37,15 @@ class TestUnusedStyle < Test::Unit::TestCase
36
37
  context "with incorrect arguments" do
37
38
  setup do
38
39
  opt = { :src => "#{fix}/src",
39
- :css_dir => "#{fix}/src" }
40
+ :css_dir => "#{fix}/src",
41
+ :output => '/tmp/as-style-vacuum.txt' }
40
42
 
41
43
  @out = StringIO.new
42
- @tool = UnusedStyle.new(opt,@out)
44
+ @tool = StyleVacuum.new(opt,@out)
43
45
  end
44
46
 
45
47
  should "fail with a warning message" do
46
- assert_match(/#{UnusedStyle::INVALID_OPTS}/, @out.string)
48
+ assert_match(/#{StyleVacuum::INVALID_OPTS}/, @out.string)
47
49
  assert_equal(false, @tool.valid_opts)
48
50
  end
49
51
  end
@@ -51,9 +53,11 @@ class TestUnusedStyle < Test::Unit::TestCase
51
53
  context "when given a css directory containing more than one css" do
52
54
  setup do
53
55
  opt = { :src => "#{fix}/src",
54
- :css_dir => "#{fix}/css-multiple" }
56
+ :css_dir => "#{fix}/css-multiple",
57
+ :output => '/tmp/as-style-vacuum.txt' }
55
58
 
56
- @tool = UnusedStyle.new(opt)
59
+ @out = StringIO.new
60
+ @tool = StyleVacuum.new(opt,@out)
57
61
  end
58
62
 
59
63
  should "find declared styles" do
@@ -63,15 +67,16 @@ class TestUnusedStyle < Test::Unit::TestCase
63
67
  should "find unused styles" do
64
68
  assert @tool.unused.length == 3
65
69
  end
66
-
67
70
  end
68
71
 
69
72
  context "when searching css files for style definitions" do
70
73
  setup do
71
74
  opt = { :src => "#{fix}/src",
72
- :css_dir => "#{fix}/css-with-comments" }
75
+ :css_dir => "#{fix}/css-with-comments",
76
+ :output => '/tmp/as-style-vacuum.txt' }
73
77
 
74
- @tool = UnusedStyle.new(opt)
78
+ @out = StringIO.new
79
+ @tool = StyleVacuum.new(opt,@out)
75
80
  end
76
81
 
77
82
  should "find basic declarations" do
@@ -87,15 +92,16 @@ class TestUnusedStyle < Test::Unit::TestCase
87
92
  context "when searching mxml documents for style useage" do
88
93
  setup do
89
94
  opt = { :src => "#{fix}/src",
90
- :css_dir => "#{fix}/css" }
95
+ :css_dir => "#{fix}/css",
96
+ :output => '/tmp/as-style-vacuum.txt' }
91
97
 
92
- @tool = UnusedStyle.new(opt)
98
+ @out = StringIO.new
99
+ @tool = StyleVacuum.new(opt,@out)
93
100
  end
94
101
 
95
102
  should "find all values of syleName attributes" do
96
103
  assert @tool.used.length == 2
97
104
  end
98
-
99
105
  end
100
106
 
101
107
  end
@@ -0,0 +1,46 @@
1
+ # encoding: utf-8
2
+
3
+ require File.join(File.dirname(__FILE__), "/../test_helper")
4
+
5
+ class TestStyleVacuumOpts < Test::Unit::TestCase
6
+
7
+ context "A Style Vacuum Tool Options Parser" do
8
+
9
+ should "return default hash if no arguments are specified" do
10
+ args = []
11
+ opts = StyleVacuumOpts.parse(args)
12
+
13
+ assert_equal 'styles.txt', opts[:output]
14
+ assert_equal 'style', opts[:css_dir]
15
+ assert_equal '.', opts[:src]
16
+ assert_equal false, opts[:verbose]
17
+ end
18
+
19
+ should "display a name" do
20
+ assert_match(/\w+/, StyleVacuumOpts.name)
21
+ end
22
+
23
+ should "describe itself" do
24
+ assert_match(/\w+/, StyleVacuumOpts.description)
25
+ end
26
+
27
+ should "raise an exception if mandatory arguments are missing" do
28
+ assert_raise(OptionParser::MissingArgument) { StyleVacuumOpts.parse(['--css']) }
29
+ end
30
+
31
+ should "raise an exception if incorrect arguments are specified" do
32
+ assert_raise(OptionParser::InvalidOption) { StyleVacuumOpts.parse(['--ccs']) }
33
+ assert_raise(OptionParser::InvalidOption) { StyleVacuumOpts.parse(['--zaaap']) }
34
+ assert_raise(OptionParser::InvalidOption) { StyleVacuumOpts.parse(['--vrrooom']) }
35
+ end
36
+
37
+ should "set manifest and link-report properties" do
38
+ args = ['--css', 'custom/ccs/directory']
39
+ opts = StyleVacuumOpts.parse(args)
40
+
41
+ assert_equal 'custom/ccs/directory', opts[:css_dir]
42
+ end
43
+
44
+ end
45
+
46
+ end