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 CHANGED
@@ -2,3 +2,12 @@ source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in guard-rocco.gemspec
4
4
  gemspec
5
+
6
+ require 'rbconfig'
7
+ gem 'guard'
8
+ gem 'guard-rspec'
9
+
10
+ if RbConfig::CONFIG['host_os'] =~ /darwin/
11
+ gem 'growl'
12
+ gem 'rb-fsevent'
13
+ end
data/Guardfile ADDED
@@ -0,0 +1,8 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'rspec', :version => 2 do
5
+ watch(%r{^spec/.+_spec\.rb$})
6
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+ end
data/guard-rocco.gemspec CHANGED
@@ -21,5 +21,7 @@ Gem::Specification.new do |s|
21
21
 
22
22
  s.add_dependency 'guard', '>= 0.4.0'
23
23
  s.add_dependency 'rocco'
24
+ s.add_development_dependency 'rspec', '~> 2.6.0'
25
+ s.add_development_dependency 'mocha'
24
26
  end
25
27
 
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module RoccoVersion
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
  end
5
5
  end
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 ||= self.filename_to_target(path)
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 self.filename_to_target(path)
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
+
@@ -0,0 +1,4 @@
1
+ RSpec.configure do |c|
2
+ c.mock_with :mocha
3
+ end
4
+
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.1
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