Skip to content

Commit

Permalink
Merge pull request #1 from rtircher/master
Browse files Browse the repository at this point in the history
Appending .html if not present in the input file
  • Loading branch information
manufaktor committed Apr 6, 2012
2 parents 1f28379 + 06a72a3 commit 3552ff6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/guard/haml.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ def compile_haml file
def get_output(file)
file_dir = File.dirname(file)
file_name = File.basename(file).split('.')[0..-2].join('.')


file_name = "#{file_name}.html" if file_name.match("\.html?").nil?

file_dir = file_dir.gsub(Regexp.new("#{@options[:input]}(\/){0,1}"), '') if @options[:input]
file_dir = File.join(@options[:output], file_dir) if @options[:output]

Expand Down
4 changes: 2 additions & 2 deletions lib/guard/haml/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Guard
class HamlVersion
VERSION = '0.3.2'
VERSION = '0.3.3'
end
end
end
4 changes: 4 additions & 0 deletions spec/guard/haml_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
it 'should return test/index.htm.haml as test/index.htm' do
subject.get_output('test/index.htm.haml').should eq('test/index.htm')
end

it 'should return test/index.haml as test/index.html' do
subject.get_output('test/index.haml').should eq('test/index.html')
end
end

context 'when the output option is set to "demo/output"' do
Expand Down

0 comments on commit 3552ff6

Please sign in to comment.