sdoc_all 1.0.2.2 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,8 @@
1
+ =begin
2
+ Autotest.add_hook :reset do |at|
3
+ at.clear_mappings
4
+ at.add_mapping(/\.rb$/) do |filename, _|
5
+ Dir.glob('spec/**/*_spec.rb')
6
+ end
7
+ end
8
+ =end
@@ -0,0 +1,5 @@
1
+ .DS_Store
2
+ pkg
3
+ doc
4
+ *.gem
5
+ *.swp
data/Manifest CHANGED
@@ -17,6 +17,7 @@ lib/sdoc_all/parts/plugins.rb
17
17
  lib/sdoc_all/parts/rails.rb
18
18
  lib/sdoc_all/parts/ruby.rb
19
19
  lib/sdoc_all/task.rb
20
+ lib/shell_escape.rb
20
21
  lib/tasks/sdoc_all_rake.rb
21
22
  spec/sdoc_all/file_list_spec.rb
22
23
  spec/sdoc_all/gems_spec.rb
@@ -66,6 +66,11 @@ to build stdlib documentation for every group not fully present in ruby document
66
66
  version: 1.8.6
67
67
  stdlib: true
68
68
 
69
+ to integrate stdlib to main ruby documentation use
70
+ - ruby:
71
+ version: 1.8.6
72
+ stdlib: integrate
73
+
69
74
  === rails
70
75
  choose rails version
71
76
  - rails: 2.3.2
data/Rakefile CHANGED
@@ -1,28 +1,36 @@
1
- require 'pathname'
2
- require 'rubygems'
3
- require 'rake'
4
- require 'rake/clean'
5
- require 'fileutils'
6
- require 'echoe'
1
+ begin
2
+ require 'jeweler'
7
3
 
8
- version = YAML.load_file(File.join(File.dirname(__FILE__), 'VERSION.yml')).join('.') rescue nil
4
+ name = 'sdoc_all'
5
+ summary = 'Documentation for everything'
6
+ description = 'Command line tool to get documentation for ruby, rails, gems and plugins in one place'
9
7
 
