dokkit 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -26,15 +26,6 @@ lib/dokkit/logging.rb
26
26
  lib/dokkit/logging/logger.rb
27
27
  lib/dokkit/logging/observers.rb
28
28
  lib/dokkit/logging/observers/console.rb
29
- lib/dokkit/models/simple/Rakefile
30
- lib/dokkit/models/simple/doc/configs/simple.yaml
31
- lib/dokkit/models/simple/doc/data/html/css/style.css
32
- lib/dokkit/models/simple/doc/data/latex/deplate.sty
33
- lib/dokkit/models/simple/doc/layouts/simple.html
34
- lib/dokkit/models/simple/doc/layouts/simple.latex
35
- lib/dokkit/models/simple/doc/layouts/simple.text
36
- lib/dokkit/models/simple/doc/pages/simple.deplate
37
- lib/dokkit/models/simple/setup/setup.rb
38
29
  lib/dokkit/resource.rb
39
30
  lib/dokkit/resource/data.rb
40
31
  lib/dokkit/resource/document.rb
@@ -46,6 +37,15 @@ lib/dokkit/resource/filenamehelper.rb
46
37
  lib/dokkit/tasklib.rb
47
38
  lib/dokkit/tasklib/clean.rb
48
39
  lib/dokkit/tasklib/render.rb
40
+ lib/models/simple/Rakefile
41
+ lib/models/simple/doc/configs/simple.yaml
42
+ lib/models/simple/doc/data/html/css/style.css
43
+ lib/models/simple/doc/data/latex/deplate.sty
44
+ lib/models/simple/doc/layouts/simple.html
45
+ lib/models/simple/doc/layouts/simple.latex
46
+ lib/models/simple/doc/layouts/simple.text
47
+ lib/models/simple/doc/pages/simple.deplate
48
+ lib/models/simple/setup/setup.rb
49
49
  tasks/annotations.rake
50
50
  tasks/doc.rake
51
51
  tasks/gem.rake
data/Rakefile CHANGED
@@ -18,7 +18,8 @@ PROJ.url = 'http://dokkit.rubyforge.org'
18
18
  PROJ.description = paragraphs_of('README.txt', 1).join("\n\n")
19
19
  PROJ.changes = paragraphs_of('History.txt', 0..1).join("\n\n")
20
20
  PROJ.rubyforge_name = 'dokkit'
21
- PROJ.dependencies = ['deplate', 'rake', 'maruku', 'haml']
21
+ PROJ.dependencies = ['deplate', 'rake', 'maruku']
22
+ PROJ.need_zip = true
22
23
  PROJ.spec_opts << ['--format', 'specdoc', '--color']
23
24
  PROJ.rdoc_exclude << "models/simple"
24
25
  # EOF
@@ -13,6 +13,29 @@ require 'dokkit'
13
13
  module Dokkit
14
14
  class Application
15
15
 
