initial release

This commit is contained in:
John Bintz 2011-06-17 16:01:49 -04:00
commit 9515c25b23
6 changed files with 76 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.gem
.bundle
Gemfile.lock
pkg/*

4
Gemfile Normal file
View File

@ -0,0 +1,4 @@
source "http://rubygems.org"
# Specify your gem's dependencies in guard-rocco.gemspec
gemspec

2
Rakefile Normal file
View File

@ -0,0 +1,2 @@
require 'bundler'
Bundler::GemHelper.install_tasks

25
guard-rocco.gemspec Normal file
View File

@ -0,0 +1,25 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "guard/rocco/version"
Gem::Specification.new do |s|
s.name = "guard-rocco"
s.version = Guard::RoccoVersion::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["John Bintz"]
s.email = ["john@coswellproductions.com"]
s.homepage = ""
s.summary = %q{Guard to generate Rocco documentation}
s.description = %q{Guard to generate Rocco documentation}
s.rubyforge_project = "guard-rocco"
s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
s.add_dependency 'guard', '>= 0.4.0'
s.add_dependency 'rocco'
end

36
lib/guard/rocco.rb Normal file
View File

@ -0,0 +1,36 @@
require 'rocco'
require 'guard/guard'
module Guard
class Rocco < Guard
def initialize(watchers = [], options = {})
super
@options = { :dir => 'doc' }.merge(options)
end
def start
UI.info "Guard::Rocco is waiting to build docs..."
end
def run_all
all_paths.each { |path| build(path) }
end
def run_on_change(paths = [])
paths.each { |path| build(path) }
end
private
def build(path)
target = File.join(@options[:dir], path).gsub(%r{\.[^\.]+$}, '.html')
puts "rocco: #{path} -> #{target}"
File.open(target, 'wb') { |fh| fh.print ::Rocco.new(path, all_paths).to_html }
end
def all_paths
Watcher.match_files(self, Dir['**/*'])
end
end
end

View File

@ -0,0 +1,5 @@
module Guard
module RoccoVersion
VERSION = '0.0.1'
end
end