guard-docbook-status 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +12 -0
- data/Gemfile.lock +49 -0
- data/Guardfile +6 -0
- data/History.txt +4 -0
- data/README.md +71 -0
- data/Rakefile +20 -0
- data/lib/guard/docbook-status.rb +35 -0
- data/lib/guard/docbook-status/templates/Guardfile +3 -0
- data/lib/guard/docbook-status/version.rb +5 -0
- data/spec/fixtures/bookxi.xml +16 -0
- data/spec/fixtures/c4/chapter4xi.xml +8 -0
- data/spec/fixtures/chapter2xi.xml +11 -0
- data/spec/fixtures/chapter3xi.xml +8 -0
- data/spec/fixtures/section1xi.xml +9 -0
- data/spec/guard/docbook-status_spec.rb +55 -0
- data/spec/spec_helper.rb +15 -0
- data/spec/work/bookxi.xml +16 -0
- data/spec/work/c4/chapter4xi.xml +8 -0
- data/spec/work/chapter2xi.xml +11 -0
- data/spec/work/chapter3xi.xml +8 -0
- data/spec/work/section1xi.xml +9 -0
- data/version.txt +1 -0
- metadata +108 -0
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
bones (3.7.1)
|
5
|
+
little-plugger (>= 1.1.2)
|
6
|
+
loquacious (>= 1.8.1)
|
7
|
+
rake (>= 0.8.7)
|
8
|
+
diff-lcs (1.1.3)
|
9
|
+
directory_watcher (1.4.1)
|
10
|
+
docbook_status (0.4.0)
|
11
|
+
directory_watcher (>= 1.4.1)
|
12
|
+
json (>= 1.6.1)
|
13
|
+
libxml-ruby (>= 2.2.2)
|
14
|
+
term-ansicolor (>= 1.0.6)
|
15
|
+
growl_notify (0.0.3)
|
16
|
+
rb-appscript
|
17
|
+
guard (0.8.4)
|
18
|
+
thor (~> 0.14.6)
|
19
|
+
guard-rspec (0.5.0)
|
20
|
+
guard (>= 0.8.4)
|
21
|
+
json (1.6.1)
|
22
|
+
libxml-ruby (2.2.2)
|
23
|
+
little-plugger (1.1.2)
|
24
|
+
loquacious (1.9.0)
|
25
|
+
rake (0.9.2)
|
26
|
+
rb-appscript (0.6.1)
|
27
|
+
rb-fsevent (0.4.3.1)
|
28
|
+
rspec (2.6.0)
|
29
|
+
rspec-core (~> 2.6.0)
|
30
|
+
rspec-expectations (~> 2.6.0)
|
31
|
+
rspec-mocks (~> 2.6.0)
|
32
|
+
rspec-core (2.6.4)
|
33
|
+
rspec-expectations (2.6.0)
|
34
|
+
diff-lcs (~> 1.1.2)
|
35
|
+
rspec-mocks (2.6.0)
|
36
|
+
term-ansicolor (1.0.7)
|
37
|
+
thor (0.14.6)
|
38
|
+
|
39
|
+
PLATFORMS
|
40
|
+
ruby
|
41
|
+
|
42
|
+
DEPENDENCIES
|
43
|
+
bones
|
44
|
+
docbook_status
|
45
|
+
growl_notify
|
46
|
+
guard
|
47
|
+
guard-rspec
|
48
|
+
rb-fsevent
|
49
|
+
rspec
|
data/Guardfile
ADDED
data/History.txt
ADDED
data/README.md
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
guard-docbook-status
|
2
|
+
===========
|
3
|
+
|
4
|
+
The docbook-status guard will watch your DocBook documents and check
|
5
|
+
their status when they change. It is meant to work with the
|
6
|
+
'docbook_status' utility, see https://github.com/rvolz/docbook_status
|
7
|
+
|
8
|
+
Usage
|
9
|
+
--------
|
10
|
+
|
11
|
+
See the [Guard documentation](https://github.com/guard/guard#readme) for general instructions.
|
12
|
+
|
13
|
+
To start with this add-on, create your Guardfile with:
|
14
|
+
|
15
|
+
guard init docbook-status
|
16
|
+
|
17
|
+
Then change the resulting Guardfile, if necessary. The standard Guardfile looks like this:
|
18
|
+
|
19
|
+
guard 'docbook-status', :cli => '--remarks myproject.xml' do
|
20
|
+
watch(/.+\.xml$/i)
|
21
|
+
end
|
22
|
+
|
23
|
+
To adapt the Guardfile to your requirements:
|
24
|
+
|
25
|
+
* change the _cli_ option. It can contain all options that you would normally use to start docbook_status.
|
26
|
+
* change the _watch_ statement. The regular expression currently looks for changes in all XML files. A change there would trigger the processing by docbook_status.
|
27
|
+
|
28
|
+
Install
|
29
|
+
-------
|
30
|
+
|
31
|
+
Since you are reading this, it is assumed that you have docbook_status already installed. Since this is a Guard add-on, you'll need also [Guard](https://github.com/guard/guard) to be installed.
|
32
|
+
|
33
|
+
Then install this add-on with
|
34
|
+
|
35
|
+
gem install guard-docbook-status
|
36
|
+
|
37
|
+
or add it to your Gemfile
|
38
|
+
|
39
|
+
gem 'guard-docbook-status'
|
40
|
+
|
41
|
+
|
42
|
+
Author
|
43
|
+
------
|
44
|
+
|
45
|
+
Original author: Rainer Volz
|
46
|
+
|
47
|
+
License
|
48
|
+
-------
|
49
|
+
|
50
|
+
(The MIT License)
|
51
|
+
|
52
|
+
Copyright (c) 2011 Rainer Volz
|
53
|
+
|
54
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
55
|
+
a copy of this software and associated documentation files (the
|
56
|
+
'Software'), to deal in the Software without restriction, including
|
57
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
58
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
59
|
+
permit persons to whom the Software is furnished to do so, subject to
|
60
|
+
the following conditions:
|
61
|
+
|
62
|
+
The above copyright notice and this permission notice shall be
|
63
|
+
included in all copies or substantial portions of the Software.
|
64
|
+
|
65
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
66
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
67
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
68
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
69
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
70
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
71
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
begin
|
3
|
+
require 'bones'
|
4
|
+
rescue LoadError
|
5
|
+
abort '### Please install the "bones" gem ###'
|
6
|
+
end
|
7
|
+
|
8
|
+
task :default => 'spec'
|
9
|
+
task 'gem:release' => 'spec'
|
10
|
+
|
11
|
+
Bones {
|
12
|
+
name 'guard-docbook-status'
|
13
|
+
authors 'Rainer Volz'
|
14
|
+
email 'dev@textmulch.de'
|
15
|
+
url 'https://github.com/rvolz/guard-docbook-status/'
|
16
|
+
ignore_file '.gitignore'
|
17
|
+
depend_on 'docbook_status'
|
18
|
+
depend_on 'guard'
|
19
|
+
}
|
20
|
+
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# *-* encoding: utf-8 -*-
|
2
|
+
require 'guard'
|
3
|
+
require 'guard/guard'
|
4
|
+
require 'guard/watcher'
|
5
|
+
|
6
|
+
module Guard
|
7
|
+
class DocbookStatus < Guard
|
8
|
+
|
9
|
+
def initialize(watchers=[], options={})
|
10
|
+
super
|
11
|
+
@options = {
|
12
|
+
:trigger_on_start => true
|
13
|
+
}.update(options)
|
14
|
+
end
|
15
|
+
|
16
|
+
def start
|
17
|
+
::Guard::UI.info("Guard::DocbookStatus has started watching your files")
|
18
|
+
run_all if @options[:trigger_on_start]
|
19
|
+
end
|
20
|
+
|
21
|
+
def run_all
|
22
|
+
run_on_change([])
|
23
|
+
end
|
24
|
+
|
25
|
+
def run_on_change(paths)
|
26
|
+
::Guard::UI.info("Guard::DocbookStatus detected a change")
|
27
|
+
output = system("docbook_status #{@options[:cli]}")
|
28
|
+
command_failure = ($?.to_i != 0)
|
29
|
+
if command_failure
|
30
|
+
::Guard::UI.error("docbook_status indicated an error")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" ?>
|
2
|
+
<book xmlns="http://docbook.org/ns/docbook"
|
3
|
+
xmlns:xi="http://www.w3.org/2001/XInclude"
|
4
|
+
version="5.0">
|
5
|
+
<title>B1</title>
|
6
|
+
<chapter>
|
7
|
+
<title>C1</title>
|
8
|
+
<para>
|
9
|
+
Dies ist ein Test .. Dies ist ein Test.
|
10
|
+
In den Jahren 1900-1901 geschahen viele Überfälle von O`Reillys.
|
11
|
+
</para>
|
12
|
+
</chapter>
|
13
|
+
<xi:include href="chapter2xi.xml"/>
|
14
|
+
<xi:include href="chapter3xi.xml"/>
|
15
|
+
<xi:include href="c4/chapter4xi.xml"/>
|
16
|
+
</book>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<chapter xmlns="http://docbook.org/ns/docbook"
|
2
|
+
xmlns:xi="http://www.w3.org/2001/XInclude"
|
3
|
+
version="5.0">
|
4
|
+
<title>C2</title>
|
5
|
+
<para>
|
6
|
+
Dies ist ein Test .. Dies ist ein Test.
|
7
|
+
In den Jahren 1900-1901 geschahen viele Überfälle von O`Reillys.
|
8
|
+
<remark>FIXME Ausbauen.</remark>
|
9
|
+
</para>
|
10
|
+
<xi:include href="section1xi.xml"/>
|
11
|
+
</chapter>
|
@@ -0,0 +1,55 @@
|
|
1
|
+
|
2
|
+
#require File.join(File.dirname(__FILE__), %w[spec_helper])
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'guard'
|
5
|
+
require 'guard/ui'
|
6
|
+
require 'guard/watcher'
|
7
|
+
require 'fileutils'
|
8
|
+
|
9
|
+
module Guard
|
10
|
+
describe DocbookStatus do
|
11
|
+
before(:each) do
|
12
|
+
@gdbs = DocbookStatus.new
|
13
|
+
end
|
14
|
+
|
15
|
+
describe "start" do
|
16
|
+
it "should trigger dbs on start" do
|
17
|
+
::Guard::UI.should_receive(:info).with("Guard::DocbookStatus has started watching your files")
|
18
|
+
::Guard::UI.should_receive(:info).with("Guard::DocbookStatus detected a change")
|
19
|
+
::Guard::UI.should_receive(:error).with("docbook_status indicated an error")
|
20
|
+
@gdbs.start
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should process a file on start" do
|
24
|
+
FileUtils.rm_rf 'spec/work'
|
25
|
+
FileUtils.cp_r 'spec/fixtures/', 'spec/work/'
|
26
|
+
::Guard::UI.should_receive(:info).with("Guard::DocbookStatus has started watching your files")
|
27
|
+
::Guard::UI.should_receive(:info).with("Guard::DocbookStatus detected a change")
|
28
|
+
::Guard::UI.should_not_receive(:error)
|
29
|
+
@gdbs = DocbookStatus.new(["*.xml"],{:cli => 'spec/work/bookxi.xml'})
|
30
|
+
@gdbs.start
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "run_on_change" do
|
35
|
+
it "should process a file in the working dir" do
|
36
|
+
w = Watcher.new("spec/fixtures/*.xml")
|
37
|
+
::Guard::UI.should_receive(:info).with("Guard::DocbookStatus has started watching your files")
|
38
|
+
@gdbs = DocbookStatus.new([w],{:cli => 'bookxi.xml'})
|
39
|
+
@gdbs.should_receive(:run_on_change).twice
|
40
|
+
@gdbs.start
|
41
|
+
@gdbs.run_on_change(["chapter2xi.xml"])
|
42
|
+
|
43
|
+
end
|
44
|
+
it "should process a file in a subdir" do
|
45
|
+
w = Watcher.new("spec/fixtures/**/*.xml")
|
46
|
+
::Guard::UI.should_receive(:info).with("Guard::DocbookStatus has started watching your files")
|
47
|
+
@gdbs = DocbookStatus.new([w],{:cli => 'bookxi.xml'})
|
48
|
+
@gdbs.should_receive(:run_on_change).twice
|
49
|
+
@gdbs.start
|
50
|
+
@gdbs.run_on_change(["chapter4xi.xml"])
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
require File.expand_path(
|
3
|
+
File.join(File.dirname(__FILE__), %w[.. lib guard docbook-status]))
|
4
|
+
|
5
|
+
RSpec.configure do |config|
|
6
|
+
# == Mock Framework
|
7
|
+
#
|
8
|
+
# RSpec uses it's own mocking framework by default. If you prefer to
|
9
|
+
# use mocha, flexmock or RR, uncomment the appropriate line:
|
10
|
+
#
|
11
|
+
# config.mock_with :mocha
|
12
|
+
# config.mock_with :flexmock
|
13
|
+
# config.mock_with :rr
|
14
|
+
end
|
15
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8" ?>
|
2
|
+
<book xmlns="http://docbook.org/ns/docbook"
|
3
|
+
xmlns:xi="http://www.w3.org/2001/XInclude"
|
4
|
+
version="5.0">
|
5
|
+
<title>B1</title>
|
6
|
+
<chapter>
|
7
|
+
<title>C1</title>
|
8
|
+
<para>
|
9
|
+
Dies ist ein Test .. Dies ist ein Test.
|
10
|
+
In den Jahren 1900-1901 geschahen viele Überfälle von O`Reillys.
|
11
|
+
</para>
|
12
|
+
</chapter>
|
13
|
+
<xi:include href="chapter2xi.xml"/>
|
14
|
+
<xi:include href="chapter3xi.xml"/>
|
15
|
+
<xi:include href="c4/chapter4xi.xml"/>
|
16
|
+
</book>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<chapter xmlns="http://docbook.org/ns/docbook"
|
2
|
+
xmlns:xi="http://www.w3.org/2001/XInclude"
|
3
|
+
version="5.0">
|
4
|
+
<title>C2</title>
|
5
|
+
<para>
|
6
|
+
Dies ist ein Test .. Dies ist ein Test.
|
7
|
+
In den Jahren 1900-1901 geschahen viele Überfälle von O`Reillys.
|
8
|
+
<remark>FIXME Ausbauen.</remark>
|
9
|
+
</para>
|
10
|
+
<xi:include href="section1xi.xml"/>
|
11
|
+
</chapter>
|
data/version.txt
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
metadata
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: guard-docbook-status
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Rainer Volz
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-10-15 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: docbook_status
|
16
|
+
requirement: &2166150860 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.4.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2166150860
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: guard
|
27
|
+
requirement: &2166149960 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.8.4
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2166149960
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: bones
|
38
|
+
requirement: &2166149240 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 3.7.1
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2166149240
|
47
|
+
description: ! 'The docbook-status guard will watch your DocBook documents and check
|
48
|
+
|
49
|
+
their status when they change. It is meant to work with the
|
50
|
+
|
51
|
+
''docbook_status'' utility, see https://github.com/rvolz/docbook_status'
|
52
|
+
email: dev@textmulch.de
|
53
|
+
executables: []
|
54
|
+
extensions: []
|
55
|
+
extra_rdoc_files:
|
56
|
+
- History.txt
|
57
|
+
- lib/guard/docbook-status/templates/Guardfile
|
58
|
+
files:
|
59
|
+
- Gemfile
|
60
|
+
- Gemfile.lock
|
61
|
+
- Guardfile
|
62
|
+
- History.txt
|
63
|
+
- README.md
|
64
|
+
- Rakefile
|
65
|
+
- lib/guard/docbook-status.rb
|
66
|
+
- lib/guard/docbook-status/templates/Guardfile
|
67
|
+
- lib/guard/docbook-status/version.rb
|
68
|
+
- spec/fixtures/bookxi.xml
|
69
|
+
- spec/fixtures/c4/chapter4xi.xml
|
70
|
+
- spec/fixtures/chapter2xi.xml
|
71
|
+
- spec/fixtures/chapter3xi.xml
|
72
|
+
- spec/fixtures/section1xi.xml
|
73
|
+
- spec/guard/docbook-status_spec.rb
|
74
|
+
- spec/spec_helper.rb
|
75
|
+
- spec/work/bookxi.xml
|
76
|
+
- spec/work/c4/chapter4xi.xml
|
77
|
+
- spec/work/chapter2xi.xml
|
78
|
+
- spec/work/chapter3xi.xml
|
79
|
+
- spec/work/section1xi.xml
|
80
|
+
- version.txt
|
81
|
+
homepage: https://github.com/rvolz/guard-docbook-status/
|
82
|
+
licenses: []
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options:
|
85
|
+
- --main
|
86
|
+
- README.md
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ! '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubyforge_project: guard-docbook-status
|
103
|
+
rubygems_version: 1.8.11
|
104
|
+
signing_key:
|
105
|
+
specification_version: 3
|
106
|
+
summary: The docbook-status guard will watch your DocBook documents and check their
|
107
|
+
status when they change.
|
108
|
+
test_files: []
|