10
- echoe = Echoe.new('sdoc_all', version) do |p|
11
- p.author = 'toy'
12
- p.summary = 'documentation for everything'
13
- p.description = 'Command line tool to get documentation for ruby, rails, gems and plugins in one place'
14
- p.email = 'ivan@workisfun.ru'
15
- p.url = 'http://github.com/toy/sdoc_all'
16
- p.runtime_dependencies << 'activesupport'
17
- p.runtime_dependencies << 'rake'
18
- p.runtime_dependencies << 'progress >=0.0.8'
19
- p.runtime_dependencies << 'sdoc'
20
- p.project = 'toytoy'
21
- end
8
+ jewel = Jeweler::Tasks.new do |j|
9
+ j.name = name
10
+ j.summary = summary
11
+ j.description = description
12
+ j.homepage = "http://github.com/toy/#{name}"
13
+ j.authors = ["Boba Fat"]
14
+ j.add_dependency 'activesupport'
15
+ j.add_dependency 'colored'
16
+ j.add_dependency 'progress', '>= 0.0.8'
17
+ j.add_dependency 'rake'
18
+ j.add_dependency 'rubigen'
19
+ j.add_dependency 'sdoc'
20
+ end
21
+
22
+ Jeweler::GemcutterTasks.new
23
+
24
+ require 'pathname'
25
+ desc "Replace system gem with symlink to this folder"
26
+ task 'ghost' do
27
+ gem_path = Pathname(Gem.searcher.find(name).full_gem_path)
28
+ current_path = Pathname('.').expand_path
29
+ cmd = gem_path.writable? && gem_path.parent.writable? ? %w() : %w(sudo)
30
+ system(*cmd + %W[rm -r #{gem_path}])
31
+ system(*cmd + %W[ln -s #{current_path} #{gem_path}])
32
+ end
22
33
 
23
- desc "Replace system gem with symlink to this folder"
24
- task 'ghost' do
25
- path = Gem.searcher.find(echoe.name).full_gem_path
26
- system 'sudo', 'rm', '-r', path
27
- symlink File.expand_path('.'), path
34
+ rescue LoadError
35
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
28
36
  end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.4
@@ -4,8 +4,8 @@ require 'rubygems'
4
4
  require 'rubigen'
5
5
 
6
6
  if %w(-v --version).include? ARGV.first
7
- version = YAML.load_file(File.join(File.dirname(__FILE__), '../VERSION.yml'))
8
- puts "#{File.basename($0)} #{version.join('.')}"
7
+ version = YAML.load_file(Pathname(__FILE__).dirname.parent + 'VERSION.yml').join('.')
8
+ puts "#{File.basename($0)} #{version}"
9
9
  exit(0)
10
10
  end
11
11
 
@@ -7,6 +7,7 @@ require 'rubygems'
7
7
  require 'activesupport'
8
8
  require 'rake'
9
9
  require 'progress'
10
+ require 'colored'
10
11
 
11
12
  __DIR__ = File.dirname(__FILE__)
12
13
  $:.unshift(__DIR__) unless $:.include?(__DIR__) || $:.include?(File.expand_path(__DIR__))
@@ -25,6 +26,16 @@ class Pathname
25
26
  end
26
27
  end
27
28
 
29
+ class String
30
+ def shrink(max_length)
31
+ if length > max_length
32
+ "#{self[0, max_length - 1]}…"
33
+ else
34
+ self
35
+ end
36
+ end
37
+ end
38
+
28
39
  class SdocAll
29
40
  module ClassMethods
30
41
  def update?
@@ -52,14 +63,18 @@ class SdocAll
52
63
  end
53
64
 
54
65
  def run(options = {})
66
+ Base.dry_run! if options[:dry_run]
67
+ Base.verbose_level = options[:verbose_level]
68
+ Progress.lines = true if Base.verbose_level >= 1
55
69
  begin
56
70
  read_config
57
71
  tasks = Base.tasks(:update => update? || options[:update])
58
72
 
59
73
  if last_build_sdoc_version.nil? || last_build_sdoc_version != current_sdoc_version
74
+ puts "sdoc version changed - rebuilding all docs".red unless last_build_sdoc_version.nil?
60
75
  Base.remove_if_present(Base.docs_path)
61
76
  else
62
- Dir.chdir(Base.docs_path) do
77
+ Base.chdir(Base.docs_path) do
63
78
  to_delete = Dir.glob('*')
64
79
  tasks.each do |task|
65
80
  to_delete -= task.occupied_doc_pathes
@@ -70,15 +85,17 @@ class SdocAll
70
85
  end
71
86
  end
72
87
 
73
- tasks.each_with_progress('docs') do |task|
74
- task.run(options)
88
+ tasks.with_progress('sdoc').each do |task|
89
+ Progress.start(task.title) do
90
+ task.run(options)
91
+ end
75
92
  end
76
93
 
77
94
  config_hash = Digest::SHA1.hexdigest(tasks.map(&:config_hash).inspect + title.to_s)
78
95
  created_hash = config_hash_path.read rescue nil
79
96
 
80
97
  if config_hash != created_hash
81
- Dir.chdir(Base.docs_path) do
98
+ Base.chdir(Base.docs_path) do
82
99
  paths = []
83
100
  titles = []
84
101
  urls = []
@@ -114,7 +131,7 @@ class SdocAll
114
131
  end
115
132
  end
116
133
  rescue ConfigError => e
117
- STDERR.puts "\e[1;31m#{e.to_s}\e[0m"
134
+ abort e.to_s.red.bold
118
135
  end
119
136
  end
120
137
 
@@ -135,7 +152,7 @@ class SdocAll
135
152
 
136
153
  if config[:sdoc] && config[:sdoc].is_a?(Array) && config[:sdoc].length > 0
137
154
  errors = []
138
- config[:sdoc].each do |entry|
155
+ config[:sdoc].with_progress('reading config').each do |entry|
139
156
  begin
140
157
  if entry.is_a?(Hash)
141
158
  if entry.length == 1
@@ -1,3 +1,5 @@
1
+ require 'shell_escape'
2
+
1
3
  class SdocAll
2
4
  class Base
3
5
  attr_reader :config
@@ -33,6 +35,19 @@ class SdocAll
33
35
  DOCS_PATH = BASE_PATH + 'docs'
34
36
  PUBLIC_PATH = BASE_PATH + 'public'
35
37
 
38
+ def dry_run!
39
+ @@dry_run = true
40
+ end
41
+ def dry_run?
42
+ defined?(@@dry_run) && @@dry_run
43
+ end
44
+ def verbose_level=(val)
45
+ @@verbose_level = val
46
+ end
47
+ def verbose_level
48
+ defined?(@@verbose_level) ? @@verbose_level : 0
49
+ end
50
+
36
51
  def base_path
37
52
  BASE_PATH
38
53
  end
@@ -88,7 +103,7 @@ class SdocAll
88
103
 
89
104
  def tasks(options = {})
90
105
  @@tasks = []
91
- entries.each do |entry|
106
+ entries.with_progress('configuring').each do |entry|
92
107
  entry.add_tasks(options)
93
108
  end
94
109
  subclasses.values.each do |subclass|
@@ -115,14 +130,60 @@ class SdocAll
115
130
  end
116
131
 
117
132
  def system(*args)
118
- escaped_args = args.map(&:to_s).map{ |arg| arg[/[^a-z0-9\/\-.]/i] ? arg.inspect : arg }
119
- command = escaped_args.join(' ')
120
- puts "Executing #{command.length > 250 ? "#{command[0, 247]}..." : command}"
121
- Kernel.system(*args)
133
+ command = args.length == 1 ? args.first : ShellEscape.command(*args)
134
+ if verbose_level >= 1
135
+ puts [dirs.last && "cd #{dirs.last}", command].compact.join('; ').shrink(250).blue
136
+ end
137
+ unless dry_run?
138
+ if verbose_level >= 2
139
+ Kernel.system(*args)
140
+ else
141
+ rd, wr = IO::pipe
142
+
143
+ pid = fork{
144
+ rd.close
145
+ STDOUT.reopen(wr)
146
+ STDERR.reopen(wr)
147
+ wr.close
148
+ exec(*args)
149
+ }
150
+
151
+ wr.close
152
+ begin
153
+ true while line = rd.gets
154
+ ensure
155
+ rd.close unless rd.closed?
156
+ Process.wait(pid)
157
+ end
158
+ end
159
+ unless $?.success?
160
+ if $?.signaled?
161
+ raise SignalException.new($?.termsig)
162
+ else
163
+ abort("failed: #{command}")
164
+ end
165
+ end
166
+ end
122
167
  end
123
168
 
124
169
  def remove_if_present(path)
125
- FileUtils.remove_entry(path) if File.exist?(path)
170
+ path = Pathname(path)
171
+ if path.exist?
172
+ puts "rm -r #{ShellEscape.word(path)}".magenta
173
+ FileUtils.remove_entry(path) unless dry_run?
174
+ end
175
+ end
176
+
177
+ def dirs
178
+ @@dirs ||= []
179
+ end
180
+
181
+ def chdir(path, &block)
182
+ path = Pathname(path)
183
+ dirs.push(path.expand_path)
184
+ Dir.chdir(path, &block)
185
+ ensure
186
+ dirs.pop
126
187
  end
127
188
 
128
189
  def with_env(key, value)
@@ -131,6 +192,25 @@ class SdocAll
131
192
  ensure
132
193
  ENV[key] = old_value
133
194
  end
195
+
196
+ def output_for_verbose_level(n)
197
+ if verbose_level >= n
198
+ yield
199
+ else
200
+ old_stdout = $stdout
201
+ old_stderr = $stderr
202
+ dev_null = File.open('/dev/null', 'w')
203
+ begin
204
+ $stdout = dev_null
205
+ $stderr = dev_null
206
+ yield
207
+ ensure
208
+ $stdout = old_stdout
209
+ $stderr = old_stderr
210
+ dev_null.close
211
+ end
212
+ end
213
+ end
134
214
  end
135
215
  extend ClassMethods
136
216
  end
@@ -66,7 +66,7 @@ class SdocAll
66
66
 
67
67
  if entry[:paths]
68
68
  paths = FileList.new
69
- Dir.chdir(path) do
69
+ Base.chdir(path) do
70
70
  entry[:paths].each do |glob|
71
71
  m = /^([+-]?)(.*)$/.match(glob)
72
72
  if m[1] == '-'
@@ -21,9 +21,11 @@ class SdocAll
21
21
  end
22
22
 
23
23
  def add_tasks(options = {})
24
- plugins = config[:path].children.map do |path|
25
- path if path.directory?
26
- end.compact
24
+ plugins = Base.chdir(config[:path]) do
25
+ Pathname.glob('*').map do |path|
26
+ config[:path] + path if path.directory?
27
+ end.compact
28
+ end
27
29
 
28
30
  plugins.delete_if{ |plugin| !config[:only].include?(plugin.basename.to_s.downcase) } if config[:only]
29
31
  plugins.delete_if{ |plugin| config[:exclude].include?(plugin.basename.to_s.downcase) }
@@ -31,7 +33,7 @@ class SdocAll
31
33
  if config[:update] && options[:update]
32
34
  plugins.each do |plugin|
33
35
  if (plugin + '.git').directory?
34
- Dir.chdir(plugin) do
36
+ Base.chdir(plugin) do
35
37
  Base.system('git fetch origin && git reset --hard origin')
36
38
  end
37
39
  end
@@ -40,7 +42,7 @@ class SdocAll
40
42
 
41
43
  plugins.each do |plugin|
42
44
  paths = FileList.new
43
- Dir.chdir(plugin) do
45
+ Base.chdir(plugin) do
44
46
  paths.include('lib/**/*.rb')
45
47
  paths.include('README*')
46
48
  paths.include('CHANGELOG*')
@@ -35,7 +35,7 @@ class SdocAll
35
35
  self.class.used_sources << path
36
36
 
37
37
  paths = FileList.new
38
- Dir.chdir(path) do
38
+ Base.chdir(path) do
39
39
  File.open('vendor/rails/railties/lib/tasks/documentation.rake') do |f|
40
40
  true until f.readline['Rake::RDocTask.new("rails")']
41
41
  until (line = f.readline.strip) == '}'
@@ -22,7 +22,6 @@ class SdocAll
22
22
  version = `#{binary} -e 'print "\#{RUBY_VERSION}-p\#{RUBY_PATCHLEVEL}"'`
23
23
  if $?.success? && version[/^\d+\.\d+\.\d+-p\d+$/]
24
24
  config[:version] = version
25
- puts "binary `#{binary}` is of version #{version}"
26
25
  else
27
26
  raise ConfigError.new("binary `#{binary}` failed or does not seem to be ruby binary as version returned is #{version.inspect}")
28
27
  end
@@ -63,54 +62,68 @@ class SdocAll
63
62
  end
64
63
  self.class.used_sources << src_path
65
64
 
66
- task_options = {
67
- :src_path => src_path,
68
- :doc_path => "ruby-#{version}",
69
- :title => "ruby-#{version}"
70
- }
71
- task_options[:index] = config[:index] if config[:index]
72
- Base.add_task(task_options)
73
-
74
- if config[:stdlib]
65
+ if config[:stdlib] == 'integrate'
75
66
  stdlib_config = download_and_get_stdlib_config(:update => config[:update] && options[:update])
76
-
77
- stdlib_tasks = []
78
- Dir.chdir(src_path) do
79
- main_files_to_document = get_files_to_document
67
+ paths = FileList.new
68
+ Base.chdir(src_path) do
69
+ paths.add(get_ruby_files_to_document)
80
70
  stdlib_config['targets'].each do |target|
81
71
  name = target['target']
82
-
83
- paths = FileList.new
84
- paths.include("{lib,ext}/#{name}/**/README*")
85
- paths.include("{lib,ext}/#{name}.{c,rb}")
86
- paths.include("{lib,ext}/#{name}/**/*.{c,rb}")
87
- paths.resolve
88
- paths.reject! do |path|
89
- [%r{/extconf.rb\Z}, %r{/test/(?!unit)}, %r{/tests/}, %r{/sample}, %r{/demo/}].any?{ |pat| pat.match path }
90
- end
91
-
92
- if paths.present? && (paths - main_files_to_document).present?
93
- stdlib_tasks << {
94
- :src_path => src_path,
95
- :doc_path => name.gsub(/[^a-z0-9\-_]/i, '-'),
96
- :paths => paths.to_a,
97
- :main => target['mainpage'],
98
- :title => name
99
- }
72
+ paths.add(get_stdlib_files_to_document(name))
73
+ end
74
+ paths.resolve
75
+ end
76
+ task_options = {
77
+ :src_path => src_path,
78
+ :doc_path => "ruby-#{version}_with_stdlib",
79
+ :title => "ruby-#{version} +stdlib",
80
+ :paths => paths.to_a
81
+ }
82
+ task_options[:index] = config[:index] if config[:index]
83
+ Base.add_task(task_options)
84
+ else
85
+ task_options = {
86
+ :src_path => src_path,
87
+ :doc_path => "ruby-#{version}",
88
+ :title => "ruby-#{version}"
89
+ }
90
+ task_options[:index] = config[:index] if config[:index]
91
+ Base.add_task(task_options)
92
+
93
+ if config[:stdlib]
94
+ stdlib_config = download_and_get_stdlib_config(:update => config[:update] && options[:update])
95
+
96
+ stdlib_tasks = []
97
+ Base.chdir(src_path) do
98
+ main_files_to_document = get_ruby_files_to_document
99
+ stdlib_config['targets'].each do |target|
100
+ name = target['target']
101
+
102
+ paths = get_stdlib_files_to_document(name)
103
+
104
+ if paths.present? && (paths - main_files_to_document).present?
105
+ stdlib_tasks << {
106
+ :src_path => src_path,
107
+ :doc_path => name.gsub(/[^a-z0-9\-_]/i, '-'),
108
+ :paths => paths.to_a,
109
+ :main => target['mainpage'],
110
+ :title => name
111
+ }
112
+ end
100
113
  end
101
114
  end
115
+ Base.add_merge_task(
116
+ :doc_path => "ruby-stdlib-#{version}",
117
+ :title => "ruby-stdlib-#{version}",
118
+ :tasks_options => stdlib_tasks.sort_by{ |task| task[:title].downcase }
119
+ )
102
120
  end
103
- Base.add_merge_task(
104
- :doc_path => "ruby-stdlib-#{version}",
105
- :title => "ruby-stdlib-#{version}",
106
- :tasks_options => stdlib_tasks.sort_by{ |task| task[:title].downcase }
107
- )
108
121
  end
109
122
  end
110
123
 
111
124
  private
112
125
 
113
- def get_files_to_document(dir = nil)
126
+ def get_ruby_files_to_document(dir = nil)
114
127
  files = []
115
128
 
116
129
  dot_document_name = '.document'
@@ -122,7 +135,7 @@ class SdocAll
122
135
  end.each do |glob|
123
136
  Pathname.glob(dir ? dir + glob : glob) do |path|
124
137
  if path.directory?
125
- files.concat(get_files_to_document(path))
138
+ files.concat(get_ruby_files_to_document(path))
126
139
  else
127
140
  files << path.to_s
128
141
  end
@@ -132,6 +145,18 @@ class SdocAll
132
145
  files
133
146
  end
134
147
 
148
+ def get_stdlib_files_to_document(name)
149
+ paths = FileList.new
150
+ paths.include("{lib,ext}/#{name}/**/README*")
151
+ paths.include("{lib,ext}/#{name}.{c,rb}")
152
+ paths.include("{lib,ext}/#{name}/**/*.{c,rb}")
153
+ paths.resolve
154
+ paths.reject! do |path|
155
+ [%r{/extconf.rb\Z}, %r{/test/(?!unit)}, %r{/tests/}, %r{/sample}, %r{/demo/}].any?{ |pat| pat.match path }
156
+ end
157
+ paths
158
+ end
159
+
135
160
  def download_and_get_stdlib_config(options = {})
136
161
  stdlib_config_url = 'http://stdlib-doc.rubyforge.org/svn/trunk/data/gendoc.yaml'
137
162
  if options[:update] || (config = get_stdlib_config).nil?
@@ -181,36 +206,40 @@ class SdocAll
181
206
  end
182
207
 
183
208
  def download_matching_archive(version)
184
- Net::FTP.open('ftp.ruby-lang.org') do |ftp|
185
- remote_path = Pathname('/pub/ruby')
186
- ftp.debug_mode = true
187
- ftp.passive = true
188
- ftp.login
189
- ftp.chdir(remote_path)
190
-
191
- tar = nil
192
-
193
- dirs, files = [], []
194
- ftp.list('*').map do |line|
195
- full_path = remote_path + line.split.last
196
- (line.starts_with?('d') ? dirs : files) << full_path
197
- end
198
-
199
- tar_bz2_matcher = /(^|\/)ruby-.*\.tar\.bz2$/
200
-
201
- unless tar = last_matching_ruby_archive(version, files.grep(tar_bz2_matcher)) || last_matching_ruby_archive(version, files)
202
- dirs = dirs.sort_by{ |dir| s = dir.basename.to_s; v = s.to_f; [v, s] }.reverse.
203
- select{ |dir| dir.basename.to_s[/^\d/] && dir.basename.to_s.starts_with?(version[0, 3]) }
204
- dirs.each do |dir|
205
- files = ftp.nlst(dir)
206
- break if tar = last_matching_ruby_archive(version, files.grep(tar_bz2_matcher)) || last_matching_ruby_archive(version, files)
207
- end
208
- end
209
-
210
- if tar
211
- dest = sources_path.parent + tar.name
212
- unless dest.exist? && dest.size == ftp.size(tar.path)
213
- ftp.getbinaryfile(tar.path, dest)
209
+ Progress.start("downloading ruby #{version}") do
210
+ output_for_verbose_level(2) do
211
+ Net::FTP.open('ftp.ruby-lang.org') do |ftp|
212
+ remote_path = Pathname('/pub/ruby')
213
+ ftp.debug_mode = true
214
+ ftp.passive = true
215
+ ftp.login
216
+ ftp.chdir(remote_path)
217
+
218
+ tar = nil
219
+
220
+ dirs, files = [], []
221
+ ftp.list('*').map do |line|
222
+ full_path = remote_path + line.split.last
223
+ (line.starts_with?('d') ? dirs : files) << full_path
224
+ end
225
+
226
+ tar_bz2_matcher = /(^|\/)ruby-.*\.tar\.bz2$/
227
+
228
+ unless tar = last_matching_ruby_archive(version, files.grep(tar_bz2_matcher)) || last_matching_ruby_archive(version, files)
229
+ dirs = dirs.sort_by{ |dir| s = dir.basename.to_s; v = s.to_f; [v, s] }.reverse.
230
+ select{ |dir| dir.basename.to_s[/^\d/] && dir.basename.to_s.starts_with?(version[0, 3]) }
231
+ dirs.each do |dir|
232
+ files = ftp.nlst(dir)
233
+ break if tar = last_matching_ruby_archive(version, files.grep(tar_bz2_matcher)) || last_matching_ruby_archive(version, files)
234
+ end
235
+ end
236
+
237
+ if tar
238
+ dest = sources_path.parent + tar.name
239
+ unless dest.exist? && dest.size == ftp.size(tar.path)
240
+ ftp.getbinaryfile(tar.path, dest)
241
+ end
242
+ end
214
243
  end
215
244
  end
216
245
  end
@@ -23,7 +23,10 @@ class SdocAll
23
23
  return true unless full_doc_path.exist?
24
24
 
25
25
  created_hash = config_hash_path.read rescue nil
26
- return true if created_hash != config_hash
26
+ if created_hash != config_hash
27
+ puts "#{title}: config changed, rebuilding".red
28
+ return true
29
+ end
27
30
  end
28
31
 
29
32
  def run_if_clobber
@@ -63,7 +66,7 @@ class SdocAll
63
66
  cmd << '-T' << 'direct'
64
67
 
65
68
  if src_path.directory?
66
- Dir.chdir(src_path) do
69
+ Base.chdir(src_path) do
67
70
  cmd << '-m' << main if main
68
71
  Base.system(*cmd + paths)
69
72
  end
@@ -96,9 +99,12 @@ class SdocAll
96
99
  src_path.find do |path|
97
100
  Find.prune if path.directory? && path.basename.to_s[0] == ?.
98
101
  latest = [latest, path.mtime, path.ctime].max
99
- break unless latest < created
102
+ break if latest >= created
100
103
  end
101
104
  end
105
+ if created && latest >= created
106
+ puts "#{title}: files changed since last build".red
107
+ end
102
108
  created.nil? || latest >= created
103
109
  end
104
110
 
@@ -129,11 +135,13 @@ class SdocAll
129
135
 
130
136
  def run(options = {})
131
137
  run_if_clobber do
132
- tasks.each_with_progress(title) do |task|
133
- task.run(options)
138
+ tasks.each do |task|
139
+ Progress.start(task.title) do
140
+ task.run(options)
141
+ end
134
142
  end
135
143
 
136
- Dir.chdir(Base.docs_path) do
144
+ Base.chdir(Base.docs_path) do
137
145
  cmd = %w(sdoc-merge)
138
146
  cmd << '-o' << Base.docs_path + doc_path
139
147
  cmd << '-t' << title
@@ -0,0 +1,64 @@
1
+ # escape.rb - escape/unescape library for several formats
2
+ #
3
+ # Copyright (C) 2006,2007 Tanaka Akira <akr@fsij.org>
4
+ #
5
+ # Redistribution and use in source and binary forms, with or without
6
+ # modification, are permitted provided that the following conditions are met:
7
+ #
8
+ # 1. Redistributions of source code must retain the above copyright notice, this
9
+ # list of conditions and the following disclaimer.
10
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
11
+ # this list of conditions and the following disclaimer in the documentation
12
+ # and/or other materials provided with the distribution.
13
+ # 3. The name of the author may not be used to endorse or promote products
14
+ # derived from this software without specific prior written permission.
15
+ #
16
+ # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17
+ # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18
+ # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19
+ # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
21
+ # OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
24
+ # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
25
+ # OF SUCH DAMAGE.
26
+
27
+ # Escape module provides several escape functions.
28
+ # * shell command
29
+ # modified to work only with shell
30
+ module ShellEscape
31
+ module_function
32
+
33
+ # Escape.shell_command composes
34
+ # a sequence of words to
35
+ # a single shell command line.
36
+ # All shell meta characters are quoted and
37
+ # the words are concatenated with interleaving space.
38
+ def command(*args)
39
+ args.map{ |arg| word(arg) } * ' '
40
+ end
41
+
42
+ # Escape.shell_single_word quotes shell meta characters.
43
+ #
44
+ # The result string is always single shell word, even if
45
+ # the argument is "".
46
+ def word(word)
47
+ word = word.to_s
48
+ if word.empty?
49
+ "''"
50
+ elsif %r{\A[0-9A-Za-z+,./:=@_-]+\z} =~ word
51
+ word
52
+ else
53
+ result = ''
54
+ word.scan(/('+)|[^']+/) {
55
+ if $1
56
+ result << %q{\'} * $1.length
57
+ else
58
+ result << "'#{$&}'"
59
+ end
60
+ }
61
+ result
62
+ end
63
+ end
64
+ end
@@ -2,9 +2,18 @@ require 'sdoc_all'
2
2
 
3
3
  task :default => :run
4
4
 
5
- desc "Build/update documentation"
5
+ def run_options
6
+ dry_run = ENV['DRY_RUN']
7
+ verbose_level = ENV['VERBOSE_LEVEL'].to_i
8
+ {
9
+ :dry_run => dry_run,
10
+ :verbose_level => dry_run ? 2 : verbose_level
11
+ }
12
+ end
13
+
14
+ desc "Build/update documentation (DRY_RUN=true to skip execution of commands (sets VERBOSE_LEVEL to 1), VERBOSE_LEVEL: 0 (default) - only progress and explanations, 1 - output commands to be executed, 2 - output result of command execution)"
6
15
  task :run do
7
- SdocAll.run
16
+ SdocAll.run(run_options)
8
17
  end
9
18
 
10
19
  desc "Clobber documentation"
@@ -16,6 +25,6 @@ end
16
25
  namespace :run do
17
26
  desc "Force update sources, before building/updating"
18
27
  task :update do
19
- SdocAll.run(:update => true)
28
+ SdocAll.run(run_options.merge(:update => true))
20
29
  end
21
30
  end
@@ -1,24 +1,72 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
1
4
  # -*- encoding: utf-8 -*-
2
5
 
3
6
  Gem::Specification.new do |s|
4
7
  s.name = %q{sdoc_all}
5
- s.version = "1.0.2.2"
8
+ s.version = "1.0.4"
6
9
 
7
- s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["toy"]
9
- s.date = %q{2009-09-21}
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Boba Fat"]
12
+ s.date = %q{2009-12-30}
10
13
  s.default_executable = %q{sdoc-all}
11
14
  s.description = %q{Command line tool to get documentation for ruby, rails, gems and plugins in one place}
12
- s.email = %q{ivan@workisfun.ru}
13
15
  s.executables = ["sdoc-all"]
14
- s.extra_rdoc_files = ["LICENSE", "README.rdoc", "bin/sdoc-all", "lib/sdoc_all.rb", "lib/sdoc_all/base.rb", "lib/sdoc_all/config_error.rb", "lib/sdoc_all/file_list.rb", "lib/sdoc_all/generator/sdoc_all/sdoc_all_generator.rb", "lib/sdoc_all/generator/sdoc_all/templates/Rakefile", "lib/sdoc_all/generator/sdoc_all/templates/config.yml", "lib/sdoc_all/parts/gems.rb", "lib/sdoc_all/parts/paths.rb", "lib/sdoc_all/parts/plugins.rb", "lib/sdoc_all/parts/rails.rb", "lib/sdoc_all/parts/ruby.rb", "lib/sdoc_all/task.rb", "lib/tasks/sdoc_all_rake.rb"]
15
- s.files = ["LICENSE", "Manifest", "README.rdoc", "Rakefile", "VERSION.yml", "bin/sdoc-all", "lib/sdoc_all.rb", "lib/sdoc_all/base.rb", "lib/sdoc_all/config_error.rb", "lib/sdoc_all/file_list.rb", "lib/sdoc_all/generator/sdoc_all/sdoc_all_generator.rb", "lib/sdoc_all/generator/sdoc_all/templates/Rakefile", "lib/sdoc_all/generator/sdoc_all/templates/config.yml", "lib/sdoc_all/parts/gems.rb", "lib/sdoc_all/parts/paths.rb", "lib/sdoc_all/parts/plugins.rb", "lib/sdoc_all/parts/rails.rb", "lib/sdoc_all/parts/ruby.rb", "lib/sdoc_all/task.rb", "lib/tasks/sdoc_all_rake.rb", "spec/sdoc_all/file_list_spec.rb", "spec/sdoc_all/gems_spec.rb", "spec/sdoc_all/paths_spec.rb", "spec/sdoc_all/plugins_spec.rb", "spec/sdoc_all/rails_spec.rb", "spec/sdoc_all/ruby_spec.rb", "spec/sdoc_all_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "sdoc_all.gemspec"]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE",
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".autotest",
22
+ ".gitignore",
23
+ "LICENSE",
24
+ "Manifest",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "bin/sdoc-all",
29
+ "lib/sdoc_all.rb",
30
+ "lib/sdoc_all/base.rb",
31
+ "lib/sdoc_all/config_error.rb",
32
+ "lib/sdoc_all/file_list.rb",
33
+ "lib/sdoc_all/generator/sdoc_all/sdoc_all_generator.rb",
34
+ "lib/sdoc_all/generator/sdoc_all/templates/Rakefile",
35
+ "lib/sdoc_all/generator/sdoc_all/templates/config.yml",
36
+ "lib/sdoc_all/parts/gems.rb",
37
+ "lib/sdoc_all/parts/paths.rb",
38
+ "lib/sdoc_all/parts/plugins.rb",
39
+ "lib/sdoc_all/parts/rails.rb",
40
+ "lib/sdoc_all/parts/ruby.rb",
41
+ "lib/sdoc_all/task.rb",
42
+ "lib/shell_escape.rb",
43
+ "lib/tasks/sdoc_all_rake.rb",
44
+ "sdoc_all.gemspec",
45
+ "spec/sdoc_all/file_list_spec.rb",
46
+ "spec/sdoc_all/gems_spec.rb",
47
+ "spec/sdoc_all/paths_spec.rb",
48
+ "spec/sdoc_all/plugins_spec.rb",
49
+ "spec/sdoc_all/rails_spec.rb",
50
+ "spec/sdoc_all/ruby_spec.rb",
51
+ "spec/sdoc_all_spec.rb",
52
+ "spec/spec.opts",
53
+ "spec/spec_helper.rb"
54
+ ]
16
55
  s.homepage = %q{http://github.com/toy/sdoc_all}
17
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Sdoc_all", "--main", "README.rdoc"]
56
+ s.rdoc_options = ["--charset=UTF-8"]
18
57
  s.require_paths = ["lib"]
19
- s.rubyforge_project = %q{toytoy}
20
58
  s.rubygems_version = %q{1.3.5}
21
- s.summary = %q{documentation for everything}
59
+ s.summary = %q{Documentation for everything}
60
+ s.test_files = [
61
+ "spec/sdoc_all/file_list_spec.rb",
62
+ "spec/sdoc_all/gems_spec.rb",
63
+ "spec/sdoc_all/paths_spec.rb",
64
+ "spec/sdoc_all/plugins_spec.rb",
65
+ "spec/sdoc_all/rails_spec.rb",
66
+ "spec/sdoc_all/ruby_spec.rb",
67
+ "spec/sdoc_all_spec.rb",
68
+ "spec/spec_helper.rb"
69
+ ]
22
70
 
23
71
  if s.respond_to? :specification_version then
24
72
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -26,19 +74,26 @@ Gem::Specification.new do |s|
26
74
 
27
75
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
76
  s.add_runtime_dependency(%q<activesupport>, [">= 0"])
29
- s.add_runtime_dependency(%q<rake>, [">= 0"])
77
+ s.add_runtime_dependency(%q<colored>, [">= 0"])
30
78
  s.add_runtime_dependency(%q<progress>, [">= 0.0.8"])
79
+ s.add_runtime_dependency(%q<rake>, [">= 0"])
80
+ s.add_runtime_dependency(%q<rubigen>, [">= 0"])
31
81
  s.add_runtime_dependency(%q<sdoc>, [">= 0"])
32
82
  else
33
83
  s.add_dependency(%q<activesupport>, [">= 0"])
34
- s.add_dependency(%q<rake>, [">= 0"])
84
+ s.add_dependency(%q<colored>, [">= 0"])
35
85
  s.add_dependency(%q<progress>, [">= 0.0.8"])
86
+ s.add_dependency(%q<rake>, [">= 0"])
87
+ s.add_dependency(%q<rubigen>, [">= 0"])
36
88
  s.add_dependency(%q<sdoc>, [">= 0"])
37
89
  end
38
90
  else
39
91
  s.add_dependency(%q<activesupport>, [">= 0"])
40
- s.add_dependency(%q<rake>, [">= 0"])
92
+ s.add_dependency(%q<colored>, [">= 0"])
41
93
  s.add_dependency(%q<progress>, [">= 0.0.8"])
94
+ s.add_dependency(%q<rake>, [">= 0"])
95
+ s.add_dependency(%q<rubigen>, [">= 0"])
42
96
  s.add_dependency(%q<sdoc>, [">= 0"])
43
97
  end
44
98
  end
99
+
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sdoc_all
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2.2
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
- - toy
7
+ - Boba Fat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-21 00:00:00 +04:00
13
- default_executable:
12
+ date: 2009-12-30 00:00:00 +03:00
13
+ default_executable: sdoc-all
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -23,7 +23,7 @@ dependencies:
23
23
  version: "0"
24
24
  version:
25
25
  - !ruby/object:Gem::Dependency
26
- name: rake
26
+ name: colored
27
27
  type: :runtime
28
28
  version_requirement:
29
29
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,6 +42,26 @@ dependencies:
42
42
  - !ruby/object:Gem::Version
43
43
  version: 0.0.8
44
44
  version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: rake
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubigen
57
+ type: :runtime
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ version:
45
65
  - !ruby/object:Gem::Dependency
46
66
  name: sdoc
47
67
  type: :runtime
@@ -53,7 +73,7 @@ dependencies:
53
73
  version: "0"
54
74
  version:
55
75
  description: Command line tool to get documentation for ruby, rails, gems and plugins in one place
56
- email: ivan@workisfun.ru
76
+ email:
57
77
  executables:
58
78
  - sdoc-all
59
79
  extensions: []
@@ -61,27 +81,14 @@ extensions: []
61
81
  extra_rdoc_files:
62
82
  - LICENSE
63
83
  - README.rdoc
64
- - bin/sdoc-all
65
- - lib/sdoc_all.rb
66
- - lib/sdoc_all/base.rb
67
- - lib/sdoc_all/config_error.rb
68
- - lib/sdoc_all/file_list.rb
69
- - lib/sdoc_all/generator/sdoc_all/sdoc_all_generator.rb
70
- - lib/sdoc_all/generator/sdoc_all/templates/Rakefile
71
- - lib/sdoc_all/generator/sdoc_all/templates/config.yml
72
- - lib/sdoc_all/parts/gems.rb
73
- - lib/sdoc_all/parts/paths.rb
74
- - lib/sdoc_all/parts/plugins.rb
75
- - lib/sdoc_all/parts/rails.rb
76
- - lib/sdoc_all/parts/ruby.rb
77
- - lib/sdoc_all/task.rb
78
- - lib/tasks/sdoc_all_rake.rb
79
84
  files:
85
+ - .autotest
86
+ - .gitignore
80
87
  - LICENSE
81
88
  - Manifest
82
89
  - README.rdoc
83
90
  - Rakefile
84
- - VERSION.yml
91
+ - VERSION
85
92
  - bin/sdoc-all
86
93
  - lib/sdoc_all.rb
87
94
  - lib/sdoc_all/base.rb
@@ -96,7 +103,9 @@ files:
96
103
  - lib/sdoc_all/parts/rails.rb
97
104
  - lib/sdoc_all/parts/ruby.rb
98
105
  - lib/sdoc_all/task.rb
106
+ - lib/shell_escape.rb
99
107
  - lib/tasks/sdoc_all_rake.rb
108
+ - sdoc_all.gemspec
100
109
  - spec/sdoc_all/file_list_spec.rb
101
110
  - spec/sdoc_all/gems_spec.rb
102
111
  - spec/sdoc_all/paths_spec.rb
@@ -106,19 +115,13 @@ files:
106
115
  - spec/sdoc_all_spec.rb
107
116
  - spec/spec.opts
108
117
  - spec/spec_helper.rb
109
- - sdoc_all.gemspec
110
118
  has_rdoc: true
111
119
  homepage: http://github.com/toy/sdoc_all
112
120
  licenses: []
113
121
 
114
122
  post_install_message:
115
123
  rdoc_options:
116
- - --line-numbers
117
- - --inline-source
118
- - --title
119
- - Sdoc_all
120
- - --main
121
- - README.rdoc
124
+ - --charset=UTF-8
122
125
  require_paths:
123
126
  - lib
124
127
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -131,14 +134,21 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
134
  requirements:
132
135
  - - ">="
133
136
  - !ruby/object:Gem::Version
134
- version: "1.2"
137
+ version: "0"
135
138
  version:
136
139
  requirements: []
137
140
 
138
- rubyforge_project: toytoy
141
+ rubyforge_project:
139
142
  rubygems_version: 1.3.5
140
143
  signing_key:
141
144
  specification_version: 3
142
- summary: documentation for everything
143
- test_files: []
144
-
145
+ summary: Documentation for everything
146
+ test_files:
147
+ - spec/sdoc_all/file_list_spec.rb
148
+ - spec/sdoc_all/gems_spec.rb
149
+ - spec/sdoc_all/paths_spec.rb
150
+ - spec/sdoc_all/plugins_spec.rb
151
+ - spec/sdoc_all/rails_spec.rb
152
+ - spec/sdoc_all/ruby_spec.rb
153
+ - spec/sdoc_all_spec.rb
154
+ - spec/spec_helper.rb
@@ -1 +0,0 @@
1
- [1, 0, 2, 2]