echoe 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,90 @@
1
+ = 1.0.0 2007-01-10
2
+
3
+ * Echoe fork to remove unecessary meta-dependency on self in output gems
4
+
5
+ = 1.1.6 2006-11-29
6
+
7
+ * Fix release to work correctly with need_zip and need_tar.
8
+
9
+ = 1.1.5 2006-11-29
10
+
11
+ * Reduced check_manifest dependencies to just diff for windows.
12
+ * Don't use default author in summary, description or changes.
13
+
14
+ = 1.1.4 2006-11-12
15
+
16
+ * Added need_tar and need_zip to customize package requirements. Stupid windoze.
17
+ * Extended spec_extras to take procs as values. Passes in named parameter.
18
+ * Removed test from require_paths. I thought I already parameterized this. :/
19
+
20
+ = 1.1.3 2006-11-09
21
+
22
+ * Added test_deps, now you can automatically discover test dependency ommisions.
23
+ * Added ext support! Build C extensions with hoe!
24
+ * Gemspec uses test_all.rb or result of test_globs. Tweak those tests.
25
+ * Now uses https to login to rubyforge. Rubyforge crackers beware!
26
+ * Fixed doco and automated updating of it.
27
+ * Added rdoc_pattern. Go doco go!
28
+
29
+ = 1.1.2 2006-10-22
30
+
31
+ * Added -d and -t flags to sow to make dev or trunk subdirs for p4 and svn projects.
32
+ * Added install_gem to further test gem builds.
33
+ * Added test_globs to customize your test file list.
34
+ * Removed demo.rb from clean_globs. I'm torn on this one.
35
+ * Fixed bug in install rule.
36
+
37
+ = 1.1.1 2006-10-11
38
+
39
+ * Fixed minor problem with subject of email.
40
+ * Fixed problem in test.
41
+
42
+ = 1.1.0 2006-10-04
43
+
44
+ * Added sow, a command-line tool for quickly creating new projects.
45
+ * Added check_manifest task
46
+
47
+ = 1.0.5 2006-10-03
48
+
49
+ * Doco cleanup.
50
+ * Removed Manifest.txt from rdoc and added title.
51
+ * Added changeset support.
52
+ * Added spec_extras for easy gemspec attribute setting.
53
+ * Added release_notes, changeset setting for releases.
54
+ * Added paragraphs_of utility method.
55
+ * Added email and rubyforge news announcement tasks.
56
+ * Url attribute may now be an array of urls.
57
+
58
+ = 1.0.4 2006-09-23
59
+
60
+ * Damnit... I messed up. There is no rubygems gem to be dependent upon. Duh.
61
+
62
+ = 1.0.3 2006-09-23
63
+
64
+ * Added debug_gem rule.
65
+ * Added lots of doco.
66
+ * Added proper deps to hoe for other's gems, and rake/rubyforge/rubygems for hoe.
67
+ * Added ridocs to generate ri locally for testing.
68
+ * Added support for multiple authors.
69
+ * Fixed include paths.
70
+ * Rdoc now includes any top level .txt files.
71
+ * Renamed deploy to release.
72
+ * Renamed upload to publish_docs.
73
+ * publish_docs is now smart about subprojects and missing subdirectories.
74
+
75
+ = 1.0.2 2006-09-20
76
+
77
+ * Wee little tests.
78
+ * Fixed up gemspec's require_paths.
79
+
80
+ = 1.0.1 2006-09-20
81
+
82
+ * Finally got deployment straightened out. Maybe. Some might be on rubyforge.org.
83
+ * Added default description and summary.
84
+ * Added dependency mechanism.
85
+ * Improved gemspec debugging.
86
+ * Swapped gem with tgz in deploy... we'd rather screw up on tgz
87
+
88
+ = 1.0.0 2006-09-19
89
+
90
+ * Birthday!
@@ -0,0 +1,184 @@
1
+ Academic Free License (AFL) v. 3.0
2
+
3
+ This Academic Free License (the "License") applies to any original work
4
+ of authorship (the "Original Work") whose owner (the "Licensor") has
5
+ placed the following licensing notice adjacent to the copyright notice
6
+ for the Original Work:
7
+
8
+ Licensed under the Academic Free License version 3.0
9
+
10
+ 1) Grant of Copyright License. Licensor grants You a worldwide,
11
+ royalty-free, non-exclusive, sublicensable license, for the duration of
12
+ the copyright, to do the following:
13
+
14
+ a) to reproduce the Original Work in copies, either alone or as part of
15
+ a collective work;
16
+
17
+ b) to translate, adapt, alter, transform, modify, or arrange the
18
+ Original Work, thereby creating derivative works ("Derivative Works")
19
+ based upon the Original Work;
20
+
21
+ c) to distribute or communicate copies of the Original Work and
22
+ Derivative Works to the public, under any license of your choice that
23
+ does not contradict the terms and conditions, including Licensor's
24
+ reserved rights and remedies, in this Academic Free License;
25
+
26
+ d) to perform the Original Work publicly; and
27
+
28
+ e) to display the Original Work publicly.
29
+
30
+ 2) Grant of Patent License. Licensor grants You a worldwide,
31
+ royalty-free, non-exclusive, sublicensable license, under patent claims
32
+ owned or controlled by the Licensor that are embodied in the Original
33
+ Work as furnished by the Licensor, for the duration of the patents, to
34
+ make, use, sell, offer for sale, have made, and import the Original Work
35
+ and Derivative Works.
36
+
37
+ 3) Grant of Source Code License. The term "Source Code" means the
38
+ preferred form of the Original Work for making modifications to it and
39
+ all available documentation describing how to modify the Original Work.
40
+ Licensor agrees to provide a machine-readable copy of the Source Code of
41
+ the Original Work along with each copy of the Original Work that
42
+ Licensor distributes. Licensor reserves the right to satisfy this
43
+ obligation by placing a machine-readable copy of the Source Code in an
44
+ information repository reasonably calculated to permit inexpensive and
45
+ convenient access by You for as long as Licensor continues to distribute
46
+ the Original Work.
47
+
48
+ 4) Exclusions From License Grant. Neither the names of Licensor, nor the
49
+ names of any contributors to the Original Work, nor any of their
50
+ trademarks or service marks, may be used to endorse or promote products
51
+ derived from this Original Work without express prior permission of the
52
+ Licensor. Except as expressly stated herein, nothing in this License
53
+ grants any license to Licensor's trademarks, copyrights, patents, trade
54
+ secrets or any other intellectual property. No patent license is granted
55
+ to make, use, sell, offer for sale, have made, or import embodiments of
56
+ any patent claims other than the licensed claims defined in Section 2.
57
+ No license is granted to the trademarks of Licensor even if such marks
58
+ are included in the Original Work. Nothing in this License shall be
59
+ interpreted to prohibit Licensor from licensing under terms different
60
+ from this License any Original Work that Licensor otherwise would have a
61
+ right to license.
62
+
63
+ 5) External Deployment. The term "External Deployment" means the use,
64
+ distribution, or communication of the Original Work or Derivative Works
65
+ in any way such that the Original Work or Derivative Works may be used
66
+ by anyone other than You, whether those works are distributed or
67
+ communicated to those persons or made available as an application
68
+ intended for use over a network. As an express condition for the grants
69
+ of license hereunder, You must treat any External Deployment by You of
70
+ the Original Work or a Derivative Work as a distribution under section
71
+ 1(c).
72
+
73
+ 6) Attribution Rights. You must retain, in the Source Code of any
74
+ Derivative Works that You create, all copyright, patent, or trademark
75
+ notices from the Source Code of the Original Work, as well as any
76
+ notices of licensing and any descriptive text identified therein as an
77
+ "Attribution Notice." You must cause the Source Code for any Derivative
78
+ Works that You create to carry a prominent Attribution Notice reasonably
79
+ calculated to inform recipients that You have modified the Original
80
+ Work.
81
+
82
+ 7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants
83
+ that the copyright in and to the Original Work and the patent rights
84
+ granted herein by Licensor are owned by the Licensor or are sublicensed
85
+ to You under the terms of this License with the permission of the
86
+ contributor(s) of those copyrights and patent rights. Except as
87
+ expressly stated in the immediately preceding sentence, the Original
88
+ Work is provided under this License on an "AS IS" BASIS and WITHOUT
89
+ WARRANTY, either express or implied, including, without limitation, the
90
+ warranties of non-infringement, merchantability or fitness for a
91
+ particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL
92
+ WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential
93
+ part of this License. No license to the Original Work is granted by this
94
+ License except under this disclaimer.
95
+
96
+ 8) Limitation of Liability. Under no circumstances and under no legal
97
+ theory, whether in tort (including negligence), contract, or otherwise,
98
+ shall the Licensor be liable to anyone for any indirect, special,
99
+ incidental, or consequential damages of any character arising as a
100
+ result of this License or the use of the Original Work including,
101
+ without limitation, damages for loss of goodwill, work stoppage,
102
+ computer failure or malfunction, or any and all other commercial damages
103
+ or losses. This limitation of liability shall not apply to the extent
104
+ applicable law prohibits such limitation.
105
+
106
+ 9) Acceptance and Termination. If, at any time, You expressly assented
107
+ to this License, that assent indicates your clear and irrevocable
108
+ acceptance of this License and all of its terms and conditions. If You
109
+ distribute or communicate copies of the Original Work or a Derivative
110
+ Work, You must make a reasonable effort under the circumstances to
111
+ obtain the express assent of recipients to the terms of this License.
112
+ This License conditions your rights to undertake the activities listed
113
+ in Section 1, including your right to create Derivative Works based upon
114
+ the Original Work, and doing so without honoring these terms and
115
+ conditions is prohibited by copyright law and international treaty.
116
+ Nothing in this License is intended to affect copyright exceptions and
117
+ limitations (including "fair use" or "fair dealing"). This License shall
118
+ terminate immediately and You may no longer exercise any of the rights
119
+ granted to You by this License upon your failure to honor the conditions
120
+ in Section 1(c).
121
+
122
+ 10) Termination for Patent Action. This License shall terminate
123
+ automatically and You may no longer exercise any of the rights granted
124
+ to You by this License as of the date You commence an action, including
125
+ a cross-claim or counterclaim, against Licensor or any licensee alleging
126
+ that the Original Work infringes a patent. This termination provision
127
+ shall not apply for an action alleging patent infringement by
128
+ combinations of the Original Work with other software or hardware.
129
+
130
+ 11) Jurisdiction, Venue and Governing Law. Any action or suit relating
131
+ to this License may be brought only in the courts of a jurisdiction
132
+ wherein the Licensor resides or in which Licensor conducts its primary
133
+ business, and under the laws of that jurisdiction excluding its
134
+ conflict-of-law provisions. The application of the United Nations
135
+ Convention on Contracts for the International Sale of Goods is expressly
136
+ excluded. Any use of the Original Work outside the scope of this License
137
+ or after its termination shall be subject to the requirements and
138
+ penalties of copyright or patent law in the appropriate jurisdiction.
139
+ This section shall survive the termination of this License.
140
+
141
+ 12) Attorneys' Fees. In any action to enforce the terms of this License
142
+ or seeking damages relating thereto, the prevailing party shall be
143
+ entitled to recover its costs and expenses, including, without
144
+ limitation, reasonable attorneys' fees and costs incurred in connection
145
+ with such action, including any appeal of such action. This section
146
+ shall survive the termination of this License.
147
+
148
+ 13) Miscellaneous. If any provision of this License is held to be
149
+ unenforceable, such provision shall be reformed only to the extent
150
+ necessary to make it enforceable.
151
+
152
+ 14) Definition of "You" in This License. "You" throughout this License,
153
+ whether in upper or lower case, means an individual or a legal entity
154
+ exercising rights under, and complying with all of the terms of, this
155
+ License. For legal entities, "You" includes any entity that controls, is
156
+ controlled by, or is under common control with you. For purposes of this
157
+ definition, "control" means (i) the power, direct or indirect, to cause
158
+ the direction or management of such entity, whether by contract or
159
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
160
+ outstanding shares, or (iii) beneficial ownership of such entity.
161
+
162
+ 15) Right to Use. You may use the Original Work in all ways not
163
+ otherwise restricted or conditioned by this License or by law, and
164
+ Licensor promises not to interfere with or be responsible for such uses
165
+ by You.
166
+
167
+ 16) Modification of This License. This License is Copyright (c) 2005
168
+ Lawrence Rosen. Permission is granted to copy, distribute, or
169
+ communicate this License without modification. Nothing in this License
170
+ permits You to modify this License as applied to the Original Work or to
171
+ Derivative Works. However, You may modify the text of this License and
172
+ copy, distribute or communicate your modified version (the "Modified
173
+ License") and apply it to other original works of authorship subject to
174
+ the following conditions: (i) You may not indicate in any way that your
175
+ Modified License is the "Academic Free License" or "AFL" and you may not
176
+ use those names in the name of your Modified License; (ii) You must
177
+ replace the notice specified in the first paragraph above with the
178
+ notice "Licensed under <insert your license name here>" or with a notice
179
+ of your own that is not confusingly similar to the notice in this
180
+ License; and (iii) You may not claim that your original works are open
181
+ source software unless your Modified License has been approved by Open
182
+ Source Initiative (OSI) and You comply with its license review and
183
+ certification process.
184
+
@@ -0,0 +1,8 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ LICENSE.txt
5
+ Rakefile
6
+ bin/echoe
7
+ lib/echoe.rb
8
+ test/test_echoe.rb
@@ -0,0 +1,95 @@
1
+ echoe
2
+ http://rubyforge.org/projects/fauna/
3
+ Evan Weaver
4
+
5
+ == DESCRIPTION:
6
+
7
+ echoe is a simple rake/rubygems helper for project Rakefiles. It
8
+ generates all the usual tasks for projects including rdoc generation,
9
+ testing, packaging, and deployment.
10
+
11
+ Tasks Provided:
12
+
13
+ * announce - Generate email announcement file and post to rubyforge.
14
+ * audit - Run ZenTest against the package
15
+ * check_manifest - Verify the manifest
16
+ * clean - Clean up all the extras
17
+ * debug_gem - Show information about the gem.
18
+ * default - Run the default tasks
19
+ * docs - Build the docs HTML Files
20
+ * email - Generate email announcement file.
21
+ * install - Install the package. Uses PREFIX and RUBYLIB
22
+ * install_gem - Install the package as a gem
23
+ * multi - Run the test suite using multiruby
24
+ * package - Build all the packages
25
+ * post_news - Post announcement to rubyforge.
26
+ * publish_docs - Publish RDoc to RubyForge
27
+ * release - Package and upload the release to rubyforge.
28
+ * ridocs - Generate ri locally for testing
29
+ * test - Run the test suite. Use FILTER to add to the command line.
30
+ * test_deps - Show which test files fail when run alone.
31
+ * uninstall - Uninstall the package.
32
+
33
+ See class rdoc for help. Hint: ri echoe
34
+
35
+ == DIFFERENCES FROM HOE:
36
+
37
+ * Removes unnecessary meta-dependency on self in created gems
38
+
39
+ == FEATURES/PROBLEMS:
40
+
41
+ * Provides 'echoe' command line tool for quick project directory creation.
42
+ * Make making and maintaining Rakefiles fun and easy.
43
+
44
+ == SYNOPSYS:
45
+
46
+ % sow [group] project
47
+
48
+ or
49
+
50
+ require 'echoe'
51
+
52
+ Echoe.new(projectname, version) do |p|
53
+ # ... project specific data ...
54
+ end
55
+
56
+ # ... project specific tasks ...
57
+
58
+ == REQUIREMENTS:
59
+
60
+ * rake
61
+ * rubyforge
62
+ * rubygems
63
+
64
+ == INSTALL:
65
+
66
+ * sudo gem install echoe
67
+
68
+ == LICENSE:
69
+
70
+ Copyright 2007 Evan Weaver.
71
+ Licensed under the Academic Free License 3.0. See LICENSE.txt, included.
72
+ The following license also applies to portions of the software:
73
+
74
+ (The MIT License)
75
+
76
+ Copyright (c) 2006 Ryan Davis, Zen Spider Software
77
+
78
+ Permission is hereby granted, free of charge, to any person obtaining
79
+ a copy of this software and associated documentation files (the
80
+ "Software"), to deal in the Software without restriction, including
81
+ without limitation the rights to use, copy, modify, merge, publish,
82
+ distribute, sublicense, and/or sell copies of the Software, and to
83
+ permit persons to whom the Software is furnished to do so, subject to
84
+ the following conditions:
85
+
86
+ The above copyright notice and this permission notice shall be
87
+ included in all copies or substantial portions of the Software.
88
+
89
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
90
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
91
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
92
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
93
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
94
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
95
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,14 @@
1
+ # -*- ruby -*-
2
+
3
+ require './lib/echoe.rb'
4
+
5
+ Echoe.new("echoe", Echoe::VERSION) do |p|
6
+ p.name = "echoe"
7
+ p.rubyforge_name = "fauna"
8
+ p.summary = "Echoe makes gem creation easy."
9
+ p.description = p.paragraphs_of('README.txt', 2..5).join("\n\n")
10
+ p.url = p.paragraphs_of('README.txt', 0).first.split(/\n/)[1..-1]
11
+ p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
12
+ end
13
+
14
+ # vim: syntax=Ruby
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env ruby -ws
2
+
3
+ $t ||= false
4
+ $d ||= false
5
+
6
+ if defined? $h then
7
+ puts "usage: #{File.dirname($0)} [-d|-t] [group] project"
8
+ puts " -t = add project to subdir under 'trunk'"
9
+ puts " -d = add project to subdir under 'dev'"
10
+ end
11
+
12
+ abort "You must specify only one of -t or -d" if $t and $d
13
+
14
+ group = ARGV.shift
15
+ project = ARGV.shift
16
+
17
+ project ||= group
18
+
19
+ # prevents false positives on my tag reporter
20
+ X = 'FI' + 'X'
21
+
22
+ abort "You must supply a project name on the commandline" unless project
23
+ abort "Project #{project} seems to exist" if test ?d, project
24
+ puts "creating project #{project}"
25
+
26
+ case project
27
+ when /_/ then
28
+ file_name = project
29
+ project = project.capitalize.gsub(/_([a-z])/) {$1.upcase}
30
+ klass = project
31
+ else
32
+ file_name = project.gsub(/([A-Z])/, '_\1').downcase.sub(/^_/, '')
33
+ klass = project.capitalize.gsub(/_([a-z])/) {$1.upcase}
34
+ end
35
+
36
+ Dir.mkdir project
37
+ Dir.chdir project do
38
+
39
+ if $d then
40
+ Dir.mkdir "dev"
41
+ Dir.chdir "dev"
42
+ elsif $t then
43
+ Dir.mkdir "trunk"
44
+ Dir.chdir "trunk"
45
+ end
46
+
47
+ %w(bin lib test).each do |path|
48
+ Dir.mkdir path
49
+ end
50
+
51
+ files = {
52
+ "History.txt" => "== 1.0.0 / #{Time.new.strftime("%Y-%m-%d")}\n\n* 1 major enhancement\n * Birthday!\n\n",
53
+ "README.txt" => "#{project}\n by #{X} (your name)\n #{X} (url)\n\n== DESCRIPTION:\n \n#{X} (describe your package)\n\n== FEATURES/PROBLEMS:\n \n* #{X} (list of features or problems)\n\n== SYNOPSYS:\n\n #{X} (code sample of usage)\n\n== REQUIREMENTS:\n\n* #{X} (list of requirements)\n\n== INSTALL:\n\n* #{X} (sudo gem install, anything else)\n\n== LICENSE:\n\n(The MIT License)\n\nCopyright (c) #{Time.new.strftime("%Y")} #{X}\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
54
+ "Manifest.txt" => "",
55
+ "bin/#{file_name}" => "",
56
+ "lib/#{file_name}.rb" => "class #{klass}\n VERSION = '1.0.0'\nend",
57
+ "test/test_#{file_name}.rb" => "",
58
+ "Rakefile" => "# -*- ruby -*-\n\nrequire 'rubygems'\nrequire 'echoe'\nrequire './lib/#{file_name}.rb'\n\nechoe.new('#{project}', #{klass}::VERSION) do |p|\n p.rubyforge_name = \'#{group}\'\n # p.summary = '#{X}'\n # p.description = p.paragraphs_of('README.txt', 2..5).join(\"\\n\\n\")\n # p.url = p.paragraphs_of('README.txt', 0).first.split(/\\n/)[1..-1]\n p.changes = p.paragraphs_of('History.txt', 0..1).join(\"\\n\\n\")\nend\n\n# vim: syntax=Ruby\n"
59
+ }
60
+
61
+ files["Manifest.txt"] = files.keys.sort.join("\n")
62
+
63
+ files.each do |file, content|
64
+ File.open(file, "w") do |f|
65
+ f.write content
66
+ end
67
+ end
68
+ end
69
+
70
+ puts "... done, now go fix all occurances of '#{X}'"
71
+ puts `find #{project} -type f | xargs grep -n #{X}`.gsub(/\A|\n/, "\n ")
@@ -0,0 +1,440 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'rake'
5
+ require 'rake/contrib/sshpublisher'
6
+ require 'rake/gempackagetask'
7
+ require 'rake/rdoctask'
8
+ require 'rake/testtask'
9
+ require 'rbconfig'
10
+
11
+ ##
12
+ # echoe - a tool to help rake
13
+ #
14
+ # echoe is a simple rake/rubygems helper for project Rakefiles. It
15
+ # generates all the usual tasks for projects including rdoc generation,
16
+ # testing, packaging, and deployment.
17
+ #
18
+ # == Using echoe
19
+ #
20
+ # === Basics
21
+ #
22
+ # Use this as a minimal starting point:
23
+ #
24
+ # require 'echoe'
25
+ #
26
+ # Echoe.new("project_name", '1.0.0') do |p|
27
+ # p.rubyforge_name = "rf_project"
28
+ # # add other details here
29
+ # end
30
+ #
31
+ # # add other tasks here
32
+ #
33
+ # === Tasks Provided:
34
+ #
35
+ # * announce - Generate email announcement file and post to rubyforge.
36
+ # * audit - Run ZenTest against the package
37
+ # * check_manifest - Verify the manifest
38
+ # * clean - Clean up all the extras
39
+ # * debug_gem - Show information about the gem.
40
+ # * default - Run the default tasks
41
+ # * docs - Build the docs HTML Files
42
+ # * email - Generate email announcement file.
43
+ # * install - Install the package. Uses PREFIX and RUBYLIB
44
+ # * install_gem - Install the package as a gem
45
+ # * multi - Run the test suite using multiruby
46
+ # * package - Build all the packages
47
+ # * post_news - Post announcement to rubyforge.
48
+ # * publish_docs - Publish RDoc to RubyForge
49
+ # * release - Package and upload the release to rubyforge.
50
+ # * ridocs - Generate ri locally for testing
51
+ # * test - Run the test suite. Use FILTER to add to the command line.
52
+ # * test_deps - Show which test files fail when run alone.
53
+ # * uninstall - Uninstall the package.
54
+ #
55
+ # === Attributes
56
+ #
57
+ # The attributes that you can provide inside the new block above are:
58
+ #
59
+ # ==== Mandatory
60
+ #
61
+ # * name - The name of the release.
62
+ # * version - The version. Don't hardcode! use a constant in the project.
63
+ #
64
+ # ==== Damn Good to Set
65
+ #
66
+ # * author - The author of the package. (can be array of authors)
67
+ # * changes - A description of the release's latest changes.
68
+ # * description - A description of the project.
69
+ # * email - The author's email address. (can be array of urls)
70
+ # * summary - A short summary of the project.
71
+ # * url - The url of the project.
72
+ #
73
+ # ==== Optional
74
+ #
75
+ # * clean_globs - An array of file patterns to delete on clean.
76
+ # * extra_deps - An array of rubygem dependencies.
77
+ # * need_tar - Should package create a tarball? [default: true]
78
+ # * need_zip - Should package create a zipfile? [default: false]
79
+ # * rdoc_pattern - A regexp to match documentation files against the manifest.
80
+ # * rubyforge_name - The name of the rubyforge project. [default: name.downcase]
81
+ # * spec_extras - A hash of extra values to set in the gemspec.
82
+ # * test_globs - An array of test file patterns [default: test/**/test_*.rb]
83
+ #
84
+ # === Environment Variables
85
+ #
86
+ # * FILTER - Used to add flags to test_unit (e.g., -n test_borked)
87
+ # * PREFIX - Used to specify a custom install location (for rake install).
88
+ # * RUBY_DEBUG - Used to add extra flags to RUBY_FLAGS.
89
+ # * RUBY_FLAGS - Used to specify flags to ruby [has smart default].
90
+
91
+ class Echoe
92
+ VERSION = '1.0.0'
93
+
94
+ rubyprefix = Config::CONFIG['prefix']
95
+ sitelibdir = Config::CONFIG['sitelibdir']
96
+
97
+ PREFIX = ENV['PREFIX'] || rubyprefix
98
+ RUBYLIB = if PREFIX == rubyprefix then
99
+ sitelibdir
100
+ else
101
+ File.join(PREFIX, sitelibdir[rubyprefix.size..-1])
102
+ end
103
+ RUBY_DEBUG = ENV['RUBY_DEBUG']
104
+ RUBY_FLAGS = ENV['RUBY_FLAGS'] ||
105
+ "-w -I#{%w(lib ext bin test).join(File::PATH_SEPARATOR)}" +
106
+ (RUBY_DEBUG ? " #{RUBY_DEBUG}" : '')
107
+ FILTER = ENV['FILTER'] # for tests (eg FILTER="-n test_blah")
108
+
109
+ attr_accessor :author, :bin_files, :changes, :clean_globs, :description, :email, :extra_deps, :lib_files, :name, :need_tar, :need_zip, :rdoc_pattern, :rubyforge_name, :spec, :spec_extras, :summary, :test_files, :test_globs, :url, :version
110
+
111
+ def initialize(name, version)
112
+ self.name = name
113
+ self.version = version
114
+
115
+ # Defaults
116
+ self.rubyforge_name = name.downcase
117
+ self.url = ""
118
+ self.author = ""
119
+ self.email = ""
120
+ self.clean_globs = %w(diff diff.txt email.txt ri *.gem **/*~)
121
+ self.test_globs = ['test/**/test_*.rb']
122
+ self.changes = ""
123
+ self.description = ""
124
+ self.summary = ""
125
+ self.rdoc_pattern = /^(lib|bin)|txt$/
126
+ self.extra_deps = []
127
+ self.spec_extras = {}
128
+ self.need_tar = true
129
+ self.need_zip = false
130
+
131
+ if name == 'echoe' then
132
+ extra_deps << ['rake']
133
+ extra_deps << ['rubyforge', '>= 0.4.0']
134
+ else
135
+ # extra_deps << ['echoe', ">= #{VERSION}"]
136
+ end
137
+
138
+ yield self if block_given?
139
+
140
+ define_tasks
141
+ end
142
+
143
+ def define_tasks
144
+ desc 'Run the default tasks'
145
+ task :default => :test
146
+
147
+ desc 'Run the test suite. Use FILTER to add to the command line.'
148
+ task :test do
149
+ run_tests
150
+ end
151
+
152
+ desc 'Show which test files fail when run alone.'
153
+ task :test_deps do
154
+ tests = Dir["test/**/test_*.rb"] + Dir["test/**/*_test.rb"]
155
+
156
+ tests.each do |test|
157
+ if not system "ruby -Ibin:lib:test #{test} &> /dev/null" then
158
+ puts "Dependency Issues: #{test}"
159
+ end
160
+ end
161
+ end
162
+
163
+ desc 'Run the test suite using multiruby'
164
+ task :multi do
165
+ run_tests :multi
166
+ end
167
+
168
+ ############################################################
169
+ # Packaging and Installing
170
+
171
+ self.spec = Gem::Specification.new do |s|
172
+ s.name = name
173
+ s.version = version
174
+ s.summary = summary
175
+ case author
176
+ when Array
177
+ s.authors = author
178
+ else
179
+ s.author = author
180
+ end
181
+ s.email = email
182
+ s.homepage = Array(url).first
183
+ s.rubyforge_project = rubyforge_name
184
+
185
+ s.description = description
186
+
187
+ extra_deps.each do |dep|
188
+ s.add_dependency(*dep)
189
+ end
190
+
191
+ s.files = File.read("Manifest.txt").split
192
+ s.executables = s.files.grep(/bin/) { |f| File.basename(f) }
193
+
194
+ s.bindir = "bin"
195
+ dirs = Dir['{lib,ext}']
196
+ s.require_paths = dirs unless dirs.empty?
197
+ s.has_rdoc = true
198
+
199
+ if test ?f, "test/test_all.rb" then
200
+ s.test_file = "test/test_all.rb"
201
+ else
202
+ s.test_files = Dir[*test_globs]
203
+ end
204
+
205
+ # Do any extra stuff the user wants
206
+ spec_extras.each do |msg, val|
207
+ case val
208
+ when Proc
209
+ val.call(s.send(msg))
210
+ else
211
+ s.send "#{msg}=", val
212
+ end
213
+ end
214
+ end
215
+
216
+ desc 'Show information about the gem.'
217
+ task :debug_gem do
218
+ puts spec.to_ruby
219
+ end
220
+
221
+ self.lib_files = spec.files.grep(/^lib/)
222
+ self.bin_files = spec.files.grep(/^bin/)
223
+ self.test_files = spec.files.grep(/^test/)
224
+
225
+ Rake::GemPackageTask.new spec do |pkg|
226
+ pkg.need_tar = @need_tar
227
+ pkg.need_zip = @need_zip
228
+ end
229
+
230
+ desc 'Install the package. Uses PREFIX and RUBYLIB'
231
+ task :install do
232
+ [
233
+ [lib_files + test_files, RUBYLIB, 0444],
234
+ [bin_files, File.join(PREFIX, 'bin'), 0555]
235
+ ].each do |files, dest, mode|
236
+ FileUtils.mkdir_p dest unless test ?d, dest
237
+ files.each do |file|
238
+ install file, dest, :mode => mode
239
+ end
240
+ end
241
+ end
242
+
243
+ desc 'Install the package as a gem'
244
+ task :install_gem => [:clean, :package] do
245
+ sh "sudo gem install pkg/*.gem"
246
+ end
247
+
248
+ desc 'Uninstall the package.'
249
+ task :uninstall do
250
+ Dir.chdir RUBYLIB do
251
+ rm_f((lib_files + test_files).map { |f| File.basename f })
252
+ end
253
+ Dir.chdir File.join(PREFIX, 'bin') do
254
+ rm_f bin_files.map { |f| File.basename f }
255
+ end
256
+ end
257
+
258
+ desc 'Package and upload the release to rubyforge.'
259
+ task :release => [:clean, :package] do |t|
260
+ v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
261
+ abort "Versions don't match #{v} vs #{version}" if v != version
262
+ require 'rubyforge'
263
+ pkg = "pkg/#{name}-#{version}"
264
+
265
+ if $DEBUG then
266
+ puts "release_id = rf.add_release #{rubyforge_name.inspect}, #{name.inspect}, #{version.inspect}, \"#{pkg}.tgz\""
267
+ puts "rf.add_file #{rubyforge_name.inspect}, #{name.inspect}, release_id, \"#{pkg}.gem\""
268
+ end
269
+
270
+ rf = RubyForge.new
271
+ puts "Logging in"
272
+ rf.login
273
+
274
+ c = rf.userconfig
275
+ c["release_notes"] = description if description
276
+ c["release_changes"] = changes if changes
277
+ c["preformatted"] = true
278
+
279
+ files = [(@need_tar ? "#{pkg}.tgz" : nil),
280
+ (@need_zip ? "#{pkg}.zip" : nil),
281
+ "#{pkg}.gem"].compact
282
+
283
+ puts "Releasing #{name} v. #{version}"
284
+ rf.add_release rubyforge_name, name, version, *files
285
+ end
286
+
287
+ ############################################################
288
+ # Doco
289
+
290
+ Rake::RDocTask.new(:docs) do |rd|
291
+ rd.main = "README.txt"
292
+ rd.options << '-d' if RUBY_PLATFORM !~ /win32/ and `which dot` =~ /\/dot/
293
+ rd.rdoc_dir = 'doc'
294
+ files = spec.files.grep(rdoc_pattern)
295
+ files -= ['Manifest.txt']
296
+ rd.rdoc_files.push(*files)
297
+
298
+ title = "#{name}-#{version} Documentation"
299
+ title = "#{rubyforge_name}'s " + title if rubyforge_name != title
300
+
301
+ rd.options << "-t #{title}"
302
+ end
303
+
304
+ desc "Generate ri locally for testing"
305
+ task :ridocs => :clean do
306
+ sh %q{ rdoc --ri -o ri . }
307
+ end
308
+
309
+ desc 'Publish RDoc to RubyForge'
310
+ task :publish_docs => [:clean, :docs] do
311
+ config = YAML.load(File.read(File.expand_path("~/.rubyforge/config.yml")))
312
+ user = "#{config["username"]}@rubyforge.org"
313
+ project = "/var/www/gforge-projects/#{rubyforge_name}"
314
+ project += "/#{name}" if rubyforge_name != name
315
+ local_dir = 'doc'
316
+ pub = Rake::SshDirPublisher.new user, project, local_dir
317
+ if rubyforge_name != name then
318
+ def pub.upload
319
+ begin
320
+ super
321
+ rescue
322
+ # project directory probably doesn't exist, transfer as a whole
323
+ sh %{scp -qr #{local_dir} #{host}:#{remote_dir}}
324
+ end
325
+ end
326
+ end
327
+ pub.upload
328
+ end
329
+
330
+ ############################################################
331
+ # Misc/Maintenance:
332
+
333
+ desc 'Run ZenTest against the package'
334
+ task :audit do
335
+ libs = %w(lib test).join(File::PATH_SEPARATOR)
336
+ sh "zentest -I=#{libs} #{spec.files.grep(/^(lib|test)/).join(' ')}"
337
+ end
338
+
339
+ desc 'Clean up all the extras'
340
+ task :clean => [ :clobber_docs, :clobber_package ] do
341
+ clean_globs.each do |pattern|
342
+ files = Dir[pattern]
343
+ rm_rf files unless files.empty?
344
+ end
345
+ end
346
+
347
+ desc 'Generate email announcement file.'
348
+ task :email do
349
+ require 'rubyforge'
350
+ subject, title, body, urls = announcement
351
+
352
+ File.open("email.txt", "w") do |mail|
353
+ mail.puts "Subject: [ANN] #{subject}"
354
+ mail.puts
355
+ mail.puts title
356
+ mail.puts
357
+ mail.puts urls
358
+ mail.puts
359
+ mail.puts body
360
+ mail.puts
361
+ mail.puts urls
362
+ end
363
+ puts "Created email.txt"
364
+ end
365
+
366
+ desc 'Post announcement to rubyforge.'
367
+ task :post_news do
368
+ require 'rubyforge'
369
+ subject, title, body, urls = announcement
370
+
371
+ rf = RubyForge.new
372
+ rf.login
373
+ rf.post_news(rubyforge_name, subject, "#{title}\n\n#{body}")
374
+ puts "Posted to rubyforge"
375
+ end
376
+
377
+ desc 'Generate email announcement file and post to rubyforge.'
378
+ task :announce => [:email, :post_news]
379
+
380
+ desc "Verify the manifest"
381
+ task :check_manifest => :clean do
382
+ f = "Manifest.tmp"
383
+ require 'find'
384
+ files = []
385
+ Find.find '.' do |path|
386
+ next unless File.file? path
387
+ next if path =~ /svn|tmp$/
388
+ files << path[2..-1]
389
+ end
390
+ files = files.sort.join "\n"
391
+ File.open f, 'w' do |fp| fp.puts files end
392
+ system "diff -du Manifest.txt #{f}"
393
+ rm f
394
+ end
395
+
396
+ end # end define
397
+
398
+ def announcement
399
+ urls = " " + Array(url).map {|s| s.strip}.join("\n ")
400
+
401
+ subject = "#{name} #{version} Released"
402
+ title = "#{name} version #{version} has been released!"
403
+ body = "#{description}\n\nChanges:\n\n#{changes}"
404
+
405
+ return subject, title, body, urls
406
+ end
407
+
408
+ def run_tests(multi=false) # :nodoc:
409
+ msg = multi ? :sh : :ruby
410
+ cmd = if test ?f, 'test/test_all.rb' then
411
+ "#{RUBY_FLAGS} test/test_all.rb #{FILTER}"
412
+ else
413
+ tests = test_globs.map { |g| Dir.glob(g) }.flatten << 'test/unit'
414
+ tests.map! {|f| %Q(require "#{f}")}
415
+ "#{RUBY_FLAGS} -e '#{tests.join("; ")}' #{FILTER}"
416
+ end
417
+ cmd = "multiruby #{cmd}" if multi
418
+ send msg, cmd
419
+ end
420
+
421
+ ##
422
+ # Reads a file at +path+ and spits out an array of the +paragraphs+ specified
423
+ #
424
+ # changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
425
+ # summary, *description = p.paragraphs_of('Readme.txt', 3, 3..8)
426
+
427
+ def paragraphs_of(path, *paragraphs)
428
+ file = File.read(path)
429
+ file.split(/\n\n+/).values_at(*paragraphs)
430
+ end
431
+ end
432
+
433
+ class ::Rake::SshDirPublisher # :nodoc:
434
+ attr_reader :host, :remote_dir, :local_dir
435
+ end
436
+
437
+ if $0 == __FILE__ then
438
+ out = `rake -T | egrep -v "redocs|repackage|clobber|trunk"`
439
+ puts out.gsub(/\#/, '-').gsub(/^rake /, '# * ')
440
+ end
@@ -0,0 +1,26 @@
1
+
2
+ require 'test/unit/testcase'
3
+ require 'echoe'
4
+
5
+ $rakefile = nil # shuts up a warning in rdoctask.rb
6
+
7
+ class TestEchoe < Test::Unit::TestCase
8
+ def setup
9
+ Rake.application.clear
10
+ end
11
+
12
+ ##
13
+ # Yes, these tests suck, but it is damn hard to test this since
14
+ # everything is forked out.
15
+
16
+ def test_basics
17
+ boring = %w(clobber clobber_docs clobber_package doc doc/index.html pkg pkg/blah-1.0.0 pkg/blah-1.0.0.gem pkg/blah-1.0.0.tgz redocs repackage)
18
+ expected = %w(audit announce check_manifest clean debug_gem default docs email gem install install_gem multi package post_news publish_docs release ridocs test test_deps uninstall)
19
+ expected += boring
20
+
21
+ Echoe.new('blah', '1.0.0')
22
+ tasks = Rake.application.tasks.map { |t| t.name }.sort
23
+
24
+ assert_equal expected.sort, tasks
25
+ end
26
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.0.9
3
+ specification_version: 1
4
+ name: echoe
5
+ version: !ruby/object:Gem::Version
6
+ version: 1.0.0
7
+ date: 2007-01-10 00:00:00 -05:00
8
+ summary: Echoe makes gem creation easy.
9
+ require_paths:
10
+ - lib
11
+ email: ""
12
+ homepage: " http://rubyforge.org/projects/fauna/"
13
+ rubyforge_project: fauna
14
+ description: "echoe is a simple rake/rubygems helper for project Rakefiles. It generates all the usual tasks for projects including rdoc generation, testing, packaging, and deployment. Tasks Provided: * announce - Generate email announcement file and post to rubyforge. * audit - Run ZenTest against the package * check_manifest - Verify the manifest * clean - Clean up all the extras * debug_gem - Show information about the gem. * default - Run the default tasks * docs - Build the docs HTML Files * email - Generate email announcement file. * install - Install the package. Uses PREFIX and RUBYLIB * install_gem - Install the package as a gem * multi - Run the test suite using multiruby * package - Build all the packages * post_news - Post announcement to rubyforge. * publish_docs - Publish RDoc to RubyForge * release - Package and upload the release to rubyforge. * ridocs - Generate ri locally for testing * test - Run the test suite. Use FILTER to add to the command line. * test_deps - Show which test files fail when run alone. * uninstall - Uninstall the package. See class rdoc for help. Hint: ri echoe"
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - ""
31
+ files:
32
+ - History.txt
33
+ - Manifest.txt
34
+ - README.txt
35
+ - LICENSE.txt
36
+ - Rakefile
37
+ - bin/echoe
38
+ - lib/echoe.rb
39
+ - test/test_echoe.rb
40
+ test_files:
41
+ - test/test_echoe.rb
42
+ rdoc_options: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ executables:
47
+ - echoe
48
+ extensions: []
49
+
50
+ requirements: []
51
+
52
+ dependencies:
53
+ - !ruby/object:Gem::Dependency
54
+ name: rake
55
+ version_requirement:
56
+ version_requirements: !ruby/object:Gem::Version::Requirement
57
+ requirements:
58
+ - - ">"
59
+ - !ruby/object:Gem::Version
60
+ version: 0.0.0
61
+ version:
62
+ - !ruby/object:Gem::Dependency
63
+ name: rubyforge
64
+ version_requirement:
65
+ version_requirements: !ruby/object:Gem::Version::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 0.4.0
70
+ version: