Shazburg-webby 0.9.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.
Files changed (172) hide show
  1. data/History.txt +176 -0
  2. data/Manifest.txt +171 -0
  3. data/README.txt +92 -0
  4. data/Rakefile +54 -0
  5. data/bin/webby +8 -0
  6. data/bin/webby-gen +8 -0
  7. data/examples/blog/Sitefile +7 -0
  8. data/examples/blog/tasks/blog.rake +72 -0
  9. data/examples/blog/templates/atom_feed.erb +40 -0
  10. data/examples/blog/templates/blog/month.erb +22 -0
  11. data/examples/blog/templates/blog/post.erb +16 -0
  12. data/examples/blog/templates/blog/year.erb +22 -0
  13. data/examples/presentation/Sitefile +10 -0
  14. data/examples/presentation/content/css/uv/twilight.css +137 -0
  15. data/examples/presentation/content/presentation/_sample_code.txt +10 -0
  16. data/examples/presentation/content/presentation/index.txt +63 -0
  17. data/examples/presentation/content/presentation/s5/blank.gif +0 -0
  18. data/examples/presentation/content/presentation/s5/bodybg.gif +0 -0
  19. data/examples/presentation/content/presentation/s5/framing.css +23 -0
  20. data/examples/presentation/content/presentation/s5/iepngfix.htc +42 -0
  21. data/examples/presentation/content/presentation/s5/opera.css +7 -0
  22. data/examples/presentation/content/presentation/s5/outline.css +15 -0
  23. data/examples/presentation/content/presentation/s5/pretty.css +86 -0
  24. data/examples/presentation/content/presentation/s5/print.css +1 -0
  25. data/examples/presentation/content/presentation/s5/s5-core.css +9 -0
  26. data/examples/presentation/content/presentation/s5/slides.css +3 -0
  27. data/examples/presentation/content/presentation/s5/slides.js +553 -0
  28. data/examples/presentation/layouts/presentation.txt +43 -0
  29. data/examples/presentation/templates/_code_partial.erb +13 -0
  30. data/examples/presentation/templates/presentation.erb +40 -0
  31. data/examples/tumblog/Sitefile +9 -0
  32. data/examples/tumblog/content/css/tumblog.css +308 -0
  33. data/examples/tumblog/content/images/tumblog/permalink.gif +0 -0
  34. data/examples/tumblog/content/images/tumblog/rss.gif +0 -0
  35. data/examples/tumblog/content/tumblog/200806/the-noble-chicken/index.txt +12 -0
  36. data/examples/tumblog/content/tumblog/200807/historical-perspectives-on-the-classic-chicken-joke/index.txt +12 -0
  37. data/examples/tumblog/content/tumblog/200807/mad-city-chickens/index.txt +10 -0
  38. data/examples/tumblog/content/tumblog/200807/the-wisdom-of-the-dutch/index.txt +11 -0
  39. data/examples/tumblog/content/tumblog/200807/up-a-tree/index.txt +13 -0
  40. data/examples/tumblog/content/tumblog/index.txt +37 -0
  41. data/examples/tumblog/content/tumblog/rss.txt +37 -0
  42. data/examples/tumblog/layouts/tumblog/default.txt +44 -0
  43. data/examples/tumblog/layouts/tumblog/post.txt +15 -0
  44. data/examples/tumblog/lib/tumblog_helper.rb +32 -0
  45. data/examples/tumblog/tasks/tumblog.rake +30 -0
  46. data/examples/tumblog/templates/atom_feed.erb +40 -0
  47. data/examples/tumblog/templates/tumblog/conversation.erb +12 -0
  48. data/examples/tumblog/templates/tumblog/link.erb +10 -0
  49. data/examples/tumblog/templates/tumblog/photo.erb +13 -0
  50. data/examples/tumblog/templates/tumblog/post.erb +12 -0
  51. data/examples/tumblog/templates/tumblog/quote.erb +11 -0
  52. data/examples/webby/Sitefile +19 -0
  53. data/examples/webby/content/css/background.gif +0 -0
  54. data/examples/webby/content/css/blueprint/print.css +76 -0
  55. data/examples/webby/content/css/blueprint/screen.css +696 -0
  56. data/examples/webby/content/css/coderay.css +96 -0
  57. data/examples/webby/content/css/site.css +184 -0
  58. data/examples/webby/content/css/uv/twilight.css +137 -0
  59. data/examples/webby/content/index.txt +37 -0
  60. data/examples/webby/content/manual/index.txt +430 -0
  61. data/examples/webby/content/reference/index.txt +202 -0
  62. data/examples/webby/content/release-notes/rel-0-9-0/index.txt +73 -0
  63. data/examples/webby/content/robots.txt +6 -0
  64. data/examples/webby/content/script/jquery.corner.js +152 -0
  65. data/examples/webby/content/script/jquery.js +31 -0
  66. data/examples/webby/content/sitemap.txt +31 -0
  67. data/examples/webby/content/tips_and_tricks/index.txt +96 -0
  68. data/examples/webby/content/tutorial/index.txt +131 -0
  69. data/examples/webby/layouts/default.txt +55 -0
  70. data/examples/webby/templates/page.erb +10 -0
  71. data/examples/website/Sitefile +7 -0
  72. data/examples/website/content/css/blueprint/License.txt +21 -0
  73. data/examples/website/content/css/blueprint/Readme.txt +100 -0
  74. data/examples/website/content/css/blueprint/compressed/print.css +76 -0
  75. data/examples/website/content/css/blueprint/compressed/screen.css +696 -0
  76. data/examples/website/content/css/blueprint/lib/forms.css +45 -0
  77. data/examples/website/content/css/blueprint/lib/grid.css +193 -0
  78. data/examples/website/content/css/blueprint/lib/grid.png +0 -0
  79. data/examples/website/content/css/blueprint/lib/ie.css +30 -0
  80. data/examples/website/content/css/blueprint/lib/reset.css +39 -0
  81. data/examples/website/content/css/blueprint/lib/typography.css +116 -0
  82. data/examples/website/content/css/blueprint/plugins/buttons/Readme +31 -0
  83. data/examples/website/content/css/blueprint/plugins/buttons/buttons.css +97 -0
  84. data/examples/website/content/css/blueprint/plugins/buttons/icons/cross.png +0 -0
  85. data/examples/website/content/css/blueprint/plugins/buttons/icons/key.png +0 -0
  86. data/examples/website/content/css/blueprint/plugins/buttons/icons/tick.png +0 -0
  87. data/examples/website/content/css/blueprint/plugins/css-classes/Readme +14 -0
  88. data/examples/website/content/css/blueprint/plugins/css-classes/css-classes.css +24 -0
  89. data/examples/website/content/css/blueprint/plugins/fancy-type/Readme +22 -0
  90. data/examples/website/content/css/blueprint/plugins/fancy-type/fancy-type-compressed.css +5 -0
  91. data/examples/website/content/css/blueprint/plugins/fancy-type/fancy-type.css +74 -0
  92. data/examples/website/content/css/blueprint/print.css +68 -0
  93. data/examples/website/content/css/blueprint/screen.css +22 -0
  94. data/examples/website/content/css/coderay.css +111 -0
  95. data/examples/website/content/css/site.css +67 -0
  96. data/examples/website/content/index.txt +19 -0
  97. data/examples/website/layouts/default.txt +58 -0
  98. data/examples/website/lib/breadcrumbs.rb +28 -0
  99. data/examples/website/templates/_partial.erb +10 -0
  100. data/examples/website/templates/page.erb +18 -0
  101. data/examples/website/templates/presentation.erb +40 -0
  102. data/lib/webby.rb +227 -0
  103. data/lib/webby/apps.rb +12 -0
  104. data/lib/webby/apps/generator.rb +283 -0
  105. data/lib/webby/apps/main.rb +221 -0
  106. data/lib/webby/auto_builder.rb +83 -0
  107. data/lib/webby/builder.rb +183 -0
  108. data/lib/webby/core_ext/enumerable.rb +11 -0
  109. data/lib/webby/core_ext/hash.rb +28 -0
  110. data/lib/webby/core_ext/kernel.rb +21 -0
  111. data/lib/webby/core_ext/string.rb +163 -0
  112. data/lib/webby/core_ext/time.rb +9 -0
  113. data/lib/webby/filters.rb +91 -0
  114. data/lib/webby/filters/basepath.rb +97 -0
  115. data/lib/webby/filters/erb.rb +9 -0
  116. data/lib/webby/filters/haml.rb +18 -0
  117. data/lib/webby/filters/markdown.rb +16 -0
  118. data/lib/webby/filters/outline.rb +308 -0
  119. data/lib/webby/filters/sass.rb +17 -0
  120. data/lib/webby/filters/slides.rb +56 -0
  121. data/lib/webby/filters/textile.rb +16 -0
  122. data/lib/webby/filters/tidy.rb +76 -0
  123. data/lib/webby/helpers.rb +30 -0
  124. data/lib/webby/helpers/capture_helper.rb +141 -0
  125. data/lib/webby/helpers/coderay_helper.rb +69 -0
  126. data/lib/webby/helpers/graphviz_helper.rb +136 -0
  127. data/lib/webby/helpers/tag_helper.rb +65 -0
  128. data/lib/webby/helpers/tex_img_helper.rb +133 -0
  129. data/lib/webby/helpers/ultraviolet_helper.rb +63 -0
  130. data/lib/webby/helpers/url_helper.rb +235 -0
  131. data/lib/webby/link_validator.rb +152 -0
  132. data/lib/webby/renderer.rb +379 -0
  133. data/lib/webby/resources.rb +96 -0
  134. data/lib/webby/resources/db.rb +251 -0
  135. data/lib/webby/resources/file.rb +221 -0
  136. data/lib/webby/resources/layout.rb +63 -0
  137. data/lib/webby/resources/page.rb +118 -0
  138. data/lib/webby/resources/partial.rb +79 -0
  139. data/lib/webby/resources/resource.rb +160 -0
  140. data/lib/webby/resources/static.rb +52 -0
  141. data/lib/webby/stelan/mktemp.rb +135 -0
  142. data/lib/webby/stelan/paginator.rb +150 -0
  143. data/lib/webby/stelan/spawner.rb +339 -0
  144. data/lib/webby/tasks/build.rake +27 -0
  145. data/lib/webby/tasks/create.rake +22 -0
  146. data/lib/webby/tasks/deploy.rake +22 -0
  147. data/lib/webby/tasks/growl.rake +15 -0
  148. data/lib/webby/tasks/heel.rake +28 -0
  149. data/lib/webby/tasks/validate.rake +19 -0
  150. data/spec/core_ext/hash_spec.rb +47 -0
  151. data/spec/core_ext/string_spec.rb +110 -0
  152. data/spec/core_ext/time_spec.rb +19 -0
  153. data/spec/spec.opts +1 -0
  154. data/spec/spec_helper.rb +14 -0
  155. data/spec/webby/apps/generator_spec.rb +111 -0
  156. data/spec/webby/apps/main_spec.rb +75 -0
  157. data/spec/webby/helpers/capture_helper_spec.rb +56 -0
  158. data/spec/webby/resources/file_spec.rb +104 -0
  159. data/spec/webby/resources_spec.rb +17 -0
  160. data/tasks/ann.rake +81 -0
  161. data/tasks/bones.rake +21 -0
  162. data/tasks/gem.rake +126 -0
  163. data/tasks/git.rake +41 -0
  164. data/tasks/manifest.rake +49 -0
  165. data/tasks/notes.rake +28 -0
  166. data/tasks/post_load.rake +39 -0
  167. data/tasks/rdoc.rake +51 -0
  168. data/tasks/rubyforge.rake +57 -0
  169. data/tasks/setup.rb +268 -0
  170. data/tasks/spec.rake +55 -0
  171. data/tasks/website.rake +38 -0
  172. metadata +287 -0
