Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Support multiple parser paths #44

Merged
merged 1 commit into from Jul 14, 2012
Jump to file or symbol
Failed to load files and symbols.
+13 −6
Split
View
@@ -10,14 +10,16 @@ class Parser
# within the directory recursively for any comment blocks that look like
# KSS.
#
- # base_path - The path String where style files are located.
- def initialize(base_path)
+ # paths - Each path String where style files are located.
+ def initialize(*paths)
@josh

josh Jul 13, 2012

Contributor

Not sure how multiple args are even supposed to be doc'd in TomDoc.

@sections = {}
- Dir["#{base_path}/**/*.*"].each do |filename|
- parser = CommentParser.new(filename)
- parser.blocks.each do |comment_block|
- add_section comment_block, filename if self.class.kss_block?(comment_block)
+ paths.each do |path|
+ Dir["#{path}/**/*.*"].each do |filename|
+ parser = CommentParser.new(filename)
+ parser.blocks.each do |comment_block|
+ add_section comment_block, filename if self.class.kss_block?(comment_block)
+ end
end
end
end
View
@@ -7,6 +7,7 @@ def setup
@sass_parsed = Kss::Parser.new('test/fixtures/sass')
@css_parsed = Kss::Parser.new('test/fixtures/css')
@less_parsed = Kss::Parser.new('test/fixtures/less')
+ @multiple_parsed = Kss::Parser.new('test/fixtures/scss', 'test/fixtures/less')
@css_comment = <<comment
/*
@@ -104,4 +105,8 @@ def setup
assert_equal 2, @css_parsed.sections.count
end
+ test "parse multiple paths" do
+ assert_equal 6, @multiple_parsed.sections.count
+ end
+
end