docbook_status 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,9 +1,8 @@
1
1
  source "http://rubygems.org"
2
2
  gem "libxml-ruby", "~> 2.2.2", :require => 'xml'
3
- gem "directory_watcher"
4
- gem "json"
5
3
  gem "term-ansicolor"
4
+ gem "zucker"
6
5
 
7
6
  group :development do
8
- gem "bones"
7
+ gem "bones"
9
8
  end
data/Gemfile.lock CHANGED
@@ -5,20 +5,18 @@ GEM
5
5
  little-plugger (>= 1.1.2)
6
6
  loquacious (>= 1.8.1)
7
7
  rake (>= 0.8.7)
8
- directory_watcher (1.4.1)
9
- json (1.6.1)
10
8
  libxml-ruby (2.2.2)
11
9
  little-plugger (1.1.2)
12
10
  loquacious (1.8.1)
13
11
  rake (0.9.2)
14
12
  term-ansicolor (1.0.6)
13
+ zucker (11)
15
14
 
16
15
  PLATFORMS
17
16
  ruby
18
17
 
19
18
  DEPENDENCIES
20
19
  bones
21
- directory_watcher
22
- json
23
20
  libxml-ruby (~> 2.2.2)
24
21
  term-ansicolor
22
+ zucker
data/History.txt CHANGED
@@ -1,4 +1,11 @@
1
- == 0.4.0 / 2011-10-??
1
+ == 0.5.0 / 2011-10-15
2
+
3
+ * Removed the daemon functionality, it didn't work across platforms. Use Guard instead.
4
+ * Improved the platform compatibility. Should now work better on Windows.
5
+ * Color support is now optional on Windows. Is switched on if gem 'win32console' is available.
6
+ * JSON support is now optional. Is switched on if the json library (1.9) or gem (1.8) is available.
7
+
8
+ == 0.4.0 / 2011-10-04
2
9
 
3
10
  * Minor changes
4
11
  ** The word counts displayed are now the totals of the respective section, including all its children
data/README.rdoc CHANGED
@@ -15,7 +15,7 @@ A utility for DocBook authors/publishers showing the document structure (section
15
15
 
16
16
  docbook_status is mainly a comandline application, bin/docbook_status, which helps with writing and editing DocBook 5 documents. The application provides information about the content of a DocBook project. That project can consist of a single file or of several files that are included in the master file via XInclude.
17
17
 
18
- To run docbook_status once, manually:
18
+ To run docbook_status:
19
19
 
20
20
  docbook_status myproject.xml
21
21
 
@@ -37,12 +37,6 @@ If you need to preprocess the XML before feeding it to docbook_status, there is
37
37
 
38
38
  --pre takes shell commands as arguments and executes them before starting the analysis on the XML file.
39
39
 
40
- Finally, if you are tired to run docbook_status manually each time you changed your file, you could run the application in demon mode, continually:
41
-
42
- docbook_status --demon --glob "*.xml" --dir "." myproject.xml
43
-
44
- In demon-mode the application checks the files matched by the _glob_ pattern in the directory specified by _dir_ for changes, and redisplays the document analysis whenever a change occures. The demon can be terminated by simply pressing RETURN.
45
-
46
40
  == Tracking writing progress
47
41
 
48
42
  As an experiment docbook_status provides features to define and track writing goals/schedules. Currently there are the following options:
@@ -111,6 +105,8 @@ https://rubygems.org/gems/docbook_status
111
105
  == Requirements
112
106
 
113
107
  * libxml2
108
+ * json (optional, install the gem if you want JSON output for Ruby 1.8)
109
+ * win32console (optional, install the gem if you want color support on MS Windows)
114
110
 
115
111
  == Install
116
112
 
data/Rakefile CHANGED
@@ -13,8 +13,9 @@ Bones {
13
13
  authors 'Rainer Volz'
14
14
  email 'dev@textmulch.de'
15
15
  url 'http://rvolz.github.com/docbook_status/'
16
- depend_on 'directory_watcher'
16
+ ignore_file '.gitignore'
17
+ exclude << 'dbs-about.org'
17
18
  depend_on 'libxml-ruby'
18
- depend_on 'json'
19
19
  depend_on 'term-ansicolor'
20
+ depend_on 'zucker'
20
21
  }
data/bin/docbook_status CHANGED
@@ -3,21 +3,43 @@
3
3
  ##
4
4
  # docbook_status is the commandline application for the library. Its
5
5
  # main purpose is to display the structure and word counts for DocBook
6
- # 5 documents. docbook_status can be used in single-run mode or
7
- # demon-mode. In demon-mode it stays active and looks for changes in
8
- # the filesystem.
6
+ # 5 documents.
9
7
  #
10
8
 
11
9
  require 'rubygems'
12
- require "bundler/setup"
13
10
  require 'optparse'
14
- require 'directory_watcher'
15
11
  require 'yaml'
16
- require 'json'
17
- require 'term/ansicolor'
12
+ require 'zucker/env'
13
+ # For Windows and/or Ruby 1.8
14
+ begin
15
+ require 'json'
16
+ @json_available = true
17
+ rescue LoadError
18
+ @json_available = false
19
+ end
18
20
 
19
- class String
20
- include Term::ANSIColor
21
+ # Windows (RubyInstaller) needs the additional gem.
22
+ # If not present create dummies for the color routines.
23
+ if OS.windows?
24
+ begin
25
+ require 'win32console'
26
+ require 'term/ansicolor'
27
+ class String
28
+ include Term::ANSIColor
29
+ end
30
+ rescue LoadError
31
+ class String
32
+ def red; self; end
33
+ def green; self; end
34
+ def magenta; self; end
35
+ def bold; self; end
36
+ end
37
+ end
38
+ else
39
+ require 'term/ansicolor'
40
+ class String
41
+ include Term::ANSIColor
42
+ end
21
43
  end
22
44
 
23
45
  require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib docbook_status]))
