docbook_files 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/Gemfile.lock +3 -1
- data/Guardfile +1 -1
- data/History.txt +9 -0
- data/README.md +29 -5
- data/Rakefile +4 -2
- data/bin/docbook_files +1 -1
- data/lib/docbook_files/app.rb +81 -37
- data/lib/docbook_files/docbook.rb +20 -13
- data/lib/docbook_files/file_data.rb +30 -11
- data/lib/docbook_files.rb +1 -1
- data/spec/docbook_files/app_spec.rb +1 -1
- data/spec/docbook_files/docbook_spec.rb +4 -2
- data/spec/docbook_files/file_data_spec.rb +3 -3
- data/version.txt +1 -1
- metadata +23 -15
- data/About.org +0 -77
- data/spec/fixtures/.DS_Store +0 -0
- data/spec/fixtures/refs/.DS_Store +0 -0
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -13,6 +13,7 @@ GEM
|
|
13
13
|
thor (~> 0.14.6)
|
14
14
|
guard-rspec (0.5.0)
|
15
15
|
guard (>= 0.8.4)
|
16
|
+
json (1.6.1)
|
16
17
|
libxml-ruby (2.2.2)
|
17
18
|
little-plugger (1.1.2)
|
18
19
|
loquacious (1.9.0)
|
@@ -29,7 +30,7 @@ GEM
|
|
29
30
|
diff-lcs (~> 1.1.2)
|
30
31
|
rspec-mocks (2.6.0)
|
31
32
|
safe_shell (1.0.1)
|
32
|
-
term-ansicolor (1.0.
|
33
|
+
term-ansicolor (1.0.7)
|
33
34
|
thor (0.14.6)
|
34
35
|
turn (0.8.3)
|
35
36
|
ansi
|
@@ -45,6 +46,7 @@ DEPENDENCIES
|
|
45
46
|
growl_notify
|
46
47
|
guard
|
47
48
|
guard-rspec
|
49
|
+
json
|
48
50
|
libxml-ruby
|
49
51
|
rb-fsevent
|
50
52
|
rspec
|
data/Guardfile
CHANGED
data/History.txt
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== 0.4.0 / 2011-10-14
|
2
|
+
|
3
|
+
* Added JSON and YAML output formats
|
4
|
+
* Changed colorization to include other errors
|
5
|
+
* Changed homepage to GitHub
|
6
|
+
* Minor fixes
|
7
|
+
** Fixed Ruby 1.8 incompatibilities
|
8
|
+
** Improved error handling
|
9
|
+
|
1
10
|
== 0.3.0 / 2011-10-11
|
2
11
|
|
3
12
|
* Reorganized output
|
data/README.md
CHANGED
@@ -7,22 +7,46 @@ Features
|
|
7
7
|
--------
|
8
8
|
|
9
9
|
* lists and checks included files (XInclude)
|
10
|
-
* lists and checks referenced files (media files and others,
|
10
|
+
* lists and checks referenced files (media files and others, specified by _fileref_)
|
11
11
|
* shows errors, e.g. not existing files
|
12
12
|
* provides a detail listing
|
13
|
+
* offers alternative output formats (YAML, JSON)
|
13
14
|
|
14
15
|
Synopsis
|
15
16
|
--------
|
16
17
|
|
17
18
|
docbook_files is a command line application, bin/docbook_files, which checks the files that are included or referenced in a DocBook 5 project.
|
18
19
|
|
19
|
-
|
20
|
+
docbook_files myproject.xml
|
20
21
|
|
21
|
-
This will result in a overview listing of the file names, starting from file _myproject.xml_ and following every XInclude link or _fileref_ reference. _fileref_ attributes are used in _mediaobject_ tags to specify external image, video, and audio files. Files
|
22
|
+
This will result in a overview listing of the file names, starting from file _myproject.xml_ and following every XInclude link or _fileref_ reference. _fileref_ attributes are used in _mediaobject_ tags to specify external image, video, and audio files. Files with problems are marked red.
|
22
23
|
|
23
|
-
|
24
|
+
docbook_files --details myproject.xml
|
24
25
|
|
25
|
-
The --
|
26
|
+
The _--details_ option adds, well yes, details to the overview: size, type information, timestamp and checksum.
|
27
|
+
|
28
|
+
If you don't like the screen output or want to integrate docbook_file into a certain workflow, just use the YAML or JSON output format instead. The option _--outputformat_ lets you specify a different output format, for example:
|
29
|
+
|
30
|
+
docbook_files --outputformat=yaml myproject.xml
|
31
|
+
|
32
|
+
The result is printed to STDOUT. The structure returned is equivalent to the normal terminal output, except that you always get the details. The structure returned is an array, where each entry contains the following key-value pairs:
|
33
|
+
|
34
|
+
* type - file type (main, inc-luded, or ref-erenced)
|
35
|
+
* name - file name
|
36
|
+
* full_name - path relative to the main file
|
37
|
+
* level - the level in the file hierarchy, starting with 0
|
38
|
+
* parent - parent file that included or referenced this file
|
39
|
+
* status - error status: 0 = ok, 1 = file not found, 2 = processing error (see error_string)
|
40
|
+
* error_string - contains an error message, if status > 0
|
41
|
+
* namespace - XML namespace, if applicable
|
42
|
+
* version - XML version attribute, of applicable
|
43
|
+
* docbook - true for DocBook 5 files, else false
|
44
|
+
* tag - start tag for XML files (chapter, book, article ...)
|
45
|
+
* ts - file modification time
|
46
|
+
* size - fiel size in byte
|
47
|
+
* checksum - SHA1 checksum
|
48
|
+
* mime - MIME type
|
49
|
+
|
26
50
|
|
27
51
|
Requirements
|
28
52
|
------------
|
data/Rakefile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#-*- mode:ruby -*-
|
1
|
+
#-*- encoding:utf-8 ; mode:ruby -*-
|
2
2
|
begin
|
3
3
|
require 'bones'
|
4
4
|
rescue LoadError
|
@@ -15,9 +15,11 @@ Bones {
|
|
15
15
|
name 'docbook_files'
|
16
16
|
authors 'Rainer Volz'
|
17
17
|
email 'dev@textmulch.de'
|
18
|
-
url 'http://github.com/
|
18
|
+
url 'http://rvolz.github.com/docbook_files/'
|
19
19
|
ignore_file '.gitignore'
|
20
|
+
exclude << 'dbf-about.org'
|
20
21
|
depend_on 'libxml-ruby'
|
21
22
|
depend_on 'term-ansicolor'
|
22
23
|
depend_on 'wand'
|
24
|
+
depend_on 'json'
|
23
25
|
}
|
data/bin/docbook_files
CHANGED
data/lib/docbook_files/app.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# -*-encoding:utf-8-*-
|
1
|
+
# -*- encoding:utf-8 -*-
|
2
2
|
|
3
3
|
require 'optparse'
|
4
4
|
require 'yaml'
|
@@ -18,14 +18,21 @@ module DocbookFiles
|
|
18
18
|
args ||= ARGV.dup.map! { |v| v.dup }
|
19
19
|
::DocbookFiles::App.new.run args
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
|
+
##
|
23
|
+
# App class for the _binary_
|
24
|
+
#
|
25
|
+
# Return codes
|
26
|
+
# * 0 - ok
|
27
|
+
# * 1 - no arguments or file not found
|
28
|
+
# * 2 - processing error
|
29
|
+
#
|
22
30
|
class App
|
23
31
|
@@banner = <<EOB
|
24
32
|
docbook_files, Version #{DocbookFiles::VERSION}
|
25
33
|
|
26
|
-
|
27
|
-
|
28
|
-
Files that could not be found are shown in red.
|
34
|
+
Shows the file hierarchy of a DocBook 5 project.
|
35
|
+
Files with problems (not found, invalid ...) are marked red.
|
29
36
|
|
30
37
|
Usage: docbook_files [options] <DOCBOOK-FILE>
|
31
38
|
EOB
|
@@ -39,24 +46,23 @@ EOB
|
|
39
46
|
@opts[:output_format] ||= :screen
|
40
47
|
@opts[:details] ||= false
|
41
48
|
@props = [:name, :full_name, :namespace, :docbook,
|
42
|
-
:version, :tag, :parent, :
|
49
|
+
:version, :tag, :parent, :status, :ts, :size, :checksum, :mime, :error_string]
|
43
50
|
end
|
44
51
|
|
45
52
|
def run(args)
|
46
53
|
opts = OptionParser.new
|
47
54
|
opts.on('--details','List file details') {|val| @opts[:details] = true}
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
55
|
+
opts.on('--outputformat=yaml|json',['json','yaml'],
|
56
|
+
'Return the result in YAML or JSON format') {|format|
|
57
|
+
case
|
58
|
+
when format == 'yaml'
|
59
|
+
@opts[:output_format] = :yaml
|
60
|
+
when format == 'json'
|
61
|
+
@opts[:output_format] = :json
|
62
|
+
else
|
63
|
+
@stderr.puts "Warning: Unknown output format #{format}. Using screen output.".orange
|
64
|
+
end
|
65
|
+
}
|
60
66
|
opts.banner = @@banner
|
61
67
|
rest = opts.parse(args)
|
62
68
|
|
@@ -66,20 +72,42 @@ EOB
|
|
66
72
|
exit 1
|
67
73
|
end
|
68
74
|
|
69
|
-
#
|
75
|
+
# Fail if argument not found
|
70
76
|
@stdout.puts("docbook_files, Version #{DocbookFiles::VERSION}") if @opts[:output_format] == :screen
|
71
77
|
unless File.exists?(rest[0])
|
72
78
|
@stderr.puts "Error: File #{rest[0]} not found.".red
|
73
79
|
exit 1
|
74
80
|
end
|
75
81
|
|
82
|
+
# Main
|
76
83
|
begin
|
77
84
|
dbf = DocbookFiles::Docbook.new(rest[0])
|
78
85
|
table = dbf.list_as_table(@props)
|
79
86
|
rescue => exc
|
87
|
+
@stderr.puts "Something unexpected happend while docbook_files was running ..."
|
80
88
|
@stderr.puts exc.inspect.red
|
89
|
+
exit 2
|
90
|
+
end
|
91
|
+
unless table.nil?
|
92
|
+
case @opts[:output_format]
|
93
|
+
when :json
|
94
|
+
mpath = table[0][:full_name]
|
95
|
+
ntable = table.map{|t|
|
96
|
+
t[:full_name] = relative2main(t[:full_name], mpath)
|
97
|
+
t
|
98
|
+
}
|
99
|
+
@stdout.puts ntable.to_json
|
100
|
+
when :yaml
|
101
|
+
mpath = table[0][:full_name]
|
102
|
+
ntable = table.map{|t|
|
103
|
+
t[:full_name] = relative2main(t[:full_name], mpath)
|
104
|
+
t
|
105
|
+
}
|
106
|
+
YAML.dump(ntable,@stdout)
|
107
|
+
else
|
108
|
+
output(table)
|
109
|
+
end
|
81
110
|
end
|
82
|
-
output(table)
|
83
111
|
end
|
84
112
|
|
85
113
|
# Terminal output to @stdout
|
@@ -91,15 +119,19 @@ EOB
|
|
91
119
|
@stdout.puts '-'*80
|
92
120
|
sum_size = 0
|
93
121
|
sum_not_existing = 0
|
122
|
+
sum_xml_err = 0
|
94
123
|
table.each do |t|
|
95
124
|
output = output_string % [t[:level],
|
96
125
|
format_name(t[:level],t[:full_name],table[0][:full_name]),
|
97
126
|
t[:type].to_s,
|
98
127
|
format_size(t[:size])]
|
99
128
|
sum_size += t[:size]
|
100
|
-
if t[:
|
129
|
+
if t[:status] == FileData::STATUS_NOT_FOUND
|
101
130
|
@stdout.puts output.red
|
102
131
|
sum_not_existing += 1
|
132
|
+
elsif t[:status] == FileData::STATUS_ERR
|
133
|
+
@stdout.puts output.red
|
134
|
+
sum_xml_err += 1
|
103
135
|
else
|
104
136
|
@stdout.puts output
|
105
137
|
end
|
@@ -109,13 +141,16 @@ EOB
|
|
109
141
|
if sum_not_existing > 0
|
110
142
|
summary += " #{sum_not_existing} file(s) not found.".red
|
111
143
|
end
|
144
|
+
if sum_xml_err > 0
|
145
|
+
summary += " #{sum_xml_err} file(s) with errors.".red
|
146
|
+
end
|
112
147
|
@stdout.puts summary
|
113
148
|
if @opts[:details]
|
114
149
|
@stdout.puts
|
115
150
|
@stdout.puts "Details".bold
|
116
151
|
table.each do |t|
|
117
152
|
fname = format_name(0,t[:full_name],table[0][:full_name])
|
118
|
-
@stdout.puts "File: %s" % [(t[:
|
153
|
+
@stdout.puts "File: %s" % [((t[:status] == FileData::STATUS_OK) ? fname : fname.red)]
|
119
154
|
if (t[:type] == FileData::TYPE_MAIN)
|
120
155
|
@stdout.puts "Main file"
|
121
156
|
elsif (t[:type] == FileData::TYPE_INCLUDE)
|
@@ -123,15 +158,18 @@ EOB
|
|
123
158
|
else
|
124
159
|
@stdout.puts "Referenced by: %s" % [t[:parent]]
|
125
160
|
end
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
161
|
+
unless t[:status] == FileData::STATUS_NOT_FOUND
|
162
|
+
# show that part only if file exists
|
163
|
+
@stdout.puts "Size: %s (%d)" % [format_size(t[:size]),t[:size]]
|
164
|
+
if (t[:docbook])
|
165
|
+
@stdout.puts "Type: DocBook, Version #{t[:version]}, Tag: #{t[:tag]}"
|
166
|
+
else
|
167
|
+
@stdout.puts "MIME: #{val_s(t[:mime])}"
|
168
|
+
end
|
169
|
+
@stdout.puts "Timestamp: %s" % [t[:ts]]
|
170
|
+
@stdout.puts "Checksum: %s" % [t[:checksum]]
|
132
171
|
end
|
133
|
-
@stdout.puts "
|
134
|
-
@stdout.puts "Checksum: %s" % [t[:checksum]]
|
172
|
+
@stdout.puts "Error: %s" % [t[:error_string].to_s.red] unless (t[:error_string].nil?)
|
135
173
|
@stdout.puts
|
136
174
|
end
|
137
175
|
end
|
@@ -146,13 +184,7 @@ EOB
|
|
146
184
|
# If the resulting string is too long for display it is shortened.
|
147
185
|
#
|
148
186
|
def format_name(level, full_name, main_name)
|
149
|
-
|
150
|
-
md = full_name.match("^#{main_dir}/")
|
151
|
-
if md.nil?
|
152
|
-
nname = full_name
|
153
|
-
else
|
154
|
-
nname = md.post_match
|
155
|
-
end
|
187
|
+
nname = relative2main(full_name, main_name)
|
156
188
|
lnname = ' '*level+nname
|
157
189
|
if (lnname.length > 60)
|
158
190
|
lnname[0..3]+'...'+lnname[-54,lnname.length-1]
|
@@ -161,6 +193,18 @@ EOB
|
|
161
193
|
end
|
162
194
|
end
|
163
195
|
|
196
|
+
# Try to find the path of _file_name_ that is relative to the _main file_.
|
197
|
+
# If there is no common part return the _file_name_.
|
198
|
+
def relative2main(file_name,main_name)
|
199
|
+
main_dir = File.dirname(main_name)
|
200
|
+
md = file_name.match("^#{main_dir}/")
|
201
|
+
if md.nil?
|
202
|
+
file_name
|
203
|
+
else
|
204
|
+
md.post_match
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
164
208
|
# :stopdoc:
|
165
209
|
KB = 1024
|
166
210
|
MB = 1048576
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# -*-encoding:utf-8-*-
|
1
|
+
# -*- encoding:utf-8 -*-
|
2
2
|
require 'xml'
|
3
3
|
module DocbookFiles
|
4
4
|
|
@@ -15,10 +15,13 @@ module DocbookFiles
|
|
15
15
|
|
16
16
|
# The FileData tree representing the file hierarchy
|
17
17
|
attr_reader :fd_tree
|
18
|
-
|
18
|
+
|
19
|
+
# Initialize vars and quiet the libxml error handler.
|
20
|
+
# See http://libxml.rubyforge.org/rdoc/classes/LibXML/XML/Error.html
|
19
21
|
def initialize(fname)
|
20
22
|
@main_name = fname
|
21
23
|
@fd_tree = nil
|
24
|
+
XML::Error.set_handler(&XML::Error::QUIET_HANDLER)
|
22
25
|
end
|
23
26
|
|
24
27
|
# Return the FileData tree representing the include
|
@@ -114,18 +117,22 @@ private
|
|
114
117
|
#
|
115
118
|
def analyze_file(fname, parent_dir, parent_fd=nil)
|
116
119
|
fl = FileData.new(fname, parent_dir, parent_fd)
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
120
|
+
if fl.exists?
|
121
|
+
begin
|
122
|
+
doc = XML::Document.file(fl.full_name)
|
123
|
+
fl.namespace = namespace(doc)
|
124
|
+
fl.docbook = true if docbook?(doc)
|
125
|
+
fl.version = version(doc) if fl.docbook
|
126
|
+
fl.tag = start_tag(doc)
|
127
|
+
files = find_xincludes(doc)
|
128
|
+
fl.refs = find_referenced_files(doc,parent_dir,fl)
|
129
|
+
rescue Exception => e
|
130
|
+
fl.error_string = e.to_s
|
131
|
+
fl.status = FileData::STATUS_ERR
|
132
|
+
files = []
|
133
|
+
end
|
134
|
+
fl.includes = files.map {|f| analyze_file(f,parent_dir,fl)}
|
127
135
|
end
|
128
|
-
fl.includes = files.map {|f| analyze_file(f,parent_dir,fl)}
|
129
136
|
fl
|
130
137
|
end
|
131
138
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# -*-encoding:utf-8-*-
|
1
|
+
# -*- encoding:utf-8 -*-
|
2
2
|
module DocbookFiles
|
3
3
|
require 'date'
|
4
4
|
require 'digest/sha1'
|
@@ -13,9 +13,17 @@ module DocbookFiles
|
|
13
13
|
TYPE_REFERENCE = :ref
|
14
14
|
# Type for included files
|
15
15
|
TYPE_INCLUDE = :inc
|
16
|
-
|
17
|
-
attr_accessor :name, :exists, :includes, :refs
|
18
16
|
|
17
|
+
# File exists and no error happened
|
18
|
+
STATUS_OK = 0
|
19
|
+
# File does not exist
|
20
|
+
STATUS_NOT_FOUND = 1
|
21
|
+
# Error while processing the file, see #error_string
|
22
|
+
STATUS_ERR = 2
|
23
|
+
|
24
|
+
attr_accessor :name, :path, :exists, :includes, :refs
|
25
|
+
attr_accessor :status, :error_string
|
26
|
+
|
19
27
|
def FileData.init_vars()
|
20
28
|
x = {:full_name => "file name + path",
|
21
29
|
:ts => "last modified timestamp",
|
@@ -37,26 +45,28 @@ module DocbookFiles
|
|
37
45
|
|
38
46
|
|
39
47
|
def initialize(name,parent_dir=".",parent_file=nil)
|
40
|
-
@
|
48
|
+
@path = name
|
41
49
|
@full_name = get_full_name(name, parent_dir)
|
42
50
|
@name = File.basename(name)
|
43
51
|
@namespace = ""
|
44
52
|
@docbook = false
|
45
53
|
@version = ""
|
46
54
|
@tag = ""
|
55
|
+
@error_string = nil
|
47
56
|
@parent = (parent_file.nil? ? nil : parent_file.name)
|
48
57
|
if (File.exists?(@full_name))
|
49
|
-
@
|
58
|
+
@status = STATUS_OK
|
50
59
|
@ts = File.mtime(full_name)
|
51
60
|
@size = File.size(full_name)
|
52
61
|
@checksum = calc_checksum()
|
53
62
|
@mime = get_mime_type()
|
54
63
|
else
|
55
|
-
@
|
64
|
+
@status = STATUS_NOT_FOUND
|
56
65
|
@ts = Time.now
|
57
66
|
@size = 0
|
58
67
|
@checksum = ""
|
59
68
|
@mime = ""
|
69
|
+
@error_string = "file not found"
|
60
70
|
end
|
61
71
|
@includes = []
|
62
72
|
@refs = []
|
@@ -65,13 +75,13 @@ module DocbookFiles
|
|
65
75
|
|
66
76
|
# Does the really file exist?
|
67
77
|
def exists?
|
68
|
-
@
|
78
|
+
@status != STATUS_NOT_FOUND
|
69
79
|
end
|
70
80
|
|
71
81
|
# Return the names and parent files of non-existing files
|
72
82
|
def find_non_existing_files
|
73
|
-
files = traverse([:name, :
|
74
|
-
files.flatten.reject{|f| f[:
|
83
|
+
files = traverse([:name, :status, :parent])
|
84
|
+
files.flatten.reject{|f| f[:status] != STATUS_NOT_FOUND}.map{|f| f.delete(:status); f}
|
75
85
|
end
|
76
86
|
|
77
87
|
# Return a tree-like array with all names
|
@@ -125,9 +135,18 @@ module DocbookFiles
|
|
125
135
|
|
126
136
|
private
|
127
137
|
|
128
|
-
# Calculate the SHA1 checksum for the file
|
138
|
+
# Calculate the SHA1 checksum for the file.
|
139
|
+
#
|
140
|
+
#--
|
141
|
+
# Includes hack for Ruby 1.8
|
142
|
+
#++
|
129
143
|
def calc_checksum
|
130
|
-
|
144
|
+
if RUBY_VERSION=~ /^1.8/
|
145
|
+
contents = open(@full_name, "rb") {|io| io.read }
|
146
|
+
else
|
147
|
+
contents = IO.binread(@full_name)
|
148
|
+
end
|
149
|
+
Digest::SHA1.hexdigest(contents)
|
131
150
|
end
|
132
151
|
|
133
152
|
# Produce the full path for a filename
|
data/lib/docbook_files.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# -*- encoding:
|
1
|
+
# -*- encoding:utf-8 -*-
|
2
2
|
require_relative '../spec_helper'
|
3
3
|
|
4
4
|
module DocbookFiles
|
@@ -11,6 +11,8 @@ module DocbookFiles
|
|
11
11
|
actual.name.should == "no-xml.xml"
|
12
12
|
actual.size.should == 15
|
13
13
|
actual.docbook.should be_false
|
14
|
+
actual.status.should == FileData::STATUS_ERR
|
15
|
+
actual.error_string.should_not be_nil
|
14
16
|
end
|
15
17
|
|
16
18
|
it "finds namespace, DocBookness, version" do
|
@@ -65,7 +67,7 @@ module DocbookFiles
|
|
65
67
|
dbf = DocbookFiles::Docbook.new("spec/fixtures/refs/book-simple-err.xml")
|
66
68
|
actual = dbf.list()
|
67
69
|
actual.refs.map{|r|r.name}.should == ["orange.png","orange.jpeg"]
|
68
|
-
actual.refs.map{|r|r.
|
70
|
+
actual.refs.map{|r|r.status != FileData::STATUS_NOT_FOUND}.should == [true,false]
|
69
71
|
end
|
70
72
|
|
71
73
|
end
|
@@ -26,11 +26,11 @@ module DocbookFiles
|
|
26
26
|
f = FileData.new("spec/fixtures/bookxi.xml")
|
27
27
|
actual = f.to_hash([:name,:mime,:size],FileData::TYPE_MAIN)
|
28
28
|
actual.should == {:type => :main, :name=>"bookxi.xml", :mime=>"application/xml", :size=>481}
|
29
|
-
actual = f.to_hash([:name, :full_name, :namespace, :docbook, :version, :tag, :parent, :
|
29
|
+
actual = f.to_hash([:name, :full_name, :namespace, :docbook, :version, :tag, :parent, :status, :ts, :size, :checksum, :mime],FileData::TYPE_MAIN)
|
30
30
|
expected = {:type => :main, :name=>"bookxi.xml",
|
31
31
|
:full_name=>File.expand_path(".")+"/spec/fixtures/bookxi.xml",
|
32
|
-
:namespace=>"", :docbook=>false, :version=>"", :tag=>"", :parent=>nil, :
|
33
|
-
:ts=>
|
32
|
+
:namespace=>"", :docbook=>false, :version=>"", :tag=>"", :parent=>nil, :status=>FileData::STATUS_OK,
|
33
|
+
:ts=>File.mtime(File.expand_path(".")+"/spec/fixtures/bookxi.xml"), :size=>481,
|
34
34
|
:checksum=>"7d240e7a084c16665ac59e5b927acd6a06953897", :mime=>"application/xml"}
|
35
35
|
actual.should == expected
|
36
36
|
end
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docbook_files
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-10-
|
12
|
+
date: 2011-10-14 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: libxml-ruby
|
16
|
-
requirement: &
|
16
|
+
requirement: &2167326260 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,21 +21,21 @@ dependencies:
|
|
21
21
|
version: 2.2.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2167326260
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: term-ansicolor
|
27
|
-
requirement: &
|
27
|
+
requirement: &2167325580 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.0.
|
32
|
+
version: 1.0.7
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2167325580
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: wand
|
38
|
-
requirement: &
|
38
|
+
requirement: &2167324900 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,21 @@ dependencies:
|
|
43
43
|
version: '0.4'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2167324900
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: json
|
49
|
+
requirement: &2167324260 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.6.1
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2167324260
|
47
58
|
- !ruby/object:Gem::Dependency
|
48
59
|
name: bones
|
49
|
-
requirement: &
|
60
|
+
requirement: &2167323640 !ruby/object:Gem::Requirement
|
50
61
|
none: false
|
51
62
|
requirements:
|
52
63
|
- - ! '>='
|
@@ -54,7 +65,7 @@ dependencies:
|
|
54
65
|
version: 3.7.1
|
55
66
|
type: :development
|
56
67
|
prerelease: false
|
57
|
-
version_requirements: *
|
68
|
+
version_requirements: *2167323640
|
58
69
|
description: docbook_files lists and checks all files related to a DocBook writing
|
59
70
|
project.
|
60
71
|
email: dev@textmulch.de
|
@@ -65,7 +76,6 @@ extra_rdoc_files:
|
|
65
76
|
- History.txt
|
66
77
|
- bin/docbook_files
|
67
78
|
files:
|
68
|
-
- About.org
|
69
79
|
- Gemfile
|
70
80
|
- Gemfile.lock
|
71
81
|
- Guardfile
|
@@ -81,7 +91,6 @@ files:
|
|
81
91
|
- spec/docbook_files/docbook_spec.rb
|
82
92
|
- spec/docbook_files/file_data_spec.rb
|
83
93
|
- spec/docbook_files_spec.rb
|
84
|
-
- spec/fixtures/.DS_Store
|
85
94
|
- spec/fixtures/book-nonexisting.xml
|
86
95
|
- spec/fixtures/bookxi.xml
|
87
96
|
- spec/fixtures/c4/chapter4xi.xml
|
@@ -89,7 +98,6 @@ files:
|
|
89
98
|
- spec/fixtures/chapter3xi.xml
|
90
99
|
- spec/fixtures/no-ns.xml
|
91
100
|
- spec/fixtures/no-xml.xml
|
92
|
-
- spec/fixtures/refs/.DS_Store
|
93
101
|
- spec/fixtures/refs/book-simple-err.xml
|
94
102
|
- spec/fixtures/refs/book-simple.xml
|
95
103
|
- spec/fixtures/refs/bookxi.xml
|
@@ -103,7 +111,7 @@ files:
|
|
103
111
|
- spec/fixtures/section1xi.xml
|
104
112
|
- spec/spec_helper.rb
|
105
113
|
- version.txt
|
106
|
-
homepage: http://github.com/
|
114
|
+
homepage: http://rvolz.github.com/docbook_files/
|
107
115
|
licenses: []
|
108
116
|
post_install_message:
|
109
117
|
rdoc_options:
|
data/About.org
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
#+title: Notizen
|
2
|
-
#+description: Notizen und Aufgaben für docbook_files
|
3
|
-
|
4
|
-
* Eigenschaften
|
5
|
-
|
6
|
-
** Grafische Ausgabe der Dateistruktur
|
7
|
-
|
8
|
-
*** Graphviz?
|
9
|
-
Für Ruby gibt es das viele Module, siehe zum Beispiel graph.
|
10
|
-
|
11
|
-
graph version 2.3.0 has been released!
|
12
|
-
|
13
|
-
* <https://github.com/seattlerb/graph>
|
14
|
-
|
15
|
-
Graph is a type of hash that outputs in graphviz's dot format. It
|
16
|
-
comes with a command-line interface that is easily pluggable.
|
17
|
-
|
18
|
-
It ships with plugins to graph dependencies and status of installed
|
19
|
-
rubygems, rake tasks, homebrew ports, mac ports, and freebsd ports,
|
20
|
-
coloring leaf nodes blue, outdated nodes red, and outdated leaf nodes
|
21
|
-
purple (red+blue).
|
22
|
-
|
23
|
-
|
24
|
-
** Detailausgabe gegenüber Hierarchie
|
25
|
-
|
26
|
-
Die Hierarchie ist die Hauptausgabe. Allerdings kann man sich über
|
27
|
-
'--details' auch die Detailangaben zu allen beteiligten Dateien
|
28
|
-
ausgeben lassen. Hier werden alle Angaben ausgegeben, die oben
|
29
|
-
optional sind.
|
30
|
-
|
31
|
-
Besonders wichtig ist die Zusammenfassung, also Dateien, die an
|
32
|
-
mehreren Stellen eingebunden werden, also mehrere Eltern haben!
|
33
|
-
|
34
|
-
Die Detailausgabe führt dann über zum Releasedokument.
|
35
|
-
|
36
|
-
** Releasedokument
|
37
|
-
|
38
|
-
Die Ausgabe kann in einer Datei gespeichert werden, die dann als
|
39
|
-
Manifest für ein Archiv dienen kann. Anhand des Dokuments kann man
|
40
|
-
schauen, ob die vorliegenden Dateien dem gespeicherten Stand
|
41
|
-
entsprechen.
|
42
|
-
|
43
|
-
** Ausgabeformate
|
44
|
-
*** Graphviz & HTML
|
45
|
-
*** TODO YAML, JSON
|
46
|
-
*** DocBook
|
47
|
-
*** RDF?
|
48
|
-
|
49
|
-
** Zusammenhang mit SCM
|
50
|
-
|
51
|
-
Wie bei Bones?
|
52
|
-
|
53
|
-
** DONE Änderung Anzeige
|
54
|
-
*** Hierarchie
|
55
|
-
|
56
|
-
Nur der Hierarchiebaum, aber mit längeren Namen. Das heißt, die
|
57
|
-
Dateien werden mit Pfad angezeigt, mit relativem zum Masterdokument.
|
58
|
-
|
59
|
-
Falls zu lang am Anfang kürzen mit Ellipse.
|
60
|
-
|
61
|
-
URIs oder nicht relative Dateien werden mit dem Anfang angezeigt,
|
62
|
-
ggf. in der Mitte gekürzt.
|
63
|
-
|
64
|
-
*** Zusammenfassung
|
65
|
-
|
66
|
-
* X Dateien
|
67
|
-
* Y inkludierte DocBooks
|
68
|
-
* Z referenzierte
|
69
|
-
|
70
|
-
YAML/JSON übernehmen und seinen eigenen machen.
|
71
|
-
*** Details
|
72
|
-
|
73
|
-
Die restlichen Angaben werden in die optionalen Details
|
74
|
-
verschoben. Die Optionen sind dann nicht mehr notwendig.
|
75
|
-
|
76
|
-
Wenn jemand den Bericht nicht mag, kann er gern die Daten über
|
77
|
-
|
data/spec/fixtures/.DS_Store
DELETED
Binary file
|
Binary file
|