sdoc_all 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Manifest +17 -0
- data/README.rdoc +23 -0
- data/Rakefile +16 -0
- data/VERSION.yml +1 -0
- data/bin/sdoc-all +16 -0
- data/lib/sdoc_all.rb +87 -0
- data/lib/sdoc_all/base.rb +80 -0
- data/lib/sdoc_all/gems.rb +28 -0
- data/lib/sdoc_all/generator/sdoc_all/sdoc_all_generator.rb +65 -0
- data/lib/sdoc_all/generator/sdoc_all/templates/Rakefile +4 -0
- data/lib/sdoc_all/generator/sdoc_all/templates/sdoc.config.yml.erb +1 -0
- data/lib/sdoc_all/plugins.rb +33 -0
- data/lib/sdoc_all/rails.rb +51 -0
- data/lib/sdoc_all/rdoc_task.rb +45 -0
- data/lib/sdoc_all/rdoc_tasks.rb +32 -0
- data/lib/sdoc_all/ruby.rb +59 -0
- data/lib/tasks/sdoc_all.rb +10 -0
- data/sdoc_all.gemspec +45 -0
- metadata +129 -0
data/Manifest
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
bin/sdoc-all
|
2
|
+
lib/sdoc_all/base.rb
|
3
|
+
lib/sdoc_all/gems.rb
|
4
|
+
lib/sdoc_all/generator/sdoc_all/sdoc_all_generator.rb
|
5
|
+
lib/sdoc_all/generator/sdoc_all/templates/Rakefile
|
6
|
+
lib/sdoc_all/generator/sdoc_all/templates/sdoc.config.yml.erb
|
7
|
+
lib/sdoc_all/plugins.rb
|
8
|
+
lib/sdoc_all/rails.rb
|
9
|
+
lib/sdoc_all/rdoc_task.rb
|
10
|
+
lib/sdoc_all/rdoc_tasks.rb
|
11
|
+
lib/sdoc_all/ruby.rb
|
12
|
+
lib/sdoc_all.rb
|
13
|
+
lib/tasks/sdoc_all.rb
|
14
|
+
Manifest
|
15
|
+
Rakefile
|
16
|
+
README.rdoc
|
17
|
+
VERSION.yml
|
data/README.rdoc
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
= sdoc-all
|
2
|
+
Command line tool to get documentation for ruby, rails, gems and plugins in one place
|
3
|
+
|
4
|
+
== Getting Started
|
5
|
+
sudo gem install sdoc sdoc_all
|
6
|
+
sdoc-all <place for your documentation>; cd <place for your documentation>
|
7
|
+
rake update
|
8
|
+
|
9
|
+
== Configure
|
10
|
+
in <tt>sdoc.config.yml</tt> you can define:
|
11
|
+
- preferred version of ruby
|
12
|
+
- preferred version of rails
|
13
|
+
- plugins directory
|
14
|
+
- what to exclude
|
15
|
+
|
16
|
+
== How it works
|
17
|
+
sdoc-all generates folder with config and rakefile
|
18
|
+
running <tt>rake update</tt> (or simply <tt>rake</tt> as it is default task) in that folder:
|
19
|
+
- downloads ruby sources from ftp.ruby-lang.org
|
20
|
+
- builds dummy rails applications and freezes gems there
|
21
|
+
- builds documentation for ruby, rails, gems and plugins
|
22
|
+
- merges documentation
|
23
|
+
rerunning rake rebuilds only changed files if not asked to rebuild everything (force in config)
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rake'
|
4
|
+
require 'rake/clean'
|
5
|
+
require 'fileutils'
|
6
|
+
require 'echoe'
|
7
|
+
|
8
|
+
version = YAML.load_file(File.join(File.dirname(__FILE__), 'VERSION.yml')).join('.') rescue nil
|
9
|
+
|
10
|
+
Echoe.new('sdoc_all', version) do |p|
|
11
|
+
p.author = "toy"
|
12
|
+
p.summary = "Command line tool to get documentation for ruby, rails, gems and plugins in one place"
|
13
|
+
p.url = "http://github.com/toy/sdoc_all"
|
14
|
+
p.runtime_dependencies = %w(sdoc activesupport rake progress)
|
15
|
+
p.project = 'toytoy'
|
16
|
+
end
|
data/VERSION.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
[0, 1, 0]
|
data/bin/sdoc-all
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby -KU
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rubigen'
|
5
|
+
|
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[:major]}.#{version[:minor]}.#{version[:patch]}"
|
9
|
+
exit(0)
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'rubigen/scripts/generate'
|
13
|
+
source = RubiGen::PathSource.new(:application, File.join(File.dirname(__FILE__), "../lib/sdoc_all/generator"))
|
14
|
+
RubiGen::Base.reset_sources
|
15
|
+
RubiGen::Base.append_sources source
|
16
|
+
RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'sdoc_all')
|
data/lib/sdoc_all.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
require 'find'
|
5
|
+
|
6
|
+
require 'rubygems'
|
7
|
+
require 'activesupport'
|
8
|
+
require 'rake'
|
9
|
+
require 'progress'
|
10
|
+
|
11
|
+
__DIR__ = File.dirname(__FILE__)
|
12
|
+
$:.unshift(__DIR__) unless $:.include?(__DIR__) || $:.include?(File.expand_path(__DIR__))
|
13
|
+
|
14
|
+
class SdocAll
|
15
|
+
def self.run(options = {})
|
16
|
+
add_default_options!(options)
|
17
|
+
|
18
|
+
Base.update_all_sources(options)
|
19
|
+
|
20
|
+
tasks = Base.rdoc_tasks(options)
|
21
|
+
|
22
|
+
selected_tasks = []
|
23
|
+
selected_tasks << tasks.find_or_last_ruby(options[:ruby])
|
24
|
+
selected_tasks << tasks.find_or_last_rails(options[:rails])
|
25
|
+
tasks.gems.group_by{ |task| task.name_parts[0] }.sort_by{ |name, versions| name.downcase }.each do |name, versions|
|
26
|
+
selected_tasks << versions.sort_by{ |version| version.name_parts[1] }.last
|
27
|
+
end
|
28
|
+
tasks.plugins.sort_by{ |task| task.name_parts[0] }.each do |task|
|
29
|
+
selected_tasks << task
|
30
|
+
end
|
31
|
+
|
32
|
+
if options[:exclude].is_a?(Array)
|
33
|
+
selected_tasks.delete_if do |task|
|
34
|
+
options[:exclude].any?{ |exclude| task.doc_path[exclude] }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
selected_tasks.each_with_progress('Building documentation') do |task|
|
39
|
+
task.run(options)
|
40
|
+
end
|
41
|
+
|
42
|
+
Dir.chdir(options[:docs_path]) do
|
43
|
+
Base.remove_if_present(options[:public_path])
|
44
|
+
|
45
|
+
pathes = []
|
46
|
+
titles = []
|
47
|
+
urls = []
|
48
|
+
selected_tasks.each do |rdoc_task|
|
49
|
+
doc_path = options[:docs_path] + rdoc_task.doc_path
|
50
|
+
if File.file?(doc_path + 'index.html')
|
51
|
+
pathes << rdoc_task.doc_path
|
52
|
+
titles << rdoc_task.title
|
53
|
+
urls << "/docs/#{rdoc_task.doc_path}"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
cmd = %w(sdoc-merge)
|
58
|
+
cmd << '-o' << options[:public_path]
|
59
|
+
cmd << '-t' << 'all'
|
60
|
+
cmd << '-n' << titles.join(',')
|
61
|
+
cmd << '-u' << urls.join(' ')
|
62
|
+
system(*cmd + pathes)
|
63
|
+
|
64
|
+
File.symlink(options[:docs_path], options[:public_path] + 'docs')
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
def self.add_default_options!(options)
|
71
|
+
options[:base_path] = Pathname.new(Dir.pwd).freeze
|
72
|
+
options[:public_path] = Pathname.new(options[:base_path] + 'public').freeze
|
73
|
+
options[:docs_path] = Pathname.new(options[:base_path] + 'docs').freeze
|
74
|
+
options[:sources_path] = Pathname.new(options[:base_path] + 'sources').freeze
|
75
|
+
|
76
|
+
options[:exclude] ||= %w(gems/actionmailer gems/actionpack gems/activerecord gems/activeresource gems/activesupport gems/rails)
|
77
|
+
options[:plugins_path] = Pathname.new(options[:plugins_path] || File.expand_path('~/.plugins')).freeze
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
require 'sdoc_all/base'
|
82
|
+
require 'sdoc_all/ruby'
|
83
|
+
require 'sdoc_all/gems'
|
84
|
+
require 'sdoc_all/rails'
|
85
|
+
require 'sdoc_all/plugins'
|
86
|
+
require 'sdoc_all/rdoc_task'
|
87
|
+
require 'sdoc_all/rdoc_tasks'
|
@@ -0,0 +1,80 @@
|
|
1
|
+
class SdocAll
|
2
|
+
class Base
|
3
|
+
def self.inherited(subclass)
|
4
|
+
(@subclasses ||= []) << subclass
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.update_all_sources(options = {})
|
8
|
+
options[:sources_path].mkpath
|
9
|
+
Dir.chdir(options[:sources_path]) do
|
10
|
+
@subclasses.each do |subclass|
|
11
|
+
subclass.update_sources(options)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.rdoc_tasks(options = {})
|
17
|
+
Dir.chdir(options[:sources_path]) do
|
18
|
+
@@tasks = RdocTasks.new
|
19
|
+
|
20
|
+
@subclasses.each do |subclass|
|
21
|
+
subclass.add_rdoc_tasks(options)
|
22
|
+
end
|
23
|
+
|
24
|
+
to_clear = Dir.glob(options[:docs_path] + '*/*')
|
25
|
+
@@tasks.each do |task|
|
26
|
+
doc_path = options[:docs_path] + task.doc_path
|
27
|
+
to_clear.delete_if{ |path| path.starts_with?(doc_path) }
|
28
|
+
end
|
29
|
+
to_clear.each do |path|
|
30
|
+
remove_if_present(path)
|
31
|
+
end
|
32
|
+
|
33
|
+
@@tasks.each do |task|
|
34
|
+
doc_path = options[:docs_path] + task.doc_path
|
35
|
+
|
36
|
+
begin
|
37
|
+
raise 'force' if options[:force]
|
38
|
+
if File.exist?(doc_path)
|
39
|
+
unless File.directory?(doc_path)
|
40
|
+
raise 'not a dir'
|
41
|
+
else
|
42
|
+
created = Time.parse(File.read(doc_path + 'created.rid'))
|
43
|
+
Find.find(options[:sources_path] + task.src_path) do |path|
|
44
|
+
Find.prune if File.directory?(path) && File.basename(path)[0] == ?.
|
45
|
+
raise "changed #{path}" if File.ctime(path) > created || File.mtime(path) > created
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
rescue => e
|
50
|
+
puts e
|
51
|
+
remove_if_present(doc_path)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
@@tasks
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
protected
|
60
|
+
|
61
|
+
def self.add_rdoc_task(options = {})
|
62
|
+
options[:pathes] ||= []
|
63
|
+
[/^readme$/i, /^readme\.(?:txt|rdoc|markdown)$/i, /^readme\./i].each do |readme_r|
|
64
|
+
options[:main] ||= options[:pathes].grep(readme_r).first
|
65
|
+
end
|
66
|
+
@@tasks.add(self, options)
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.with_env(key, value)
|
70
|
+
old_value, ENV[key] = ENV[key], value
|
71
|
+
yield
|
72
|
+
ensure
|
73
|
+
ENV[key] = old_value
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.remove_if_present(path)
|
77
|
+
FileUtils.remove_entry(path) if File.exist?(path)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'enumerator'
|
2
|
+
|
3
|
+
class SdocAll
|
4
|
+
class Gems < Base
|
5
|
+
def self.each(&block)
|
6
|
+
Gem.source_index.each(&block)
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.update_sources(options = {})
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.add_rdoc_tasks(options = {})
|
13
|
+
each do |gem_name, spec|
|
14
|
+
main = nil
|
15
|
+
spec.rdoc_options.each_cons(2) do |options|
|
16
|
+
main = options[1] if %w(--main -m).include?(options[0])
|
17
|
+
end
|
18
|
+
add_rdoc_task(
|
19
|
+
:name_parts => [spec.name, spec.version],
|
20
|
+
:src_path => spec.full_gem_path,
|
21
|
+
:doc_path => "gems/#{gem_name}",
|
22
|
+
:pathes => spec.require_paths + spec.extra_rdoc_files,
|
23
|
+
:main => main
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
class SdocAllGenerator < RubiGen::Base
|
2
|
+
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
|
3
|
+
Config::CONFIG['ruby_install_name'])
|
4
|
+
|
5
|
+
def initialize(runtime_args, runtime_options = {})
|
6
|
+
super
|
7
|
+
usage if args.empty?
|
8
|
+
@destination_root = File.expand_path(args.shift)
|
9
|
+
@name = base_name
|
10
|
+
extract_options
|
11
|
+
end
|
12
|
+
|
13
|
+
def manifest
|
14
|
+
record do |m|
|
15
|
+
m.directory ''
|
16
|
+
BASEDIRS.each { |path| m.directory path }
|
17
|
+
|
18
|
+
m.file_copy_each %w(Rakefile)
|
19
|
+
m.template_copy_each %w(sdoc.config.yml.erb), nil, :assigns => {:sdoc_options => {
|
20
|
+
'ruby' => options[:ruby],
|
21
|
+
'rails' => options[:rails],
|
22
|
+
'exclude' => options[:exclude],
|
23
|
+
'plugins_path' => options[:plugins_path],
|
24
|
+
}}
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
29
|
+
def banner
|
30
|
+
<<-EOS
|
31
|
+
Creates an app for all ruby related documentation
|
32
|
+
edit sdoc.config.yml.erb if you need
|
33
|
+
run rake tasks
|
34
|
+
wait until finished (it takes some time)
|
35
|
+
all your documentation is in public folder
|
36
|
+
|
37
|
+
note:
|
38
|
+
content of docs and sources folders can be destroyed during rebuild
|
39
|
+
public folder is destroyed and recreated every build!
|
40
|
+
|
41
|
+
USAGE: #{File.basename($0)} name
|
42
|
+
EOS
|
43
|
+
end
|
44
|
+
|
45
|
+
def add_options!(opts)
|
46
|
+
opts.separator ''
|
47
|
+
opts.separator 'Options:'
|
48
|
+
|
49
|
+
opts.on("-r", "--ruby=\"version\"", String, "version of ruby you want to be documented like 1.8 or 1.8.6", "Default: latest") { |o| options[:ruby] = o }
|
50
|
+
opts.on("-a", "--rails=\"version\"", String, "version of rails you want to be documented like 2. or 2.3.2", "Default: latest") { |o| options[:rails] = o }
|
51
|
+
opts.on("-e", "--exclude=\"pathes\"", Array, "what to exclude separated with comma like gems/actionmailer or gems/actionpack,gems/rails", "Default: gems related to rails") { |o| options[:exclude] = o }
|
52
|
+
opts.on("-p", "--plugins_path=\"path\"", Array, "directory in which you store plugins you use are stored", "Default: ~/.plugins") { |o| options[:plugins_path] = o }
|
53
|
+
|
54
|
+
opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
55
|
+
end
|
56
|
+
|
57
|
+
def extract_options
|
58
|
+
end
|
59
|
+
|
60
|
+
BASEDIRS = %w(
|
61
|
+
docs
|
62
|
+
public
|
63
|
+
sources
|
64
|
+
)
|
65
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= YAML.dump(sdoc_options) %>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class SdocAll
|
2
|
+
class Plugins < Base
|
3
|
+
def self.each(plugins_path, &block)
|
4
|
+
Dir[plugins_path + '*'].each(&block)
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.update_sources(options = {})
|
8
|
+
each(options[:plugins_path]) do |plugin|
|
9
|
+
Dir.chdir(plugin) do
|
10
|
+
system('git fetch origin && git reset --hard HEAD')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.add_rdoc_tasks(options = {})
|
16
|
+
each(options[:plugins_path]) do |plugin|
|
17
|
+
Dir.chdir(plugin) do
|
18
|
+
pathes = Rake::FileList.new
|
19
|
+
pathes.include('lib/**/*.rb')
|
20
|
+
pathes.include('README*')
|
21
|
+
pathes.include('CHANGELOG*')
|
22
|
+
plugin_name = File.basename(plugin)
|
23
|
+
add_rdoc_task(
|
24
|
+
:name_parts => [plugin_name],
|
25
|
+
:src_path => plugin,
|
26
|
+
:doc_path => "plugins/#{plugin_name}",
|
27
|
+
:pathes => pathes.resolve
|
28
|
+
)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
class SdocAll
|
2
|
+
class Rails < Base
|
3
|
+
def self.each
|
4
|
+
Gem.source_index.search(Gem::Dependency.new('rails', :all)).each do |spec|
|
5
|
+
yield spec.full_name, spec.version.to_s
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.update_sources(options = {})
|
10
|
+
to_clear = Dir['rails-*']
|
11
|
+
each do |rails, version|
|
12
|
+
to_clear.delete(rails)
|
13
|
+
remove_if_present(rails) if options[:force]
|
14
|
+
unless File.directory?(rails)
|
15
|
+
with_env 'VERSION', version do
|
16
|
+
system('rails', rails, '--freeze')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
to_clear.each do |rails|
|
21
|
+
remove_if_present(rails)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.add_rdoc_tasks(options = {})
|
26
|
+
each do |rails, version|
|
27
|
+
if File.directory?(rails)
|
28
|
+
Dir.chdir(rails) do
|
29
|
+
pathes = Rake::FileList.new
|
30
|
+
File.open('vendor/rails/railties/lib/tasks/documentation.rake') do |f|
|
31
|
+
true until f.readline['Rake::RDocTask.new("rails")']
|
32
|
+
until (line = f.readline.strip) == '}'
|
33
|
+
if line['rdoc.rdoc_files.include']
|
34
|
+
pathes.include(line[/'(.*)'/, 1])
|
35
|
+
elsif line['rdoc.rdoc_files.exclude']
|
36
|
+
pathes.exclude(line[/'(.*)'/, 1])
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
add_rdoc_task(
|
41
|
+
:name_parts => [version],
|
42
|
+
:src_path => rails,
|
43
|
+
:doc_path => rails,
|
44
|
+
:pathes => pathes.resolve
|
45
|
+
)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
class SdocAll
|
2
|
+
class RdocTask
|
3
|
+
def initialize(options = {})
|
4
|
+
@options = options
|
5
|
+
@options[:title] = @options[:doc_path].sub('s/', ' — ') if @options[:doc_path]
|
6
|
+
end
|
7
|
+
|
8
|
+
def src_path
|
9
|
+
@options[:src_path]
|
10
|
+
end
|
11
|
+
|
12
|
+
def doc_path
|
13
|
+
@options[:doc_path]
|
14
|
+
end
|
15
|
+
|
16
|
+
def pathes
|
17
|
+
@options[:pathes]
|
18
|
+
end
|
19
|
+
|
20
|
+
def title
|
21
|
+
@options[:title]
|
22
|
+
end
|
23
|
+
|
24
|
+
def main
|
25
|
+
@options[:main]
|
26
|
+
end
|
27
|
+
|
28
|
+
def name_parts
|
29
|
+
@options[:name_parts]
|
30
|
+
end
|
31
|
+
|
32
|
+
def run(options = {})
|
33
|
+
unless File.directory?(options[:docs_path] + doc_path)
|
34
|
+
Dir.chdir(options[:sources_path] + src_path) do
|
35
|
+
cmd = %w(sdoc)
|
36
|
+
cmd << '-o' << options[:docs_path] + doc_path
|
37
|
+
cmd << '-t' << title
|
38
|
+
cmd << '-T' << 'direct'
|
39
|
+
cmd << '-m' << main if main
|
40
|
+
system(*cmd + pathes)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class SdocAll
|
2
|
+
class RdocTasks
|
3
|
+
include Enumerable
|
4
|
+
def initialize
|
5
|
+
@tasks = {}
|
6
|
+
end
|
7
|
+
|
8
|
+
def add(klass, options = {})
|
9
|
+
type = klass.name.split('::').last.downcase.to_sym
|
10
|
+
(@tasks[type] ||= []) << RdocTask.new(options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def length
|
14
|
+
@tasks.sum{ |type, tasks| tasks.length }
|
15
|
+
end
|
16
|
+
def each(&block)
|
17
|
+
@tasks.each do |type, tasks|
|
18
|
+
tasks.each(&block)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def method_missing(method, *args, &block)
|
23
|
+
if /^find_or_(first|last)_(.*)/ === method.to_s
|
24
|
+
tasks = @tasks[$2.to_sym] || super
|
25
|
+
name = args[0]
|
26
|
+
name && tasks.find{ |task| task.name_parts.any?{ |part| part[name] } } || ($1 == 'first' ? tasks.first : tasks.last)
|
27
|
+
else
|
28
|
+
@tasks[method] || super
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'net/ftp'
|
2
|
+
|
3
|
+
class SdocAll
|
4
|
+
class Ruby < Base
|
5
|
+
def self.tars
|
6
|
+
Dir['ruby-*.tar.bz2']
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.rubys
|
10
|
+
Dir['ruby-*'].select{ |path| File.directory?(path) }
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.update_sources(options = {})
|
14
|
+
to_clear = tars
|
15
|
+
Net::FTP.open('ftp.ruby-lang.org') do |ftp|
|
16
|
+
remote_path = Pathname.new('/pub/ruby')
|
17
|
+
ftp.debug_mode = true
|
18
|
+
ftp.passive = true
|
19
|
+
ftp.login
|
20
|
+
ftp.chdir(remote_path)
|
21
|
+
ftp.list('ruby-*.tar.bz2').each do |line|
|
22
|
+
tar_path, tar = File.split(line.split.last)
|
23
|
+
to_clear.delete(tar)
|
24
|
+
remove_if_present(tar) if options[:force]
|
25
|
+
unless File.exist?(tar) && File.size(tar) == ftp.size(remote_path + tar_path + tar)
|
26
|
+
ftp.getbinaryfile(remote_path + tar_path + tar)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
to_clear.each do |tar|
|
31
|
+
remove_if_present(tar)
|
32
|
+
end
|
33
|
+
|
34
|
+
to_clear = rubys
|
35
|
+
tars.each do |tar|
|
36
|
+
ruby = File.basename(tar, '.tar.bz2')
|
37
|
+
to_clear.delete(ruby)
|
38
|
+
remove_if_present(ruby) if options[:force]
|
39
|
+
unless File.directory?(ruby)
|
40
|
+
system('tar', '-xjf', tar)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
to_clear.each do |ruby|
|
44
|
+
remove_if_present(ruby)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.add_rdoc_tasks(options = {})
|
49
|
+
rubys.each do |ruby|
|
50
|
+
version = ruby.split('-', 2)[1]
|
51
|
+
add_rdoc_task(
|
52
|
+
:name_parts => [version],
|
53
|
+
:src_path => ruby,
|
54
|
+
:doc_path => ruby
|
55
|
+
)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/sdoc_all.gemspec
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{sdoc_all}
|
5
|
+
s.version = "0.1.0"
|
6
|
+
|
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-04-22}
|
10
|
+
s.default_executable = %q{sdoc-all}
|
11
|
+
s.description = %q{Command line tool to get documentation for ruby, rails, gems and plugins in one place}
|
12
|
+
s.email = %q{}
|
13
|
+
s.executables = ["sdoc-all"]
|
14
|
+
s.extra_rdoc_files = ["bin/sdoc-all", "lib/sdoc_all/base.rb", "lib/sdoc_all/gems.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/sdoc.config.yml.erb", "lib/sdoc_all/plugins.rb", "lib/sdoc_all/rails.rb", "lib/sdoc_all/rdoc_task.rb", "lib/sdoc_all/rdoc_tasks.rb", "lib/sdoc_all/ruby.rb", "lib/sdoc_all.rb", "lib/tasks/sdoc_all.rb", "README.rdoc"]
|
15
|
+
s.files = ["bin/sdoc-all", "lib/sdoc_all/base.rb", "lib/sdoc_all/gems.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/sdoc.config.yml.erb", "lib/sdoc_all/plugins.rb", "lib/sdoc_all/rails.rb", "lib/sdoc_all/rdoc_task.rb", "lib/sdoc_all/rdoc_tasks.rb", "lib/sdoc_all/ruby.rb", "lib/sdoc_all.rb", "lib/tasks/sdoc_all.rb", "Manifest", "Rakefile", "README.rdoc", "VERSION.yml", "sdoc_all.gemspec"]
|
16
|
+
s.has_rdoc = true
|
17
|
+
s.homepage = %q{http://github.com/toy/sdoc_all}
|
18
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Sdoc_all", "--main", "README.rdoc"]
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
s.rubyforge_project = %q{toytoy}
|
21
|
+
s.rubygems_version = %q{1.3.2}
|
22
|
+
s.summary = %q{Command line tool to get documentation for ruby, rails, gems and plugins in one place}
|
23
|
+
|
24
|
+
if s.respond_to? :specification_version then
|
25
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
26
|
+
s.specification_version = 3
|
27
|
+
|
28
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
29
|
+
s.add_runtime_dependency(%q<sdoc>, [">= 0"])
|
30
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
31
|
+
s.add_runtime_dependency(%q<rake>, [">= 0"])
|
32
|
+
s.add_runtime_dependency(%q<progress>, [">= 0"])
|
33
|
+
else
|
34
|
+
s.add_dependency(%q<sdoc>, [">= 0"])
|
35
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
36
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
37
|
+
s.add_dependency(%q<progress>, [">= 0"])
|
38
|
+
end
|
39
|
+
else
|
40
|
+
s.add_dependency(%q<sdoc>, [">= 0"])
|
41
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
42
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
43
|
+
s.add_dependency(%q<progress>, [">= 0"])
|
44
|
+
end
|
45
|
+
end
|
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sdoc_all
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- toy
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-04-22 00:00:00 +04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: sdoc
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: activesupport
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rake
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: "0"
|
44
|
+
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: progress
|
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
|
+
description: Command line tool to get documentation for ruby, rails, gems and plugins in one place
|
56
|
+
email: ""
|
57
|
+
executables:
|
58
|
+
- sdoc-all
|
59
|
+
extensions: []
|
60
|
+
|
61
|
+
extra_rdoc_files:
|
62
|
+
- bin/sdoc-all
|
63
|
+
- lib/sdoc_all/base.rb
|
64
|
+
- lib/sdoc_all/gems.rb
|
65
|
+
- lib/sdoc_all/generator/sdoc_all/sdoc_all_generator.rb
|
66
|
+
- lib/sdoc_all/generator/sdoc_all/templates/Rakefile
|
67
|
+
- lib/sdoc_all/generator/sdoc_all/templates/sdoc.config.yml.erb
|
68
|
+
- lib/sdoc_all/plugins.rb
|
69
|
+
- lib/sdoc_all/rails.rb
|
70
|
+
- lib/sdoc_all/rdoc_task.rb
|
71
|
+
- lib/sdoc_all/rdoc_tasks.rb
|
72
|
+
- lib/sdoc_all/ruby.rb
|
73
|
+
- lib/sdoc_all.rb
|
74
|
+
- lib/tasks/sdoc_all.rb
|
75
|
+
- README.rdoc
|
76
|
+
files:
|
77
|
+
- bin/sdoc-all
|
78
|
+
- lib/sdoc_all/base.rb
|
79
|
+
- lib/sdoc_all/gems.rb
|
80
|
+
- lib/sdoc_all/generator/sdoc_all/sdoc_all_generator.rb
|
81
|
+
- lib/sdoc_all/generator/sdoc_all/templates/Rakefile
|
82
|
+
- lib/sdoc_all/generator/sdoc_all/templates/sdoc.config.yml.erb
|
83
|
+
- lib/sdoc_all/plugins.rb
|
84
|
+
- lib/sdoc_all/rails.rb
|
85
|
+
- lib/sdoc_all/rdoc_task.rb
|
86
|
+
- lib/sdoc_all/rdoc_tasks.rb
|
87
|
+
- lib/sdoc_all/ruby.rb
|
88
|
+
- lib/sdoc_all.rb
|
89
|
+
- lib/tasks/sdoc_all.rb
|
90
|
+
- Manifest
|
91
|
+
- Rakefile
|
92
|
+
- README.rdoc
|
93
|
+
- VERSION.yml
|
94
|
+
- sdoc_all.gemspec
|
95
|
+
has_rdoc: true
|
96
|
+
homepage: http://github.com/toy/sdoc_all
|
97
|
+
licenses: []
|
98
|
+
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options:
|
101
|
+
- --line-numbers
|
102
|
+
- --inline-source
|
103
|
+
- --title
|
104
|
+
- Sdoc_all
|
105
|
+
- --main
|
106
|
+
- README.rdoc
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: "0"
|
114
|
+
version:
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: "1.2"
|
120
|
+
version:
|
121
|
+
requirements: []
|
122
|
+
|
123
|
+
rubyforge_project: toytoy
|
124
|
+
rubygems_version: 1.3.2
|
125
|
+
signing_key:
|
126
|
+
specification_version: 3
|
127
|
+
summary: Command line tool to get documentation for ruby, rails, gems and plugins in one place
|
128
|
+
test_files: []
|
129
|
+
|