@@ -45,10 +67,7 @@ EOB
45
67
 
46
68
  opts = OptionParser.new
47
69
  opts.banner = banner
48
- opts.on('--demon', 'Keep running, act when files change') {|val| @demon = true}
49
- opts.on('--glob PATTERN', String, 'File mask for demon mode, default = "*.xml"') {|val| @glob = val}
50
- opts.on('--dir DIR', String, 'Source directory for demon mode, default = "." ') {|val| @dir = File.expand_path(val)}
51
- opts.on('--pre COMMAND', String, 'A shell command that should be executed before') {|val| @pre << val}
70
+ opts.on('--pre COMMAND', String, 'A shell command that should be executed first') {|val| @pre << val}
52
71
  opts.on('--remarks[=FILTER]', String, 'Show the remarks, comments. Use a keyword FILTER to restrict the listing') {|val|
53
72
  @remarks = true
54
73
  unless (val.nil? || val.empty?)
@@ -74,12 +93,18 @@ opts.on('--daily[=WORDS]',Integer, 'Goal: daily number of words') {|val|
74
93
  else
75
94
  @daily_words = val.abs
76
95
  end}
77
- opts.on('--outputformat=yaml|json',['json','yaml'],'Return the result in YAML or JSON format instead of printing it') {|format|
96
+ opts.on('--outputformat=yaml|json',['json','yaml'],'Return the result in YAML or JSON format') {|format|
78
97
  case
79
98
  when format == 'yaml'
80
99
  @output_format = :yaml
81
100
  when format == 'json'
82
- @output_format = :json
101
+ if @json_available
102
+ @output_format = :json
103
+ else
104
+ @output_format = :screen
105
+ STDERR.puts "JSON support not available. Please install the json gem first."
106
+ exit 1
107
+ end
83
108
  else
84
109
  STDERR.puts "Unknown output format #{format}. Using screen output."
85
110
  @output = :screen
@@ -217,28 +242,6 @@ def run(file)
217
242
  end
218
243
  end
219
244
 
220
-
221
- # Demon routine for continuous processing of a DocBook document.
222
- # This routine calls _run_ whenever the filesystem signals changes. To
223
- # reduce load it waits for a defined time (interval * stable) before
224
- # starting the actual processing.
225
- #
226
- def demon(file)
227
- dw = DirectoryWatcher.new @dir, :glob => @glob, :pre_load => true
228
- dw.interval = 5.0
229
- dw.stable = 2
230
- dw.add_observer {|*args|
231
- args.each {|event|
232
- if event.type == :stable
233
- run(file)
234
- end
235
- }
236
- }
237
- dw.start # loads state from dw_state.yml
238
- STDIN.gets # when the user hits "enter" the script will terminate
239
- dw.stop # stores state to dw_state.yml
240
- end
241
-
242
245
  # Print banner if called without arguments
243
246
  if rest.length < 1
244
247
  puts opts.to_s
@@ -253,7 +256,5 @@ end
253
256
  # The main routine
254
257
  puts("docbook_status, Version #{DocbookStatus.version}") if @output_format == :screen
255
258
  run(rest[0])
256
- if (@demon)
257
- demon(rest[0])
258
- end
259
259
  exit 0
260
+
data/version.txt CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.5.0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docbook_status
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,22 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-10-04 00:00:00.000000000Z
12
+ date: 2011-10-15 00:00:00.000000000Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: directory_watcher
16
- requirement: &2165156720 !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: 1.4.1
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: *2165156720
25
14
  - !ruby/object:Gem::Dependency
26
15
  name: libxml-ruby
27
- requirement: &2165156200 !ruby/object:Gem::Requirement
16
+ requirement: &2167250780 !ruby/object:Gem::Requirement
28
17
  none: false
29
18
  requirements:
30
19
  - - ! '>='
@@ -32,32 +21,32 @@ dependencies:
32
21
  version: 2.2.2
33
22
  type: :runtime
34
23
  prerelease: false
35
- version_requirements: *2165156200
24
+ version_requirements: *2167250780
36
25
  - !ruby/object:Gem::Dependency
37
- name: json
38
- requirement: &2165155600 !ruby/object:Gem::Requirement
26
+ name: term-ansicolor
27
+ requirement: &2167250280 !ruby/object:Gem::Requirement
39
28
  none: false
40
29
  requirements:
41
30
  - - ! '>='
42
31
  - !ruby/object:Gem::Version
43
- version: 1.6.1
32
+ version: 1.0.7
44
33
  type: :runtime
45
34
  prerelease: false
46
- version_requirements: *2165155600
35
+ version_requirements: *2167250280
47
36
  - !ruby/object:Gem::Dependency
48
- name: term-ansicolor
49
- requirement: &2165154960 !ruby/object:Gem::Requirement
37
+ name: zucker
38
+ requirement: &2167249780 !ruby/object:Gem::Requirement
50
39
  none: false
51
40
  requirements:
52
41
  - - ! '>='
53
42
  - !ruby/object:Gem::Version
54
- version: 1.0.6
43
+ version: '11'
55
44
  type: :runtime
56
45
  prerelease: false
57
- version_requirements: *2165154960
46
+ version_requirements: *2167249780
58
47
  - !ruby/object:Gem::Dependency
59
48
  name: bones
60
- requirement: &2165154300 !ruby/object:Gem::Requirement
49
+ requirement: &2167249140 !ruby/object:Gem::Requirement
61
50
  none: false
62
51
  requirements:
63
52
  - - ! '>='
@@ -65,7 +54,7 @@ dependencies:
65
54
  version: 3.7.1
66
55
  type: :development
67
56
  prerelease: false
68
- version_requirements: *2165154300
57
+ version_requirements: *2167249140
69
58
  description: A utility for DocBook authors/publishers showing the document structure
70
59
  (sections) and word count of a DocBook project. It is intended to provide an overview
71
60
  of a DocBook project's structure and size while you are writing or editing it.
@@ -78,7 +67,6 @@ extra_rdoc_files:
78
67
  - README.rdoc
79
68
  - bin/docbook_status
80
69
  files:
81
- - .bnsignore
82
70
  - Gemfile
83
71
  - Gemfile.lock
84
72
  - History.txt
@@ -122,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
110
  version: '0'
123
111
  requirements: []
124
112
  rubyforge_project: docbook_status
125
- rubygems_version: 1.8.10
113
+ rubygems_version: 1.8.11
126
114
  signing_key:
127
115
  specification_version: 3
128
116
  summary: A utility for DocBook authors/publishers showing the document structure (sections)
data/.bnsignore DELETED
@@ -1,18 +0,0 @@
1
- # The list of files that should be ignored by Mr Bones.
2
- # Lines that start with '#' are comments.
3
- #
4
- # A .gitignore file can be used instead by setting it as the ignore
5
- # file in your Rakefile:
6
- #
7
- # Bones {
8
- # ignore_file '.gitignore'
9
- # }
10
- #
11
- # For a project with a C extension, the following would be a good set of
12
- # exclude patterns (uncomment them if you want to use them):
13
- # *.[oa]
14
- # *~
15
- announcement.txt
16
- coverage
17
- doc
18
- pkg