16
+ class << self
17
+
18
+ def get_modelname_from(path)
19
+ File.basename(path)
20
+ end
21
+
22
+ def get_model_dir_from(array_of_path)
23
+ array_of_path.select { |path| path =~ /\.?dokkit-?/ }.collect { |path| File.join(path, 'models')}
24
+ end
25
+
26
+ def get_models_from(array_of_path)
27
+ models = { }
28
+ get_model_dir_from(array_of_path).each do |model_path|
29
+ Dir.glob(File.join(model_path, '*')).each do |model_path|
30
+ name = get_modelname_from(model_path)
31
+ models[name] = model_path
32
+ end
33
+ end
34
+ models
35
+ end
36
+
37
+ end
38
+
16
39
  OPTIONS = [
17
40
  [ "--usage", "-u", GetoptLong::NO_ARGUMENT,
18
41
  "Display usage information." ],
@@ -38,14 +61,15 @@ EOU
38
61
  def initialize(logger, configuration = { })
39
62
  @logger = logger
40
63
  @configuration = configuration
41
- @dokkit_dir = configuration[:dokkit_dir] || dokkit_dir
42
64
  @user_dir = configuration[:user_dir] || relative_to_home('.dokkit')
43
65
  @model_dir = configuration[:model_dir] || 'models'
44
66
  @default_model = configuration[:default_model] || 'simple'
45
- @models = { 'simple' => File.join(@dokkit_dir, 'dokkit/models/simple') } if @dokkit_dir
46
- @models.merge!(fetch_models)
47
67
  end
48
68
 
69
+ def models
70
+ Application::get_models_from(Gem.latest_load_paths.push(@user_dir))
71
+ end
72
+
49
73
  def run
50
74
 
51
75
  process_args
@@ -60,27 +84,16 @@ EOU
60
84
 
61
85
  private
62
86
 
63
- def dokkit_dir
64
- lib = nil
65
- $:.each do |it|
66
- if File.exists?(File.join(it, 'dokkit/models/'))
67
- lib = it
68
- break
69
- end
70
- end
71
- lib
72
- end
73
-
74
87
  def relative_to_home(path)
75
88
  File.join(((ENV['HOMEPATH'] if RUBY_PLATFORM =~ /win32/) || ENV['HOME']), path)
76
89
  end
77
90
 
78
91
  def create_environment(dest_dir)
79
92
  model = @model || @default_model
80
- if @models.has_key?(model)
93
+ if models.has_key?(model)
81
94
  unless File.exists?(dest_dir)
82
95
  @logger.info("Creating documentation environment based on '#{model}' on directory '#{dest_dir}'.")
83
- FileUtils.cp_r(@models[model], dest_dir)
96
+ FileUtils.cp_r(models[model], dest_dir)
84
97
  else
85
98
  @logger.error("Directory '#{dest_dir}' already exists.")
86
99
  end
@@ -133,26 +146,9 @@ EOU
133
146
  puts
134
147
  end
135
148
  end
136
-
137
- def model_dir
138
- File.join(@dokkit_dir, @model_dir)
139
- end
140
-
141
- def fetch_models
142
- models = { }
143
- if File.exists?(model_dir)
144
- Dir.glob(File.join(model_dir, '*')) do |model|
145
- modelname = model.sub(File.join(@dokkit_dir, @model_dir), '').sub('/', '')
146
- models[modelname] = model
147
- end
148
- end
149
- models
150
- end
151
-
149
+
152
150
  def list_models
153
- @models.each_key do |model|
154
- @logger.info("Found model '#{model}'.")
155
- end
151
+ models.each_key { |model| @logger.info("Found model '#{model}'.") }
156
152
  end
157
153
 
158
154
  end
@@ -6,7 +6,11 @@
6
6
  # (C)2006-2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors).
7
7
  #
8
8
 
9
- require 'haml'
9
+ begin
10
+ require 'haml'
11
+ rescue LoadError
12
+ nil
13
+ end
10
14
 
11
15
  module Dokkit
12
16
  module Filter
@@ -121,7 +121,11 @@ module Dokkit
121
121
  end
122
122
 
123
123
  def default_filter_chain_for(formatter, format)
124
- @configuration[:default_filter_chain][formatter][format]
124
+ if @configuration[:default_filter_chain][formatter].has_key?(format)
125
+ @configuration[:default_filter_chain][formatter][format]
126
+ else
127
+ @logger.error("Output format '#{format}' is not available for '#{formatter}' formatter.")
128
+ end
125
129
  end
126
130
 
127
131
  def default_postfilter_chain_for(format)
data/lib/dokkit.rb CHANGED
@@ -51,5 +51,5 @@ rescue LoadError
51
51
  end
52
52
 
53
53
  module Dokkit
54
- VERSION = '0.4.3'
54
+ VERSION = '0.4.4'
55
55
  end
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dokkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrea Fazzi
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-05 00:00:00 +00:00
12
+ date: 2008-08-10 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -39,15 +39,6 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: "0"
41
41
  version:
42
- - !ruby/object:Gem::Dependency
43
- name: haml
44
- version_requirement:
45
- version_requirements: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - ">="
48
- - !ruby/object:Gem::Version
49
- version: "0"
50
- version:
51
42
  description: "== DESCRIPTION: dokkit is a document generator. It was inspired by rote but now it is completely independent from it. dokkit uses filters like deplate and maruku to generate output in a large variety of formats (tex, html, docbook, plain text, ...)."
52
43
  email: andrea.fazzi@alca.le.it
53
44
  executables:
@@ -87,15 +78,6 @@ files:
87
78
  - lib/dokkit/logging/logger.rb
88
79
  - lib/dokkit/logging/observers.rb
89
80
  - lib/dokkit/logging/observers/console.rb
90
- - lib/dokkit/models/simple/Rakefile
91
- - lib/dokkit/models/simple/doc/configs/simple.yaml
92
- - lib/dokkit/models/simple/doc/data/html/css/style.css
93
- - lib/dokkit/models/simple/doc/data/latex/deplate.sty
94
- - lib/dokkit/models/simple/doc/layouts/simple.html
95
- - lib/dokkit/models/simple/doc/layouts/simple.latex
96
- - lib/dokkit/models/simple/doc/layouts/simple.text
97
- - lib/dokkit/models/simple/doc/pages/simple.deplate
98
- - lib/dokkit/models/simple/setup/setup.rb
99
81
  - lib/dokkit/resource.rb
100
82
  - lib/dokkit/resource/data.rb
101
83
  - lib/dokkit/resource/document.rb
@@ -107,6 +89,15 @@ files:
107
89
  - lib/dokkit/tasklib.rb
108
90
  - lib/dokkit/tasklib/clean.rb
109
91
  - lib/dokkit/tasklib/render.rb
92
+ - lib/models/simple/Rakefile
93
+ - lib/models/simple/doc/configs/simple.yaml
94
+ - lib/models/simple/doc/data/html/css/style.css
95
+ - lib/models/simple/doc/data/latex/deplate.sty
96
+ - lib/models/simple/doc/layouts/simple.html
97
+ - lib/models/simple/doc/layouts/simple.latex
98
+ - lib/models/simple/doc/layouts/simple.text
99
+ - lib/models/simple/doc/pages/simple.deplate
100
+ - lib/models/simple/setup/setup.rb
110
101
  - tasks/annotations.rake
111
102
  - tasks/doc.rake
112
103
  - tasks/gem.rake