@@ -0,0 +1,75 @@
1
+
2
+ require ::File.expand_path(
3
+ ::File.join(::File.dirname(__FILE__), %w[.. .. spec_helper]))
4
+
5
+ # ---------------------------------------------------------------------------
6
+ describe Webby::Apps::Main do
7
+ before do
8
+ @main = Webby::Apps::Main.new
9
+ end
10
+
11
+ describe ".capture_command_line_args" do
12
+ it "should set the raw arguments" do
13
+ raw = ["The Raw Arguments"]
14
+ args = @main.capture_command_line_args(raw)
15
+ args.raw.should == raw
16
+ end
17
+
18
+ it "should set the page with one argument by downcasing" do
19
+ page = "This-is-a-page"
20
+ args = @main.capture_command_line_args([page])
21
+ args.page.should == page.downcase
22
+ end
23
+
24
+ it "should set the page with two or more arguments by joining" do
25
+ page = %w(this is a page)
26
+ args = @main.capture_command_line_args(page)
27
+ args.page.should == page.join('-')
28
+ end
29
+
30
+ it "should set the dir from the page's dirname" do
31
+ page = "foo/bar/this-is-a-page.txt"
32
+ args = @main.capture_command_line_args([page])
33
+ args.dir.should == "foo/bar"
34
+ end
35
+
36
+ it "should set the slug from the page's basename" do
37
+ page = "foo/bar/this-is-a-page.txt"
38
+ args = @main.capture_command_line_args([page])
39
+ args.slug.should == "this-is-a-page"
40
+ end
41
+
42
+ it "should turn the slug into a url" do
43
+ page = "10% Inspiration & 90% Perspiration"
44
+ args = @main.capture_command_line_args([page])
45
+ args.slug.should == "10-percent-inspiration-and-90-percent-perspiration"
46
+ end
47
+
48
+ it "should set the page by combining the dir and slug" do
49
+ page = "10% Inspiration & 90% Perspiration"
50
+ args = @main.capture_command_line_args([page])
51
+ args.page.should == "10-percent-inspiration-and-90-percent-perspiration"
52
+
53
+ page = "foo/bar/10% Inspiration & 90% Perspiration"
54
+ args = @main.capture_command_line_args([page])
55
+ args.page.should == "foo/bar/10-percent-inspiration-and-90-percent-perspiration"
56
+ end
57
+
58
+ # TODO: Is this desired behavior?
59
+ it "should set the title by joining the raw args, getting the basename, and titlecasing" do
60
+ page = "foo/bar/this-is-a-page.txt"
61
+ args = @main.capture_command_line_args([page])
62
+ args.title.should == "This-Is-a-Page"
63
+ end
64
+ end
65
+
66
+ describe ".parse" do
67
+ it "should pass environment variables to the rake application" do
68
+ ARGV = ary = []
69
+ args = %w[rebuild foo BASE=http://www.example.com bar]
70
+ @main.parse args
71
+ ary.should == %w[rebuild BASE=http://www.example.com]
72
+ args.should == %w[foo bar]
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,56 @@
1
+
2
+ require ::File.expand_path(
3
+ ::File.join(::File.dirname(__FILE__), %w[.. .. spec_helper]))
4
+
5
+ # ---------------------------------------------------------------------------
6
+ describe Webby::Helpers::CaptureHelper do
7
+ CFN = ::File.expand_path(::File.join(::File.dirname(__FILE__), '..', '..', 'capture_for_yaml.txt'))
8
+ CLINES = [
9
+ "--- ",
10
+ "filter: ",
11
+ " - erb ",
12
+ "--- ",
13
+ "Hello world!",
14
+ "<% content_for :sidebar do %>",
15
+ "I'm sidebar content.",
16
+ "<% end %>"
17
+ ]
18
+
19
+ before :all do
20
+ ::File.open(CFN,'w') {|fd| fd.write CLINES.join("\n") }
21
+ end
22
+
23
+ before :each do
24
+ @renderman = Webby::Renderer.new(
25
+ Webby::Resources::Page.new(CFN))
26
+ @page_content = @renderman._render_page
27
+ end
28
+
29
+ after :all do
30
+ ::FileUtils.rm_f(CFN)
31
+ end
32
+
33
+ it 'should not "leak" any content to containing page' do
34
+ @page_content.should_not be_nil
35
+ @page_content.should eql("Hello world!\n")
36
+ end
37
+
38
+ it "should return the stored content for the given key" do
39
+ @renderman.content_for(:sidebar).should_not be_nil
40
+ @renderman.content_for(:sidebar).should eql("\nI'm sidebar content.\n") # Note: Leading newline
41
+ end
42
+
43
+ it "should report if content is associated with a given key" do
44
+ @renderman.content_for?(:sidebar).should == true
45
+ @renderman.content_for?(:header).should == false
46
+ end
47
+
48
+ it "should clear content associated with a given key" do
49
+ @renderman.content_for?(:sidebar).should == true
50
+ @renderman.delete_content_for(:sidebar)
51
+ @renderman.content_for?(:sidebar).should == false
52
+ end
53
+
54
+ end
55
+
56
+ # EOF
@@ -0,0 +1,104 @@
1
+
2
+ require ::File.join(::File.dirname(__FILE__), %w[.. .. spec_helper])
3
+
4
+ # ---------------------------------------------------------------------------
5
+ describe Webby::Resources::File do
6
+
7
+ FN = ::File.expand_path(::File.join(::File.dirname(__FILE__), '..', '..', 'lorem_ipsum.txt'))
8
+ FN_YAML = FN.gsub %r/\.txt\z/, '_yaml.txt'
9
+ LINES = [
10
+ "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla orci\n",
11
+ "ante, aliquet ac, vulputate ut, suscipit et, sapien. Integer elementum\n",
12
+ "nisi quis magna tincidunt mattis. Aliquam semper. Pellentesque pretium.\n",
13
+ "Ut a ligula sit amet pede malesuada laoreet. Ut et purus. Morbi turpis\n",
14
+ "justo, pharetra vitae, consequat a, sodales vitae, tortor. Donec non\n",
15
+ "massa. Maecenas adipiscing venenatis nisi. Proin vulputate lorem posuere\n",
16
+ "mi. Cras sagittis. Pellentesque tortor mauris, accumsan vitae, ultrices\n",
17
+ "vel, tristique ultricies, eros. Donec fringilla hendrerit mauris. Nam in\n",
18
+ "orci. Curabitur congue consectetuer leo. Donec ut pede. Proin et lorem.\n",
19
+ "Aliquam eget lacus. In nibh.\n"
20
+ ]
21
+
22
+ before do
23
+ ::File.open(FN,'w') {|fd| fd.write LINES}
24
+ ::File.open(FN_YAML,'w') do |fd|
25
+ fd.write "--- \n- one\n- two\n- three\n--- \n"
26
+ fd.write LINES
27
+ end
28
+ end
29
+
30
+ after do
31
+ ::FileUtils.rm_f(FN)
32
+ ::FileUtils.rm_f(FN_YAML)
33
+ end
34
+
35
+ it 'should return nil for meta-data on regular files' do
36
+ begin
37
+ fd = Webby::Resources::File.new FN, 'r'
38
+ fd.meta_data.should be_nil
39
+
40
+ fd.readlines.should == LINES
41
+ ensure
42
+ fd.close
43
+ end
44
+ end
45
+
46
+ it 'should add meta-data to the top of a file' do
47
+ Webby::Resources::File.open(FN,'a+') do |fd|
48
+ fd.meta_data.should be_nil
49
+ fd.meta_data = %w(one two three)
50
+ end
51
+
52
+ Webby::Resources::File.open(FN,'r') do |fd|
53
+ fd.meta_data.should == %w(one two three)
54
+ end
55
+
56
+ ::File.open(FN_YAML, 'r') do |fd|
57
+ ary = LINES.dup
58
+ ary.insert 0, [
59
+ "--- \n",
60
+ "- one\n",
61
+ "- two\n",
62
+ "- three\n",
63
+ "--- \n"
64
+ ]
65
+ fd.readlines.should == ary.flatten
66
+ end
67
+ end
68
+
69
+ it 'should remove the meta-data when set to nil' do
70
+ Webby::Resources::File.open(FN_YAML,'a+') do |fd|
71
+ fd.meta_data.should == %w(one two three)
72
+ fd.meta_data = nil
73
+ end
74
+
75
+ Webby::Resources::File.open(FN_YAML,'r') do |fd|
76
+ fd.meta_data.should be_nil
77
+ end
78
+
79
+ ::File.open(FN_YAML, 'r') do |fd|
80
+ fd.readlines.should == LINES
81
+ end
82
+ end
83
+
84
+ it 'should skip the meta-data when reading from the file' do
85
+ begin
86
+ fd = Webby::Resources::File.new FN_YAML, 'r'
87
+ fd.meta_data.should == %w(one two three)
88
+
89
+ fd.getc.should == ?L; fd.seek 0
90
+ fd.gets.should == LINES.first; fd.seek 0
91
+ fd.read(5).should == 'Lorem'; fd.seek 0
92
+ fd.read_nonblock(11) == 'Lorem ipsum'; fd.seek 0
93
+ fd.readchar.should == ?L; fd.seek 0
94
+ fd.readline.should == LINES.first; fd.seek 0
95
+ fd.readlines.should == LINES; fd.seek 0
96
+ fd.readpartial(11).should == 'Lorem ipsum'; fd.seek 0
97
+
98
+ ensure
99
+ fd.close
100
+ end
101
+ end
102
+ end # describe Webby::Resources::File
103
+
104
+ # EOF
@@ -0,0 +1,17 @@
1
+
2
+
3
+ require ::File.join(::File.dirname(__FILE__), %w[.. spec_helper])
4
+
5
+ # ---------------------------------------------------------------------------
6
+ describe Webby::Resources do
7
+ it "should raise a useful error if there are no layouts" do
8
+ layouts = mock("Layouts")
9
+ Webby::Resources.stub!(:layouts).and_return(layouts)
10
+ layouts.should_receive(:find).and_raise RuntimeError
11
+
12
+ lambda do
13
+ Webby::Resources.find_layout("default")
14
+ end.should raise_error(Webby::Error, 'could not find layout "default"')
15
+
16
+ end
17
+ end
data/tasks/ann.rake ADDED
@@ -0,0 +1,81 @@
1
+ # $Id$
2
+
3
+ begin
4
+ require 'bones/smtp_tls'
5
+ rescue LoadError
6
+ require 'net/smtp'
7
+ end
8
+ require 'time'
9
+
10
+ namespace :ann do
11
+
12
+ # A prerequisites task that all other tasks depend upon
13
+ task :prereqs
14
+
15
+ file PROJ.ann.file do
16
+ ann = PROJ.ann
17
+ puts "Generating #{ann.file}"
18
+ File.open(ann.file,'w') do |fd|
19
+ fd.puts("#{PROJ.name} version #{PROJ.version}")
20
+ fd.puts(" by #{Array(PROJ.authors).first}") if PROJ.authors
21
+ fd.puts(" #{PROJ.url}") if PROJ.url.valid?
22
+ fd.puts(" (the \"#{PROJ.release_name}\" release)") if PROJ.release_name
23
+ fd.puts
24
+ fd.puts("== DESCRIPTION")
25
+ fd.puts
26
+ fd.puts(PROJ.description)
27
+ fd.puts
28
+ fd.puts(PROJ.changes.sub(%r/^.*$/, '== CHANGES'))
29
+ fd.puts
30
+ ann.paragraphs.each do |p|
31
+ fd.puts "== #{p.upcase}"
32
+ fd.puts
33
+ fd.puts paragraphs_of(PROJ.readme_file, p).join("\n\n")
34
+ fd.puts
35
+ end
36
+ fd.puts ann.text if ann.text
37
+ end
38
+ end
39
+
40
+ desc "Create an announcement file"
41
+ task :announcement => ['ann:prereqs', PROJ.ann.file]
42
+
43
+ desc "Send an email announcement"
44
+ task :email => ['ann:prereqs', PROJ.ann.file] do
45
+ ann = PROJ.ann
46
+ from = ann.email[:from] || PROJ.email
47
+ to = Array(ann.email[:to])
48
+
49
+ ### build a mail header for RFC 822
50
+ rfc822msg = "From: #{from}\n"
51
+ rfc822msg << "To: #{to.join(',')}\n"
52
+ rfc822msg << "Subject: [ANN] #{PROJ.name} #{PROJ.version}"
53
+ rfc822msg << " (#{PROJ.release_name})" if PROJ.release_name
54
+ rfc822msg << "\n"
55
+ rfc822msg << "Date: #{Time.new.rfc822}\n"
56
+ rfc822msg << "Message-Id: "
57
+ rfc822msg << "<#{"%.8f" % Time.now.to_f}@#{ann.email[:domain]}>\n\n"
58
+ rfc822msg << File.read(ann.file)
59
+
60
+ params = [:server, :port, :domain, :acct, :passwd, :authtype].map do |key|
61
+ ann.email[key]
62
+ end
63
+
64
+ params[3] = PROJ.email if params[3].nil?
65
+
66
+ if params[4].nil?
67
+ STDOUT.write "Please enter your e-mail password (#{params[3]}): "
68
+ params[4] = STDIN.gets.chomp
69
+ end
70
+
71
+ ### send email
72
+ Net::SMTP.start(*params) {|smtp| smtp.sendmail(rfc822msg, from, to)}
73
+ end
74
+ end # namespace :ann
75
+
76
+ desc 'Alias to ann:announcement'
77
+ task :ann => 'ann:announcement'
78
+
79
+ CLOBBER << PROJ.ann.file
80
+
81
+ # EOF
data/tasks/bones.rake ADDED
@@ -0,0 +1,21 @@
1
+ # $Id$
2
+
3
+ if HAVE_BONES
4
+
5
+ namespace :bones do
6
+
7
+ desc 'Show the PROJ open struct'
8
+ task :debug do |t|
9
+ atr = if t.application.top_level_tasks.length == 2
10
+ t.application.top_level_tasks.pop
11
+ end
12
+
13
+ if atr then Bones::Debug.show_attr(PROJ, atr)
14
+ else Bones::Debug.show PROJ end
15
+ end
16
+
17
+ end # namespace :bones
18
+
19
+ end # HAVE_BONES
20
+
21
+ # EOF
data/tasks/gem.rake ADDED
@@ -0,0 +1,126 @@
1
+ # $Id$
2
+
3
+ require 'rake/gempackagetask'
4
+
5
+ namespace :gem do
6
+
7
+ PROJ.gem._spec = Gem::Specification.new do |s|
8
+ s.name = PROJ.name
9
+ s.version = PROJ.version
10
+ s.summary = PROJ.summary
11
+ s.authors = Array(PROJ.authors)
12
+ s.email = PROJ.email
13
+ s.homepage = Array(PROJ.url).first
14
+ s.rubyforge_project = PROJ.rubyforge.name
15
+
16
+ s.description = PROJ.description
17
+
18
+ PROJ.gem.dependencies.each do |dep|
19
+ s.add_dependency(*dep)
20
+ end
21
+
22
+ s.files = PROJ.gem.files
23
+ s.executables = PROJ.gem.executables.map {|fn| File.basename(fn)}
24
+ s.extensions = PROJ.gem.files.grep %r/extconf\.rb$/
25
+
26
+ s.bindir = 'bin'
27
+ dirs = Dir["{#{PROJ.libs.join(',')}}"]
28
+ s.require_paths = dirs unless dirs.empty?
29
+
30
+ incl = Regexp.new(PROJ.rdoc.include.join('|'))
31
+ excl = PROJ.rdoc.exclude.dup.concat %w[\.rb$ ^(\.\/|\/)?ext]
32
+ excl = Regexp.new(excl.join('|'))
33
+ rdoc_files = PROJ.gem.files.find_all do |fn|
34
+ case fn
35
+ when excl; false
36
+ when incl; true
37
+ else false end
38
+ end
39
+ s.rdoc_options = PROJ.rdoc.opts + ['--main', PROJ.rdoc.main]
40
+ s.extra_rdoc_files = rdoc_files
41
+ s.has_rdoc = true
42
+
43
+ if test ?f, PROJ.test.file
44
+ s.test_file = PROJ.test.file
45
+ else
46
+ s.test_files = PROJ.test.files.to_a
47
+ end
48
+
49
+ # Do any extra stuff the user wants
50
+ PROJ.gem.extras.each do |msg, val|
51
+ case val
52
+ when Proc
53
+ val.call(s.send(msg))
54
+ else
55
+ s.send "#{msg}=", val
56
+ end
57
+ end
58
+ end # Gem::Specification.new
59
+
60
+ # A prerequisites task that all other tasks depend upon
61
+ task :prereqs
62
+
63
+ desc 'Show information about the gem'
64
+ task :debug => 'gem:prereqs' do
65
+ puts PROJ.gem._spec.to_ruby
66
+ end
67
+
68
+ pkg = Rake::PackageTask.new(PROJ.name, PROJ.version) do |pkg|
69
+ pkg.need_tar = PROJ.gem.need_tar
70
+ pkg.need_zip = PROJ.gem.need_zip
71
+ pkg.package_files += PROJ.gem._spec.files
72
+ end
73
+ Rake::Task['gem:package'].instance_variable_set(:@full_comment, nil)
74
+
75
+ gem_file = if PROJ.gem._spec.platform == Gem::Platform::RUBY
76
+ "#{pkg.package_name}.gem"
77
+ else
78
+ "#{pkg.package_name}-#{PROJ.gem._spec.platform}.gem"
79
+ end
80
+
81
+ desc "Build the gem file #{gem_file}"
82
+ task :package => ['gem:prereqs', "#{pkg.package_dir}/#{gem_file}"]
83
+
84
+ file "#{pkg.package_dir}/#{gem_file}" => [pkg.package_dir] + PROJ.gem._spec.files do
85
+ when_writing("Creating GEM") {
86
+ Gem::Builder.new(PROJ.gem._spec).build
87
+ verbose(true) {
88
+ mv gem_file, "#{pkg.package_dir}/#{gem_file}"
89
+ }
90
+ }
91
+ end
92
+
93
+ desc 'Install the gem'
94
+ task :install => [:clobber, 'gem:package'] do
95
+ sh "#{SUDO} #{GEM} install --local pkg/#{PROJ.gem._spec.full_name}"
96
+
97
+ # use this version of the command for rubygems > 1.0.0
98
+ #sh "#{SUDO} #{GEM} install --no-update-sources pkg/#{PROJ.gem._spec.full_name}"
99
+ end
100
+
101
+ desc 'Uninstall the gem'
102
+ task :uninstall do
103
+ installed_list = Gem.source_index.find_name(PROJ.name)
104
+ if installed_list and installed_list.collect { |s| s.version.to_s}.include?(PROJ.version) then
105
+ sh "#{SUDO} #{GEM} uninstall --version '#{PROJ.version}' --ignore-dependencies --executables #{PROJ.name}"
106
+ end
107
+ end
108
+
109
+ desc 'Reinstall the gem'
110
+ task :reinstall => [:uninstall, :install]
111
+
112
+ desc 'Cleanup the gem'
113
+ task :cleanup do
114
+ sh "#{SUDO} #{GEM} cleanup #{PROJ.gem._spec.name}"
115
+ end
116
+
117
+ end # namespace :gem
118
+
119
+ desc 'Alias to gem:package'
120
+ task :gem => 'gem:package'
121
+
122
+ task :clobber => 'gem:clobber_package'
123
+
124
+ remove_desc_for_task %w(gem:clobber_package)
125
+
126
+ # EOF