webby 0.9.3-x86-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +206 -0
- data/Manifest.txt +228 -0
- data/README.txt +92 -0
- data/Rakefile +49 -0
- data/bin/webby +41 -0
- data/bin/webby-gen +41 -0
- data/examples/blog/Sitefile +7 -0
- data/examples/blog/tasks/blog.rake +72 -0
- data/examples/blog/templates/atom_feed.erb +40 -0
- data/examples/blog/templates/blog/month.erb +22 -0
- data/examples/blog/templates/blog/post.erb +16 -0
- data/examples/blog/templates/blog/year.erb +22 -0
- data/examples/presentation/Sitefile +10 -0
- data/examples/presentation/content/css/uv/twilight.css +137 -0
- data/examples/presentation/content/presentation/_sample_code.txt +10 -0
- data/examples/presentation/content/presentation/index.txt +63 -0
- data/examples/presentation/content/presentation/s5/blank.gif +0 -0
- data/examples/presentation/content/presentation/s5/bodybg.gif +0 -0
- data/examples/presentation/content/presentation/s5/framing.css +23 -0
- data/examples/presentation/content/presentation/s5/iepngfix.htc +42 -0
- data/examples/presentation/content/presentation/s5/opera.css +7 -0
- data/examples/presentation/content/presentation/s5/outline.css +15 -0
- data/examples/presentation/content/presentation/s5/pretty.css +86 -0
- data/examples/presentation/content/presentation/s5/print.css +25 -0
- data/examples/presentation/content/presentation/s5/s5-core.css +9 -0
- data/examples/presentation/content/presentation/s5/slides.css +3 -0
- data/examples/presentation/content/presentation/s5/slides.js +553 -0
- data/examples/presentation/layouts/presentation.txt +43 -0
- data/examples/presentation/templates/_code_partial.erb +13 -0
- data/examples/presentation/templates/presentation.erb +40 -0
- data/examples/tumblog/Sitefile +9 -0
- data/examples/tumblog/content/css/tumblog.css +308 -0
- data/examples/tumblog/content/images/tumblog/permalink.gif +0 -0
- data/examples/tumblog/content/images/tumblog/rss.gif +0 -0
- data/examples/tumblog/content/tumblog/200806/the-noble-chicken/index.txt +12 -0
- data/examples/tumblog/content/tumblog/200807/historical-perspectives-on-the-classic-chicken-joke/index.txt +12 -0
- data/examples/tumblog/content/tumblog/200807/mad-city-chickens/index.txt +10 -0
- data/examples/tumblog/content/tumblog/200807/the-wisdom-of-the-dutch/index.txt +11 -0
- data/examples/tumblog/content/tumblog/200807/up-a-tree/index.txt +13 -0
- data/examples/tumblog/content/tumblog/index.txt +37 -0
- data/examples/tumblog/content/tumblog/rss.txt +37 -0
- data/examples/tumblog/layouts/tumblog/default.txt +44 -0
- data/examples/tumblog/layouts/tumblog/post.txt +15 -0
- data/examples/tumblog/lib/tumblog_helper.rb +32 -0
- data/examples/tumblog/tasks/tumblog.rake +30 -0
- data/examples/tumblog/templates/atom_feed.erb +40 -0
- data/examples/tumblog/templates/tumblog/conversation.erb +12 -0
- data/examples/tumblog/templates/tumblog/link.erb +10 -0
- data/examples/tumblog/templates/tumblog/photo.erb +13 -0
- data/examples/tumblog/templates/tumblog/post.erb +12 -0
- data/examples/tumblog/templates/tumblog/quote.erb +11 -0
- data/examples/webby/Sitefile +19 -0
- data/examples/webby/content/communicate/index.txt +28 -0
- data/examples/webby/content/css/background.gif +0 -0
- data/examples/webby/content/css/blueprint/print.css +76 -0
- data/examples/webby/content/css/blueprint/screen.css +696 -0
- data/examples/webby/content/css/coderay.css +96 -0
- data/examples/webby/content/css/site.css +196 -0
- data/examples/webby/content/css/uv/twilight.css +137 -0
- data/examples/webby/content/index.txt +37 -0
- data/examples/webby/content/learn/index.txt +28 -0
- data/examples/webby/content/reference/index.txt +204 -0
- data/examples/webby/content/release-notes/index.txt +21 -0
- data/examples/webby/content/release-notes/rel-0-9-0/index.txt +74 -0
- data/examples/webby/content/release-notes/rel-0-9-1/index.txt +93 -0
- data/examples/webby/content/release-notes/rel-0-9-2/index.txt +14 -0
- data/examples/webby/content/release-notes/rel-0-9-3/index.txt +49 -0
- data/examples/webby/content/robots.txt +6 -0
- data/examples/webby/content/script/jquery.corner.js +152 -0
- data/examples/webby/content/script/jquery.js +31 -0
- data/examples/webby/content/sitemap.txt +31 -0
- data/examples/webby/content/tips_and_tricks/index.txt +97 -0
- data/examples/webby/content/tutorial/index.txt +135 -0
- data/examples/webby/content/user-manual/index.txt +419 -0
- data/examples/webby/layouts/default.txt +49 -0
- data/examples/webby/templates/page.erb +10 -0
- data/examples/website/Sitefile +7 -0
- data/examples/website/content/css/blueprint/License.txt +21 -0
- data/examples/website/content/css/blueprint/Readme.txt +100 -0
- data/examples/website/content/css/blueprint/compressed/print.css +76 -0
- data/examples/website/content/css/blueprint/compressed/screen.css +696 -0
- data/examples/website/content/css/blueprint/lib/forms.css +45 -0
- data/examples/website/content/css/blueprint/lib/grid.css +193 -0
- data/examples/website/content/css/blueprint/lib/grid.png +0 -0
- data/examples/website/content/css/blueprint/lib/ie.css +30 -0
- data/examples/website/content/css/blueprint/lib/reset.css +39 -0
- data/examples/website/content/css/blueprint/lib/typography.css +116 -0
- data/examples/website/content/css/blueprint/plugins/buttons/Readme +31 -0
- data/examples/website/content/css/blueprint/plugins/buttons/buttons.css +97 -0
- data/examples/website/content/css/blueprint/plugins/buttons/icons/cross.png +0 -0
- data/examples/website/content/css/blueprint/plugins/buttons/icons/key.png +0 -0
- data/examples/website/content/css/blueprint/plugins/buttons/icons/tick.png +0 -0
- data/examples/website/content/css/blueprint/plugins/css-classes/Readme +14 -0
- data/examples/website/content/css/blueprint/plugins/css-classes/css-classes.css +24 -0
- data/examples/website/content/css/blueprint/plugins/fancy-type/Readme +22 -0
- data/examples/website/content/css/blueprint/plugins/fancy-type/fancy-type-compressed.css +5 -0
- data/examples/website/content/css/blueprint/plugins/fancy-type/fancy-type.css +74 -0
- data/examples/website/content/css/blueprint/print.css +68 -0
- data/examples/website/content/css/blueprint/screen.css +22 -0
- data/examples/website/content/css/coderay.css +111 -0
- data/examples/website/content/css/site.css +67 -0
- data/examples/website/content/index.txt +19 -0
- data/examples/website/layouts/default.txt +58 -0
- data/examples/website/lib/breadcrumbs.rb +28 -0
- data/examples/website/templates/_partial.erb +10 -0
- data/examples/website/templates/page.erb +18 -0
- data/lib/webby.rb +221 -0
- data/lib/webby/apps.rb +12 -0
- data/lib/webby/apps/generator.rb +276 -0
- data/lib/webby/apps/main.rb +255 -0
- data/lib/webby/auto_builder.rb +157 -0
- data/lib/webby/builder.rb +180 -0
- data/lib/webby/core_ext/enumerable.rb +11 -0
- data/lib/webby/core_ext/hash.rb +28 -0
- data/lib/webby/core_ext/kernel.rb +26 -0
- data/lib/webby/core_ext/string.rb +163 -0
- data/lib/webby/core_ext/time.rb +9 -0
- data/lib/webby/filters.rb +83 -0
- data/lib/webby/filters/basepath.rb +97 -0
- data/lib/webby/filters/erb.rb +9 -0
- data/lib/webby/filters/haml.rb +18 -0
- data/lib/webby/filters/markdown.rb +16 -0
- data/lib/webby/filters/outline.rb +309 -0
- data/lib/webby/filters/sass.rb +17 -0
- data/lib/webby/filters/slides.rb +56 -0
- data/lib/webby/filters/textile.rb +16 -0
- data/lib/webby/filters/tidy.rb +76 -0
- data/lib/webby/filters/wiki_words.rb +14 -0
- data/lib/webby/helpers.rb +30 -0
- data/lib/webby/helpers/capture_helper.rb +141 -0
- data/lib/webby/helpers/coderay_helper.rb +69 -0
- data/lib/webby/helpers/graphviz_helper.rb +136 -0
- data/lib/webby/helpers/tag_helper.rb +65 -0
- data/lib/webby/helpers/tex_img_helper.rb +133 -0
- data/lib/webby/helpers/ultraviolet_helper.rb +63 -0
- data/lib/webby/helpers/url_helper.rb +241 -0
- data/lib/webby/journal.rb +126 -0
- data/lib/webby/link_validator.rb +152 -0
- data/lib/webby/renderer.rb +386 -0
- data/lib/webby/resources.rb +136 -0
- data/lib/webby/resources/db.rb +251 -0
- data/lib/webby/resources/layout.rb +54 -0
- data/lib/webby/resources/meta_file.rb +211 -0
- data/lib/webby/resources/page.rb +81 -0
- data/lib/webby/resources/partial.rb +85 -0
- data/lib/webby/resources/resource.rb +201 -0
- data/lib/webby/resources/static.rb +36 -0
- data/lib/webby/stelan/mktemp.rb +135 -0
- data/lib/webby/stelan/paginator.rb +165 -0
- data/lib/webby/stelan/spawner.rb +339 -0
- data/lib/webby/tasks/build.rake +27 -0
- data/lib/webby/tasks/create.rake +22 -0
- data/lib/webby/tasks/deploy.rake +22 -0
- data/lib/webby/tasks/growl.rake +16 -0
- data/lib/webby/tasks/validate.rake +19 -0
- data/spec/core_ext/hash_spec.rb +47 -0
- data/spec/core_ext/string_spec.rb +110 -0
- data/spec/core_ext/time_spec.rb +19 -0
- data/spec/data/hooligans/bad_meta_data_1.txt +34 -0
- data/spec/data/hooligans/bad_meta_data_2.txt +34 -0
- data/spec/data/outline/basic.out +81 -0
- data/spec/data/outline/basic.txt +25 -0
- data/spec/data/outline/no_clobber.out +86 -0
- data/spec/data/outline/numbering.out +81 -0
- data/spec/data/outline/numbering_only.out +21 -0
- data/spec/data/outline/toc_range_1.out +66 -0
- data/spec/data/outline/toc_range_2.out +55 -0
- data/spec/data/outline/toc_style.out +81 -0
- data/spec/data/site/Sitefile +9 -0
- data/spec/data/site/content/_partial.txt +10 -0
- data/spec/data/site/content/css/coderay.css +111 -0
- data/spec/data/site/content/css/site.css +67 -0
- data/spec/data/site/content/css/tumblog.css +308 -0
- data/spec/data/site/content/images/tumblog/permalink.gif +0 -0
- data/spec/data/site/content/images/tumblog/rss.gif +0 -0
- data/spec/data/site/content/index.txt +19 -0
- data/spec/data/site/content/photos.txt +21 -0
- data/spec/data/site/content/tumblog/200806/the-noble-chicken/index.txt +12 -0
- data/spec/data/site/content/tumblog/200807/historical-perspectives-on-the-classic-chicken-joke/index.txt +12 -0
- data/spec/data/site/content/tumblog/200807/mad-city-chickens/index.txt +10 -0
- data/spec/data/site/content/tumblog/200807/the-wisdom-of-the-dutch/index.txt +11 -0
- data/spec/data/site/content/tumblog/200807/up-a-tree/index.txt +13 -0
- data/spec/data/site/content/tumblog/index.txt +37 -0
- data/spec/data/site/content/tumblog/rss.txt +37 -0
- data/spec/data/site/layouts/default.txt +58 -0
- data/spec/data/site/layouts/tumblog/default.txt +44 -0
- data/spec/data/site/layouts/tumblog/post.txt +15 -0
- data/spec/data/site/lib/breadcrumbs.rb +28 -0
- data/spec/data/site/lib/tumblog_helper.rb +32 -0
- data/spec/data/site/tasks/tumblog.rake +30 -0
- data/spec/data/site/templates/_partial.erb +10 -0
- data/spec/data/site/templates/atom_feed.erb +40 -0
- data/spec/data/site/templates/page.erb +18 -0
- data/spec/data/site/templates/presentation.erb +40 -0
- data/spec/data/site/templates/tumblog/conversation.erb +12 -0
- data/spec/data/site/templates/tumblog/link.erb +10 -0
- data/spec/data/site/templates/tumblog/photo.erb +13 -0
- data/spec/data/site/templates/tumblog/post.erb +12 -0
- data/spec/data/site/templates/tumblog/quote.erb +11 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +51 -0
- data/spec/webby/apps/generator_spec.rb +116 -0
- data/spec/webby/apps/main_spec.rb +88 -0
- data/spec/webby/filters/basepath_spec.rb +167 -0
- data/spec/webby/filters/outline_spec.rb +92 -0
- data/spec/webby/filters/textile_spec.rb +20 -0
- data/spec/webby/helpers/capture_helper_spec.rb +56 -0
- data/spec/webby/renderer_spec.rb +139 -0
- data/spec/webby/resources/db_spec.rb +250 -0
- data/spec/webby/resources/layout_spec.rb +83 -0
- data/spec/webby/resources/meta_file_spec.rb +171 -0
- data/spec/webby/resources/page_spec.rb +111 -0
- data/spec/webby/resources/partial_spec.rb +58 -0
- data/spec/webby/resources/resource_spec.rb +219 -0
- data/spec/webby/resources/static_spec.rb +49 -0
- data/spec/webby/resources_spec.rb +69 -0
- data/tasks/ann.rake +81 -0
- data/tasks/bones.rake +21 -0
- data/tasks/gem.rake +187 -0
- data/tasks/git.rake +41 -0
- data/tasks/manifest.rake +48 -0
- data/tasks/notes.rake +28 -0
- data/tasks/post_load.rake +39 -0
- data/tasks/rdoc.rake +51 -0
- data/tasks/rubyforge.rake +55 -0
- data/tasks/setup.rb +268 -0
- data/tasks/spec.rake +55 -0
- data/tasks/website.rake +38 -0
- metadata +365 -0
data/tasks/manifest.rake
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
|
2
|
+
require 'find'
|
3
|
+
|
4
|
+
namespace :manifest do
|
5
|
+
|
6
|
+
desc 'Verify the manifest'
|
7
|
+
task :check do
|
8
|
+
fn = PROJ.manifest_file + '.tmp'
|
9
|
+
files = manifest_files
|
10
|
+
|
11
|
+
File.open(fn, 'w') {|fp| fp.puts files}
|
12
|
+
lines = %x(#{DIFF} -du #{PROJ.manifest_file} #{fn}).split("\n")
|
13
|
+
if HAVE_FACETS_ANSICODE and ENV.has_key?('TERM')
|
14
|
+
lines.map! do |line|
|
15
|
+
case line
|
16
|
+
when %r/^(-{3}|\+{3})/; nil
|
17
|
+
when %r/^@/; ANSICode.blue line
|
18
|
+
when %r/^\+/; ANSICode.green line
|
19
|
+
when %r/^\-/; ANSICode.red line
|
20
|
+
else line end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
puts lines.compact
|
24
|
+
rm fn rescue nil
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'Create a new manifest'
|
28
|
+
task :create do
|
29
|
+
files = manifest_files
|
30
|
+
unless test(?f, PROJ.manifest_file)
|
31
|
+
files << PROJ.manifest_file
|
32
|
+
files.sort!
|
33
|
+
end
|
34
|
+
File.open(PROJ.manifest_file, 'w') {|fp| fp.puts files}
|
35
|
+
end
|
36
|
+
|
37
|
+
task :assert do
|
38
|
+
files = manifest_files
|
39
|
+
manifest = File.read(PROJ.manifest_file).split($/)
|
40
|
+
raise "ERROR: #{PROJ.manifest_file} is out of date" unless files == manifest
|
41
|
+
end
|
42
|
+
|
43
|
+
end # namespace :manifest
|
44
|
+
|
45
|
+
desc 'Alias to manifest:check'
|
46
|
+
task :manifest => 'manifest:check'
|
47
|
+
|
48
|
+
# EOF
|
data/tasks/notes.rake
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
if HAVE_BONES
|
4
|
+
|
5
|
+
desc "Enumerate all annotations"
|
6
|
+
task :notes do |t|
|
7
|
+
id = if t.application.top_level_tasks.length > 1
|
8
|
+
t.application.top_level_tasks.slice!(1..-1).join(' ')
|
9
|
+
end
|
10
|
+
Bones::AnnotationExtractor.enumerate(
|
11
|
+
PROJ, PROJ.notes.tags.join('|'), id, :tag => true)
|
12
|
+
end
|
13
|
+
|
14
|
+
namespace :notes do
|
15
|
+
PROJ.notes.tags.each do |tag|
|
16
|
+
desc "Enumerate all #{tag} annotations"
|
17
|
+
task tag.downcase.to_sym do |t|
|
18
|
+
id = if t.application.top_level_tasks.length > 1
|
19
|
+
t.application.top_level_tasks.slice!(1..-1).join(' ')
|
20
|
+
end
|
21
|
+
Bones::AnnotationExtractor.enumerate(PROJ, tag, id)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end # if HAVE_BONES
|
27
|
+
|
28
|
+
# EOF
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
# This file does not define any rake tasks. It is used to load some project
|
4
|
+
# settings if they are not defined by the user.
|
5
|
+
|
6
|
+
PROJ.rdoc.exclude << "^#{Regexp.escape(PROJ.manifest_file)}$"
|
7
|
+
PROJ.exclude << ["^#{Regexp.escape(PROJ.ann.file)}$",
|
8
|
+
"^#{Regexp.escape(PROJ.rdoc.dir)}/",
|
9
|
+
"^#{Regexp.escape(PROJ.rcov.dir)}/"]
|
10
|
+
|
11
|
+
flatten_arrays = lambda do |this,os|
|
12
|
+
os.instance_variable_get(:@table).each do |key,val|
|
13
|
+
next if key == :dependencies
|
14
|
+
case val
|
15
|
+
when Array; val.flatten!
|
16
|
+
when OpenStruct; this.call(this,val)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
flatten_arrays.call(flatten_arrays,PROJ)
|
21
|
+
|
22
|
+
PROJ.changes ||= paragraphs_of(PROJ.history_file, 0..1).join("\n\n")
|
23
|
+
|
24
|
+
PROJ.description ||= paragraphs_of(PROJ.readme_file, 'description').join("\n\n")
|
25
|
+
|
26
|
+
PROJ.summary ||= PROJ.description.split('.').first
|
27
|
+
|
28
|
+
PROJ.gem.files ||=
|
29
|
+
if test(?f, PROJ.manifest_file)
|
30
|
+
files = File.readlines(PROJ.manifest_file).map {|fn| fn.chomp.strip}
|
31
|
+
files.delete ''
|
32
|
+
files
|
33
|
+
else [] end
|
34
|
+
|
35
|
+
PROJ.gem.executables ||= PROJ.gem.files.find_all {|fn| fn =~ %r/^bin/}
|
36
|
+
|
37
|
+
PROJ.rdoc.main ||= PROJ.readme_file
|
38
|
+
|
39
|
+
# EOF
|
data/tasks/rdoc.rake
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
namespace :doc do
|
6
|
+
|
7
|
+
desc 'Generate RDoc documentation'
|
8
|
+
Rake::RDocTask.new do |rd|
|
9
|
+
rdoc = PROJ.rdoc
|
10
|
+
rd.main = rdoc.main
|
11
|
+
rd.rdoc_dir = rdoc.dir
|
12
|
+
|
13
|
+
incl = Regexp.new(rdoc.include.join('|'))
|
14
|
+
excl = Regexp.new(rdoc.exclude.join('|'))
|
15
|
+
files = PROJ.gem.files.find_all do |fn|
|
16
|
+
case fn
|
17
|
+
when excl; false
|
18
|
+
when incl; true
|
19
|
+
else false end
|
20
|
+
end
|
21
|
+
rd.rdoc_files.push(*files)
|
22
|
+
|
23
|
+
title = "#{PROJ.name}-#{PROJ.version} Documentation"
|
24
|
+
|
25
|
+
rf_name = PROJ.rubyforge.name
|
26
|
+
title = "#{rf_name}'s " + title if rf_name.valid? and rf_name != title
|
27
|
+
|
28
|
+
rd.options << "-t #{title}"
|
29
|
+
rd.options.concat(rdoc.opts)
|
30
|
+
end
|
31
|
+
|
32
|
+
desc 'Generate ri locally for testing'
|
33
|
+
task :ri => :clobber_ri do
|
34
|
+
sh "#{RDOC} --ri -o ri ."
|
35
|
+
end
|
36
|
+
|
37
|
+
task :clobber_ri do
|
38
|
+
rm_r 'ri' rescue nil
|
39
|
+
end
|
40
|
+
|
41
|
+
end # namespace :doc
|
42
|
+
|
43
|
+
desc 'Alias to doc:rdoc'
|
44
|
+
task :doc => 'doc:rdoc'
|
45
|
+
|
46
|
+
desc 'Remove all build products'
|
47
|
+
task :clobber => %w(doc:clobber_rdoc doc:clobber_ri)
|
48
|
+
|
49
|
+
remove_desc_for_task %w(doc:clobber_rdoc)
|
50
|
+
|
51
|
+
# EOF
|
@@ -0,0 +1,55 @@
|
|
1
|
+
|
2
|
+
if PROJ.rubyforge.name.valid? && HAVE_RUBYFORGE
|
3
|
+
|
4
|
+
require 'rubyforge'
|
5
|
+
require 'rake/contrib/sshpublisher'
|
6
|
+
|
7
|
+
namespace :gem do
|
8
|
+
desc 'Package and upload to RubyForge'
|
9
|
+
task :release => [:clobber, 'gem'] do |t|
|
10
|
+
v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
|
11
|
+
abort "Versions don't match #{v} vs #{PROJ.version}" if v != PROJ.version
|
12
|
+
pkg = "pkg/#{PROJ.gem._spec.full_name}"
|
13
|
+
|
14
|
+
if $DEBUG then
|
15
|
+
puts "release_id = rf.add_release #{PROJ.rubyforge.name.inspect}, #{PROJ.name.inspect}, #{PROJ.version.inspect}, \"#{pkg}.tgz\""
|
16
|
+
puts "rf.add_file #{PROJ.rubyforge.name.inspect}, #{PROJ.name.inspect}, release_id, \"#{pkg}.gem\""
|
17
|
+
end
|
18
|
+
|
19
|
+
rf = RubyForge.new
|
20
|
+
rf.configure rescue nil
|
21
|
+
puts 'Logging in'
|
22
|
+
rf.login
|
23
|
+
|
24
|
+
c = rf.userconfig
|
25
|
+
c['release_notes'] = PROJ.description if PROJ.description
|
26
|
+
c['release_changes'] = PROJ.changes if PROJ.changes
|
27
|
+
c['preformatted'] = true
|
28
|
+
|
29
|
+
files = Dir.glob("#{pkg}*.*")
|
30
|
+
|
31
|
+
puts "Releasing #{PROJ.name} v. #{PROJ.version}"
|
32
|
+
rf.add_release PROJ.rubyforge.name, PROJ.name, PROJ.version, *files
|
33
|
+
end
|
34
|
+
end # namespace :gem
|
35
|
+
|
36
|
+
|
37
|
+
namespace :doc do
|
38
|
+
desc "Publish RDoc to RubyForge"
|
39
|
+
task :release => %w(doc:clobber_rdoc doc:rdoc) do
|
40
|
+
config = YAML.load(
|
41
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
42
|
+
)
|
43
|
+
|
44
|
+
host = "#{config['username']}@rubyforge.org"
|
45
|
+
remote_dir = "/var/www/gforge-projects/#{PROJ.rubyforge.name}/"
|
46
|
+
remote_dir << PROJ.rdoc.remote_dir if PROJ.rdoc.remote_dir
|
47
|
+
local_dir = PROJ.rdoc.dir
|
48
|
+
|
49
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
50
|
+
end
|
51
|
+
end # namespace :doc
|
52
|
+
|
53
|
+
end # if HAVE_RUBYFORGE
|
54
|
+
|
55
|
+
# EOF
|
data/tasks/setup.rb
ADDED
@@ -0,0 +1,268 @@
|
|
1
|
+
# $Id$
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rake'
|
5
|
+
require 'rake/clean'
|
6
|
+
require 'fileutils'
|
7
|
+
require 'ostruct'
|
8
|
+
|
9
|
+
class OpenStruct; undef :gem; end
|
10
|
+
|
11
|
+
PROJ = OpenStruct.new(
|
12
|
+
# Project Defaults
|
13
|
+
:name => nil,
|
14
|
+
:summary => nil,
|
15
|
+
:description => nil,
|
16
|
+
:changes => nil,
|
17
|
+
:authors => nil,
|
18
|
+
:email => nil,
|
19
|
+
:url => "\000",
|
20
|
+
:version => ENV['VERSION'] || '0.0.0',
|
21
|
+
:exclude => %w(tmp$ bak$ ~$ CVS \.svn/ \.git/ ^pkg/),
|
22
|
+
:release_name => ENV['RELEASE'],
|
23
|
+
|
24
|
+
# System Defaults
|
25
|
+
:ruby_opts => %w(-w),
|
26
|
+
:libs => [],
|
27
|
+
:history_file => 'History.txt',
|
28
|
+
:manifest_file => 'Manifest.txt',
|
29
|
+
:readme_file => 'README.txt',
|
30
|
+
|
31
|
+
# Announce
|
32
|
+
:ann => OpenStruct.new(
|
33
|
+
:file => 'announcement.txt',
|
34
|
+
:text => nil,
|
35
|
+
:paragraphs => [],
|
36
|
+
:email => {
|
37
|
+
:from => nil,
|
38
|
+
:to => %w(ruby-talk@ruby-lang.org),
|
39
|
+
:server => 'localhost',
|
40
|
+
:port => 25,
|
41
|
+
:domain => ENV['HOSTNAME'],
|
42
|
+
:acct => nil,
|
43
|
+
:passwd => nil,
|
44
|
+
:authtype => :plain
|
45
|
+
}
|
46
|
+
),
|
47
|
+
|
48
|
+
# Gem Packaging
|
49
|
+
:gem => OpenStruct.new(
|
50
|
+
:dependencies => [],
|
51
|
+
:executables => nil,
|
52
|
+
:extensions => FileList['ext/**/extconf.rb'],
|
53
|
+
:files => nil,
|
54
|
+
:need_tar => true,
|
55
|
+
:need_zip => false,
|
56
|
+
:extras => {}
|
57
|
+
),
|
58
|
+
|
59
|
+
# File Annotations
|
60
|
+
:notes => OpenStruct.new(
|
61
|
+
:exclude => %w(^tasks/setup\.rb$),
|
62
|
+
:extensions => %w(.txt .rb .erb) << '',
|
63
|
+
:tags => %w(FIXME OPTIMIZE TODO)
|
64
|
+
),
|
65
|
+
|
66
|
+
# Rcov
|
67
|
+
:rcov => OpenStruct.new(
|
68
|
+
:dir => 'coverage',
|
69
|
+
:opts => %w[--sort coverage -T],
|
70
|
+
:threshold => 90.0,
|
71
|
+
:threshold_exact => false
|
72
|
+
),
|
73
|
+
|
74
|
+
# Rdoc
|
75
|
+
:rdoc => OpenStruct.new(
|
76
|
+
:opts => [],
|
77
|
+
:include => %w(^lib/ ^bin/ ^ext/ \.txt$),
|
78
|
+
:exclude => %w(extconf\.rb$),
|
79
|
+
:main => nil,
|
80
|
+
:dir => 'doc',
|
81
|
+
:remote_dir => nil
|
82
|
+
),
|
83
|
+
|
84
|
+
# Rubyforge
|
85
|
+
:rubyforge => OpenStruct.new(
|
86
|
+
:name => "\000"
|
87
|
+
),
|
88
|
+
|
89
|
+
# Rspec
|
90
|
+
:spec => OpenStruct.new(
|
91
|
+
:files => FileList['spec/**/*_spec.rb'],
|
92
|
+
:opts => []
|
93
|
+
),
|
94
|
+
|
95
|
+
# Subversion Repository
|
96
|
+
:svn => OpenStruct.new(
|
97
|
+
:root => nil,
|
98
|
+
:path => '',
|
99
|
+
:trunk => 'trunk',
|
100
|
+
:tags => 'tags',
|
101
|
+
:branches => 'branches'
|
102
|
+
),
|
103
|
+
|
104
|
+
# Test::Unit
|
105
|
+
:test => OpenStruct.new(
|
106
|
+
:files => FileList['test/**/test_*.rb'],
|
107
|
+
:file => 'test/all.rb',
|
108
|
+
:opts => []
|
109
|
+
)
|
110
|
+
)
|
111
|
+
|
112
|
+
# Load the other rake files in the tasks folder
|
113
|
+
rakefiles = Dir.glob('tasks/*.rake').sort
|
114
|
+
rakefiles.unshift(rakefiles.delete('tasks/post_load.rake')).compact!
|
115
|
+
import(*rakefiles)
|
116
|
+
|
117
|
+
# Setup the project libraries
|
118
|
+
%w(lib ext).each {|dir| PROJ.libs << dir if test ?d, dir}
|
119
|
+
|
120
|
+
# Setup some constants
|
121
|
+
WIN32 = %r/djgpp|(cyg|ms|bcc)win|mingw/ =~ RUBY_PLATFORM unless defined? WIN32
|
122
|
+
|
123
|
+
DEV_NULL = WIN32 ? 'NUL:' : '/dev/null'
|
124
|
+
|
125
|
+
def quiet( &block )
|
126
|
+
io = [STDOUT.dup, STDERR.dup]
|
127
|
+
STDOUT.reopen DEV_NULL
|
128
|
+
STDERR.reopen DEV_NULL
|
129
|
+
block.call
|
130
|
+
ensure
|
131
|
+
STDOUT.reopen io.first
|
132
|
+
STDERR.reopen io.last
|
133
|
+
$stdout, $stderr = STDOUT, STDERR
|
134
|
+
end
|
135
|
+
|
136
|
+
DIFF = if WIN32 then 'diff.exe'
|
137
|
+
else
|
138
|
+
if quiet {system "gdiff", __FILE__, __FILE__} then 'gdiff'
|
139
|
+
else 'diff' end
|
140
|
+
end unless defined? DIFF
|
141
|
+
|
142
|
+
SUDO = if WIN32 then ''
|
143
|
+
else
|
144
|
+
if quiet {system 'which sudo'} then 'sudo'
|
145
|
+
else '' end
|
146
|
+
end
|
147
|
+
|
148
|
+
RCOV = WIN32 ? 'rcov.bat' : 'rcov'
|
149
|
+
RDOC = WIN32 ? 'rdoc.bat' : 'rdoc'
|
150
|
+
GEM = WIN32 ? 'gem.bat' : 'gem'
|
151
|
+
|
152
|
+
%w(rcov spec/rake/spectask rubyforge bones facets/ansicode).each do |lib|
|
153
|
+
begin
|
154
|
+
require lib
|
155
|
+
Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", true}
|
156
|
+
rescue LoadError
|
157
|
+
Object.instance_eval {const_set "HAVE_#{lib.tr('/','_').upcase}", false}
|
158
|
+
end
|
159
|
+
end
|
160
|
+
HAVE_SVN = (Dir.entries(Dir.pwd).include?('.svn') and
|
161
|
+
system("svn --version 2>&1 > #{DEV_NULL}"))
|
162
|
+
HAVE_GIT = (Dir.entries(Dir.pwd).include?('.git') and
|
163
|
+
system("git --version 2>&1 > #{DEV_NULL}"))
|
164
|
+
|
165
|
+
# Reads a file at +path+ and spits out an array of the +paragraphs+
|
166
|
+
# specified.
|
167
|
+
#
|
168
|
+
# changes = paragraphs_of('History.txt', 0..1).join("\n\n")
|
169
|
+
# summary, *description = paragraphs_of('README.txt', 3, 3..8)
|
170
|
+
#
|
171
|
+
def paragraphs_of( path, *paragraphs )
|
172
|
+
title = String === paragraphs.first ? paragraphs.shift : nil
|
173
|
+
ary = File.read(path).delete("\r").split(/\n\n+/)
|
174
|
+
|
175
|
+
result = if title
|
176
|
+
tmp, matching = [], false
|
177
|
+
rgxp = %r/^=+\s*#{Regexp.escape(title)}/i
|
178
|
+
paragraphs << (0..-1) if paragraphs.empty?
|
179
|
+
|
180
|
+
ary.each do |val|
|
181
|
+
if val =~ rgxp
|
182
|
+
break if matching
|
183
|
+
matching = true
|
184
|
+
rgxp = %r/^=+/i
|
185
|
+
elsif matching
|
186
|
+
tmp << val
|
187
|
+
end
|
188
|
+
end
|
189
|
+
tmp
|
190
|
+
else ary end
|
191
|
+
|
192
|
+
result.values_at(*paragraphs)
|
193
|
+
end
|
194
|
+
|
195
|
+
# Adds the given gem _name_ to the current project's dependency list. An
|
196
|
+
# optional gem _version_ can be given. If omitted, the newest gem version
|
197
|
+
# will be used.
|
198
|
+
#
|
199
|
+
def depend_on( name, version = nil )
|
200
|
+
spec = Gem.source_index.find_name(name).last
|
201
|
+
version = spec.version.to_s if version.nil? and !spec.nil?
|
202
|
+
|
203
|
+
PROJ.gem.dependencies << case version
|
204
|
+
when nil; [name]
|
205
|
+
when %r/^\d/; [name, ">= #{version}"]
|
206
|
+
else [name, version] end
|
207
|
+
end
|
208
|
+
|
209
|
+
# Adds the given arguments to the include path if they are not already there
|
210
|
+
#
|
211
|
+
def ensure_in_path( *args )
|
212
|
+
args.each do |path|
|
213
|
+
path = File.expand_path(path)
|
214
|
+
$:.unshift(path) if test(?d, path) and not $:.include?(path)
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
# Find a rake task using the task name and remove any description text. This
|
219
|
+
# will prevent the task from being displayed in the list of available tasks.
|
220
|
+
#
|
221
|
+
def remove_desc_for_task( names )
|
222
|
+
Array(names).each do |task_name|
|
223
|
+
task = Rake.application.tasks.find {|t| t.name == task_name}
|
224
|
+
next if task.nil?
|
225
|
+
task.instance_variable_set :@comment, nil
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
# Change working directories to _dir_, call the _block_ of code, and then
|
230
|
+
# change back to the original working directory (the current directory when
|
231
|
+
# this method was called).
|
232
|
+
#
|
233
|
+
def in_directory( dir, &block )
|
234
|
+
curdir = pwd
|
235
|
+
begin
|
236
|
+
cd dir
|
237
|
+
return block.call
|
238
|
+
ensure
|
239
|
+
cd curdir
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
# Scans the current working directory and creates a list of files that are
|
244
|
+
# candidates to be in the manifest.
|
245
|
+
#
|
246
|
+
def manifest_files
|
247
|
+
files = []
|
248
|
+
exclude = Regexp.new(PROJ.exclude.join('|'))
|
249
|
+
Find.find '.' do |path|
|
250
|
+
path.sub! %r/^(\.\/|\/)/o, ''
|
251
|
+
next unless test ?f, path
|
252
|
+
next if path =~ exclude
|
253
|
+
files << path
|
254
|
+
end
|
255
|
+
files.sort!
|
256
|
+
end
|
257
|
+
|
258
|
+
# We need a "valid" method thtat determines if a string is suitable for use
|
259
|
+
# in the gem specification.
|
260
|
+
#
|
261
|
+
class Object
|
262
|
+
def valid?
|
263
|
+
return !(self.empty? or self == "\000") if self.respond_to?(:to_str)
|
264
|
+
return false
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
# EOF
|