Skip to content

Commit

Permalink
Add detection for passing the --literate option.
Browse files Browse the repository at this point in the history
  • Loading branch information
oychang committed Jan 26, 2014
1 parent 9d72f89 commit 686bd10
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions lib/guard/coffeescript/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,22 @@ def compile(filename, options)
# Gets the CoffeeScript compilation options.
#
# @param [String] file the CoffeeScript file
# @param [Hash] options the options for the execution
# @param [Hash] options the options for the execution of all files
# @option options [Boolean] :bare do not wrap the output in a top level function
# @return [Hash] options for a particular file's execution
#
def options_for_file(file, options)
return options unless options[:bare].respond_to? :include?
file_options = options.clone

# if :bare was provided an array of filenames, check for file's inclusion
if file_options[:bare].respond_to? :include?
filename = file[/([^\/]*)\.(?:coffee|coffee\.md|litcoffee)$/]
file_options[:bare] = file_options[:bare].include?(filename)
end

file_options = options.clone
filename = file[/([^\/]*)\.(?:coffee|coffee\.md|litcoffee)$/]
file_options[:bare] = file_options[:bare].include?(filename)
if ['.coffee.md', '.litcoffee'].include? File.extname(file)
file_options[:literate] = true
end

file_options
end
Expand Down

0 comments on commit 686bd10

Please sign in to comment.