Merge pull request #2 from mybuddymichael/master
Add support for a ':stylesheet' option.
This commit is contained in:
commit
c1510cfdcc
@ -5,9 +5,11 @@ It's a [Guard](http://github.com/guard/guard) for the [Rocco](http://github.com/
|
|||||||
watch(%r{^lib/.*\.rb$})
|
watch(%r{^lib/.*\.rb$})
|
||||||
end
|
end
|
||||||
|
|
||||||
Only one option for now:
|
Options:
|
||||||
|
|
||||||
* `:dir` specifies the output dir (default `doc`)
|
* `:dir` specifies the output dir (default `doc`)
|
||||||
|
* `:stylesheet` specifies a custom stylesheet to use (default is
|
||||||
|
http://jashkenas.github.com/docco/resources/docco.css)
|
||||||
|
|
||||||
`gem install guard-rocco` or Bundle it up with `gem 'guard-rocco'`. Then `guard init rocco`. Yeah!
|
`gem install guard-rocco` or Bundle it up with `gem 'guard-rocco'`. Then `guard init rocco`. Yeah!
|
||||||
|
|
||||||
|
@ -28,7 +28,9 @@ module Guard
|
|||||||
target ||= filename_to_target(path)
|
target ||= filename_to_target(path)
|
||||||
puts "rocco: #{path} -> #{target}"
|
puts "rocco: #{path} -> #{target}"
|
||||||
FileUtils.mkdir_p File.split(target).first
|
FileUtils.mkdir_p File.split(target).first
|
||||||
File.open(target, 'wb') { |fh| fh.print ::Rocco.new(path, all_paths).to_html }
|
File.open(target, 'wb') do |fh|
|
||||||
|
fh.print ::Rocco.new(path, all_paths, rocco_options).to_html
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def all_paths
|
def all_paths
|
||||||
@ -38,6 +40,10 @@ module Guard
|
|||||||
def filename_to_target(path)
|
def filename_to_target(path)
|
||||||
File.join(@options[:dir], path).gsub(%r{\.[^\.]+$}, '.html')
|
File.join(@options[:dir], path).gsub(%r{\.[^\.]+$}, '.html')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def rocco_options
|
||||||
|
@options[:stylesheet] ? {stylesheet: @options[:stylesheet]} : {}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user