guard-rocco 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +9 -0
- data/Guardfile +8 -0
- data/guard-rocco.gemspec +2 -0
- data/lib/guard/rocco/version.rb +1 -1
- data/lib/guard/rocco.rb +4 -2
- data/spec/lib/guard/rocco_spec.rb +40 -0
- data/spec/spec_helper.rb +4 -0
- metadata +29 -3
data/Gemfile
CHANGED
data/Guardfile
ADDED
data/guard-rocco.gemspec
CHANGED
data/lib/guard/rocco/version.rb
CHANGED
data/lib/guard/rocco.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rocco'
|
2
2
|
require 'guard/guard'
|
3
|
+
require 'fileutils'
|
3
4
|
|
4
5
|
module Guard
|
5
6
|
class Rocco < Guard
|
@@ -23,8 +24,9 @@ module Guard
|
|
23
24
|
|
24
25
|
private
|
25
26
|
def build(path, target = nil)
|
26
|
-
target ||=
|
27
|
+
target ||= filename_to_target(path)
|
27
28
|
puts "rocco: #{path} -> #{target}"
|
29
|
+
FileUtils.mkdir_p File.split(target).first
|
28
30
|
File.open(target, 'wb') { |fh| fh.print ::Rocco.new(path, all_paths).to_html }
|
29
31
|
end
|
30
32
|
|
@@ -32,7 +34,7 @@ module Guard
|
|
32
34
|
Watcher.match_files(self, Dir['**/*'])
|
33
35
|
end
|
34
36
|
|
35
|
-
def
|
37
|
+
def filename_to_target(path)
|
36
38
|
File.join(@options[:dir], path).gsub(%r{\.[^\.]+$}, '.html')
|
37
39
|
end
|
38
40
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'guard/rocco'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
describe Guard::Rocco do
|
6
|
+
let(:doc_dir) { 'spec/doc' }
|
7
|
+
|
8
|
+
before do
|
9
|
+
FileUtils.rm_rf doc_dir
|
10
|
+
FileUtils.mkdir_p doc_dir
|
11
|
+
end
|
12
|
+
|
13
|
+
after do
|
14
|
+
FileUtils.rm_rf doc_dir
|
15
|
+
end
|
16
|
+
|
17
|
+
let(:guard) { Guard::Rocco.new([], :dir => doc_dir) }
|
18
|
+
let(:filename) { 'lib/guard/rocco.rb' }
|
19
|
+
|
20
|
+
describe '#run_all' do
|
21
|
+
before do
|
22
|
+
guard.stubs(:all_paths).returns([filename])
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should generate the docs' do
|
26
|
+
guard.run_all
|
27
|
+
|
28
|
+
File.file?(File.join(doc_dir, 'lib/guard/rocco.html')).should be_true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#run_on_change' do
|
33
|
+
it 'should generate the doc' do
|
34
|
+
guard.run_on_change([filename])
|
35
|
+
|
36
|
+
File.file?(File.join(doc_dir, 'lib/guard/rocco.html')).should be_true
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: guard-rocco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- John Bintz
|
@@ -35,6 +35,28 @@ dependencies:
|
|
35
35
|
version: "0"
|
36
36
|
type: :runtime
|
37
37
|
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: rspec
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 2.6.0
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: mocha
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: "0"
|
58
|
+
type: :development
|
59
|
+
version_requirements: *id004
|
38
60
|
description: Guard to generate Rocco documentation
|
39
61
|
email:
|
40
62
|
- john@coswellproductions.com
|
@@ -47,12 +69,15 @@ extra_rdoc_files: []
|
|
47
69
|
files:
|
48
70
|
- .gitignore
|
49
71
|
- Gemfile
|
72
|
+
- Guardfile
|
50
73
|
- README.md
|
51
74
|
- Rakefile
|
52
75
|
- guard-rocco.gemspec
|
53
76
|
- lib/guard/rocco.rb
|
54
77
|
- lib/guard/rocco/templates/Guardfile
|
55
78
|
- lib/guard/rocco/version.rb
|
79
|
+
- spec/lib/guard/rocco_spec.rb
|
80
|
+
- spec/spec_helper.rb
|
56
81
|
has_rdoc: true
|
57
82
|
homepage: ""
|
58
83
|
licenses: []
|
@@ -81,5 +106,6 @@ rubygems_version: 1.6.2
|
|
81
106
|
signing_key:
|
82
107
|
specification_version: 3
|
83
108
|
summary: Guard to generate Rocco documentation
|
84
|
-
test_files:
|
85
|
-
|
109
|
+
test_files:
|
110
|
+
- spec/lib/guard/rocco_spec.rb
|
111
|
+
- spec/spec_helper.rb
|