initial release
This commit is contained in:
commit
9515c25b23
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
*.gem
|
||||
.bundle
|
||||
Gemfile.lock
|
||||
pkg/*
|
4
Gemfile
Normal file
4
Gemfile
Normal file
@ -0,0 +1,4 @@
|
||||
source "http://rubygems.org"
|
||||
|
||||
# Specify your gem's dependencies in guard-rocco.gemspec
|
||||
gemspec
|
25
guard-rocco.gemspec
Normal file
25
guard-rocco.gemspec
Normal 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
36
lib/guard/rocco.rb
Normal 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
|
||||
|
5
lib/guard/rocco/version.rb
Normal file
5
lib/guard/rocco/version.rb
Normal file
@ -0,0 +1,5 @@
|
||||
module Guard
|
||||
module RoccoVersion
|
||||
VERSION = '0.0.1'
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user