Didn't commit the whole tree in [191]. This commit contains all the fixes referred to in the log for [191].



git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@192 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
bsag 2006-02-26 11:03:18 +00:00
parent e2487c412b
commit aa0760f0ef
80 changed files with 501 additions and 7259 deletions

View file

@ -20,7 +20,7 @@ class LoginController < ApplicationController
redirect_back_or_default :controller => "todo", :action => "list"
else
@login = @params['user_login']
@message = "Login unsuccessful"
flash['warning'] = "Login unsuccessful"
end
end
end
@ -51,13 +51,13 @@ class LoginController < ApplicationController
return
end
user.is_admin = 1 if User.find_all.empty?
user.is_admin = true if User.find_all.empty?
if user.save
@session['user'] = User.authenticate(user.login, @params['user']['password'])
@user = @session['user']
#@session['user'] = User.authenticate(user.login, @params['user']['password'])
@user = User.authenticate(user.login, @params['user']['password'])
@user.preferences = { "date_format" => "%d/%m/%Y", "week_starts" => "1", "no_completed" => "5", "staleness_starts" => "7", "due_style" => "1", "admin_email" => "butshesagirl@rousette.org.uk"}
@user.save
flash['notice'] = "Signup successful"
flash['notice'] = "Signup successful for user #{@user.login}."
redirect_back_or_default :controller => "todo", :action => "list"
end
end

View file

@ -1,5 +1,6 @@
class UserController < ApplicationController
layout 'standard'
before_filter :login_required
def index
render_text "This will be our jumping-off point for managing user functions!"
@ -37,7 +38,7 @@ class UserController < ApplicationController
end
def change_password
@page_title = "Change password"
@page_title = "TRACKS::Change password"
@user = @session['user']
end

View file

@ -18,8 +18,6 @@ class User < ActiveRecord::Base
def change_password(pass,pass_confirm)
self.password = pass
self.password_confirmation = pass_confirm
# update_attribute("password", self.class.sha1(pass)) if pass == pass_confirm
# update_attribute("word", self.class.sha1(login + Time.now.to_i.to_s + rand.to_s))
end
protected
@ -29,7 +27,8 @@ protected
Digest::SHA1.hexdigest("#{SALT}--#{pass}--")
end
after_validation :crypt_password_and_word
before_create :crypt_password_and_word
before_update :crypt_password_and_word
def crypt_password_and_word
write_attribute("password", self.class.sha1(password)) if password == @password_confirmation

View file

@ -0,0 +1,32 @@
<div id="single_box" class="container context">
<h2><%= @page_title %></h2>
<% for name in ["notice", "warning", "message"] %>
<% if flash[name] %>
<%= "<div id=\"#{name}\">#{flash[name]}</div>" %>
<% end %>
<% end %>
<%= error_messages_for 'user' %>
<p>Enter your new password in the fields below and click 'Change Password' to replace your current password with your new one (note that this will also change the URL you use to subscribe to your RSS or text field).</p>
<%= start_form_tag :action => 'update_password' %>
<table width="440px">
<tr>
<td><label for="updateuser_password">New password:</label></td>
<td><%= password_field "updateuser", "password", :size => 40 %></td>
</tr>
<tr>
<td><label for="updateuser_password_confirmation">Confirm password:</label></td>
<td><%= password_field "updateuser", "password_confirmation", :size => 40 %></td>
</tr>
<tr>
<td><%= link_to 'Cancel', :action => 'preferences' %></td>
<td><%= submit_tag 'Change password' %></td>
</tr>
</table>
<%= end_form_tag %>
</div>

View file

@ -21,3 +21,4 @@ config.action_mailer.delivery_method = :test
# config.transactional_fixtures = true
# config.instantiated_fixtures = false
# config.pre_loaded_fixtures = false
SALT = "change-me" unless defined?( SALT ).nil?

View file

@ -79,6 +79,24 @@ div.memo {
padding: 0px;
}
#warning {
padding: 2px;
border: 1px solid #ED2E38;
background-color: #F6979C;
color: #000000;
margin: 15px 5px;
text-align: center;
}
#message {
padding: 2px;
border: 1px solid #CCC;
background-color: #D2D3D6;
color: #666;
margin: 15px 5px;
text-align: center;
}
/* Error message styles */
.fieldWithErrors {
padding: 2px;

View file

@ -286,7 +286,7 @@ a.footer_link:hover {color: #fff; background-color: #cc3334 !important;}
padding: 2px;
border: 1px solid #ED2E38;
background-color: #F6979C;
color: #FFFFFF;
color: #000000;
margin: 15px 5px;
text-align: center;
}

View file

@ -0,0 +1,437 @@
# Logfile created on Wed Feb 22 09:02:35 GMT 2006 by logger.rb/1.5.2.4
SQL (0.364451) CREATE TABLE 'accounts' (
'id' INTEGER PRIMARY KEY NOT NULL,
'firm_id' INTEGER DEFAULT NULL,
'credit_limit' INTEGER DEFAULT NULL
)
SQL (0.311816) 
CREATE TABLE 'companies' (
'id' INTEGER PRIMARY KEY NOT NULL,
'type' VARCHAR(255) DEFAULT NULL,
'ruby_type' VARCHAR(255) DEFAULT NULL,
'firm_id' INTEGER DEFAULT NULL,
'name' TEXT DEFAULT NULL,
'client_of' INTEGER DEFAULT NULL,
'rating' INTEGER DEFAULT 1
)
SQL (0.327027) 
CREATE TABLE 'topics' (
'id' INTEGER PRIMARY KEY NOT NULL,
'title' VARCHAR(255) DEFAULT NULL,
'author_name' VARCHAR(255) DEFAULT NULL,
'author_email_address' VARCHAR(255) DEFAULT NULL,
'written_on' DATETIME DEFAULT NULL,
'bonus_time' TIME DEFAULT NULL,
'last_read' DATE DEFAULT NULL,
'content' TEXT,
'approved' boolean DEFAULT 't',
'replies_count' INTEGER DEFAULT 0,
'parent_id' INTEGER DEFAULT NULL,
'type' VARCHAR(255) DEFAULT NULL
)
SQL (0.356027) 
CREATE TABLE 'developers' (
'id' INTEGER PRIMARY KEY NOT NULL,
'name' TEXT DEFAULT NULL,
'salary' INTEGER DEFAULT 70000,
'created_at' DATETIME DEFAULT NULL,
'updated_at' DATETIME DEFAULT NULL
)
SQL (0.327498) 
CREATE TABLE 'projects' (
'id' INTEGER PRIMARY KEY NOT NULL,
'name' TEXT DEFAULT NULL,
'type' VARCHAR(255) DEFAULT NULL
)
SQL (0.327152) 
CREATE TABLE 'developers_projects' (
'developer_id' INTEGER NOT NULL,
'project_id' INTEGER NOT NULL,
'joined_on' DATE DEFAULT NULL,
'access_level' INTEGER DEFAULT 1
)
SQL (0.326826) 
CREATE TABLE 'orders' (
'id' INTEGER PRIMARY KEY NOT NULL,
'name' VARCHAR(255) DEFAULT NULL,
'billing_customer_id' INTEGER DEFAULT NULL,
'shipping_customer_id' INTEGER DEFAULT NULL
)
SQL (0.356291) 
CREATE TABLE 'customers' (
'id' INTEGER PRIMARY KEY NOT NULL,
'name' VARCHAR(255) DEFAULT NULL,
'balance' INTEGER DEFAULT 0,
'address_street' TEXT DEFAULT NULL,
'address_city' TEXT DEFAULT NULL,
'address_country' TEXT DEFAULT NULL,
'gps_location' TEXT DEFAULT NULL
)
SQL (0.313541) 
CREATE TABLE 'movies' (
'movieid' INTEGER PRIMARY KEY NOT NULL,
'name' VARCHAR(255) DEFAULT NULL
)
SQL (0.341444) 
CREATE TABLE subscribers (
'nick' VARCHAR(255) PRIMARY KEY NOT NULL,
'name' VARCHAR(255) DEFAULT NULL
)
SQL (0.356109) 
CREATE TABLE 'booleantests' (
'id' INTEGER PRIMARY KEY NOT NULL,
'value' INTEGER DEFAULT NULL
)
SQL (0.299288) 
CREATE TABLE 'auto_id_tests' (
'auto_id' INTEGER PRIMARY KEY NOT NULL,
'value' INTEGER DEFAULT NULL
)
SQL (0.327438) 
CREATE TABLE 'entrants' (
'id' INTEGER NOT NULL PRIMARY KEY,
'name' VARCHAR(255) NOT NULL,
'course_id' INTEGER NOT NULL
)
SQL (0.342461) 
CREATE TABLE 'colnametests' (
'id' INTEGER NOT NULL PRIMARY KEY,
'references' INTEGER NOT NULL
)
SQL (0.326617) 
CREATE TABLE 'mixins' (
'id' INTEGER NOT NULL PRIMARY KEY,
'parent_id' INTEGER DEFAULT NULL,
'type' VARCHAR(40) DEFAULT NULL,
'pos' INTEGER DEFAULT NULL,
'lft' INTEGER DEFAULT NULL,
'rgt' INTEGER DEFAULT NULL,
'root_id' INTEGER DEFAULT NULL,
'created_at' DATETIME DEFAULT NULL,
'updated_at' DATETIME DEFAULT NULL
)
SQL (0.298901) 
CREATE TABLE 'people' (
'id' INTEGER NOT NULL PRIMARY KEY,
'first_name' VARCHAR(40) DEFAULT NULL,
'lock_version' INTEGER NOT NULL DEFAULT 0
)
SQL (0.383537) 
CREATE TABLE 'binaries' (
'id' INTEGER NOT NULL PRIMARY KEY,
'data' BLOB DEFAULT NULL
)
SQL (0.314553) 
CREATE TABLE 'computers' (
'id' INTEGER NOT NULL PRIMARY KEY,
'developer' INTEGER NOT NULL,
'extendedWarranty' INTEGER NOT NULL
)
SQL (0.313509) 
CREATE TABLE 'posts' (
'id' INTEGER NOT NULL PRIMARY KEY,
'author_id' INTEGER,
'title' VARCHAR(255) NOT NULL,
'type' VARCHAR(255) NOT NULL,
'body' TEXT NOT NULL
)
SQL (0.312656) 
CREATE TABLE 'comments' (
'id' INTEGER NOT NULL PRIMARY KEY,
'post_id' INTEGER NOT NULL,
'type' VARCHAR(255) NOT NULL,
'body' TEXT NOT NULL
)
SQL (0.370833) 
CREATE TABLE 'authors' (
'id' INTEGER NOT NULL PRIMARY KEY,
'name' VARCHAR(255) NOT NULL
)
SQL (0.341725) 
CREATE TABLE 'tasks' (
'id' INTEGER NOT NULL PRIMARY KEY,
'starting' DATETIME DEFAULT NULL,
'ending' DATETIME DEFAULT NULL
)
SQL (0.313227) 
CREATE TABLE 'categories' (
'id' INTEGER NOT NULL PRIMARY KEY,
'name' VARCHAR(255) NOT NULL,
'type' VARCHAR(255) DEFAULT NULL
)
SQL (0.342654) 
CREATE TABLE 'categories_posts' (
'category_id' INTEGER NOT NULL,
'post_id' INTEGER NOT NULL
)
SQL (0.355434) 
CREATE TABLE 'fk_test_has_pk' (
'id' INTEGER NOT NULL PRIMARY KEY
)
SQL (0.313012) 
CREATE TABLE 'fk_test_has_fk' (
'id' INTEGER NOT NULL PRIMARY KEY,
'fk_id' INTEGER NOT NULL,
FOREIGN KEY ('fk_id') REFERENCES 'fk_test_has_pk'('id')
)
SQL (0.327909) 
CREATE TABLE 'keyboards' (
'key_number' INTEGER PRIMARY KEY NOT NULL,
'name' VARCHAR(255) DEFAULT NULL
)
SQL (0.354369) CREATE TABLE 'courses' (
'id' INTEGER NOT NULL PRIMARY KEY,
'name' VARCHAR(255) NOT NULL
)
SQL (0.008238) PRAGMA table_info(topics)
SQL (0.001936) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES(NULL, NULL, NULL, 't', NULL, 0, NULL, '---
- one
- two
- three', '2006-02-22 09:02:48', NULL, NULL)
Topic Load (0.000691) SELECT * FROM topics WHERE (topics.id = 0) LIMIT 1
Topic Load (0.004732) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
SQL (0.021708) PRAGMA table_info(auto_id_tests)
SQL (0.001471) INSERT INTO auto_id_tests ("value") VALUES(NULL)
Company Load (0.004551) SELECT * FROM companies WHERE (companies.id = 1) LIMIT 1
SQL (0.011168) PRAGMA table_info(companies)
Firm Update (0.002707) UPDATE companies SET "name" = '37signals', "client_of" = NULL, "rating" = 2147483647, "firm_id" = NULL, "ruby_type" = 'Firm', "type" = 'Firm' WHERE id = 1
Company Load (0.002322) SELECT * FROM companies WHERE (companies.id = 1) LIMIT 1
SQL (0.011983) PRAGMA table_info(booleantests)
SQL (0.001625) INSERT INTO booleantests ("value") VALUES(0)
SQL (0.000608) INSERT INTO booleantests ("value") VALUES(1)
Booleantest Load (0.000551) SELECT * FROM booleantests WHERE (booleantests.id = 0) LIMIT 1
Topic Load (0.004215) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Load (0.002738) SELECT * FROM topics WHERE (topics.id = 2) LIMIT 1
Computer Load (0.004049) SELECT * FROM computers LIMIT 1
SQL (0.007553) PRAGMA table_info(computers)
SQL (0.018187) PRAGMA table_info(topics)
SQL (0.004108) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES(NULL, 'hello', 'Reply', 't', NULL, 0, NULL, 'world', '2006-02-22 09:02:48', NULL, NULL)
Topic Load (0.002219) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Reply Load (0.000843) SELECT * FROM topics WHERE (topics.parent_id = 1) AND ( (topics."type" = 'Reply' OR topics."type" = 'SillyReply' ) ) 
Reply Update (0.002640) UPDATE topics SET "bonus_time" = NULL, "approved" = 't', "written_on" = '2006-02-22 09:02:48', "author_email_address" = NULL, "content" = 'world', "replies_count" = 0, "title" = 'hello', "author_name" = NULL, "parent_id" = 1, "last_read" = NULL, "type" = 'Reply' WHERE id = 0
Topic Delete all (0.000936) DELETE FROM topics WHERE (id IN (1)) 
Topic Load (0.000583) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Reply Load (0.000979) SELECT * FROM topics WHERE (topics.id = 0) AND ( (topics."type" = 'Reply' OR topics."type" = 'SillyReply' ) ) LIMIT 1
SQL (0.003438) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES(NULL, 'hello', 'Reply', 't', NULL, 0, NULL, 'world', '2006-02-22 09:02:48', NULL, NULL)
Topic Load (0.002749) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Reply Load (0.000902) SELECT * FROM topics WHERE (topics.parent_id = 1) AND ( (topics."type" = 'Reply' OR topics."type" = 'SillyReply' ) ) 
Reply Update (0.001912) UPDATE topics SET "bonus_time" = NULL, "approved" = 't', "written_on" = '2006-02-22 09:02:48', "author_email_address" = NULL, "content" = 'world', "replies_count" = 0, "title" = 'hello', "author_name" = NULL, "parent_id" = 1, "last_read" = NULL, "type" = 'Reply' WHERE id = 0
Topic Load (0.002545) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Reply Load (0.000860) SELECT * FROM topics WHERE (topics.parent_id = 1) AND ( (topics."type" = 'Reply' OR topics."type" = 'SillyReply' ) ) 
Topic Delete all (0.000451) DELETE FROM topics WHERE (parent_id = 1) 
Topic Destroy (0.000557)  DELETE FROM topics
WHERE id = 1

Topic Load (0.001116) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Reply Load (0.000589) SELECT * FROM topics WHERE (topics.id = 0) AND ( (topics."type" = 'Reply' OR topics."type" = 'SillyReply' ) ) LIMIT 1
SQL (0.011551) PRAGMA table_info(companies)
Client Load (0.004009) SELECT * FROM companies WHERE (companies.id = 3) AND ( (companies."type" = 'Client' OR companies."type" = 'SpecialClient' OR companies."type" = 'VerySpecialClient' ) ) LIMIT 1
Firm Load (0.007877) SELECT * FROM companies WHERE (companies.id = 1) AND ( (companies."type" = 'Firm' ) ) LIMIT 1
Firm Load (0.002278) SELECT * FROM companies WHERE (companies.id = 1) AND ( (companies."type" = 'Firm' ) ) LIMIT 1
Client Load (0.003355) SELECT * FROM companies WHERE (companies.firm_id = 1) AND ( (companies."type" = 'Client' OR companies."type" = 'SpecialClient' OR companies."type" = 'VerySpecialClient' ) ) ORDER BY id 
Client Load (0.005013) SELECT * FROM companies WHERE (companies.firm_id = 1) AND ( (companies."type" = 'Client' OR companies."type" = 'SpecialClient' OR companies."type" = 'VerySpecialClient' ) ) ORDER BY id 
Topic Load (0.010690) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
SQL (0.001431) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES('David', '---
a: c', NULL, 'f', '2000-01-01 14:28:00', 0, 'david@loudthinking.com', 'Have a nice day', '2003-07-16 15:28:00', '2004-04-15', NULL)
Company Load (0.008524) SELECT * FROM companies WHERE (companies.id = 3) LIMIT 1
DeveloperWithAggregate Load (0.008655) SELECT * FROM developers WHERE (developers.id = 1) LIMIT 1
SQL (0.005846) PRAGMA table_info(developers)
SQL (0.002019) INSERT INTO developers ("name", "updated_at", "salary", "created_at") VALUES('David', '2006-02-22 09:02:49', 80000, '2006-02-22 09:02:49')
SQL (0.004239) PRAGMA table_info(colnametests)
SQL (0.002245) INSERT INTO colnametests ("references") VALUES(40)
ColumnName Update (0.002336) UPDATE colnametests SET "references" = 41 WHERE id = 0
ColumnName Load (0.001016) SELECT * FROM colnametests WHERE (colnametests.id = 0) LIMIT 1
Post Count (0.003503) SELECT COUNT(*) FROM posts LEFT JOIN comments ON posts.id=comments.post_id WHERE posts."type" = 'Post'
Post Count (0.001267) SELECT COUNT(*) FROM posts LEFT JOIN comments ON posts.id=comments.post_id WHERE (posts."type" = 'Post') 
SQL (0.003124) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES(NULL, 'New Topic', NULL, 't', NULL, 0, NULL, NULL, '2006-02-22 09:02:49', NULL, NULL)
Topic Load (0.000694) SELECT * FROM topics WHERE (topics.id = 0) LIMIT 1
SQL (0.003434) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES(NULL, 'Another New Topic', NULL, 't', NULL, 0, NULL, NULL, '2006-02-22 09:02:49', NULL, NULL)
SQL (0.003293) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES(NULL, 'first', NULL, 't', NULL, 0, NULL, NULL, '2006-02-22 09:02:49', NULL, NULL)
SQL (0.000571) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES(NULL, 'second', NULL, 't', NULL, 0, NULL, NULL, '2006-02-22 09:02:49', NULL, NULL)
SQL (0.003338) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES(NULL, 'New Topic', NULL, 't', NULL, 0, NULL, NULL, '2006-02-22 09:02:49', NULL, NULL)
Topic Load (0.000593) SELECT * FROM topics WHERE (topics.id = 0) LIMIT 1
SQL (0.006616) PRAGMA table_info(subscribers)
SQL (0.002865) PRAGMA table_info(keyboards)
Topic Load (0.004479) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Update (0.002569) UPDATE topics SET "bonus_time" = '2000-01-01 14:28:00', "approved" = 'f', "written_on" = '2003-07-16 15:28:00', "author_email_address" = 'david@loudthinking.com', "content" = 'Have a nice day', "replies_count" = 2, "title" = 'The First Topic', "author_name" = 'David', "parent_id" = NULL, "last_read" = '2004-04-15', "type" = NULL WHERE id = 1
Topic Update (0.000962) UPDATE topics SET "bonus_time" = '2000-01-01 14:28:00', "approved" = 'f', "written_on" = '2003-07-16 15:28:00', "author_email_address" = 'david@loudthinking.com', "content" = 'Have a nice day', "replies_count" = 1, "title" = 'The First Topic', "author_name" = 'David', "parent_id" = NULL, "last_read" = '2004-04-15', "type" = NULL WHERE id = 1
Reply Load (0.000735) SELECT * FROM topics WHERE (topics.parent_id = 1) AND ( (topics."type" = 'Reply' OR topics."type" = 'SillyReply' ) ) 
Topic Load (0.002504) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Update (0.000755) UPDATE topics SET "bonus_time" = '2000-01-01 14:28:00', "approved" = 'f', "written_on" = '2003-07-16 15:28:00', "author_email_address" = 'david@loudthinking.com', "content" = 'Have a nice day', "replies_count" = -1, "title" = 'The First Topic', "author_name" = 'David', "parent_id" = NULL, "last_read" = '2004-04-15', "type" = NULL WHERE id = 1
Reply Load (0.000948) SELECT * FROM topics WHERE (topics.parent_id = 1) AND ( (topics."type" = 'Reply' OR topics."type" = 'SillyReply' ) ) 
Topic Load (0.002257) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Update (0.010406) UPDATE topics SET replies_count = replies_count - 1 WHERE (id = 2) 
Topic Load (0.002498) SELECT * FROM topics WHERE (topics.id = 2) LIMIT 1
Topic Update (0.001241) UPDATE topics SET replies_count = replies_count - 1 WHERE (id = 2) 
Topic Load (0.002399) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
SQL (0.003381) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES(NULL, NULL, NULL, 't', NULL, 0, NULL, NULL, '2006-02-22 09:02:49', NULL, NULL)
Topic Load (0.001056) SELECT * FROM topics WHERE (topics.id = 0) LIMIT 1
SQL (0.002852) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES(NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, '2006-02-22 09:02:49', NULL, NULL)
Topic Load (0.000600) SELECT * FROM topics WHERE (topics.id = 0) LIMIT 1
Topic Delete all (0.040234) DELETE FROM topics WHERE 1=1
Topic Delete all (0.003659) DELETE FROM topics WHERE (id IN (1,2)) 
Topic Count (0.001563) SELECT COUNT(*) FROM topics 
SQL (0.003603) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES(NULL, 'Yet Another New Topic', NULL, 't', NULL, 0, NULL, NULL, '2003-12-12 23:23:00', NULL, NULL)
Reply Load (0.003346) SELECT * FROM topics WHERE (topics.parent_id = 0) AND ( (topics."type" = 'Reply' OR topics."type" = 'SillyReply' ) ) 
Topic Delete all (0.000497) DELETE FROM topics WHERE (parent_id = 0) 
Topic Destroy (0.000409)  DELETE FROM topics
WHERE id = 0

Topic Load (0.001023) SELECT * FROM topics WHERE (topics.id = 0) LIMIT 1
Topic Count (0.003070) SELECT COUNT(*) FROM topics 
Topic Load (0.002273) SELECT * FROM topics WHERE (author_name = 'Mary') 
Reply Load (0.001030) SELECT * FROM topics WHERE (topics.parent_id = 2) AND ( (topics."type" = 'Reply' OR topics."type" = 'SillyReply' ) ) 
Topic Delete all (0.001630) DELETE FROM topics WHERE (parent_id = 2) 
Topic Destroy (0.000750)  DELETE FROM topics
WHERE id = 2

Topic Count (0.001248) SELECT COUNT(*) FROM topics 
Client Count (0.003684) SELECT COUNT(*) FROM companies WHERE ( (companies."type" = 'Client' OR companies."type" = 'SpecialClient' OR companies."type" = 'VerySpecialClient' ) ) 
Client Load (0.007093) SELECT * FROM companies WHERE (companies.id = 2) AND ( (companies."type" = 'Client' OR companies."type" = 'SpecialClient' OR companies."type" = 'VerySpecialClient' ) ) LIMIT 1
Firm Load (0.000661) SELECT * FROM companies WHERE (companies.id = 2) AND ( (companies."type" = 'Firm' ) ) LIMIT 1
Client Destroy (0.001917)  DELETE FROM companies
WHERE id = 2

Client Load (0.001796) SELECT * FROM companies WHERE (companies.id = 3) AND ( (companies."type" = 'Client' OR companies."type" = 'SpecialClient' OR companies."type" = 'VerySpecialClient' ) ) LIMIT 1
Firm Load (0.002688) SELECT * FROM companies WHERE (companies.id = 1) AND ( (companies."type" = 'Firm' ) ) LIMIT 1
Client Destroy (0.000853)  DELETE FROM companies
WHERE id = 3

Client Count (0.001605) SELECT COUNT(*) FROM companies WHERE ( (companies."type" = 'Client' OR companies."type" = 'SpecialClient' OR companies."type" = 'VerySpecialClient' ) ) 
Client Load (0.005973) SELECT * FROM companies WHERE (companies.id = 3) AND ( (companies."type" = 'Client' OR companies."type" = 'SpecialClient' OR companies."type" = 'VerySpecialClient' ) ) LIMIT 1
Firm Load (0.002549) SELECT * FROM companies WHERE (companies.id = 1) AND ( (companies."type" = 'Firm' ) ) LIMIT 1
Client Destroy (0.001864)  DELETE FROM companies
WHERE id = 3

SQL (0.003713) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES(NULL, 'Yet Another Title', NULL, 't', NULL, 0, NULL, NULL, '2006-02-22 09:02:49', NULL, NULL)
Reply Load (0.001058) SELECT * FROM topics WHERE (topics.parent_id = 0) AND ( (topics."type" = 'Reply' OR topics."type" = 'SillyReply' ) ) 
Topic Delete all (0.000551) DELETE FROM topics WHERE (parent_id = 0) 
Topic Destroy (0.000773)  DELETE FROM topics
WHERE id = 0

Topic Load (0.008984) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Load (0.002726) SELECT * FROM topics WHERE (topics.id = 2) LIMIT 1
Topic Load (0.002896) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
SQL (0.003320) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES(NULL, NULL, NULL, 't', NULL, 0, NULL, '---
two: 2
one: 1', '2006-02-22 09:02:49', NULL, NULL)
Topic Load (0.000604) SELECT * FROM topics WHERE (topics.id = 0) LIMIT 1
Topic Load (0.009243) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Load (0.002759) SELECT * FROM topics WHERE (topics.id = 2) LIMIT 1
Topic Load (0.005795) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Load (0.002667) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Load (0.008666) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Update (0.002875) UPDATE topics SET "bonus_time" = '2000-01-01 14:28:00', "approved" = 'f', "written_on" = '2003-07-16 15:28:00', "author_email_address" = 'david@loudthinking.com', "content" = 'Have a nice day', "replies_count" = 1, "title" = 'The First Topic', "author_name" = 'David', "parent_id" = NULL, "last_read" = '2004-04-15', "type" = NULL WHERE id = 1
Topic Load (0.003552) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Update (0.001403) UPDATE topics SET "bonus_time" = '2000-01-01 14:28:00', "approved" = 'f', "written_on" = '2003-07-16 15:28:00', "author_email_address" = 'david@loudthinking.com', "content" = 'Have a nice day', "replies_count" = 3, "title" = 'The First Topic', "author_name" = 'David', "parent_id" = NULL, "last_read" = '2004-04-15', "type" = NULL WHERE id = 1
Reply Load (0.000694) SELECT * FROM topics WHERE (topics.parent_id = 1) AND ( (topics."type" = 'Reply' OR topics."type" = 'SillyReply' ) ) 
Topic Load (0.002520) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Update (0.009274) UPDATE topics SET replies_count = replies_count + 1 WHERE (id = 1) 
Topic Load (0.002998) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Update (0.000938) UPDATE topics SET replies_count = replies_count + 1 WHERE (id = 1) 
Topic Load (0.002618) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Load (0.009468) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Update (0.005177) UPDATE topics SET "bonus_time" = '2000-01-01 14:28:00', "approved" = 'f', "written_on" = '2003-07-16 15:28:00', "author_email_address" = 'david@loudthinking.com', "content" = 'Have a nice day', "replies_count" = 0, "title" = 'The First Topic', "author_name" = 'David', "parent_id" = 1, "last_read" = '2004-04-15', "type" = NULL WHERE id = 1
SQL (0.010030) INSERT INTO auto_id_tests ("value") VALUES(NULL)
AutoId Load (0.000585) SELECT * FROM auto_id_tests WHERE (auto_id_tests.auto_id = 0) LIMIT 1
SQL (0.006707) PRAGMA table_info(categories)
Topic Load (0.012476) SELECT * FROM topics ORDER BY id 
Topic Load (0.002900) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Load (0.009610) SELECT * FROM topics WHERE (author_name = 'Mary') 
Topic Load (0.002122) SELECT * FROM topics WHERE (topics.id = 2) LIMIT 1
SQL (0.006091) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES(NULL, 'hello', 'Reply', 't', NULL, 0, NULL, 'world', '2006-02-22 09:02:50', NULL, NULL)
Reply Update (0.002221) UPDATE topics SET "bonus_time" = NULL, "approved" = 'f', "written_on" = '2006-02-22 09:02:50', "author_email_address" = NULL, "content" = 'world', "replies_count" = 0, "title" = 'hello', "author_name" = NULL, "parent_id" = NULL, "last_read" = NULL, "type" = 'Reply' WHERE id = 0
Topic Load (0.004532) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Load (0.011355) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Load (0.003861) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Load (0.004536) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Load (0.009412) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
SQL (0.012033) PRAGMA table_info(tasks)
Topic Load (0.003992) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
SQL (0.002058) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES(NULL, 'Hey you', NULL, 't', NULL, 0, NULL, NULL, '2006-02-22 09:02:50', NULL, NULL)
Topic Load (0.013915) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Load (0.004504) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Load (0.002590) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
SQL (0.003083) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES('\  ''
\n "', NULL, NULL, 't', NULL, 0, NULL, NULL, '2006-02-22 09:02:50', NULL, NULL)
Topic Load (0.000578) SELECT * FROM topics WHERE (topics.id = 0) LIMIT 1
Topic Load (0.006271) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Load (0.012460) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Load (0.005476) SELECT * FROM topics LIMIT 1
Exception occured during reader method compilation.
Maybe mumub-jumbo is not a valid Ruby identifier?
(eval):1:in `class_eval': compile error
(eval):1: syntax error
def mumub-jumbo; raise NoMethodError, 'missing attribute: mumub-jumbo', caller unless @attributes.has_key?('mumub-jumbo'); @attributes['mumub-jumbo']; end
^
(eval):1: syntax error
def mumub-jumbo; raise NoMethodError, 'missing attribute: mumub-jumbo', caller unless @attributes.has_key?('mumub-jumbo'); @attributes['mumub-jumbo']; end
^
Topic Load (0.010857) SELECT * FROM topics LIMIT 1
Firm Load (0.002415) SELECT * FROM companies WHERE ( (companies."type" = 'Firm' ) ) LIMIT 1
Client Load (0.001866) SELECT * FROM companies WHERE ( (companies."type" = 'Client' OR companies."type" = 'SpecialClient' OR companies."type" = 'VerySpecialClient' ) ) LIMIT 1
Topic Load (0.002584) SELECT * FROM topics WHERE (topics.id = 99999) LIMIT 1
Topic Load (0.011069) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Load (0.002149) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Update (0.003213) UPDATE topics SET "bonus_time" = '2000-01-01 14:28:00', "approved" = 'f', "written_on" = '2003-07-16 15:28:00', "author_email_address" = 'david@loudthinking.com', "content" = 'Have a nice day', "replies_count" = 0, "title" = 'something else', "author_name" = 'David', "parent_id" = NULL, "last_read" = '2004-04-15', "type" = NULL WHERE id = 1
Topic Load (0.002511) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Load (0.004236) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Developer Load (0.003825) SELECT * FROM developers WHERE (salary > 90000) AND (id < 5) 
Developer Load (0.001538) SELECT * FROM developers WHERE (developers.id = 1) LIMIT 1
SQL (0.003689) PRAGMA table_info(developers)
Developer Load (0.012198) SELECT * FROM developers ORDER BY id LIMIT 3 OFFSET 2
Developer Load (0.001852) SELECT * FROM developers WHERE (developers.id = 1) LIMIT 1
Developer Load (0.003312) SELECT * FROM developers WHERE (developers.id = 1) LIMIT 1
Developer Load (0.005539) SELECT * FROM developers ORDER BY id 
SQL (0.003824) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES(NULL, NULL, NULL, 't', NULL, 0, NULL, '--- !ruby/struct:BasicsTest::MyObject
attribute1: value1
attribute2: value2', '2006-02-22 09:02:50', NULL, NULL)
SQL (0.003664) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES(NULL, NULL, NULL, 't', NULL, 0, NULL, '--- !ruby/struct:BasicsTest::MyObject
attribute1: value1
attribute2: value2', '2006-02-22 09:02:50', NULL, NULL)
Topic Load (0.000653) SELECT * FROM topics WHERE (topics.id = 0) LIMIT 1
Topic Load (0.004584) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
SQL (0.011570) SELECT name FROM sqlite_master WHERE type = 'table'
SQL (0.013690) SELECT name FROM sqlite_master WHERE type = 'table'
Topic Load (0.004343) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
SQL (0.003293) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES(NULL, 'Another New Topic', NULL, 't', NULL, 0, NULL, NULL, '2003-12-12 23:23:00', NULL, NULL)
Topic Load (0.000615) SELECT * FROM topics WHERE (topics.id = 0) LIMIT 1
Topic Update (0.004120) UPDATE topics SET content = 'bulk updated!' 
Topic Load (0.002553) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Load (0.004413) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Load (0.002548) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Update (0.004526) UPDATE topics SET content = 'bulk updated!' WHERE (approved = 't') 
Topic Load (0.002641) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
SQL (0.003577) INSERT INTO topics ("author_name", "title", "type", "approved", "bonus_time", "replies_count", "author_email_address", "content", "written_on", "last_read", "parent_id") VALUES(NULL, 'Still another topic', NULL, 't', NULL, 0, NULL, NULL, '2006-02-22 09:02:51', NULL, NULL)
Topic Load (0.000582) SELECT * FROM topics WHERE (topics.id = 0) LIMIT 1
Topic Load (0.004113) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1
Topic Load (0.011675) SELECT * FROM topics WHERE (topics.id = 1) LIMIT 1

View file

@ -1,234 +0,0 @@
= Rake Changelog
== PreVersion 0.5.5
* Fixed file creation bug in the unit tests (caused infinite loop on
windows).
* Fixed bug where session based functional tests were run under
windows.
* Fixed bug in directory tasks so that updating a directory will not
retrigger file tasks depending on the directory (see
FileCreationTask and EarlyTime).
* Added egrep to FileList
* ruby command now runs same ruby version as rake.
* Added investigation to task object. (suggested by Martin Fowler)
* Added ruby_opts to the test task to allow arbitrary ruby options to
be passed to the test script. (Greg Fast)
* Fixed the test loader to ignore options. (Greg Fast)
* Moved Task, FileTask, FileCreationTask and RakeApp into the Rake
module namespace. Old style namespace behavior can be invoked via
the --classic-namespace option. (requested by Kelly Felkins).
* GemTask is now sensitive to the gem platform (Masao Mutoh).
* A non-existing file prerequisite will no longer cause an exception
(Philipp Neubeck).
* Multiple prerequisites on Rake rules now allowed (initial patch
supplied by Stuart Jansen).
== Version 0.5.4
* Added double quotes to the test runner.
* Added .svn to default ignore list.
* Updated FileList#include to support nested arrays and filelists.
== Version 0.5.3
* Added support for importing Rakefile and other dependencies.
* Fixed bug so that now rules can chain off of existing tasks as well
as existing files.
* Fixed verbose flag bug in the testing task. Shortened some failure
messages.
* Make FileUtils methods private at the top level module to avoid
accidental method leaking into other objects.
* Added test loader option to test task. "testrb" is no longer the
default test loader. It is now eating syntax errors that should
halt the unit tests.
* Revamped FileList so that it works more like and array (addressed
flatten bug). Added many tests around file list.
* Added +ext+ method to both String and FileList.
== Version 0.5.0
* Fixed documentation that was lacking the Rake module name (Tilman
Sauerbeck).
* Added tar.gz and tar.bz2 support to package task (Tilman Sauerbeck).
* Recursive rules are now supported (Tilman Sauerbeck).
* Added warning option for the Test Task (requested by Eric Hodel).
* The jamis rdoc template is only used if it exists.
* Added fix for Ruby 1.8.2 test/unit and rails problem.
* Added contributed rake man file (Jani Monoses).
* Added Brian Candler's fix for problems in --trace and --dry-run
mode.
== Version 0.4.15
* Fixed a bug that prevented the TESTOPTS flag from working with the
revised for 1.8.2 test task.
* Updated the docs on --trace to indicate that it also enables a full
backtrace on errors.
== Version 0.4.14
* Modified the TestTask to workaround the Ruby 1.8.2 change in
autoexecuting unit tests.
== Version 0.4.13
* Fixed the dry-run flag so it is operating again.
* Multiple arguments to sh and ruby commands will not be interpreted
by the shell (patch provided by Jonathan Paisley).
== Version 0.4.12
* Added --silent (-s) to suppress the (in directory) rake message.
== Version 0.4.11
* Changed the "don't know how to rake" message (finally)
* Changes references to a literal "Rakefile" to reference the global
variable $rakefile (which contains the actual name of the rakefile).
== Version 0.4.10
* Added block support to the "sh" command, allowing users to take
special actions on the result of the system call. E.g.
sh "shell_command" do |ok, res|
puts "Program returned #{res.exitstatus}" if ! ok
end
== Version 0.4.9
* Switched to Jamis Buck's RDoc template.
* Removed autorequire from Rake's gem spec. This prevents the Rake
libraries from loading while using rails.
== Version 0.4.8
* Added support for .rb versions of Rakefile.
* Removed \\\n's from test task.
* Fixed Ruby 1.9 compatibility issue with FileList.
== Version 0.4.7
* Fixed problem in FileList that caused Ruby 1.9 to go into infinite
recursion. Since to_a was removed from Object, it does not need to
added back into the list of methods to rewrite in FileList. (Thanks
to Kent Sibilev for pointing this out).
== Version 0.4.6
* Removed test version of ln in FileUtils that prevented safe_ln from
using ln.
== Version 0.4.5
* Upgraded comments in TestTask.
* FileList to_s and inspect now automatically resolve pending changes.
* FileList#exclude properly returns the FileList.
== Version 0.4.4
* Fixed initialization problem with @comment.
* Now using multi -r technique in TestTask. Switch Rakefile back to
using the built-in test task macros because the rake runtime is no
longer needed.
* Added 'TEST=filename' and 'TESTOPTS=options' to the Test Task
macros.
* Allow a +test_files+ attribute in test tasks. This allows more
flexibility in specifying test files.
== Version 0.4.3
* Fixed Comment leakage.
== Version 0.4.2
* Added safe_ln that falls back to a copy if a file link is not supported.
* Package builder now uses safe_ln.
== Version 0.4.1
* Task comments are now additive, combined with "/".
* Works with (soon to be released) rubygems 0.6.2 (or 0.7.0)
== Version 0.4.0
* FileList now uses deferred loading. The file system is not searched
until the first call that needs the file names.
* VAR=VALUE options are now accepted on the command line and are
treated like environment variables. The values may be tested in a
Rakefile by referencing ENV['VAR'].
* File.mtime is now used (instead of File.new().mtime).
== Version 0.3.2.x
* Removed some hidden dependencies on rubygems. Tests now will test
gems only if they are installed.
* Removed Sys from some example files. I believe that is that last
reference to Sys outside of the contrib area.
* Updated all copyright notices to include 2004.
== Version 0.3.2
* GEM Installation now works with the application stub.
== Version 0.3.1
* FileLists now automatically ignore CVS, .bak, !
* GEM Installation now works.
== Version 0.3.0
Promoted 0.2.10.
== Version 0.2.10
General
* Added title to Rake's rdocs
* Contrib packages are no longer included in the documentation.
RDoc Issues
* Removed default for the '--main' option
* Fixed rendering of the rdoc options
* Fixed clean/clobber confusion with rerdoc
* 'title' attribute added
Package Task Library Issues
* Version (or explicit :noversion) is required.
* +package_file+ attribute is now writable
FileList Issues
* Dropped bang version of exclude. Now using ant-like include/exclude semantics.
* Enabled the "yield self" idiom in FileList#initialize.
== Version 0.2.9
This version contains numerous changes as the RubyConf.new(2003)
presentation was being prepared. The changes include:
* The monolithic rubyapp task library is in the process of being
dropped in favor of lighter weight task libraries.
== Version 0.2.7
* Added "desc" for task descriptions.
* -T will now display tasks with descriptions.
* -P will display tasks and prerequisites.
* Dropped the Sys module in favor of the 1.8.x FileUtils module. Sys
is still supported in the contrib area.
== Version 0.2.6
* Moved to RubyForge
== Version 0.2.5
* Switched to standard ruby app builder.
* Added no_match option to file matcher.
== Version 0.2.4
* Fixed indir, which neglected to actually change directories.
== Version 0.2.3
* Added rake module for a help target
* Added 'for_files' to Sys
* Added a $rakefile constant
* Added test for selecting proper rule with multiple targets.

View file

@ -1,21 +0,0 @@
Copyright (c) 2003, 2004 Jim Weirich
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -1,228 +0,0 @@
= RAKE -- Ruby Make
Supporting Rake version: 0.6
This package contains Rake, a simple ruby build program with
capabilities similar to make.
Rake has the following features:
* Rakefiles (rake's version of Makefiles) are completely defined in
standard Ruby syntax. No XML files to edit. No quirky Makefile
syntax to worry about (is that a tab or a space?)
* Users can specify tasks with prerequisites.
* Rake supports rule patterns to sythesize implicit tasks.
* Flexible FileLists that act like arrays but know about manipulating
file names and paths.
* A library of prepackaged tasks to make building rakefiles easier.
== Download
The latest version of rake can be found at
* http://rubyforge.org/project/showfiles.php?group_id=50
== Installation
=== Normal Installation
You can install rake with the following command.
% ruby install.rb
from its distribution directory.
=== GEM Installation
Download and install rake with the following.
gem install --remote rake
== Online Resources
== Rake References
* Rake Documentation Home: http://docs.rubyrake.org
* Rake Project Page: http://rubyforge.org/projects/rake
* Rake API Documents: http://rake.rubyforge.org
== Presentations and Articles about Rake
* Jim Weirich\u2019s 2003 RubyConf presentation: http://onestepback.org/articles/buildingwithrake/
* Martin Fowler\u2019s article on Rake: http://martinfowler.com/articles/rake.html
=== Road Map
* If you want to see how to invoke rake to build your projects, read on.
* If you want to see the format of a Rakefile, see
doc/rakefile.rdoc[http://rake.rubyforge.org/files/doc/rakefile_rdoc.html].
* If you want to see the original announcement of rake, see
doc/rational.rdoc[http://rake.rubyforge.org/files/doc/rational_rdoc.html].
* If you want to see a glossary of terms, see
doc/glossary.rdoc[http://rake.rubyforge.org/files/doc/glossary_rdoc.html].
== Simple Example
Once installed, you can run rake as follows ...
% rake [options ...] [VAR=VALUE ...] [tasks...]
Type "rake --help" for an up-to-date option summary.
Invoking <tt>rake</tt> without any options or targets causes rake to
look for a rakefile and invoke the default task in that rakefile.
For example, given a simple rakefile like this ...
task :default => [:test]
task :test do
ruby "test/unittest.rb"
end
The command
$ rake
will invoke the +default+ task. As +default+ satisfies its
prerequisites, the +test+ task will run the unit tests for the
package.
== Other Make Reinvisionings ...
Rake is a late entry in the make replacement field. Here are links to
other projects with similar (and not so similar) goals.
* http://www.a-a-p.org -- Make in Python
* http://www.aromatic.com/tools/jam.txt -- JAM, Java Automated Make
* http://ant.apache.org -- The Ant project
* http://www.perl.com/language/ppt/src/make/index.html -- Make from
the Perl Power Tools implementation.
== Credits
[<b>Ryan Dlugosz</b>] For the initial conversation that sparked Rake.
[<b>nobu.nokada@softhome.net</b>] For the initial patch for rule support.
[<b>Tilman Sauerbeck <tilman@code-monkey.de></b>] For the recursive rule patch.
== License
Rake is available under an MIT-style license.
:include: MIT-LICENSE
== Support
The Rake homepage is http://rake.rubyforge.org. You can find the Rake
RubyForge page at http://rubyforge.org/projects/rake.
Feel free to submit commits or feature requests. If you send a patch,
remember to update the corresponding unit tests. If fact, I prefer
new feature to be submitted in the form of new unit tests.
For other information, feel free to ask on the ruby-talk mailing list
(which is mirrored to comp.lang.ruby) or contact
mailto:jim@weirichhouse.org.
----
= Usage
Rake is invoked from the command line using:
% rake [<em>options</em> ...] [<em>VAR</em>=<em>VALUE</em>] [<em>targets</em> ...]
Options are:
[<tt><em>name</em>=<em>value</em></tt>]
Set the environment variable <em>name</em> to <em>value</em>
during the execution of the <b>rake</b> command. You can access
the value by using ENV['<em>name</em>'].
[<tt>--classic-namespace</tt> (-n)]
Import the Task, FileTask, and FileCreateTask into the top-level
scope to be compatible with older versions of Rake. Alternatively
you can include the line <code>require
'rake/classic_namespace'</code> in your Rakefile to get the
classic behavior.
[<tt>--dry-run</tt> (-n)]
Do a dry run. Print the tasks invoked and executed, but do not
actually execute any of the actions.
[<tt>--help</tt> (-H)]
Display some help text and exit.
[<tt>--libdir</tt> _directory_ (-I)]
Add _directory_ to the list of directories searched for require.
[<tt>--nosearch</tt> (-N)]
Do not search for a Rakefile in parent directories.
[<tt>--prereqs</tt> (-P)]
Display a list of all tasks and their immediate prerequisites.
[<tt>--quiet</tt> (-q)]
Do not echo commands from FileUtils.
[<tt>--rakefile</tt> _filename_ (-f)]
Use _filename_ as the name of the rakefile. The default rakefile
names are +rakefile+ and +Rakefile+ (with +rakefile+ taking
precedence). If the rakefile is not found in the current
directory, +rake+ will search parent directories for a match. The
directory where the Rakefile is found will become the current
directory for the actions executed in the Rakefile.
[<tt>--require</tt> _name_ (-r)]
Require _name_ before executing the Rakefile.
[<tt>--tasks</tt> (-T)]
Display a list of the major tasks and their comments. Comments
are defined using the "desc" command.
[<tt>--trace</tt> (-t)]
Turn on invoke/execute tracing. Also enable full backtrace on errors.
[<tt>--usage</tt> (-h)]
Display a usage message and exit.
[<tt>--verbose</tt> (-v)]
Echo the Sys commands to standard output.
[<tt>--version</tt> (-V)]
Display the program version and exit.
In addition, any command line option of the form
<em>VAR</em>=<em>VALUE</em> will be added to the environment hash
<tt>ENV</tt> and may be tested in the Rakefile.
---
= Rakefile Format
See doc/rakefile.rdoc[http://rake.rubyforge.org/files/doc/rakefile_rdoc.html]
for details on the Rakefile format.
---
= Other stuff
Author:: Jim Weirich <jim@weirichhouse.org>
Requires:: Ruby 1.8.0 or later
License:: Copyright 2003, 2004 by Jim Weirich.
Released under an MIT-style license. See the LICENSE file
included in the distribution.
== Warranty
This software is provided "as is" and without any express or
implied warranties, including, without limitation, the implied
warranties of merchantibility and fitness for a particular
purpose.

View file

@ -1,353 +0,0 @@
# Rakefile for rake -*- ruby -*-
# Copyright 2003, 2004 by Jim Weirich (jim@weirichhouse.org)
# All rights reserved.
# This file is may be distributed under an MIT style license. See
# MIT-LICENSE for details.
begin
require 'rubygems'
require 'rake/gempackagetask'
rescue Exception
nil
end
require 'rake/clean'
require 'rake/testtask'
require 'rake/rdoctask'
CLEAN.include('**/*.o')
CLOBBER.include('doc/example/main', 'testdata')
CLOBBER.include('test/data/**/temp_*')
CLOBBER.include('test/data/chains/play.*')
CLOBBER.include('test/data/file_creation_task/build')
CLOBBER.include('test/data/file_creation_task/src')
CLOBBER.include('TAGS')
def announce(msg='')
STDERR.puts msg
end
# Determine the current version of the software
if `ruby -Ilib ./bin/rake --version` =~ /\S+$/
CURRENT_VERSION = $&
else
CURRENT_VERSION = "0.0.0"
end
if ENV['REL']
PKG_VERSION = ENV['REL']
else
PKG_VERSION = CURRENT_VERSION
end
SRC_RB = FileList['lib/**/*.rb']
# The default task is run if rake is given no explicit arguments.
desc "Default Task"
task :default => :alltests
# Test Tasks ---------------------------------------------------------
task :ta => :alltests
task :tf => :funtests
task :tu => :unittests
task :tc => :contribtests
task :test => :unittests
Rake::TestTask.new(:alltests) do |t|
t.test_files = FileList[
'test/test*.rb',
'test/contrib/test*.rb',
'test/fun*.rb'
]
t.warning = true
t.verbose = true
end
Rake::TestTask.new(:unittests) do |t|
t.test_files = FileList['test/test*.rb']
t.warning = true
t.verbose = false
end
Rake::TestTask.new(:funtests) do |t|
t.test_files = FileList['test/fun*.rb']
t.warning = true
t.warning = true
end
Rake::TestTask.new(:contribtests) do |t|
t.test_files = FileList['test/contrib/test*.rb']
t.verbose = false
t.warning = true
end
directory 'testdata'
[:alltests, :unittests, :contribtests, :funtests].each do |t|
task t => ['testdata']
end
# CVS Tasks ----------------------------------------------------------
# Install rake using the standard install.rb script.
desc "Install the application"
task :install do
ruby "install.rb"
end
# Create a task to build the RDOC documentation tree.
rd = Rake::RDocTask.new("rdoc") { |rdoc|
rdoc.rdoc_dir = 'html'
# rdoc.template = 'kilmer'
# rdoc.template = 'css2'
rdoc.template = 'doc/jamis.rb'
rdoc.title = "Rake -- Ruby Make"
rdoc.options << '--line-numbers' << '--inline-source' << '--main' << 'README'
rdoc.rdoc_files.include('README', 'MIT-LICENSE', 'TODO', 'CHANGES')
rdoc.rdoc_files.include('lib/**/*.rb', 'doc/**/*.rdoc')
rdoc.rdoc_files.exclude(/\bcontrib\b/)
}
# ====================================================================
# Create a task that will package the Rake software into distributable
# tar, zip and gem files.
PKG_FILES = FileList[
'install.rb',
'[A-Z]*',
'bin/**/*',
'lib/**/*.rb',
'test/**/*.rb',
'test/**/*.rf',
'test/**/*.mf',
'test/**/Rakefile',
'doc/**/*'
]
PKG_FILES.exclude('doc/example/*.o')
PKG_FILES.exclude(%r{doc/example/main$})
if ! defined?(Gem)
puts "Package Target requires RubyGEMs"
else
spec = Gem::Specification.new do |s|
#### Basic information.
s.name = 'rake'
s.version = PKG_VERSION
s.summary = "Ruby based make-like utility."
s.description = <<-EOF
Rake is a Make-like program implemented in Ruby. Tasks
and dependencies are specified in standard Ruby syntax.
EOF
#### Dependencies and requirements.
#s.add_dependency('log4r', '> 1.0.4')
#s.requirements << ""
#### Which files are to be included in this gem? Everything! (Except CVS directories.)
s.files = PKG_FILES.to_a
#### C code extensions.
#s.extensions << "ext/rmagic/extconf.rb"
#### Load-time details: library and application (you will need one or both).
s.require_path = 'lib' # Use these for libraries.
s.bindir = "bin" # Use these for applications.
s.executables = ["rake"]
s.default_executable = "rake"
#### Documentation and testing.
s.has_rdoc = true
s.extra_rdoc_files = rd.rdoc_files.reject { |fn| fn =~ /\.rb$/ }.to_a
s.rdoc_options <<
'--title' << 'Rake -- Ruby Make' <<
'--main' << 'README' <<
'--line-numbers'
#### Author and project details.
s.author = "Jim Weirich"
s.email = "jim@weirichhouse.org"
s.homepage = "http://rake.rubyforge.org"
s.rubyforge_project = "rake"
# if ENV['CERT_DIR']
# s.signing_key = File.join(ENV['CERT_DIR'], 'gem-private_key.pem')
# s.cert_chain = [File.join(ENV['CERT_DIR'], 'gem-public_cert.pem')]
# end
end
package_task = Rake::GemPackageTask.new(spec) do |pkg|
pkg.need_zip = true
pkg.need_tar = true
end
end
# Misc tasks =========================================================
def count_lines(filename)
lines = 0
codelines = 0
open(filename) { |f|
f.each do |line|
lines += 1
next if line =~ /^\s*$/
next if line =~ /^\s*#/
codelines += 1
end
}
[lines, codelines]
end
def show_line(msg, lines, loc)
printf "%6s %6s %s\n", lines.to_s, loc.to_s, msg
end
desc "Count lines in the main rake file"
task :lines do
total_lines = 0
total_code = 0
show_line("File Name", "LINES", "LOC")
SRC_RB.each do |fn|
lines, codelines = count_lines(fn)
show_line(fn, lines, codelines)
total_lines += lines
total_code += codelines
end
show_line("TOTAL", total_lines, total_code)
end
ARCHIVEDIR = '/mnt/usb'
task :archive => [:package] do
cp FileList["pkg/*.tgz", "pkg/*.zip", "pkg/*.gem"], ARCHIVEDIR
end
# Define an optional publish target in an external file. If the
# publish.rf file is not found, the publish targets won't be defined.
load "publish.rf" if File.exist? "publish.rf"
# Support Tasks ------------------------------------------------------
desc "Look for TODO and FIXME tags in the code"
task :todo do
FileList['**/*.rb'].egrep /#.*(FIXME|TODO|TBD)/
end
desc "Look for Debugging print lines"
task :dbg do
FileList['**/*.rb'].egrep /\bDBG|\bbreakpoint\b/
end
desc "List all ruby files"
task :rubyfiles do
puts Dir['**/*.rb'].reject { |fn| fn =~ /^pkg/ }
puts Dir['bin/*'].reject { |fn| fn =~ /CVS|(~$)|(\.rb$)/ }
end
# --------------------------------------------------------------------
# Creating a release
desc "Make a new release"
task :release => [
:prerelease,
:clobber,
:alltests,
:update_version,
:package,
:tag] do
announce
announce "**************************************************************"
announce "* Release #{PKG_VERSION} Complete."
announce "* Packages ready to upload."
announce "**************************************************************"
announce
end
# Validate that everything is ready to go for a release.
task :prerelease do
announce
announce "**************************************************************"
announce "* Making RubyGem Release #{PKG_VERSION}"
announce "* (current version #{CURRENT_VERSION})"
announce "**************************************************************"
announce
# Is a release number supplied?
unless ENV['REL']
fail "Usage: rake release REL=x.y.z [REUSE=tag_suffix]"
end
# Is the release different than the current release.
# (or is REUSE set?)
if PKG_VERSION == CURRENT_VERSION && ! ENV['REUSE']
fail "Current version is #{PKG_VERSION}, must specify REUSE=tag_suffix to reuse version"
end
# Are all source files checked in?
if ENV['RELTEST']
announce "Release Task Testing, skipping checked-in file test"
else
announce "Checking for unchecked-in files..."
data = `cvs -q update`
unless data =~ /^$/
fail "CVS update is not clean ... do you have unchecked-in files?"
end
announce "No outstanding checkins found ... OK"
end
end
task :update_version => [:prerelease] do
if PKG_VERSION == CURRENT_VERSION
announce "No version change ... skipping version update"
else
announce "Updating Rake version to #{PKG_VERSION}"
open("lib/rake.rb") do |rakein|
open("lib/rake.rb.new", "w") do |rakeout|
rakein.each do |line|
if line =~ /^RAKEVERSION\s*=\s*/
rakeout.puts "RAKEVERSION = '#{PKG_VERSION}'"
else
rakeout.puts line
end
end
end
end
mv "lib/rake.rb.new", "lib/rake.rb"
if ENV['RELTEST']
announce "Release Task Testing, skipping commiting of new version"
else
sh %{cvs commit -m "Updated to version #{PKG_VERSION}" lib/rake.rb}
end
end
end
desc "Tag all the CVS files with the latest release number (REL=x.y.z)"
task :tag => [:prerelease] do
reltag = "REL_#{PKG_VERSION.gsub(/\./, '_')}"
reltag << ENV['REUSE'].gsub(/\./, '_') if ENV['REUSE']
announce "Tagging CVS with [#{reltag}]"
if ENV['RELTEST']
announce "Release Task Testing, skipping CVS tagging"
else
sh %{cvs tag #{reltag}}
end
end
# Require experimental XForge/Metaproject support.
load 'xforge.rf' if File.exist?('xforge.rf')

View file

@ -1,19 +0,0 @@
= Rake Project -- To Do List
Send suggestions for this list to mailto:jim@weirichhouse.org or on
the rake-devel@rubyforge.org mailing list.
=== To Do
* Provide a way to disable -w warning mode.
* Define a set of default rules that work in the absense of any Rakefile
* What about cyclic dependencies?
* Java support utilities
* Installation support utilities
* Check out installpkg.rb
* Autogenerate Dependencies
* Rules should apply to existing tasks if no actions are defined.
* How to create multiple package tasks without task name collision?
* Trap "ln -s" commands that fail and use "cp" instead (SMB mounted
drives have problems with "ln -s".
(moved DONE list to CHANGES file)

View file

@ -1,8 +0,0 @@
begin
require 'rake'
rescue LoadError
require 'rubygems'
require_gem 'rake'
end
Rake::Application.new.run

View file

@ -1,38 +0,0 @@
# Example Rakefile -*- ruby -*-
task :default => [:main]
file "a.o" => ["a.c"] do |t|
src = t.name.sub(/\.o$/, '.c')
sh "gcc #{src} -c -o #{t.name}"
end
file "b.o" => ["b.c"] do |t|
src = t.name.sub(/\.o$/, '.c')
sh "gcc #{src} -c -o #{t.name}"
end
file "main.o" => ["main.c"] do |t|
src = t.name.sub(/\.o$/, '.c')
sh "gcc #{src} -c -o #{t.name}"
end
OBJFILES = ["a.o", "b.o", "main.o"]
task :obj => OBJFILES
file "main" => OBJFILES do |t|
sh "gcc -o #{t.name} main.o a.o b.o"
end
task :clean do
rm_f FileList['*.o']
Dir['*~'].each { |fn| rm_f fn }
end
task :clobber => [:clean] do
rm_f "main"
end
task :run => ["main"] do
sh "./main"
end

View file

@ -1,35 +0,0 @@
# Example Rakefile -*- ruby -*-
# Using the power of Ruby
task :default => [:main]
def ext(fn, newext)
fn.sub(/\.[^.]+$/, newext)
end
SRCFILES = Dir['*.c']
OBJFILES = SRCFILES.collect { |fn| ext(fn,".o") }
OBJFILES.each do |objfile|
srcfile = ext(objfile, ".c")
file objfile => [srcfile] do |t|
sh "gcc #{srcfile} -c -o #{t.name}"
end
end
file "main" => OBJFILES do |t|
sh "gcc -o #{t.name} main.o a.o b.o"
end
task :clean do
rm_f FileList['*.o']
Dir['*~'].each { |fn| rm_f fn }
end
task :clobber => [:clean] do
rm_f "main"
end
task :run => ["main"] do
sh "./main"
end

View file

@ -1,6 +0,0 @@
#include <stdio.h>
void a()
{
printf ("In function a\n");
}

View file

@ -1,6 +0,0 @@
#include <stdio.h>
void b()
{
printf ("In function b\n");
}

View file

@ -1,11 +0,0 @@
#include <stdio.h>
extern void a();
extern void b();
int main ()
{
a();
b();
return 0;
}

View file

@ -1,51 +0,0 @@
= Glossary
[<b>action</b>]
Code to be executed in order to perform a task. Actions in a
rakefile are specified in a code block (usually delimited by
+do+/+end+ pairs.
[<b>execute</b>]
When a task is executed, all of its actions are performed, in
the order they were defined. Note that unlike
<tt>invoke</tt>, <tt>execute</tt> always executes the actions
(without invoking or executing the prerequisites).
[<b>file task</b> (FileTask)]
A file task is a task whose purpose is to create a file
(which has the same name as the task). When invoked, a file
task will only execute if one or more of the following
conditions are true.
1. The associated file does not exist.
2. A prerequisite has a later time stamp than the existing file.
Because normal Tasks always have the current time as
timestamp, a FileTask that has a normal Task prerequisite
will always execute.
[<b>invoke</b>]
When a task is invoked, first we check to see if it has been
invoked before. if it has been, then nothing else is done.
If this is the first time its been invoked, then we invoke
each of its prerequisites. Finally, we check to see if we
need to execute the actions of this task by calling
<tt>needed?</tt>. Finally, if the task is needed, we execute
its actions.
NOTE: Currently prerequisites are invoked even if the task is
not needed. This may change in the future.
[<b>prerequisites</b>]
Every task has a set (possiblity empty) of prerequisites. A
prerequisite P to Task T is itself a task that must be invoked
before Task T.
[<b>rule</b>]
A rule is a recipe for synthesizing a task when no task is
explicitly defined. Rules generally synthesize file tasks.
[<b>task</b> (Task)]
Basic unit of work in a rakefile. A task has a name, a set of
prerequisites and a list of actions to be performed.

View file

@ -1,591 +0,0 @@
module RDoc
module Page
FONTS = "\"Bitstream Vera Sans\", Verdana, Arial, Helvetica, sans-serif"
STYLE = <<CSS
a {
color: #00F;
text-decoration: none;
}
a:hover {
color: #77F;
text-decoration: underline;
}
body, td, p {
font-family: %fonts%;
background: #FFF;
color: #000;
margin: 0px;
font-size: small;
}
#content {
margin: 2em;
}
#description p {
margin-bottom: 0.5em;
}
.sectiontitle {
margin-top: 1em;
margin-bottom: 1em;
padding: 0.5em;
padding-left: 2em;
background: #005;
color: #FFF;
font-weight: bold;
border: 1px dotted black;
}
.attr-rw {
padding-left: 1em;
padding-right: 1em;
text-align: center;
color: #055;
}
.attr-name {
font-weight: bold;
}
.attr-desc {
}
.attr-value {
font-family: monospace;
}
.file-title-prefix {
font-size: large;
}
.file-title {
font-size: large;
font-weight: bold;
background: #005;
color: #FFF;
}
.banner {
background: #005;
color: #FFF;
border: 1px solid black;
padding: 1em;
}
.banner td {
background: transparent;
color: #FFF;
}
h1 a, h2 a, .sectiontitle a, .banner a {
color: #FF0;
}
h1 a:hover, h2 a:hover, .sectiontitle a:hover, .banner a:hover {
color: #FF7;
}
.dyn-source {
display: none;
background: #FFE;
color: #000;
border: 1px dotted black;
margin: 0.5em 2em 0.5em 2em;
padding: 0.5em;
}
.dyn-source .cmt {
color: #00F;
font-style: italic;
}
.dyn-source .kw {
color: #070;
font-weight: bold;
}
.method {
margin-left: 1em;
margin-right: 1em;
margin-bottom: 1em;
}
.description pre {
padding: 0.5em;
border: 1px dotted black;
background: #FFE;
}
.method .title {
font-family: monospace;
font-size: large;
border-bottom: 1px dashed black;
margin-bottom: 0.3em;
padding-bottom: 0.1em;
}
.method .description, .method .sourcecode {
margin-left: 1em;
}
.description p, .sourcecode p {
margin-bottom: 0.5em;
}
.method .sourcecode p.source-link {
text-indent: 0em;
margin-top: 0.5em;
}
.method .aka {
margin-top: 0.3em;
margin-left: 1em;
font-style: italic;
text-indent: 2em;
}
h1 {
padding: 1em;
border: 1px solid black;
font-size: x-large;
font-weight: bold;
color: #FFF;
background: #007;
}
h2 {
padding: 0.5em 1em 0.5em 1em;
border: 1px solid black;
font-size: large;
font-weight: bold;
color: #FFF;
background: #009;
}
h3, h4, h5, h6 {
padding: 0.2em 1em 0.2em 1em;
border: 1px dashed black;
color: #000;
background: #AAF;
}
.sourcecode > pre {
padding: 0.5em;
border: 1px dotted black;
background: #FFE;
}
CSS
XHTML_PREAMBLE = %{<?xml version="1.0" encoding="%charset%"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
}
HEADER = XHTML_PREAMBLE + <<ENDHEADER
<html>
<head>
<title>%title%</title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%" />
<link rel="stylesheet" href="%style_url%" type="text/css" media="screen" />
<script language="JavaScript" type="text/javascript">
// <![CDATA[
function toggleSource( id )
{
var elem
var link
if( document.getElementById )
{
elem = document.getElementById( id )
link = document.getElementById( "l_" + id )
}
else if ( document.all )
{
elem = eval( "document.all." + id )
link = eval( "document.all.l_" + id )
}
else
return false;
if( elem.style.display == "block" )
{
elem.style.display = "none"
link.innerHTML = "show source"
}
else
{
elem.style.display = "block"
link.innerHTML = "hide source"
}
}
function openCode( url )
{
window.open( url, "SOURCE_CODE", "width=400,height=400,scrollbars=yes" )
}
// ]]>
</script>
</head>
<body>
ENDHEADER
FILE_PAGE = <<HTML
<table border='0' cellpadding='0' cellspacing='0' width="100%" class='banner'>
<tr><td>
<table width="100%" border='0' cellpadding='0' cellspacing='0'><tr>
<td class="file-title" colspan="2"><span class="file-title-prefix">File</span><br />%short_name%</td>
<td align="right">
<table border='0' cellspacing="0" cellpadding="2">
<tr>
<td>Path:</td>
<td>%full_path%
IF:cvsurl
&nbsp;(<a href="%cvsurl%">CVS</a>)
ENDIF:cvsurl
</td>
</tr>
<tr>
<td>Modified:</td>
<td>%dtm_modified%</td>
</tr>
</table>
</td></tr>
</table>
</td></tr>
</table><br>
HTML
###################################################################
CLASS_PAGE = <<HTML
<table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
<td class="file-title"><span class="file-title-prefix">%classmod%</span><br />%full_name%</td>
<td align="right">
<table cellspacing=0 cellpadding=2>
<tr valign="top">
<td>In:</td>
<td>
START:infiles
HREF:full_path_url:full_path:
IF:cvsurl
&nbsp;(<a href="%cvsurl%">CVS</a>)
ENDIF:cvsurl
END:infiles
</td>
</tr>
IF:parent
<tr>
<td>Parent:</td>
<td>
IF:par_url
<a href="%par_url%">
ENDIF:par_url
%parent%
IF:par_url
</a>
ENDIF:par_url
</td>
</tr>
ENDIF:parent
</table>
</td>
</tr>
</table>
HTML
###################################################################
METHOD_LIST = <<HTML
<div id="content">
IF:diagram
<table cellpadding='0' cellspacing='0' border='0' width="100%"><tr><td align="center">
%diagram%
</td></tr></table>
ENDIF:diagram
IF:description
<div class="description">%description%</div>
ENDIF:description
IF:requires
<div class="sectiontitle">Required Files</div>
<ul>
START:requires
<li>HREF:aref:name:</li>
END:requires
</ul>
ENDIF:requires
IF:toc
<div class="sectiontitle">Contents</div>
<ul>
START:toc
<li><a href="#%href%">%secname%</a></li>
END:toc
</ul>
ENDIF:toc
IF:methods
<div class="sectiontitle">Methods</div>
<ul>
START:methods
<li>HREF:aref:name:</li>
END:methods
</ul>
ENDIF:methods
IF:includes
<div class="sectiontitle">Included Modules</div>
<ul>
START:includes
<li>HREF:aref:name:</li>
END:includes
</ul>
ENDIF:includes
START:sections
IF:sectitle
<div class="sectiontitle"><a nem="%secsequence%">%sectitle%</a></div>
IF:seccomment
<div class="description">
%seccomment%
</div>
ENDIF:seccomment
ENDIF:sectitle
IF:classlist
<div class="sectiontitle">Classes and Modules</div>
%classlist%
ENDIF:classlist
IF:constants
<div class="sectiontitle">Constants</div>
<table border='0' cellpadding='5'>
START:constants
<tr valign='top'>
<td class="attr-name">%name%</td>
<td>=</td>
<td class="attr-value">%value%</td>
</tr>
IF:desc
<tr valign='top'>
<td>&nbsp;</td>
<td colspan="2" class="attr-desc">%desc%</td>
</tr>
ENDIF:desc
END:constants
</table>
ENDIF:constants
IF:attributes
<div class="sectiontitle">Attributes</div>
<table border='0' cellpadding='5'>
START:attributes
<tr valign='top'>
<td class='attr-rw'>
IF:rw
[%rw%]
ENDIF:rw
</td>
<td class='attr-name'>%name%</td>
<td class='attr-desc'>%a_desc%</td>
</tr>
END:attributes
</table>
ENDIF:attributes
IF:method_list
START:method_list
IF:methods
<div class="sectiontitle">%type% %category% methods</div>
START:methods
<div class="method">
<div class="title">
IF:callseq
<a name="%aref%"></a><b>%callseq%</b>
ENDIF:callseq
IFNOT:callseq
<a name="%aref%"></a><b>%name%</b>%params%
ENDIF:callseq
IF:codeurl
[ <a href="javascript:openCode('%codeurl%')">source</a> ]
ENDIF:codeurl
</div>
IF:m_desc
<div class="description">
%m_desc%
</div>
ENDIF:m_desc
IF:aka
<div class="aka">
This method is also aliased as
START:aka
<a href="%aref%">%name%</a>
END:aka
</div>
ENDIF:aka
IF:sourcecode
<div class="sourcecode">
<p class="source-link">[ <a href="javascript:toggleSource('%aref%_source')" id="l_%aref%_source">show source</a> ]</p>
<div id="%aref%_source" class="dyn-source">
<pre>
%sourcecode%
</pre>
</div>
</div>
ENDIF:sourcecode
</div>
END:methods
ENDIF:methods
END:method_list
ENDIF:method_list
END:sections
</div>
HTML
FOOTER = <<ENDFOOTER
</body>
</html>
ENDFOOTER
BODY = HEADER + <<ENDBODY
!INCLUDE! <!-- banner header -->
<div id="bodyContent">
#{METHOD_LIST}
</div>
#{FOOTER}
ENDBODY
########################## Source code ##########################
SRC_PAGE = XHTML_PREAMBLE + <<HTML
<html>
<head><title>%title%</title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%">
<style>
.ruby-comment { color: green; font-style: italic }
.ruby-constant { color: #4433aa; font-weight: bold; }
.ruby-identifier { color: #222222; }
.ruby-ivar { color: #2233dd; }
.ruby-keyword { color: #3333FF; font-weight: bold }
.ruby-node { color: #777777; }
.ruby-operator { color: #111111; }
.ruby-regexp { color: #662222; }
.ruby-value { color: #662222; font-style: italic }
.kw { color: #3333FF; font-weight: bold }
.cmt { color: green; font-style: italic }
.str { color: #662222; font-style: italic }
.re { color: #662222; }
</style>
</head>
<body bgcolor="white">
<pre>%code%</pre>
</body>
</html>
HTML
########################## Index ################################
FR_INDEX_BODY = <<HTML
!INCLUDE!
HTML
FILE_INDEX = XHTML_PREAMBLE + <<HTML
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%">
<style>
<!--
body {
background-color: #EEE;
font-family: #{FONTS};
color: #000;
margin: 0px;
}
.banner {
background: #005;
color: #FFF;
padding: 0.2em;
font-size: small;
font-weight: bold;
text-align: center;
}
.entries {
margin: 0.25em 1em 0 1em;
font-size: x-small;
}
a {
color: #00F;
text-decoration: none;
white-space: nowrap;
}
a:hover {
color: #77F;
text-decoration: underline;
}
-->
</style>
<base target="docwin">
</head>
<body>
<div class="banner">%list_title%</div>
<div class="entries">
START:entries
<a href="%href%">%name%</a><br>
END:entries
</div>
</body></html>
HTML
CLASS_INDEX = FILE_INDEX
METHOD_INDEX = FILE_INDEX
INDEX = XHTML_PREAMBLE + <<HTML
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>%title%</title>
<meta http-equiv="Content-Type" content="text/html; charset=%charset%">
</head>
<frameset cols="20%,*">
<frameset rows="15%,35%,50%">
<frame src="fr_file_index.html" title="Files" name="Files" />
<frame src="fr_class_index.html" name="Classes" />
<frame src="fr_method_index.html" name="Methods" />
</frameset>
IF:inline_source
<frame src="%initial_page%" name="docwin">
ENDIF:inline_source
IFNOT:inline_source
<frameset rows="80%,20%">
<frame src="%initial_page%" name="docwin">
<frame src="blank.html" name="source">
</frameset>
ENDIF:inline_source
<noframes>
<body bgcolor="white">
Click <a href="html/index.html">here</a> for a non-frames
version of this page.
</body>
</noframes>
</frameset>
</html>
HTML
end
end

View file

@ -1,127 +0,0 @@
= Original Prototype Rake
This is the original 100 line prototype rake program.
---
#!/usr/bin/env ruby
require 'ftools'
class Task
TASKS = Hash.new
attr_reader :prerequisites
def initialize(task_name)
@name = task_name
@prerequisites = []
@actions = []
end
def enhance(deps=nil, &block)
@prerequisites |= deps if deps
@actions << block if block_given?
self
end
def name
@name.to_s
end
def invoke
@prerequisites.each { |n| Task[n].invoke }
execute if needed?
end
def execute
return if @triggered
@triggered = true
@actions.collect { |act| result = act.call(self) }.last
end
def needed?
true
end
def timestamp
Time.now
end
class << self
def [](task_name)
TASKS[intern(task_name)] or fail "Don't know how to rake #{task_name}"
end
def define_task(args, &block)
case args
when Hash
fail "Too Many Target Names: #{args.keys.join(' ')}" if args.size > 1
fail "No Task Name Given" if args.size < 1
task_name = args.keys[0]
deps = args[task_name]
else
task_name = args
deps = []
end
deps = deps.collect {|d| intern(d) }
get(task_name).enhance(deps, &block)
end
def get(task_name)
name = intern(task_name)
TASKS[name] ||= self.new(name)
end
def intern(task_name)
(Symbol === task_name) ? task_name : task_name.intern
end
end
end
class FileTask < Task
def needed?
return true unless File.exist?(name)
latest_prereq = @prerequisites.collect{|n| Task[n].timestamp}.max
return false if latest_prereq.nil?
timestamp < latest_prereq
end
def timestamp
File.new(name.to_s).mtime
end
end
def task(args, &block)
Task.define_task(args, &block)
end
def file(args, &block)
FileTask.define_task(args, &block)
end
def sys(cmd)
puts cmd
system(cmd) or fail "Command Failed: [#{cmd}]"
end
def rake
begin
here = Dir.pwd
while ! File.exist?("Rakefile")
Dir.chdir("..")
fail "No Rakefile found" if Dir.pwd == here
here = Dir.pwd
end
puts "(in #{Dir.pwd})"
load "./Rakefile"
ARGV.push("default") if ARGV.size == 0
ARGV.each { |task_name| Task[task_name].invoke }
rescue Exception => ex
puts "rake aborted ... #{ex.message}"
puts ex.backtrace.find {|str| str =~ /Rakefile/ } || ""
end
end
if __FILE__ == $0 then
rake
end

Binary file not shown.

View file

@ -1,267 +0,0 @@
= Rakefile Format
First of all, there is no special format for a Rakefile. A Rakefile
contains executable Ruby code. Anything legal in a ruby script is
allowed in a Rakefile.
Now that we understand there is no special syntax in a Rakefile, there
are some conventions that are used in a Rakefile that are a little
unusual in a typical Ruby program. Since a Rakefile is tailored to
specifying tasks and actions, the idioms used in a Rakefile are
designed to support that.
So, what goes into a Rakefile?
== Tasks
Tasks are the main unit of work in a Rakefile. Tasks have a name
(usually given as a symbol or a string), a list of prerequisites (more
symbols or strings) and a list of actions (given as a block).
=== Simple Tasks
A task is declared by using the +task+ method. +task+ takes a single
parameter that is the name of the task.
task :name
=== Tasks with Prerequisites
Any prerequisites are given as a list (inclosed in square brackets)
following the name and an arrow (=>).
task :name => [:prereq1, :prereq2]
<b>NOTE:</b> Although this syntax looks a little funky, it is legal
Ruby. We are constructing a hash where the key is :name and the value
for that key is the list of prerequisites. It is equivalent to the
following ...
hash = Hash.new
hash[:name] = [:prereq1, :prereq2]
task(hash)
=== Tasks with Actions
Actions are defined by passing a block to the +task+ method. Any Ruby
code can be placed in the block. The block may reference the task
object via the block paramter..
task :name => [:prereq1, :prereq2] do |t|
# actions (may reference t)
end
=== Multiple Definitions
A task may be specified more than once. Each specification adds its
prerequisites and actions to the existing definition. This allows one
part of a rakefile to specify the actions and a different rakefile
(perhaps separately generated) to specify the dependencies.
For example, the following is equivalent to the single task
specification given above.
task :name
task :name => [:prereq1]
task :name => [:prereq2]
task :name do |t|
# actions
end
== File Tasks
Some tasks are designed to create a file from one or more other files.
Tasks that generate these files may be skipped if the file already
exists. File tasks are used to specify file creation tasks.
File tasks are declared using the +file+ method (instead of the +task+
method). In addition, file tasks are usually named with a string
rather than a symbol.
The following file task creates a executable program (named +prog+)
given two object files name <tt>a.o</tt> and <tt>b.o</tt>. The tasks
for creating <tt>a.o</tt> and <tt>b.o</tt> are not shown.
file "prog" => ["a.o", "b.o"] do |t|
sh "cc -o #{t.name} #{t.prerequisites.join(' ')}"
end
== Directory Tasks
It is common to need to create directories upon demand. The
+directory+ convenience method is a short-hand for creating a FileTask
that creates the directory. For example, the following declaration
...
directory "testdata/examples/doc"
is equivalent to ...
file "testdata" do |t| mkdir t.name end
file "testdata/examples" do |t| mkdir t.name end
file "testdata/examples/doc" do |t| mkdir t.name end
The +directory+ method does not accept prerequisites or actions, but
both prerequisites and actions can be added later. For example ...
directory "testdata"
file "testdata" => ["otherdata"]
file "testdata" do
cp Dir["standard_data/*.data"], "testdata"
end
== Rules
When a file is named as a prerequisite, but does not have a file task
defined for it, Rake will attempt to synthesize a task by looking at a
list of rules supplied in the Rakefile.
Suppose we were trying to invoke task "mycode.o", but no task is
defined for it. But the rakefile has a rule that look like this ...
rule '.o' => ['.c'] do |t|
sh "cc #{t.source} -c -o #{t.name}"
end
This rule will synthesize any task that ends in ".o". It has a
prerequisite a source file with an extension of ".c" must exist. If
Rake is able to find a file named "mycode.c", it will automatically
create a task that builds "mycode.o" from "mycode.c".
If the file "mycode.c" does not exist, rake will attempt
to recursively synthesize a rule for it.
When a task is synthesized from a rule, the +source+ attribute of the
task is set to the matching source file. This allows us to write
rules with actions that reference the source file.
=== Advanced Rules
Any regular expression may be used as the rule pattern. Additionally,
a proc may be used to calculate the name of the source file. This
allows for complex patterns and sources.
The following rule is equivalent to the example above.
rule( /\.o$/ => [
proc {|task_name| task_name.sub(/\.[^.]+$/, '.c') }
]) do |t|
sh "cc #{t.source} -c -o #{t.name}"
end
<b>NOTE:</b> Because of a _quirk_ in Ruby syntax, parenthesis are
required on *rule* when the first argument is a regular expression.
The following rule might be used for Java files ...
rule '.java' => [
proc { |tn| tn.sub(/\.class$/, '.java').sub(/^classes\//, 'src/') }
] do |t|
java_compile(t.source, t.name)
end
<b>NOTE:</b> +java_compile+ is a hypothetical method that invokes the
java compiler.
== Importing Dependencies
Any ruby file (including other rakefiles) can be included with a
standard Ruby +require+ command. The rules and declarations in the
required file are just added to the definitions already accumulated.
Because the files are loaded _before_ the rake targets are evaluated,
the loaded files must be "ready to go" when the rake command is
invoked. This make generated dependency files difficult to use. By
the time rake gets around to updating the dependencies file, it is too
late to load it.
The +import+ command addresses this by specifying a file to be loaded
_after_ the main rakefile is loaded, but _before_ any targets on the
command line are specified. In addition, if the file name matches an
explicit task, that task is invoked before loading the file. This
allows dependency files to be generated and used in a single rake
command invocation.
=== Example:
require 'rake/loaders/makefile'
file ".depends.mf" => [SRC_LIST] do |t|
sh "makedepend -f- -- #{CFLAGS} -- #{t.prerequisites} > #{t.name}"
end
import ".depends.mf"
If ".depends" does not exist, or is out of date w.r.t. the source
files, a new ".depends" file is generated using +makedepend+ before
loading.
== Comments
Standard Ruby comments (beginning with "#") can be used anywhere it is
legal in Ruby source code, including comments for tasks and rules.
However, if you wish a task to be described using the "-T" switch,
then you need to use the +desc+ command to describe the task.
=== Example:
desc "Create a distribution package"
task :package => [ ... ] do ... end
The "-T" switch (or "--tasks" if you like to spell things out) will
display a list of tasks that have a defined comment. If you use
+desc+ to describe your major tasks, you have a semi-automatic way of
generating a summary of your Rake file.
traken$ rake -T
(in /home/.../rake)
rake clean # Remove any temporary products.
rake clobber # Remove any generated file.
rake clobber_rdoc # Remove rdoc products
rake contrib_test # Run tests for contrib_test
rake default # Default Task
rake install # Install the application
rake lines # Count lines in the main rake file
rake rdoc # Build the rdoc HTML Files
rake rerdoc # Force a rebuild of the RDOC files
rake test # Run tests
rake testall # Run all test targets
Only tasks with descriptions will be displayed with the "-T" switch.
Use "-P" (or "--prereqs") to get a list of all tasks and their
prerequisites.
== Odds and Ends
=== do/end verses { }
Blocks may be specified with either a +do+/+end+ pair, or with curly
braces in Ruby. We _strongly_ recommend using +do+/+end+ to specify the
actions for tasks and rules. Because the rakefile idiom tends to
leave off parenthesis on the task/file/rule methods, unusual
ambiguities can arise when using curly braces.
For example, suppose that the method +object_files+ returns a list of
object files in a project. Now we use +object_files+ as the
prerequistes in a rule specified with actions in curly braces.
# DON'T DO THIS!
file "prog" => object_files {
# Actions are expected here (but it doesn't work)!
}
Because curly braces have a higher precedence than +do+/+end+, the
block is associated with the +object_files+ method rather than the
+file+ method.
This is the proper way to specify the task ...
# THIS IS FINE
file "prog" => object_files do
# Actions go here
end
----
== See
* README -- Main documentation for Rake.

View file

@ -1,151 +0,0 @@
= Why rake?
Ok, let me state from the beginning that I never intended to write this
code. I'm not convinced it is useful, and I'm not convinced anyone
would even be interested in it. All I can say is that Why's onion truck
must by been passing through the Ohio valley.
What am I talking about? ... A Ruby version of Make.
See, I can sense you cringing already, and I agree. The world certainly
doesn't need yet another reworking of the "make" program. I mean, we
already have "ant". Isn't that enough?
It started yesterday. I was helping a coworker fix a problem in one of
the Makefiles we use in our project. Not a particularly tough problem,
but during the course of the conversation I began lamenting some of the
shortcomings of make. In particular, in one of my makefiles I wanted to
determine the name of a file dynamically and had to resort to some
simple scripting (in Ruby) to make it work. "Wouldn't it be nice if you
could just use Ruby inside a Makefile" I said.
My coworker (a recent convert to Ruby) agreed, but wondered what it
would look like. So I sketched the following on the whiteboard...
"What if you could specify the make tasks in Ruby, like this ..."
task "build" do
java_compile(...args, etc ...)
end
"The task function would register "build" as a target to be made,
and the block would be the action executed whenever the build
system determined that it was time to do the build target."
We agreed that would be cool, but writing make from scratch would be WAY
too much work. And that was the end of that!
... Except I couldn't get the thought out of my head. What exactly
would be needed to make the about syntax work as a make file? Hmmm, you
would need to register the tasks, you need some way of specifying
dependencies between tasks, and some way of kicking off the process.
Hey! What if we did ... and fifteen minutes later I had a working
prototype of Ruby make, complete with dependencies and actions.
I showed the code to my coworker and we had a good laugh. It was just
about a page worth of code that reproduced an amazing amount of the
functionality of make. We were both truely stunned with the power of
Ruby.
But it didn't do everything make did. In particular, it didn't have
timestamp based file dependencies (where a file is rebuilt if any of its
prerequisite files have a later timestamp). Obviously THAT would be a
pain to add and so Ruby Make would remain an interesting experiment.
... Except as I walked back to my desk, I started thinking about what
file based dependecies would really need. Rats! I was hooked again,
and by adding a new class and two new methods, file/timestamp
dependencies were implemented.
Ok, now I was really hooked. Last night (during CSI!) I massaged the
code and cleaned it up a bit. The result is a bare-bones replacement
for make in exactly 100 lines of code.
For the curious, you can see it at ...
* doc/proto_rake.rdoc
Oh, about the name. When I wrote the example Ruby Make task on my
whiteboard, my coworker exclaimed "Oh! I have the perfect name: Rake ...
Get it? Ruby-Make. Rake!" He said he envisioned the tasks as leaves
and Rake would clean them up ... or something like that. Anyways, the
name stuck.
Some quick examples ...
A simple task to delete backup files ...
task :clean do
Dir['*~'].each {|fn| rm fn rescue nil}
end
Note that task names are symbols (they are slightly easier to type
than quoted strings ... but you may use quoted string if you would
rather). Rake makes the methods of the FileUtils module directly
available, so we take advantage of the <tt>rm</tt> command. Also note
the use of "rescue nil" to trap and ignore errors in the <tt>rm</tt>
command.
To run it, just type "rake clean". Rake will automatically find a
Rakefile in the current directory (or above!) and will invoke the
targets named on the command line. If there are no targets explicitly
named, rake will invoke the task "default".
Here's another task with dependencies ...
task :clobber => [:clean] do
rm_r "tempdir"
end
Task :clobber depends upon task :clean, so :clean will be run before
:clobber is executed.
Files are specified by using the "file" command. It is similar to the
task command, except that the task name represents a file, and the task
will be run only if the file doesn't exist, or if its modification time
is earlier than any of its prerequisites.
Here is a file based dependency that will compile "hello.cc" to
"hello.o".
file "hello.cc"
file "hello.o" => ["hello.cc"] do |t|
srcfile = t.name.sub(/\.o$/, ".cc")
sh %{g++ #{srcfile} -c -o #{t.name}}
end
I normally specify file tasks with string (rather than symbols). Some
file names can't be represented by symbols. Plus it makes the
distinction between them more clear to the casual reader.
Currently writing a task for each and every file in the project would be
tedious at best. I envision a set of libraries to make this job
easier. For instance, perhaps something like this ...
require 'rake/ctools'
Dir['*.c'].each do |fn|
c_source_file(fn)
end
where "c_source_file" will create all the tasks need to compile all the
C source files in a directory. Any number of useful libraries could be
created for rake.
That's it. There's no documentation (other than whats in this
message). Does this sound interesting to anyone? If so, I'll continue
to clean it up and write it up and publish it on RAA. Otherwise, I'll
leave it as an interesting excerise and a tribute to the power of Ruby.
Why /might/ rake be interesting to Ruby programmers. I don't know,
perhaps ...
* No weird make syntax (only weird Ruby syntax :-)
* No need to edit or read XML (a la ant)
* Platform independent build scripts.
* Will run anywhere Ruby exists, so no need to have "make" installed.
If you stay away from the "sys" command and use things like
'ftools', you can have a perfectly platform independent
build script. Also rake is only 100 lines of code, so it can
easily be packaged along with the rest of your code.
So ... Sorry for the long rambling message. Like I said, I never
intended to write this code at all.

View file

@ -1,23 +0,0 @@
= Rake 0.4.14 Released
== Changes
Version 0.4.14 is a compatibility fix to allow Rake's test task to
work under Ruby 1.8.2. A change in the Test::Unit autorun feature
prevented Rake from running any tests. This release fixes the
problem.
Rake 0.4.14 is the recommended release for anyone using Ruby 1.8.2.
== What is Rake
Rake is a build tool similar to the make program in many ways. But
instead of cryptic make recipes, Rake uses standard Ruby code to
declare tasks and dependencies. You have the full power of a modern
scripting language built right into your build tool.
== Availability
Home Page:: http://rake.rubyforge.org/
Download:: http://rubyforge.org/project/showfiles.php?group_id=50

View file

@ -1,35 +0,0 @@
= Rake 0.4.15 Released
== Changes
Version 0.4.15 is a bug fix update for the Ruby 1.8.2 compatibility
changes. This release includes:
* Fixed a bug that prevented the TESTOPTS flag from working with the
revised for 1.8.2 test task.
* Updated the docs on --trace to indicate that it also enables a full
backtrace on errors.
* Several fixes for new warnings generated.
== Mini-Roadmap
I will continue to issue Rake updates in the 0.4.xx series as new
Ruby-1.8.2 issues become manifest. Once the codebase stabilizes, I
will release a 0.5.0 version incorporating all the changes. If you
are not using Ruby-1.8.2 and wish to avoid version churn, I recommend
staying with a release prior to Rake-0.4.14.
== What is Rake
Rake is a build tool similar to the make program in many ways. But
instead of cryptic make recipes, Rake uses standard Ruby code to
declare tasks and dependencies. You have the full power of a modern
scripting language built right into your build tool.
== Availability
Home Page:: http://rake.rubyforge.org/
Download:: http://rubyforge.org/project/showfiles.php?group_id=50

View file

@ -1,53 +0,0 @@
= Rake 0.5.0 Released
It has been a long time in coming, but we finally have a new version
of Rake available.
== Changes
* Fixed bug where missing intermediate file dependencies could cause
an abort with --trace or --dry-run. (Brian Candler)
* Recursive rules are now supported (Tilman Sauerbeck).
* Added tar.gz and tar.bz2 support to package task (Tilman Sauerbeck).
* Added warning option for the Test Task (requested by Eric Hodel).
* The jamis rdoc template is only used if it exists.
* Added fix for Ruby 1.8.2 test/unit and rails problem.
* Added contributed rake man file. (Jani Monoses)
* Fixed documentation that was lacking the Rake module name (Tilman
Sauerbeck).
== What is Rake
Rake is a build tool similar to the make program in many ways. But
instead of cryptic make recipes, Rake uses standard Ruby code to
declare tasks and dependencies. You have the full power of a modern
scripting language built right into your build tool.
== Availability
The easiest way to get and install rake is via RubyGems ...
gem install rake (you may need root/admin privileges)
Otherwise, you can get it from the more traditional places:
Home Page:: http://rake.rubyforge.org/
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
== Thanks
Lots of people provided input to this release. Thanks to Tilman
Sauerbeck for numerous patches, documentation fixes and suggestions.
And for also pushing me to get this release out. Also, thanks to
Brian Candler for the finding and fixing --trace/dry-run fix. That
was an obscure bug. Also to Eric Hodel for some good suggestions.
-- Jim Weirich

View file

@ -1,78 +0,0 @@
= Rake 0.5.0 Released
Although it has only been two weeks since the last release, we have
enough updates to the Rake program to make it time for another
release.
== Changes
Here are the changes for version 0.5.3 ...
* FileLists have been extensively changed so that they mimic the
behavior of real arrays even more closely. In particular,
operations on FileLists that return a new collection (e.g. collect,
reject) will now return a FileList rather than an array. In
addition, several places where FileLists were not properly expanded
before use have been fixed.
* A method (+ext+) to simplify the handling of file extensions was
added to String and to Array.
* The 'testrb' script in test/unit tends to silently swallow syntax
errors in test suites. Because of that, the default test loader is
now a rake-provided script. You can still use 'testrb' by setting
the loader flag in the test task to :testrb. (See the API documents
for TestTask for all the loader flag values).
* FileUtil methods (e.g. cp, mv, install) are now declared to be
private. This will cut down on the interference with user defined
methods of the same name.
* Fixed the verbose flag in the TestTask so that the test code is
controlled by the flag. Also shortened up some failure messages.
(Thanks to Tobias Luetke for the suggestion).
* Rules will now properly detect a task that can generate a source
file. Previously rules would only consider source files that were
already present.
* Added an +import+ command that allows Rake to dynamically import
dependendencies into a running Rake session. The +import+ command
can run tasks to update the dependency file before loading them.
Dependency files can be in rake or make format, allowing rake to
work with tools designed to generate dependencies for make.
== What is Rake
Rake is a build tool similar to the make program in many ways. But
instead of cryptic make recipes, Rake uses standard Ruby code to
declare tasks and dependencies. You have the full power of a modern
scripting language built right into your build tool.
== Availability
The easiest way to get and install rake is via RubyGems ...
gem install rake (you may need root/admin privileges)
Otherwise, you can get it from the more traditional places:
Home Page:: http://rake.rubyforge.org/
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
== Thanks
As usual, it was input from users that drove a alot of these changes.
Thanks to ...
* Brian Gernhardt for the rules fix (especially for the patience to
explain the problem to me until I got what he was talking about).
* Stefan Lang for pointing out problems in the dark corners of the
FileList implementation.
* Alexey Verkhovsky pointing out the silently swallows syntax errors
in tests.
* Tobias Luetke for beautifying the test task output.
* Sam Roberts for some of the ideas behind dependency loading.
-- Jim Weirich

View file

@ -1,46 +0,0 @@
= Rake 0.5.4 Released
Time for some minor bug fixes and small enhancements
== Changes
Here are the changes for version 0.5.3 ...
* Added double quotes to the test runner. This allows the location of
the tests (and runner) to be in a directory path that contains
spaces (e.g. "C:/Program Files/ruby/bin").
* Added .svn to default ignore list. Now subversion project metadata
is automatically ignored by Rake's FileList.
* Updated FileList#include to support nested arrays and filelists.
FileLists are flat lists of file names. Using a FileList in an
include will flatten out the nested file names.
== What is Rake
Rake is a build tool similar to the make program in many ways. But
instead of cryptic make recipes, Rake uses standard Ruby code to
declare tasks and dependencies. You have the full power of a modern
scripting language built right into your build tool.
== Availability
The easiest way to get and install rake is via RubyGems ...
gem install rake (you may need root/admin privileges)
Otherwise, you can get it from the more traditional places:
Home Page:: http://rake.rubyforge.org/
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
== Thanks
As usual, it was input from users that drove a alot of these changes.
Thanks to ...
* Tilman Sauerbeck for the nested FileList suggestion.
* Josh Knowles for pointing out the spaces in directory name problem.
-- Jim Weirich

View file

@ -1,141 +0,0 @@
= Rake 0.6.0 Released
Its time for some long requested enhancements and lots of bug fixes
... And a whole new web page.
== New Web Page
The primary documentation for rake has moved from the RubyForge based
wiki to its own Hieraki based web site. Constant spam on the wiki
made it a difficult to keep clean. The new site will be easier to
update and organize.
Check out the new documentation at: http://docs.rubyrake.org
We will be adding new documentation to the site as time goes on.
In addition to the new docs page, make sure you check out Martin
Fowlers article on rake at http://martinfowler.com/articles/rake.html
== Changes
=== New Features
* Multiple prerequisites on Rake rules now allowed. However, keep the
following in mind:
1. All the prerequisites of a rule must be available before a rule
is triggered, where "enabled" means (a) an existing file, (b) a
defined rule, or (c) another rule which also must be
trigger-able.
2. Rules are checked in order of definition, so it is important to
order your rules properly. If a file can be created by two
different rules, put the more specific rule first (otherwise the
more general rule will trigger first and the specific one will
never be triggered).
3. The <tt>source</tt> method now returns the name of the first
prerequisite listed in the rule. <tt>sources</tt> returns the
names of all the rule prerequisites, ordered as they are defined
in the rule. If the task has other prerequisites not defined in
the rule (but defined in an explicit task definition), then they
will _not_ be included in the sources list.
* FileLists may now use the egrep command. This popular enhancement
is now a core part of the FileList object. If you want to get a
list of all your to-dos, fixmes and TBD comments, add the following
to your Rakefile.
desc "Look for TODO and FIXME tags in the code"
task :todo do
FileList['**/*.rb'].egrep /#.*(FIXME|TODO|TBD)/
end
* The <tt>investigation</tt> method was added to task object to dump
out some important values. This makes it a bit easier to debug Rake
tasks.
For example, if you are having problems with a particular task, just
print it out:
task :huh do
puts Rake::Task['huh'].investigation
end
* The Rake::TestTask class now supports a "ruby_opts" option to pass
arbitrary ruby options to a test subprocess.
=== Some Incompatibilities
* When using the <tt>ruby</tt> command to start a Ruby subprocess, the
Ruby interpreter that is currently running rake is used by default.
This makes it easier to use rake in an environment with multiple
ruby installation. (Previously, the first ruby command found in the
PATH was used).
If you wish to chose a different Ruby interpreter, you can
explicitly choose the interpreter via the <tt>sh</tt> command.
* The major rake classes (Task, FileTask, FileCreationTask, RakeApp)
have been moved out of the toplevel scope and are now accessible as
Rake::Task, Rake::FileTask, Rake::FileCreationTask and
Rake::Application. If your Rakefile
directly references any one of these tasks, you may:
1. Update your Rakefile to use the new classnames
2. Use the --classic-namespace option on the rake command to get the
old behavior,
3. Add <code>require 'rake/classic_namespace'</code> to the
Rakefile to get the old behavior.
<tt>rake</tt> will print a rather annoying warning whenever a
deprecated class name is referenced without enabling classic
namespace.
=== Bug Fixes
* Several unit tests and functional tests were fixed to run better
under windows.
* Directory tasks are now a specialized version of a File task. A
directory task will only be triggered if it doesn't exist. It will
not be triggered if it is out of date w.r.t. any of its
prerequisites.
* Fixed a bug in the Rake::GemPackageTask class so that the gem now
properly contains the platform name.
* Fixed a bug where a prerequisite on a <tt>file</tt> task would cause
an exception if the prerequisite did not exist.
== What is Rake
Rake is a build tool similar to the make program in many ways. But
instead of cryptic make recipes, Rake uses standard Ruby code to
declare tasks and dependencies. You have the full power of a modern
scripting language built right into your build tool.
== Availability
The easiest way to get and install rake is via RubyGems ...
gem install rake (you may need root/admin privileges)
Otherwise, you can get it from the more traditional places:
Home Page:: http://rake.rubyforge.org/
Download:: http://rubyforge.org/project/showfiles.php?group_id=50
== Thanks
As usual, it was input from users that drove a alot of these changes.
The following people either contributed patches, made suggestions or
made otherwise helpful comments. Thanks to ...
* Greg Fast (better ruby_opt test options)
* Kelly Felkins (requested by better namespace support)
* Martin Fowler (suggested Task.investigation)
* Stuart Jansen (send initial patch for multiple prerequisites).
* Masao Mutch (better support for non-ruby Gem platforms)
* Philipp Neubeck (patch for file task exception fix)
-- Jim Weirich

View file

@ -1,88 +0,0 @@
require 'rbconfig'
require 'find'
require 'ftools'
include Config
$ruby = CONFIG['ruby_install_name']
##
# Install a binary file. We patch in on the way through to
# insert a #! line. If this is a Unix install, we name
# the command (for example) 'rake' and let the shebang line
# handle running it. Under windows, we add a '.rb' extension
# and let file associations to their stuff
#
def installBIN(from, opfile)
tmp_dir = nil
for t in [".", "/tmp", "c:/temp", $bindir]
stat = File.stat(t) rescue next
if stat.directory? and stat.writable?
tmp_dir = t
break
end
end
fail "Cannot find a temporary directory" unless tmp_dir
tmp_file = File.join(tmp_dir, "_tmp")
File.open(from) do |ip|
File.open(tmp_file, "w") do |op|
ruby = File.join($realbindir, $ruby)
op.puts "#!#{ruby} -w"
op.write ip.read
end
end
opfile += ".rb" if CONFIG["target_os"] =~ /mswin/i
File::install(tmp_file, File.join($bindir, opfile), 0755, true)
File::unlink(tmp_file)
end
$sitedir = CONFIG["sitelibdir"]
unless $sitedir
version = CONFIG["MAJOR"]+"."+CONFIG["MINOR"]
$libdir = File.join(CONFIG["libdir"], "ruby", version)
$sitedir = $:.find {|x| x =~ /site_ruby/}
if !$sitedir
$sitedir = File.join($libdir, "site_ruby")
elsif $sitedir !~ Regexp.quote(version)
$sitedir = File.join($sitedir, version)
end
end
$bindir = CONFIG["bindir"]
$realbindir = $bindir
bindir = CONFIG["bindir"]
if (destdir = ENV['DESTDIR'])
$bindir = destdir + $bindir
$sitedir = destdir + $sitedir
File::makedirs($bindir)
File::makedirs($sitedir)
end
rake_dest = File.join($sitedir, "rake")
File::makedirs(rake_dest, true)
File::chmod(0755, rake_dest)
# The library files
files = Dir.chdir('lib') { Dir['**/*.rb'] }
for fn in files
fn_dir = File.dirname(fn)
target_dir = File.join($sitedir, fn_dir)
if ! File.exist?(target_dir)
File.makedirs(target_dir)
end
File::install(File.join('lib', fn), File.join($sitedir, fn), 0644, true)
end
# and the executable
installBIN("bin/rake", "rake")

File diff suppressed because it is too large Load diff

View file

@ -1,8 +0,0 @@
# The following classes used to be in the top level namespace.
# Loading this file enables compatibility with older Rakefile that
# referenced Task from the top level.
Task = Rake::Task
FileTask = Rake::FileTask
FileCreationTask = Rake::FileCreationTask
RakeApp = Rake::Application

View file

@ -1,31 +0,0 @@
#!/usr/bin/env ruby
# The 'rake/clean' file defines two file lists (CLEAN and CLOBBER) and
# two rake tasks (:clean and :clobber).
#
# [:clean] Clean up the project by deleting scratch files and backup
# files. Add files to the CLEAN file list to have the :clean
# target handle them.
#
# [:clobber] Clobber all generated and non-source files in a project.
# The task depends on :clean, so all the clean files will
# be deleted as well as files in the CLOBBER file list.
# The intent of this task is to return a project to its
# pristine, just unpacked state.
require 'rake'
CLEAN = Rake::FileList["**/*~", "**/*.bak", "**/core"]
CLEAN.clear_exclude
desc "Remove any temporary products."
task :clean do
CLEAN.each { |fn| rm_r fn rescue nil }
end
CLOBBER = Rake::FileList.new
desc "Remove any generated file."
task :clobber => [:clean] do
CLOBBER.each { |fn| rm_r fn rescue nil }
end

View file

@ -1,24 +0,0 @@
#!/usr/bin/env ruby
module Rake
# Manage several publishers as a single entity.
class CompositePublisher
def initialize
@publishers = []
end
# Add a publisher to the composite.
def add(pub)
@publishers << pub
end
# Upload all the individual publishers.
def upload
@publishers.each { |p| p.upload }
end
end
end

View file

@ -1,139 +0,0 @@
#!/usr/bin/env ruby
# = Tools for FTP uploading.
#
# This file is still under development and is not released for general
# use.
require 'date'
require 'parsedate'
require 'net/ftp'
module Rake # :nodoc:
####################################################################
# <b>Note:</b> <em> Not released for general use.</em>
class FtpFile
attr_reader :name, :size, :owner, :group, :time
def self.date
@date_class ||= Date
end
def initialize(path, entry)
@path = path
@mode, line, @owner, @group, size, d1, d2, d3, @name = entry.split(' ')
@size = size.to_i
@time = determine_time(d1, d2, d3)
end
def path
File.join(@path, @name)
end
def directory?
@mode[0] == ?d
end
def mode
parse_mode(@mode)
end
def symlink?
@mode[0] == ?l
end
private # --------------------------------------------------------
def parse_mode(m)
result = 0
(1..9).each do |i|
result = 2*result + ((m[i]==?-) ? 0 : 1)
end
result
end
def determine_time(d1, d2, d3)
elements = ParseDate.parsedate("#{d1} #{d2} #{d3}")
if elements[0].nil?
today = self.class.date.today
if elements[1] > today.month
elements[0] = today.year - 1
else
elements[0] = today.year
end
end
elements = elements.collect { |el| el.nil? ? 0 : el }
Time.mktime(*elements[0,7])
end
end
####################################################################
# Manage the uploading of files to an FTP account.
class FtpUploader
# Log uploads to standard output when true.
attr_accessor :verbose
class << FtpUploader
# Create an uploader and pass it to the given block as +up+.
# When the block is complete, close the uploader.
def connect(path, host, account, password)
up = self.new(path, host, account, password)
begin
yield(up)
ensure
up.close
end
end
end
# Create an FTP uploader targetting the directory +path+ on +host+
# using the given account and password. +path+ will be the root
# path of the uploader.
def initialize(path, host, account, password)
@created = Hash.new
@path = path
@ftp = Net::FTP.new(host, account, password)
makedirs(@path)
@ftp.chdir(@path)
end
# Create the directory +path+ in the uploader root path.
def makedirs(path)
route = []
File.split(path).each do |dir|
route << dir
current_dir = File.join(route)
if @created[current_dir].nil?
@created[current_dir] = true
puts "Creating Directory #{current_dir}" if @verbose
@ftp.mkdir(current_dir) rescue nil
end
end
end
# Upload all files matching +wildcard+ to the uploader's root
# path.
def upload_files(wildcard)
Dir[wildcard].each do |fn|
upload(fn)
end
end
# Close the uploader.
def close
@ftp.close
end
private # --------------------------------------------------------
# Upload a single file to the uploader's root path.
def upload(file)
puts "Uploading #{file}" if @verbose
dir = File.dirname(file)
makedirs(dir)
@ftp.putbinaryfile(file, file) unless File.directory?(file)
end
end
end

View file

@ -1,75 +0,0 @@
#!/usr/bin/env ruby
# Copyright 2003, 2004 by Jim Weirich (jim@weirichhouse.org)
# All rights reserved.
# Permission is granted for use, copying, modification, distribution,
# and distribution of modified versions of this work as long as the
# above copyright notice is included.
# Configuration information about an upload host system.
# * name :: Name of host system.
# * webdir :: Base directory for the web information for the
# application. The application name (APP) is appended to
# this directory before using.
# * pkgdir :: Directory on the host system where packages can be
# placed.
HostInfo = Struct.new(:name, :webdir, :pkgdir)
# Manage several publishers as a single entity.
class CompositePublisher
def initialize
@publishers = []
end
# Add a publisher to the composite.
def add(pub)
@publishers << pub
end
# Upload all the individual publishers.
def upload
@publishers.each { |p| p.upload }
end
end
# Publish an entire directory to an existing remote directory using
# SSH.
class SshDirPublisher
def initialize(host, remote_dir, local_dir)
@host = host
@remote_dir = remote_dir
@local_dir = local_dir
end
def upload
run %{scp -rq #{@local_dir}/* #{@host}:#{@remote_dir}}
end
end
# Publish an entire directory to a fresh remote directory using SSH.
class SshFreshDirPublisher < SshDirPublisher
def upload
run %{ssh #{@host} rm -rf #{@remote_dir}} rescue nil
run %{ssh #{@host} mkdir #{@remote_dir}}
super
end
end
# Publish a list of files to an existing remote directory.
class SshFilePublisher
# Create a publisher using the give host information.
def initialize(host, remote_dir, local_dir, *files)
@host = host
@remote_dir = remote_dir
@local_dir = local_dir
@files = files
end
# Upload the local directory to the remote directory.
def upload
@files.each do |fn|
run %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}
end
end
end

View file

@ -1,18 +0,0 @@
#!/usr/bin/env ruby
require 'rake/contrib/sshpublisher'
module Rake
class RubyForgePublisher < SshDirPublisher
attr_reader :project, :proj_id, :user
def initialize(projname, user)
super(
"#{user}@rubyforge.org",
"/var/www/gforge-projects/#{projname}",
"html")
end
end
end

View file

@ -1,47 +0,0 @@
#!/usr/bin/env ruby
require 'rake/contrib/compositepublisher'
module Rake
# Publish an entire directory to an existing remote directory using
# SSH.
class SshDirPublisher
def initialize(host, remote_dir, local_dir)
@host = host
@remote_dir = remote_dir
@local_dir = local_dir
end
def upload
sh %{scp -rq #{@local_dir}/* #{@host}:#{@remote_dir}}
end
end
# Publish an entire directory to a fresh remote directory using SSH.
class SshFreshDirPublisher < SshDirPublisher
def upload
sh %{ssh #{@host} rm -rf #{@remote_dir}} rescue nil
sh %{ssh #{@host} mkdir #{@remote_dir}}
super
end
end
# Publish a list of files to an existing remote directory.
class SshFilePublisher
# Create a publisher using the give host information.
def initialize(host, remote_dir, local_dir, *files)
@host = host
@remote_dir = remote_dir
@local_dir = local_dir
@files = files
end
# Upload the local directory to the remote directory.
def upload
@files.each do |fn|
sh %{scp -q #{@local_dir}/#{fn} #{@host}:#{@remote_dir}}
end
end
end
end

View file

@ -1,207 +0,0 @@
#!/usr/bin/env ruby
#--
# Copyright (c) 2003, 2004 Jim Weirich
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
#
require 'ftools'
require 'rbconfig'
######################################################################
# Sys provides a number of file manipulation tools for the convenience
# of writing Rakefiles. All commands in this module will announce
# their activity on standard output if the $verbose flag is set
# ($verbose = true is the default). You can control this by globally
# setting $verbose or by using the +verbose+ and +quiet+ methods.
#
# Sys has been deprecated in favor of the FileUtils module available
# in Ruby 1.8.
#
module Sys
RUBY = Config::CONFIG['ruby_install_name']
# Install all the files matching +wildcard+ into the +dest_dir+
# directory. The permission mode is set to +mode+.
def install(wildcard, dest_dir, mode)
Dir[wildcard].each do |fn|
File.install(fn, dest_dir, mode, $verbose)
end
end
# Run the system command +cmd+.
def run(cmd)
log cmd
system(cmd) or fail "Command Failed: [#{cmd}]"
end
# Run a Ruby interpreter with the given arguments.
def ruby(*args)
run "#{RUBY} #{args.join(' ')}"
end
# Copy a single file from +file_name+ to +dest_file+.
def copy(file_name, dest_file)
log "Copying file #{file_name} to #{dest_file}"
File.copy(file_name, dest_file)
end
# Copy all files matching +wildcard+ into the directory +dest_dir+.
def copy_files(wildcard, dest_dir)
for_matching_files(wildcard, dest_dir) { |from, to| copy(from, to) }
end
# Link +file_name+ to +dest_file+.
def link(file_name, dest_file)
log "Linking file #{file_name} to #{dest_file}"
File.link(file_name, dest_file)
end
# Link all files matching +wildcard+ into the directory +dest_dir+.
def link_files(wildcard, dest_dir)
for_matching_files(wildcard, dest_dir) { |from, to| link(from, to) }
end
# Symlink +file_name+ to +dest_file+.
def symlink(file_name, dest_file)
log "Symlinking file #{file_name} to #{dest_file}"
File.symlink(file_name, dest_file)
end
# Symlink all files matching +wildcard+ into the directory +dest_dir+.
def symlink_files(wildcard, dest_dir)
for_matching_files(wildcard, dest_dir) { |from, to| link(from, to) }
end
# Remove all files matching +wildcard+. If a matching file is a
# directory, it must be empty to be removed. used +delete_all+ to
# recursively delete directories.
def delete(*wildcards)
wildcards.each do |wildcard|
Dir[wildcard].each do |fn|
if File.directory?(fn)
log "Deleting directory #{fn}"
Dir.delete(fn)
else
log "Deleting file #{fn}"
File.delete(fn)
end
end
end
end
# Recursively delete all files and directories matching +wildcard+.
def delete_all(*wildcards)
wildcards.each do |wildcard|
Dir[wildcard].each do |fn|
next if ! File.exist?(fn)
if File.directory?(fn)
Dir["#{fn}/*"].each do |subfn|
next if subfn=='.' || subfn=='..'
delete_all(subfn)
end
log "Deleting directory #{fn}"
Dir.delete(fn)
else
log "Deleting file #{fn}"
File.delete(fn)
end
end
end
end
# Make the directories given in +dirs+.
def makedirs(*dirs)
dirs.each do |fn|
log "Making directory #{fn}"
File.makedirs(fn)
end
end
# Make +dir+ the current working directory for the duration of
# executing the given block.
def indir(dir)
olddir = Dir.pwd
Dir.chdir(dir)
yield
ensure
Dir.chdir(olddir)
end
# Split a file path into individual directory names.
#
# For example:
# split_all("a/b/c") => ['a', 'b', 'c']
def split_all(path)
head, tail = File.split(path)
return [tail] if head == '.' || tail == '/'
return [head, tail] if head == '/'
return split_all(head) + [tail]
end
# Write a message to standard out if $verbose is enabled.
def log(msg)
print " " if $trace && $verbose
puts msg if $verbose
end
# Perform a block with $verbose disabled.
def quiet(&block)
with_verbose(false, &block)
end
# Perform a block with $verbose enabled.
def verbose(&block)
with_verbose(true, &block)
end
# Perform a block with each file matching a set of wildcards.
def for_files(*wildcards)
wildcards.each do |wildcard|
Dir[wildcard].each do |fn|
yield(fn)
end
end
end
extend(self)
private # ----------------------------------------------------------
def for_matching_files(wildcard, dest_dir)
Dir[wildcard].each do |fn|
dest_file = File.join(dest_dir, fn)
parent = File.dirname(dest_file)
makedirs(parent) if ! File.directory?(parent)
yield(fn, dest_file)
end
end
def with_verbose(v)
oldverbose = $verbose
$verbose = v
yield
ensure
$verbose = oldverbose
end
end

View file

@ -1,100 +0,0 @@
#!/usr/bin/env ruby
# Define a package task library to aid in the definition of GEM
# packages.
require 'rubygems'
require 'rake'
require 'rake/packagetask'
begin
Gem.manage_gems
rescue NoMethodError => ex
# Using rubygems prior to 0.6.1
end
module Rake
# Create a package based upon a Gem spec. Gem packages, as well as
# zip files and tar/gzipped packages can be produced by this task.
#
# In addition to the Rake targets generated by PackageTask, a
# GemPackageTask will also generate the following tasks:
#
# [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.gem"</b>]
# Create a Ruby GEM package with the given name and version.
#
# Example using a Ruby GEM spec:
#
# require 'rubygems'
#
# spec = Gem::Specification.new do |s|
# s.platform = Gem::Platform::RUBY
# s.summary = "Ruby based make-like utility."
# s.name = 'rake'
# s.version = PKG_VERSION
# s.requirements << 'none'
# s.require_path = 'lib'
# s.autorequire = 'rake'
# s.files = PKG_FILES
# s.description = <<EOF
# Rake is a Make-like program implemented in Ruby. Tasks
# and dependencies are specified in standard Ruby syntax.
# EOF
# end
#
# Rake::GemPackageTask.new(spec) do |pkg|
# pkg.need_zip = true
# pkg.need_tar = true
# end
#
class GemPackageTask < PackageTask
# Ruby GEM spec containing the metadata for this package. The
# name, version and package_files are automatically determined
# from the GEM spec and don't need to be explicitly provided.
attr_accessor :gem_spec
# Create a GEM Package task library. Automatically define the gem
# if a block is given. If no block is supplied, then +define+
# needs to be called to define the task.
def initialize(gem_spec)
init(gem_spec)
yield self if block_given?
define if block_given?
end
# Initialization tasks without the "yield self" or define
# operations.
def init(gem)
super(gem.name, gem.version)
@gem_spec = gem
@package_files += gem_spec.files if gem_spec.files
end
# Create the Rake tasks and actions specified by this
# GemPackageTask. (+define+ is automatically called if a block is
# given to +new+).
def define
super
task :package => [:gem]
task :gem => ["#{package_dir}/#{gem_file}"]
file "#{package_dir}/#{gem_file}" => [package_dir] + @gem_spec.files do
when_writing("Creating GEM") {
Gem::Builder.new(gem_spec).build
verbose(true) {
mv gem_file, "#{package_dir}/#{gem_file}"
}
}
end
end
def gem_file
if @gem_spec.platform == Gem::Platform::RUBY
"#{package_name}.gem"
else
"#{package_name}-#{@gem_spec.platform}.gem"
end
end
end
end

View file

@ -1,41 +0,0 @@
#!/usr/bin/env ruby
module Rake
# Makefile loader to be used with the import file loader.
class MakefileLoader
# Load the makefile dependencies in +fn+.
def load(fn)
buffer = ''
open(fn) do |mf|
mf.each do |line|
next if line =~ /^\s*#/
buffer << line
if buffer =~ /\\$/
buffer.sub!(/\\\n/, ' ')
state = :append
else
process_line(buffer)
buffer = ''
end
end
end
process_line(buffer) if buffer != ''
end
private
# Process one logical line of makefile data.
def process_line(line)
file_task, args = line.split(':')
return if args.nil?
dependents = args.split
file file_task => dependents
end
end
# Install the handler
Rake.application.add_loader('mf', MakefileLoader.new)
end

View file

@ -1,178 +0,0 @@
#!/usr/bin/env ruby
# Define a package task libarary to aid in the definition of
# redistributable package files.
require 'rake'
require 'rake/tasklib'
module Rake
# Create a packaging task that will package the project into
# distributable files (e.g zip archive or tar files).
#
# The PackageTask will create the following targets:
#
# [<b>:package</b>]
# Create all the requested package files.
#
# [<b>:clobber_package</b>]
# Delete all the package files. This target is automatically
# added to the main clobber target.
#
# [<b>:repackage</b>]
# Rebuild the package files from scratch, even if they are not out
# of date.
#
# [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tgz"</b>]
# Create a gzipped tar package (if <em>need_tar</em> is true).
#
# [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tar.gz"</b>]
# Create a gzipped tar package (if <em>need_tar_gz</em> is true).
#
# [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.tar.bz2"</b>]
# Create a bzip2'd tar package (if <em>need_tar_bz2</em> is true).
#
# [<b>"<em>package_dir</em>/<em>name</em>-<em>version</em>.zip"</b>]
# Create a zip package archive (if <em>need_zip</em> is true).
#
# Example:
#
# Rake::PackageTask.new("rake", "1.2.3") do |p|
# p.need_tar = true
# p.package_files.include("lib/**/*.rb")
# end
#
class PackageTask < TaskLib
# Name of the package (from the GEM Spec).
attr_accessor :name
# Version of the package (e.g. '1.3.2').
attr_accessor :version
# Directory used to store the package files (default is 'pkg').
attr_accessor :package_dir
# True if a gzipped tar file (tgz) should be produced (default is false).
attr_accessor :need_tar
# True if a gzipped tar file (tar.gz) should be produced (default is false).
attr_accessor :need_tar_gz
# True if a bzip2'd tar file (tar.bz2) should be produced (default is false).
attr_accessor :need_tar_bz2
# True if a zip file should be produced (default is false)
attr_accessor :need_zip
# List of files to be included in the package.
attr_accessor :package_files
# Create a Package Task with the given name and version.
def initialize(name=nil, version=nil)
init(name, version)
yield self if block_given?
define unless name.nil?
end
# Initialization that bypasses the "yield self" and "define" step.
def init(name, version)
@name = name
@version = version
@package_files = Rake::FileList.new
@package_dir = 'pkg'
@need_tar = false
@need_tar_gz = false
@need_tar_bz2 = false
@need_zip = false
end
# Create the tasks defined by this task library.
def define
fail "Version required (or :noversion)" if @version.nil?
@version = nil if :noversion == @version
desc "Build all the packages"
task :package
desc "Force a rebuild of the package files"
task :repackage => [:clobber_package, :package]
desc "Remove package products"
task :clobber_package do
rm_r package_dir rescue nil
end
task :clobber => [:clobber_package]
[
[need_tar, tgz_file, "z"],
[need_tar_gz, tar_gz_file, "z"],
[need_tar_bz2, tar_bz2_file, "j"]
].each do |(need, file, flag)|
if need
task :package => ["#{package_dir}/#{file}"]
file "#{package_dir}/#{file}" => [package_dir_path] + package_files do
chdir(package_dir) do
sh %{tar #{flag}cvf #{file} #{package_name}}
end
end
end
end
if need_zip
task :package => ["#{package_dir}/#{zip_file}"]
file "#{package_dir}/#{zip_file}" => [package_dir_path] + package_files do
chdir(package_dir) do
sh %{zip -r #{zip_file} #{package_name}}
end
end
end
directory package_dir
file package_dir_path => @package_files do
mkdir_p package_dir rescue nil
@package_files.each do |fn|
f = File.join(package_dir_path, fn)
fdir = File.dirname(f)
mkdir_p(fdir) if !File.exist?(fdir)
if File.directory?(fn)
mkdir_p(f)
else
rm_f f
safe_ln(fn, f)
end
end
end
self
end
def package_name
@version ? "#{@name}-#{@version}" : @name
end
def package_dir_path
"#{package_dir}/#{package_name}"
end
def tgz_file
"#{package_name}.tgz"
end
def tar_gz_file
"#{package_name}.tar.gz"
end
def tar_bz2_file
"#{package_name}.tar.bz2"
end
def zip_file
"#{package_name}.zip"
end
end
end

View file

@ -1,5 +0,0 @@
#!/usr/bin/env ruby
# Load the test files from the command line.
ARGV.each { |f| load f unless f =~ /^-/ }

View file

@ -1,128 +0,0 @@
#!/usr/bin/env ruby
require 'rake'
require 'rake/tasklib'
module Rake
# Create a documentation task that will generate the RDoc files for
# a project.
#
# The RDocTask will create the following targets:
#
# [<b><em>rdoc</em></b>]
# Main task for this RDOC task.
#
# [<b>:clobber_<em>rdoc</em></b>]
# Delete all the rdoc files. This target is automatically
# added to the main clobber target.
#
# [<b>:re<em>rdoc</em></b>]
# Rebuild the rdoc files from scratch, even if they are not out
# of date.
#
# Simple Example:
#
# Rake::RDocTask.new do |rd|
# rd.main = "README.rdoc"
# rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
# end
#
# You may wish to give the task a different name, such as if you are
# generating two sets of documentation. For instance, if you want to have a
# development set of documentation including private methods:
#
# Rake::RDocTask.new(:rdoc_dev) do |rd|
# rd.main = "README.doc"
# rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
# rd.options << "--all"
# end
#
# The tasks would then be named :<em>rdoc_dev</em>, :clobber_<em>rdoc_dev</em>, and
# :re<em>rdoc_dev</em>.
#
class RDocTask < TaskLib
# Name of the main, top level task. (default is :rdoc)
attr_accessor :name
# Name of directory to receive the html output files. (default is "html")
attr_accessor :rdoc_dir
# Title of RDoc documentation. (default is none)
attr_accessor :title
# Name of file to be used as the main, top level file of the
# RDoc. (default is none)
attr_accessor :main
# Name of template to be used by rdoc. (default is 'html')
attr_accessor :template
# List of files to be included in the rdoc generation. (default is [])
attr_accessor :rdoc_files
# List of options to be passed rdoc. (default is [])
attr_accessor :options
# Create an RDoc task named <em>rdoc</em>. Default task name is +rdoc+.
def initialize(name=:rdoc) # :yield: self
@name = name
@rdoc_files = Rake::FileList.new
@rdoc_dir = 'html'
@main = nil
@title = nil
@template = 'html'
@options = []
yield self if block_given?
define
end
# Create the tasks defined by this task lib.
def define
if name.to_s != "rdoc"
desc "Build the RDOC HTML Files"
end
desc "Build the #{name} HTML Files"
task name
desc "Force a rebuild of the RDOC files"
task paste("re", name) => [paste("clobber_", name), name]
desc "Remove rdoc products"
task paste("clobber_", name) do
rm_r rdoc_dir rescue nil
end
task :clobber => [paste("clobber_", name)]
directory @rdoc_dir
task name => [rdoc_target]
file rdoc_target => @rdoc_files + [$rakefile] do
rm_r @rdoc_dir rescue nil
opts = option_list.join(' ')
sh %{rdoc -o #{@rdoc_dir} #{opts} #{@rdoc_files}}
end
self
end
def option_list
result = @options.dup
result << "--main" << "'#{main}'" if main
result << "--title" << "'#{title}'" if title
result << "-T" << "'#{template}'" if template
result
end
def option_string
option_list.join(' ')
end
private
def rdoc_target
"#{rdoc_dir}/index.html"
end
end
end

View file

@ -1,23 +0,0 @@
module Test
module Unit
module Collector
class Dir
undef collect_file
def collect_file(name, suites, already_gathered)
# loadpath = $:.dup
dir = File.dirname(File.expand_path(name))
$:.unshift(dir) unless $:.first == dir
if(@req)
@req.require(name)
else
require(name)
end
find_test_cases(already_gathered).each{|t| add_suite(suites, t.suite)}
ensure
# $:.replace(loadpath)
$:.delete_at $:.rindex(dir)
end
end
end
end
end

View file

@ -1,23 +0,0 @@
#!/usr/bin/env ruby
require 'test/unit'
require 'test/unit/assertions'
module Rake
include Test::Unit::Assertions
def run_tests(pattern='test/test*.rb', log_enabled=false)
Dir["#{pattern}"].each { |fn|
puts fn if log_enabled
begin
load fn
rescue Exception => ex
puts "Error in #{fn}: #{ex.message}"
puts ex.backtrace
assert false
end
}
end
extend self
end

View file

@ -1,18 +0,0 @@
#!/usr/bin/env ruby
require 'rake'
module Rake
# Base class for Task Libraries.
class TaskLib
include Cloneable
# Make a symbol by pasting two strings together.
def paste(a,b)
(a.to_s + b.to_s).intern
end
end
end

View file

@ -1,162 +0,0 @@
#!/usr/bin/env ruby
# Define a task library for running unit tests.
require 'rake'
require 'rake/tasklib'
module Rake
# Create a task that runs a set of tests.
#
# Example:
#
# Rake::TestTask.new do |t|
# t.libs << "test"
# t.test_files = FileList['test/test*.rb']
# t.verbose = true
# end
#
# If rake is invoked with a "TEST=filename" command line option,
# then the list of test files will be overridden to include only the
# filename specified on the command line. This provides an easy way
# to run just one test.
#
# If rake is invoked with a "TESTOPTS=options" command line option,
# then the given options are passed to the test process after a
# '--'. This allows Test::Unit options to be passed to the test
# suite.
#
# Examples:
#
# rake test # run tests normally
# rake test TEST=just_one_file.rb # run just one test file.
# rake test TESTOPTS="-v" # run in verbose mode
# rake test TESTOPTS="--runner=fox" # use the fox test runner
#
class TestTask < TaskLib
# Name of test task. (default is :test)
attr_accessor :name
# List of directories to added to $LOAD_PATH before running the
# tests. (default is 'lib')
attr_accessor :libs
# True if verbose test output desired. (default is false)
attr_accessor :verbose
# Test options passed to the test suite. An explicit
# TESTOPTS=opts on the command line will override this. (default
# is NONE)
attr_accessor :options
# Request that the tests be run with the warning flag set.
# E.g. warning=true implies "ruby -w" used to run the tests.
attr_accessor :warning
# Glob pattern to match test files. (default is 'test/test*.rb')
attr_accessor :pattern
# Style of test loader to use. Options are:
#
# * :rake -- Rake provided test loading script (default).
# * :testrb -- Ruby provided test loading script.
# * :direct -- Load tests using command line loader.
#
attr_accessor :loader
# Array of commandline options to pass to ruby when running test loader.
attr_accessor :ruby_opts
# Explicitly define the list of test files to be included in a
# test. +list+ is expected to be an array of file names (a
# FileList is acceptable). If both +pattern+ and +test_files+ are
# used, then the list of test files is the union of the two.
def test_files=(list)
@test_files = list
end
# Create a testing task.
def initialize(name=:test)
@name = name
@libs = ["lib"]
@pattern = nil
@options = nil
@test_files = nil
@verbose = false
@warning = false
@loader = :rake
@ruby_opts = []
yield self if block_given?
@pattern = 'test/test*.rb' if @pattern.nil? && @test_files.nil?
define
end
# Create the tasks defined by this task lib.
def define
lib_path = @libs.join(File::PATH_SEPARATOR)
desc "Run tests" + (@name==:test ? "" : " for #{@name}")
task @name do
run_code = ''
RakeFileUtils.verbose(@verbose) do
run_code =
case @loader
when :direct
"-e 'ARGV.each{|f| load f}'"
when :testrb
"-S testrb #{fix}"
when :rake
rake_loader
end
@ruby_opts.unshift( "-I#{lib_path}" )
@ruby_opts.unshift( "-w" ) if @warning
ruby @ruby_opts.join(" ") +
" \"#{run_code}\" " +
file_list.collect { |fn| "\"#{fn}\"" }.join(' ') +
" #{option_list}"
end
end
self
end
def option_list # :nodoc:
ENV['TESTOPTS'] || @options || ""
end
def file_list # :nodoc:
if ENV['TEST']
FileList[ ENV['TEST'] ]
else
result = []
result += @test_files.to_a if @test_files
result += FileList[ @pattern ].to_a if @pattern
FileList[result]
end
end
def fix # :nodoc:
case RUBY_VERSION
when '1.8.2'
find_file 'rake/ruby182_test_unit_fix'
else
nil
end || ''
end
def rake_loader # :nodoc:
find_file('rake/rake_test_loader') or
fail "unable to find rake test loader"
end
def find_file(fn) # :nodoc:
$LOAD_PATH.each do |path|
file_path = File.join(path, "#{fn}.rb")
return file_path if File.exist? file_path
end
nil
end
end
end

View file

@ -1,47 +0,0 @@
#!/usr/bin/env ruby
require 'test/unit'
require 'test/filecreation'
require 'rake/contrib/sys'
class TestSys < Test::Unit::TestCase
include FileCreation
# def test_delete
# create_file("testdata/a")
# Sys.delete_all("testdata/a")
# assert ! File.exist?("testdata/a")
# end
# def test_copy
# create_file("testdata/a")
# Sys.copy("testdata/a", "testdata/b")
# assert File.exist?("testdata/b")
# end
# def test_for_files
# test_files = ["testdata/a.pl", "testdata/c.pl", "testdata/b.rb"]
# test_files.each { |fn| create_file(fn) }
# list = []
# Sys.for_files("testdata/*.pl", "testdata/*.rb") { |fn|
# list << fn
# }
# assert_equal test_files.sort, list.sort
# end
# def test_indir
# here = Dir.pwd
# Sys.makedirs("testdata/dir")
# assert_equal "#{here}/testdata/dir", Sys.indir("testdata/dir") { Dir.pwd }
# assert_equal here, Dir.pwd
# end
def test_split_all
assert_equal ['a'], Sys.split_all('a')
assert_equal ['..'], Sys.split_all('..')
assert_equal ['/'], Sys.split_all('/')
assert_equal ['a', 'b'], Sys.split_all('a/b')
assert_equal ['/', 'a', 'b'], Sys.split_all('/a/b')
assert_equal ['..', 'a', 'b'], Sys.split_all('../a/b')
end
end

View file

@ -1,15 +0,0 @@
# -*- ruby -*-
task :default => "play.app"
file "play.scpt" => "base" do |t|
cp t.prerequisites.first, t.name
end
rule ".app" => ".scpt" do |t|
cp t.source, t.name
end
file 'base' do
touch 'base'
end

View file

@ -1,19 +0,0 @@
#!/usr/bin/env ruby
if ENV['TESTTOPSCOPE']
puts "TOPSCOPE"
end
task :default do
puts "DEFAULT"
end
task :other => [:default] do
puts "OTHER"
end
task :task_scope do
if ENV['TESTTASKSCOPE']
puts "TASKSCOPE"
end
end

View file

@ -1,22 +0,0 @@
#
task :default => ["temp_main"]
file "temp_main" => [:all_apps] do touch "temp_main" end
task :all_apps => [:one, :two]
task :one => ["temp_one"]
task :two => ["temp_two"]
file "temp_one" do |t|
touch "temp_one"
end
file "temp_two" do |t|
touch "temp_two"
end
task :clean do
["temp_one", "temp_two", "temp_main"].each do |file|
rm_f file
end
end

View file

@ -1,30 +0,0 @@
N = 2
task :default => :run
BUILD_DIR = 'build'
task :clean do
rm_rf 'build'
rm_rf 'src'
end
task :run
TARGET_DIR = 'build/copies'
FileList['src/*'].each do |src|
directory TARGET_DIR
target = File.join TARGET_DIR, File.basename(src)
file target => [src, TARGET_DIR] do
cp src, target
sleep 3 if src !~ /foo#{N-1}$/
end
task :run => target
end
task :prep => :clean do
mkdir_p 'src'
N.times do |n|
touch "src/foo#{n}"
end
end

View file

@ -1,19 +0,0 @@
# -*- ruby -*-
require 'rake/loaders/makefile'
task :default
task :other do
puts "OTHER"
end
file "dynamic_deps" do |t|
open(t.name, "w") do |f| f.puts "puts 'DYNAMIC'" end
end
import "dynamic_deps"
import "static_deps"
import "static_deps"
import "deps.mf"
puts "FIRST"

View file

@ -1 +0,0 @@
default: other

View file

@ -1,14 +0,0 @@
#!/usr/bin/env ruby
task :b
desc "A"
task :a
desc "B"
task :b
desc "A2"
task :a
task :c

View file

@ -1,3 +0,0 @@
task :default do
puts "OK"
end

View file

@ -1,9 +0,0 @@
# Comments
a: a1 a2 a3 a4
b: b1 b2 b3 \
b4 b5 b6\
# Mid: Comment
b7
a: a5 a6 a7
c: c1
d: d1 d2 \

View file

@ -1,35 +0,0 @@
#!/usr/bin/env ruby
require 'ftools'
module FileCreation
OLDFILE = "testdata/old"
NEWFILE = "testdata/new"
def create_timed_files(oldfile, *newfiles)
return if File.exist?(oldfile) && newfiles.all? { |newfile| File.exist?(newfile) }
old_time = create_file(oldfile)
newfiles.each do |newfile|
while create_file(newfile) <= old_time
sleep(0.1)
File.delete(newfile) rescue nil
end
end
end
def create_dir(dirname)
FileUtils.mkdir_p(dirname) unless File.exist?(dirname)
File.stat(dirname).mtime
end
def create_file(name)
create_dir(File.dirname(name))
FileUtils.touch(name) unless File.exist?(name)
File.stat(name).mtime
end
def delete_file(name)
File.delete(name) rescue nil
end
end

View file

@ -1,13 +0,0 @@
#!/usr/bin/env ruby
begin
require 'rubygems'
require_gem 'session'
rescue LoadError
puts "UNABLE TO RUN FUNCTIONAL TESTS"
puts "No Session Found"
end
if defined?(Session)
require 'test/session_functional'
end

View file

@ -1,159 +0,0 @@
#!/usr/bin/env ruby
require 'test/unit'
require 'fileutils'
# Version 2.1.9 of session has a bug where the @debug instance
# variable is not initialized, causing warning messages. This snippet
# of code fixes that problem.
module Session
class AbstractSession
alias old_initialize initialize
def initialize(*args)
@debug = nil
old_initialize(*args)
end
end
end
class FunctionalTest < Test::Unit::TestCase
def setup
@rake_path = File.expand_path("bin/rake")
lib_path = File.expand_path("lib")
@ruby_options = "-I#{lib_path} -I."
@verbose = ! ENV['VERBOSE'].nil?
if @verbose
puts
puts
puts "--------------------------------------------------------------------"
puts name
puts "--------------------------------------------------------------------"
end
end
def test_rake_default
Dir.chdir("test/data/default") do rake end
assert_match(/^DEFAULT$/, @out)
assert_status
end
def test_rake_error_on_bad_task
Dir.chdir("test/data/default") do rake "xyz" end
assert_match(/rake aborted/, @out)
assert_status(1)
end
def test_env_availabe_at_top_scope
Dir.chdir("test/data/default") do rake "TESTTOPSCOPE=1" end
assert_match(/^TOPSCOPE$/, @out)
assert_status
end
def test_env_availabe_at_task_scope
Dir.chdir("test/data/default") do rake "TESTTASKSCOPE=1 task_scope" end
assert_match(/^TASKSCOPE$/, @out)
assert_status
end
def test_multi_desc
Dir.chdir("test/data/multidesc") do rake "-T" end
assert_match %r{^rake a *# A / A2 *$}, @out
assert_match %r{^rake b *# B *$}, @out
assert_no_match %r{^rake c}, @out
end
def test_rbext
Dir.chdir("test/data/rbext") do rake "-N" end
assert_match %r{^OK$}, @out
end
def test_nosearch
Dir.chdir("test/data/nosearch") do rake "-N" end
assert_match %r{^No Rakefile found}, @out
end
def test_dry_run
Dir.chdir("test/data/default") do rake "-n", "other" end
assert_match %r{Execute \(dry run\) default}, @out
assert_match %r{Execute \(dry run\) other}, @out
assert_no_match %r{DEFAULT}, @out
assert_no_match %r{OTHER}, @out
end
# Test for the trace/dry_run bug found by Brian Chandler
def test_dry_run_bug
Dir.chdir("test/data/dryrun") do rake end
FileUtils.rm_f "test/data/dryrun/temp_one"
Dir.chdir("test/data/dryrun") do rake "--dry-run" end
assert_no_match(/No such file/, @out)
assert_status
end
# Test for the trace/dry_run bug found by Brian Chandler
def test_trace_bug
Dir.chdir("test/data/dryrun") do rake end
FileUtils.rm_f "test/data/dryrun/temp_one"
Dir.chdir("test/data/dryrun") do rake "--trace" end
assert_no_match(/No such file/, @out)
assert_status
end
def test_imports
open("test/data/imports/static_deps", "w") do |f|
f.puts 'puts "STATIC"'
end
FileUtils.rm_f "test/data/imports/dynamic_deps"
Dir.chdir("test/data/imports") do rake end
assert File.exist?("test/data/imports/dynamic_deps"),
"'dynamic_deps' file should exist"
assert_match(/^FIRST$\s+^DYNAMIC$\s+^STATIC$\s+^OTHER$/, @out)
assert_status
FileUtils.rm_f "test/data/imports/dynamic_deps"
FileUtils.rm_f "test/data/imports/static_deps"
end
def test_rules_chaining_to_file_task
remove_chaining_files
Dir.chdir("test/data/chains") do rake end
assert File.exist?("test/data/chains/play.app"),
"'play.app' file should exist"
assert_status
remove_chaining_files
end
def test_file_creation_task
Dir.chdir("test/data/file_creation_task") do
rake "prep"
rake "run"
rake "run"
assert(@err !~ /^cp src/, "Should not recopy data")
end
end
private
def remove_chaining_files
%w(play.scpt play.app base).each do |fn|
FileUtils.rm_f File.join("test/data/chains", fn)
end
end
def rake(*option_list)
options = option_list.join(' ')
shell = Session::Shell.new
command = "ruby #{@ruby_options} #{@rake_path} #{options}"
puts "COMMAND: [#{command}]" if @verbose
@out, @err = shell.execute command
@status = shell.exit_status
puts "STATUS: [#{@status}]" if @verbose
puts "OUTPUT: [#{@out}]" if @verbose
puts "ERROR: [#{@err}]" if @verbose
puts "PWD: [#{Dir.pwd}]" if @verbose
shell.close
end
def assert_status(expected_status=0)
assert_equal expected_status, @status
end
end

View file

@ -1,3 +0,0 @@
#!/usr/bin/env ruby
exit((ARGV[0] || "0").to_i)

View file

@ -1,14 +0,0 @@
#!/usr/bin/env ruby
require 'test/unit'
require 'rake/clean'
class TestClean < Test::Unit::TestCase
include Rake
def test_clean
assert Task['clean'], "Should define clean"
assert Task['clobber'], "Should define clobber"
assert Task['clobber'].prerequisites.include?("clean"),
"Clobber should require clean"
end
end

View file

@ -1,82 +0,0 @@
#!/usr/bin/env ruby
require 'test/unit'
require 'fileutils'
require 'rake'
require 'test/filecreation'
######################################################################
class TestDefinitions < Test::Unit::TestCase
include Rake
EXISTINGFILE = "testdata/existing"
def setup
Task.clear
end
def test_task
done = false
task :one => [:two] do done = true end
task :two
task :three => [:one, :two]
check_tasks(:one, :two, :three)
assert done, "Should be done"
end
def test_file_task
done = false
file "testdata/one" => "testdata/two" do done = true end
file "testdata/two"
file "testdata/three" => ["testdata/one", "testdata/two"]
check_tasks("testdata/one", "testdata/two", "testdata/three")
assert done, "Should be done"
end
def check_tasks(n1, n2, n3)
t = Task[n1]
assert Task === t, "Should be a Task"
assert_equal n1.to_s, t.name
assert_equal [n2.to_s], t.prerequisites.collect{|n| n.to_s}
t.invoke
t2 = Task[n2]
assert_equal FileList[], t2.prerequisites
t3 = Task[n3]
assert_equal [n1.to_s, n2.to_s], t3.prerequisites.collect{|n|n.to_s}
end
def test_incremental_definitions
runs = []
task :t1 => [:t2] do runs << "A"; 4321 end
task :t1 => [:t3] do runs << "B"; 1234 end
task :t1 => [:t3]
task :t2
task :t3
Task[:t1].invoke
assert_equal ["A", "B"], runs
assert_equal ["t2", "t3"], Task[:t1].prerequisites
end
def test_missing_dependencies
task :x => ["testdata/missing"]
assert_raises(RuntimeError) { Task[:x].invoke }
end
def test_implicit_file_dependencies
runs = []
create_existing_file
task :y => [EXISTINGFILE] do |t| runs << t.name end
Task[:y].invoke
assert_equal runs, ['y']
end
private # ----------------------------------------------------------
def create_existing_file
Dir.mkdir File.dirname(EXISTINGFILE) unless
File.exist?(File.dirname(EXISTINGFILE))
open(EXISTINGFILE, "w") do |f| f.puts "HI" end unless
File.exist?(EXISTINGFILE)
end
end

View file

@ -1,31 +0,0 @@
#!/usr/bin/env ruby
require 'test/unit'
require 'rake'
class TestEarlyTime < Test::Unit::TestCase
def test_create
early = Rake::EarlyTime.instance
time = Time.mktime(1920, 1, 1, 0, 0, 0)
assert early <= Time.now
assert early < Time.now
assert early != Time.now
assert Time.now > early
assert Time.now >= early
assert Time.now != early
end
def test_equality
early = Rake::EarlyTime.instance
assert_equal early, early, "two early times should be equal"
end
def test_original_time_compare_is_not_messed_up
t1 = Time.mktime(1920, 1, 1, 0, 0, 0)
t2 = Time.now
assert t1 < t2
assert t2 > t1
assert t1 == t1
assert t2 == t2
end
end

View file

@ -1,56 +0,0 @@
#!/usr/bin/env ruby
require 'test/unit'
require 'fileutils'
require 'rake'
require 'test/filecreation'
######################################################################
class TestFileCreationTask < Test::Unit::TestCase
include Rake
include FileCreation
DUMMY_DIR = 'testdata/dummy_dir'
def setup
Task.clear
end
def teardown
FileUtils.rm_rf DUMMY_DIR
end
def test_file_needed
create_dir DUMMY_DIR
fc_task = Task[DUMMY_DIR]
assert_equal DUMMY_DIR, fc_task.name
FileUtils.rm_rf fc_task.name
assert fc_task.needed?, "file should be needed"
FileUtils.mkdir fc_task.name
assert_equal nil, fc_task.prerequisites.collect{|n| Task[n].timestamp}.max
assert ! fc_task.needed?, "file should not be needed"
end
def test_directory
directory DUMMY_DIR
fc_task = Task[DUMMY_DIR]
assert_equal DUMMY_DIR, fc_task.name
assert FileCreationTask === fc_task
end
def test_no_retriggers_on_filecreate_task
create_timed_files(OLDFILE, NEWFILE)
t1 = FileCreationTask.lookup(OLDFILE).enhance([NEWFILE])
t2 = FileCreationTask.lookup(NEWFILE)
assert ! t2.needed?, "Should not need to build new file"
assert ! t1.needed?, "Should not need to rebuild old file because of new"
end
def test_no_retriggers_on_file_task
create_timed_files(OLDFILE, NEWFILE)
t1 = FileTask.lookup(OLDFILE).enhance([NEWFILE])
t2 = FileCreationTask.lookup(NEWFILE)
assert ! t2.needed?, "Should not need to build new file"
assert ! t1.needed?, "Should not need to rebuild old file because of new"
end
end

View file

@ -1,140 +0,0 @@
#!/usr/bin/env ruby
require 'test/unit'
require 'fileutils'
require 'rake'
require 'test/filecreation'
######################################################################
class TestFileTask < Test::Unit::TestCase
include Rake
include FileCreation
def setup
Task.clear
@runs = Array.new
FileUtils.rm_f NEWFILE
FileUtils.rm_f OLDFILE
end
def test_file_need
name = "testdata/dummy"
file name
ftask = Task[name]
assert_equal name.to_s, ftask.name
File.delete(ftask.name) rescue nil
assert ftask.needed?, "file should be needed"
open(ftask.name, "w") { |f| f.puts "HI" }
assert_equal nil, ftask.prerequisites.collect{|n| Task[n].timestamp}.max
assert ! ftask.needed?, "file should not be needed"
File.delete(ftask.name) rescue nil
end
def test_file_times_new_depends_on_old
create_timed_files(OLDFILE, NEWFILE)
t1 = FileTask.lookup(NEWFILE).enhance([OLDFILE])
t2 = FileTask.lookup(OLDFILE)
assert ! t2.needed?, "Should not need to build old file"
assert ! t1.needed?, "Should not need to rebuild new file because of old"
end
def test_file_times_old_depends_on_new
create_timed_files(OLDFILE, NEWFILE)
t1 = FileTask.lookup(OLDFILE).enhance([NEWFILE])
t2 = FileTask.lookup(NEWFILE)
assert ! t2.needed?, "Should not need to build new file"
preq_stamp = t1.prerequisites.collect{|t| Task[t].timestamp}.max
assert_equal t2.timestamp, preq_stamp
assert t1.timestamp < preq_stamp, "T1 should be older"
assert t1.needed?, "Should need to rebuild old file because of new"
end
def test_file_depends_on_task_depend_on_file
create_timed_files(OLDFILE, NEWFILE)
file NEWFILE => [:obj] do |t| @runs << t.name end
task :obj => [OLDFILE] do |t| @runs << t.name end
file OLDFILE do |t| @runs << t.name end
Task[:obj].invoke
Task[NEWFILE].invoke
assert ! @runs.include?(NEWFILE)
end
def test_existing_file_depends_on_non_existing_file
create_file(OLDFILE)
delete_file(NEWFILE)
file NEWFILE
file OLDFILE => NEWFILE
assert_nothing_raised do Task[OLDFILE].invoke end
end
# I have currently disabled this test. I'm not convinced that
# deleting the file target on failure is always the proper thing to
# do. I'm willing to hear input on this topic.
def ztest_file_deletes_on_failure
task :obj
file NEWFILE => [:obj] do |t|
FileUtils.touch NEWFILE
fail "Ooops"
end
assert Task[NEWFILE]
begin
Task[NEWFILE].invoke
rescue Exception
end
assert( ! File.exist?(NEWFILE), "NEWFILE should be deleted")
end
end
######################################################################
class TestDirectoryTask < Test::Unit::TestCase
include Rake
def setup
rm_rf "testdata", :verbose=>false
end
def teardown
rm_rf "testdata", :verbose=>false
end
def test_directory
desc "DESC"
directory "testdata/a/b/c"
assert_equal FileCreationTask, Task["testdata"].class
assert_equal FileCreationTask, Task["testdata/a"].class
assert_equal FileCreationTask, Task["testdata/a/b/c"].class
assert_nil Task["testdata"].comment
assert_equal "DESC", Task["testdata/a/b/c"].comment
assert_nil Task["testdata/a/b"].comment
verbose(false) {
Task['testdata/a/b'].invoke
}
assert File.exist?("testdata/a/b")
assert ! File.exist?("testdata/a/b/c")
end
def test_directory_win32
desc "WIN32 DESC"
FileUtils.mkdir_p("testdata")
Dir.chdir("testdata") do
directory 'c:/testdata/a/b/c'
assert_equal FileCreationTask, Task['c:/testdata'].class
assert_equal FileCreationTask, Task['c:/testdata/a'].class
assert_equal FileCreationTask, Task['c:/testdata/a/b/c'].class
assert_nil Task['c:/testdata'].comment
assert_equal "WIN32 DESC", Task['c:/testdata/a/b/c'].comment
assert_nil Task['c:/testdata/a/b'].comment
verbose(false) {
Task['c:/testdata/a/b'].invoke
}
assert File.exist?('c:/testdata/a/b')
assert ! File.exist?('c:/testdata/a/b/c')
end
end
end

View file

@ -1,480 +0,0 @@
#!/usr/bin/env ruby
require 'test/unit'
require 'rake'
class TestFileList < Test::Unit::TestCase
FileList = Rake::FileList
def setup
create_test_data
end
def teardown
FileList.select_default_ignore_patterns
FileUtils.rm_rf("testdata")
end
def test_create
fl = FileList.new
assert_equal 0, fl.size
end
def test_create_with_args
fl = FileList.new("testdata/*.c", "x")
assert_equal ["testdata/abc.c", "testdata/x.c", "testdata/xyz.c", "x"].sort,
fl.sort
end
def test_create_with_block
fl = FileList.new { |f| f.include("x") }
assert_equal ["x"], fl.resolve
end
def test_create_with_brackets
fl = FileList["testdata/*.c", "x"]
assert_equal ["testdata/abc.c", "testdata/x.c", "testdata/xyz.c", "x"].sort,
fl.sort
end
def test_create_with_brackets_and_filelist
fl = FileList[FileList["testdata/*.c", "x"]]
assert_equal ["testdata/abc.c", "testdata/x.c", "testdata/xyz.c", "x"].sort,
fl.sort
end
def test_include_with_another_array
fl = FileList.new.include(["x", "y", "z"])
assert_equal ["x", "y", "z"].sort, fl.sort
end
def test_include_with_another_filelist
fl = FileList.new.include(FileList["testdata/*.c", "x"])
assert_equal ["testdata/abc.c", "testdata/x.c", "testdata/xyz.c", "x"].sort,
fl.sort
end
def test_append
fl = FileList.new
fl << "a.rb" << "b.rb"
assert_equal ['a.rb', 'b.rb'], fl
end
def test_add_many
fl = FileList.new
fl.include %w(a d c)
fl.include('x', 'y')
assert_equal ['a', 'd', 'c', 'x', 'y'], fl
assert_equal ['a', 'd', 'c', 'x', 'y'], fl.resolve
end
def test_add_return
f = FileList.new
g = f << "x"
assert_equal f.object_id, g.object_id
h = f.include("y")
assert_equal f.object_id, h.object_id
end
def test_match
fl = FileList.new
fl.include('test/test*.rb')
assert fl.include?("test/test_filelist.rb")
assert fl.size > 3
fl.each { |fn| assert_match(/\.rb$/, fn) }
end
def test_add_matching
fl = FileList.new
fl << "a.java"
fl.include("test/*.rb")
assert_equal "a.java", fl[0]
assert fl.size > 2
assert fl.include?("test/test_filelist.rb")
end
def test_multiple_patterns
create_test_data
fl = FileList.new
fl.include('*.c', '*xist*')
assert_equal [], fl
fl.include('testdata/*.c', 'testdata/*xist*')
assert_equal [
'testdata/x.c', 'testdata/xyz.c', 'testdata/abc.c', 'testdata/existing'
].sort, fl.sort
end
def test_reject
fl = FileList.new
fl.include %w(testdata/x.c testdata/abc.c testdata/xyz.c testdata/existing)
fl.reject! { |fn| fn =~ %r{/x} }
assert_equal [
'testdata/abc.c', 'testdata/existing'
], fl
end
def test_exclude
fl = FileList['testdata/x.c', 'testdata/abc.c', 'testdata/xyz.c', 'testdata/existing']
fl.each { |fn| touch fn, :verbose => false }
x = fl.exclude(%r{/x.+\.})
assert_equal FileList, x.class
assert_equal [
'testdata/x.c', 'testdata/abc.c', 'testdata/existing'
], fl
assert_equal fl.object_id, x.object_id
fl.exclude('testdata/*.c')
assert_equal ['testdata/existing'], fl
fl.exclude('testdata/existing')
assert_equal [], fl
end
def test_exclude_return_on_create
fl = FileList['testdata/*'].exclude(/.*\.c$/)
assert_equal FileList, fl.class
end
def test_default_exclude
fl = FileList.new
fl.clear_exclude
fl.include("**/*~", "**/*.bak", "**/core")
assert fl.member?("testdata/core"), "Should include core"
assert fl.member?("testdata/x.bak"), "Should include .bak files"
end
def test_unique
fl = FileList.new
fl << "x.c" << "a.c" << "b.rb" << "a.c"
assert_equal ['x.c', 'a.c', 'b.rb', 'a.c'], fl
fl.uniq!
assert_equal ['x.c', 'a.c', 'b.rb'], fl
end
def test_to_string
fl = FileList.new
fl << "a.java" << "b.java"
assert_equal "a.java b.java", fl.to_s
assert_equal "a.java b.java", "#{fl}"
end
def test_to_array
fl = FileList['a.java', 'b.java']
assert_equal ['a.java', 'b.java'], fl.to_a
assert_equal Array, fl.to_a.class
assert_equal ['a.java', 'b.java'], fl.to_ary
assert_equal Array, fl.to_ary.class
end
def test_to_s_pending
fl = FileList['testdata/abc.*']
assert_equal %{testdata/abc.c}, fl.to_s
end
def test_inspect_pending
fl = FileList['testdata/abc.*']
assert_equal %{["testdata/abc.c"]}, fl.inspect
end
def test_sub
fl = FileList["testdata/*.c"]
f2 = fl.sub(/\.c$/, ".o")
assert_equal FileList, f2.class
assert_equal ["testdata/abc.o", "testdata/x.o", "testdata/xyz.o"].sort,
f2.sort
f3 = fl.gsub(/\.c$/, ".o")
assert_equal FileList, f3.class
assert_equal ["testdata/abc.o", "testdata/x.o", "testdata/xyz.o"].sort,
f3.sort
end
def test_sub!
f = "x/a.c"
fl = FileList[f, "x/b.c"]
res = fl.sub!(/\.c$/, ".o")
assert_equal ["x/a.o", "x/b.o"].sort, fl.sort
assert_equal "x/a.c", f
assert_equal fl.object_id, res.object_id
end
def test_sub_with_block
fl = FileList["src/org/onestepback/a.java", "src/org/onestepback/b.java"]
# The block version doesn't work the way I want it to ...
# f2 = fl.sub(%r{^src/(.*)\.java$}) { |x| "classes/" + $1 + ".class" }
f2 = fl.sub(%r{^src/(.*)\.java$}, "classes/\\1.class")
assert_equal [
"classes/org/onestepback/a.class",
"classes/org/onestepback/b.class"
].sort,
f2.sort
end
def test_string_ext
assert_equal "one.net", "one.two".ext("net")
assert_equal "one.net", "one.two".ext(".net")
assert_equal "one.net", "one".ext("net")
assert_equal "one.net", "one".ext(".net")
assert_equal "one.two.net", "one.two.c".ext(".net")
assert_equal "one/two.net", "one/two.c".ext(".net")
assert_equal "one.x/two.net", "one.x/two.c".ext(".net")
assert_equal "one.x\\two.net", "one.x\\two.c".ext(".net")
assert_equal "one.x/two.net", "one.x/two".ext(".net")
assert_equal "one.x\\two.net", "one.x\\two".ext(".net")
assert_equal ".onerc.net", ".onerc.dot".ext("net")
assert_equal ".onerc.net", ".onerc".ext("net")
assert_equal ".a/.onerc.net", ".a/.onerc".ext("net")
assert_equal "one", "one.two".ext('')
assert_equal "one", "one.two".ext
assert_equal ".one", ".one.two".ext
assert_equal ".one", ".one".ext
assert_equal ".", ".".ext("c")
assert_equal "..", "..".ext("c")
end
def test_filelist_ext
assert_equal FileList['one.c', '.one.c'],
FileList['one.net', '.one'].ext('c')
end
def test_gsub
create_test_data
fl = FileList["testdata/*.c"]
f2 = fl.gsub(/a/, "A")
assert_equal ["testdAtA/Abc.c", "testdAtA/x.c", "testdAtA/xyz.c"].sort,
f2.sort
end
def test_egrep
files = FileList['test/test*.rb']
found = false
the_line_number = __LINE__ + 1
files.egrep(/XYZZY/) do |fn, ln, line |
assert_equal 'test/test_filelist.rb', fn
assert_equal the_line_number, ln
assert_match(/files\.egrep/, line)
found = true
end
assert found, "should have foudn a matching line"
end
def test_ignore_special
f = FileList['testdata/*']
assert ! f.include?("testdata/CVS"), "Should not contain CVS"
assert ! f.include?("testdata/.svn"), "Should not contain .svn"
assert ! f.include?("testdata/.dummy"), "Should not contain dot files"
assert ! f.include?("testdata/x.bak"), "Should not contain .bak files"
assert ! f.include?("testdata/x~"), "Should not contain ~ files"
assert ! f.include?("testdata/core"), "Should not contain core files"
end
def test_clear_ignore_patterns
f = FileList['testdata/*', 'testdata/.svn']
f.clear_exclude
assert f.include?("testdata/abc.c")
assert f.include?("testdata/xyz.c")
assert f.include?("testdata/CVS")
assert f.include?("testdata/.svn")
assert f.include?("testdata/x.bak")
assert f.include?("testdata/x~")
end
def test_exclude_with_alternate_file_seps
fl = FileList.new
assert fl.exclude?("x/CVS/y")
assert fl.exclude?("x\\CVS\\y")
assert fl.exclude?("x/.svn/y")
assert fl.exclude?("x\\.svn\\y")
assert fl.exclude?("x/core")
assert fl.exclude?("x\\core")
end
def test_add_default_exclude_list
fl = FileList.new
fl.exclude(/~\d+$/)
assert fl.exclude?("x/CVS/y")
assert fl.exclude?("x\\CVS\\y")
assert fl.exclude?("x/.svn/y")
assert fl.exclude?("x\\.svn\\y")
assert fl.exclude?("x/core")
assert fl.exclude?("x\\core")
assert fl.exclude?("x/abc~1")
end
def test_basic_array_functions
f = FileList['b', 'c', 'a']
assert_equal 'b', f.first
assert_equal 'b', f[0]
assert_equal 'a', f.last
assert_equal 'a', f[2]
assert_equal 'a', f[-1]
assert_equal ['a', 'b', 'c'], f.sort
f.sort!
assert_equal ['a', 'b', 'c'], f
end
def test_flatten
assert_equal ['a', 'testdata/x.c', 'testdata/xyz.c', 'testdata/abc.c'].sort,
['a', FileList['testdata/*.c']].flatten.sort
end
def test_clone
a = FileList['a', 'b', 'c']
b = a.clone
a << 'd'
assert_equal ['a', 'b', 'c', 'd'], a
assert_equal ['a', 'b', 'c'], b
end
def test_array_comparisons
fl = FileList['b', 'b']
a = ['b', 'a']
b = ['b', 'b']
c = ['b', 'c']
assert_equal( 1, fl <=> a )
assert_equal( 0, fl <=> b )
assert_equal( -1, fl <=> c )
assert_equal( -1, a <=> fl )
assert_equal( 0, b <=> fl )
assert_equal( 1, c <=> fl )
end
def test_array_equality
a = FileList['a', 'b']
b = ['a', 'b']
assert a == b
assert b == a
# assert a.eql?(b)
# assert b.eql?(a)
assert ! a.equal?(b)
assert ! b.equal?(a)
end
def test_enumeration_methods
a = FileList['a', 'b']
b = a.collect { |it| it.upcase }
assert_equal ['A', 'B'], b
assert_equal FileList, b.class
b = a.map { |it| it.upcase }
assert_equal ['A', 'B'], b
assert_equal FileList, b.class
b = a.sort
assert_equal ['a', 'b'], b
assert_equal FileList, b.class
b = a.sort_by { |it| it }
assert_equal ['a', 'b'], b
assert_equal FileList, b.class
b = a.find_all { |it| it == 'b'}
assert_equal ['b'], b
assert_equal FileList, b.class
b = a.select { |it| it.size == 1 }
assert_equal ['a', 'b'], b
assert_equal FileList, b.class
b = a.reject { |it| it == 'b' }
assert_equal ['a'], b
assert_equal FileList, b.class
b = a.grep(/./)
assert_equal ['a', 'b'], b
assert_equal FileList, b.class
b = a.partition { |it| it == 'b' }
assert_equal [['b'], ['a']], b
assert_equal Array, b.class
assert_equal FileList, b[0].class
assert_equal FileList, b[1].class
b = a.zip(['x', 'y'])
assert_equal [['a', 'x'], ['b', 'y']], b
assert_equal Array, b.class
assert_equal Array, b[0].class
assert_equal Array, b[1].class
end
def test_array_operators
a = ['a', 'b']
b = ['c', 'd']
f = FileList['x', 'y']
g = FileList['w', 'z']
r = f + g
assert_equal ['x', 'y', 'w', 'z'], r
assert_equal FileList, r.class
r = a + g
assert_equal ['a', 'b', 'w', 'z'], r
assert_equal Array, r.class
r = f + b
assert_equal ['x', 'y', 'c', 'd'], r
assert_equal FileList, r.class
r = FileList['w', 'x', 'y', 'z'] - f
assert_equal ['w', 'z'], r
assert_equal FileList, r.class
r = FileList['w', 'x', 'y', 'z'] & f
assert_equal ['x', 'y'], r
assert_equal FileList, r.class
r = f * 2
assert_equal ['x', 'y', 'x', 'y'], r
assert_equal FileList, r.class
r = f * ','
assert_equal 'x,y', r
assert_equal String, r.class
r = f | ['a', 'x']
assert_equal ['a', 'x', 'y'].sort, r.sort
assert_equal FileList, r.class
end
def test_other_array_returning_methods
f = FileList['a', nil, 'b']
r = f.compact
assert_equal ['a', 'b'], r
assert_equal FileList, r.class
f = FileList['a', 'b']
r = f.concat(['x', 'y'])
assert_equal ['a', 'b', 'x', 'y'], r
assert_equal FileList, r.class
f = FileList['a', ['b', 'c'], FileList['d', 'e']]
r = f.flatten
assert_equal ['a', 'b', 'c', 'd', 'e'], r
assert_equal FileList, r.class
f = FileList['a', 'b', 'a']
r = f.uniq
assert_equal ['a', 'b'], r
assert_equal FileList, r.class
f = FileList['a', 'b', 'c', 'd']
r = f.values_at(1,3)
assert_equal ['b', 'd'], r
assert_equal FileList, r.class
end
def create_test_data
verbose(false) do
mkdir "testdata" unless File.exist? "testdata"
mkdir "testdata/CVS" rescue nil
mkdir "testdata/.svn" rescue nil
touch "testdata/.dummy"
touch "testdata/x.bak"
touch "testdata/x~"
touch "testdata/core"
touch "testdata/x.c"
touch "testdata/xyz.c"
touch "testdata/abc.c"
touch "testdata/existing"
end
end
end

View file

@ -1,125 +0,0 @@
#!/usr/bin/env ruby
require 'rake'
require 'test/unit'
require 'test/filecreation'
require 'fileutils'
class TestFileUtils < Test::Unit::TestCase
include FileCreation
def setup
File.chmod(0750,"test/shellcommand.rb")
end
def teardown
FileUtils.rm_rf("testdata")
end
def test_rm_one_file
create_file("testdata/a")
FileUtils.rm_rf "testdata/a"
assert ! File.exist?("testdata/a")
end
def test_rm_two_files
create_file("testdata/a")
create_file("testdata/b")
FileUtils.rm_rf ["testdata/a", "testdata/b"]
assert ! File.exist?("testdata/a")
assert ! File.exist?("testdata/b")
end
def test_rm_filelist
list = Rake::FileList.new << "testdata/a" << "testdata/b"
list.each { |fn| create_file(fn) }
FileUtils.rm_r list
assert ! File.exist?("testdata/a")
assert ! File.exist?("testdata/b")
end
def test_verbose
verbose true
assert_equal true, verbose
verbose false
assert_equal false, verbose
verbose(true){
assert_equal true, verbose
}
assert_equal false, verbose
end
def test_nowrite
nowrite true
assert_equal true, nowrite
nowrite false
assert_equal false, nowrite
nowrite(true){
assert_equal true, nowrite
}
assert_equal false, nowrite
end
def test_sh
verbose(false) { sh %{test/shellcommand.rb} }
assert true, "should not fail"
end
def test_sh_multiple_arguments
ENV['RAKE_TEST_SH'] = 'someval'
# This one gets expanded by the shell
verbose(false) { sh %{test $RAKE_TEST_SH = someval} }
assert true, "should not fail"
assert_raises(RuntimeError) {
# This one does not get expanded
verbose(false) { sh 'test','$RAKE_TEST_SH', '=', 'someval' }
}
end
def test_sh_failure
assert_raises(RuntimeError) {
verbose(false) { sh %{test/shellcommand.rb 1} }
}
end
def test_sh_special_handling
count = 0
verbose(false) {
sh(%{test/shellcommand.rb}) do |ok, res|
assert(ok)
assert_equal 0, res.exitstatus
count += 1
end
sh(%{test/shellcommand.rb 1}) do |ok, res|
assert(!ok)
assert_equal 1, res.exitstatus
count += 1
end
}
assert_equal 2, count, "Block count should be 2"
end
def test_ruby
verbose(false) do
ENV['RAKE_TEST_RUBY'] = "123"
block_run = false
# This one gets expanded by the shell
ruby %{-e "exit $RAKE_TEST_RUBY"} do |ok, status|
assert(!ok)
assert_equal 123, status.exitstatus
block_run = true
end
assert block_run, "The block must be run"
# This one does not get expanded
block_run = false
ruby '-e', 'exit "$RAKE_TEST_RUBY".length' do |ok, status|
assert(!ok)
assert_equal 15, status.exitstatus
block_run = true
end
assert block_run, "The block must be run"
end
end
end

View file

@ -1,55 +0,0 @@
#!/usr/bin/env ruby
require 'date'
require 'test/unit'
require 'rake/contrib/ftptools'
class FakeDate
def self.today
Date.new(2003,10,3)
end
end
class TestFtpFile < Test::Unit::TestCase
def setup
Rake::FtpFile.class_eval { @date_class = FakeDate }
end
def test_general
file = Rake::FtpFile.new("here", "-rw-r--r-- 1 a279376 develop 121770 Mar 6 14:50 wiki.pl")
assert_equal "wiki.pl", file.name
assert_equal "here/wiki.pl", file.path
assert_equal "a279376", file.owner
assert_equal "develop", file.group
assert_equal 0644, file.mode
assert_equal 121770, file.size
assert_equal Time.mktime(2003,3,6,14,50,0,0), file.time
assert ! file.directory?
assert ! file.symlink?
end
def test_far_date
file = Rake::FtpFile.new(".", "drwxr-xr-x 3 a279376 develop 4096 Nov 26 2001 vss")
assert_equal Time.mktime(2001,11,26,0,0,0,0), file.time
end
def test_close_date
file = Rake::FtpFile.new(".", "drwxr-xr-x 3 a279376 develop 4096 Nov 26 15:35 vss")
assert_equal Time.mktime(2002,11,26,15,35,0,0), file.time
end
def test_directory
file = Rake::FtpFile.new(".", "drwxrwxr-x 9 a279376 develop 4096 Mar 13 14:32 working")
assert file.directory?
assert !file.symlink?
end
def test_symlink
file = Rake::FtpFile.new(".", "lrwxrwxrwx 1 a279376 develop 64 Mar 26 2002 xtrac -> /home/a279376/working/ics/development/java/com/fmr/fwp/ics/xtrac")
assert_equal 'xtrac', file.name
assert file.symlink?
assert !file.directory?
end
end

View file

@ -1,23 +0,0 @@
#!/usr/bin/env ruby
require 'test/unit'
require 'rake'
require 'rake/loaders/makefile'
class TestMakefileLoader < Test::Unit::TestCase
include Rake
def test_create
Task.clear
loader = Rake::MakefileLoader.new
loader.load("test/data/sample.mf")
%w(a b c d).each do |t|
assert Task.task_defined?(t), "#{t} should be a defined task"
end
assert_equal %w(a1 a2 a3 a4 a5 a6 a7).sort, Task['a'].prerequisites.sort
assert_equal %w(b1 b2 b3 b4 b5 b6 b7).sort, Task['b'].prerequisites.sort
assert_equal %w(c1).sort, Task['c'].prerequisites.sort
assert_equal %w(d1 d2).sort, Task['d'].prerequisites.sort
assert_equal 4, Task.tasks.size
end
end

View file

@ -1,130 +0,0 @@
#!/usr/bin/env ruby
require 'test/unit'
require 'rake/packagetask'
class TestPackageTask < Test::Unit::TestCase
include Rake
def test_create
pkg = Rake::PackageTask.new("pkgr", "1.2.3") { |p|
p.package_files << "install.rb"
p.package_files.include(
'[A-Z]*',
'bin/**/*',
'lib/**/*.rb',
'test/**/*.rb',
'doc/**/*',
'build/rubyapp.rb',
'*.blurb')
p.package_files.exclude(/\bCVS\b/)
p.package_files.exclude(/~$/)
p.package_dir = 'pkg'
p.need_tar = true
p.need_tar_gz = true
p.need_tar_bz2 = true
p.need_zip = true
}
assert_equal "pkg", pkg.package_dir
assert pkg.package_files.include?("bin/rake")
assert "pkgr", pkg.name
assert "1.2.3", pkg.version
assert Task[:package]
assert Task['pkg/pkgr-1.2.3.tgz']
assert Task['pkg/pkgr-1.2.3.tar.gz']
assert Task['pkg/pkgr-1.2.3.tar.bz2']
assert Task['pkg/pkgr-1.2.3.zip']
assert Task["pkg/pkgr-1.2.3"]
assert Task[:clobber_package]
assert Task[:repackage]
end
def test_missing_version
assert_raises(RuntimeError) {
pkg = Rake::PackageTask.new("pkgr") { |p| }
}
end
def test_no_version
pkg = Rake::PackageTask.new("pkgr", :noversion) { |p| }
assert "pkgr", pkg.send(:package_name)
end
def test_clone
pkg = Rake::PackageTask.new("x", :noversion)
p2 = pkg.clone
pkg.package_files << "y"
p2.package_files << "x"
assert_equal ["y"], pkg.package_files
assert_equal ["x"], p2.package_files
end
end
begin
require 'rubygems'
require 'rake/gempackagetask'
rescue Exception
puts "WARNING: RubyGems not installed"
end
if ! defined?(Gem)
puts "WARNING: Unable to test GemPackaging ... requires RubyGems"
else
class TestGemPackageTask < Test::Unit::TestCase
def test_gem_package
gem = Gem::Specification.new do |g|
g.name = "pkgr"
g.version = "1.2.3"
g.files = FileList["x"].resolve
end
pkg = Rake::GemPackageTask.new(gem) do |p|
p.package_files << "y"
end
assert_equal ["x", "y"], pkg.package_files
assert_equal "pkgr-1.2.3.gem", pkg.gem_file
end
def test_gem_package_with_specific_platform
gem = Gem::Specification.new do |g|
g.name = "pkgr"
g.version = "1.2.3"
g.files = FileList["x"].resolve
g.platform = Gem::Platform::WIN32
end
pkg = Rake::GemPackageTask.new(gem) do |p|
p.package_files << "y"
end
assert_equal ["x", "y"], pkg.package_files
assert_equal "pkgr-1.2.3-mswin32.gem", pkg.gem_file
end
def test_gem_package_with_current_platform
gem = Gem::Specification.new do |g|
g.name = "pkgr"
g.version = "1.2.3"
g.files = FileList["x"].resolve
g.platform = Gem::Platform::CURRENT
end
pkg = Rake::GemPackageTask.new(gem) do |p|
p.package_files << "y"
end
assert_equal ["x", "y"], pkg.package_files
assert_match(/^pkgr-1\.2\.3-(\S+)\.gem$/, pkg.gem_file)
end
def test_gem_package_with_ruby_platform
gem = Gem::Specification.new do |g|
g.name = "pkgr"
g.version = "1.2.3"
g.files = FileList["x"].resolve
g.platform = Gem::Platform::RUBY
end
pkg = Rake::GemPackageTask.new(gem) do |p|
p.package_files << "y"
end
assert_equal ["x", "y"], pkg.package_files
assert_equal "pkgr-1.2.3.gem", pkg.gem_file
end
end
end

View file

@ -1,21 +0,0 @@
#!/usr/bin/env ruby
require 'test/unit'
require 'rake'
class TestRake < Test::Unit::TestCase
def test_each_dir_parent
assert_equal ['a'], alldirs('a')
assert_equal ['a/b', 'a'], alldirs('a/b')
assert_equal ['/a/b', '/a', '/'], alldirs('/a/b')
assert_equal ['c:/a/b', 'c:/a', 'c:'], alldirs('c:/a/b')
assert_equal ['c:a/b', 'c:a'], alldirs('c:a/b')
end
def alldirs(fn)
result = []
Rake.each_dir_parent(fn) { |d| result << d }
result
end
end

View file

@ -1,206 +0,0 @@
#!/usr/bin/env ruby
require 'test/unit'
require 'fileutils'
require 'rake'
require 'test/filecreation'
######################################################################
class TestRules < Test::Unit::TestCase
include Rake
include FileCreation
SRCFILE = "testdata/abc.c"
SRCFILE2 = "testdata/xyz.c"
FTNFILE = "testdata/abc.f"
OBJFILE = "testdata/abc.o"
def setup
Task.clear
@runs = []
end
def teardown
FileList['testdata/*'].each do |f| rm_r(f, :verbose=>false) end
end
def test_multiple_rules1
create_file(FTNFILE)
delete_file(SRCFILE)
delete_file(OBJFILE)
rule(/\.o$/ => ['.c']) do @runs << :C end
rule(/\.o$/ => ['.f']) do @runs << :F end
t = Task[OBJFILE]
t.invoke
Task[OBJFILE].invoke
assert_equal [:F], @runs
end
def test_multiple_rules2
create_file(FTNFILE)
delete_file(SRCFILE)
delete_file(OBJFILE)
rule(/\.o$/ => ['.f']) do @runs << :F end
rule(/\.o$/ => ['.c']) do @runs << :C end
Task[OBJFILE].invoke
assert_equal [:F], @runs
end
def test_create_with_source
create_file(SRCFILE)
rule(/\.o$/ => ['.c']) do |t|
@runs << t.name
assert_equal OBJFILE, t.name
assert_equal SRCFILE, t.source
end
Task[OBJFILE].invoke
assert_equal [OBJFILE], @runs
end
def test_single_dependent
create_file(SRCFILE)
rule(/\.o$/ => '.c') do |t|
@runs << t.name
end
Task[OBJFILE].invoke
assert_equal [OBJFILE], @runs
end
def test_create_by_string
create_file(SRCFILE)
rule '.o' => ['.c'] do |t|
@runs << t.name
end
Task[OBJFILE].invoke
assert_equal [OBJFILE], @runs
end
def test_rule_and_no_action_task
create_file(SRCFILE)
create_file(SRCFILE2)
delete_file(OBJFILE)
rule '.o' => '.c' do |t|
@runs << t.source
end
file OBJFILE => [SRCFILE2]
Task[OBJFILE].invoke
assert_equal [SRCFILE], @runs
end
def test_string_close_matches
create_file("testdata/x.c")
rule '.o' => ['.c'] do |t|
@runs << t.name
end
assert_raises(RuntimeError) { Task['testdata/x.obj'].invoke }
assert_raises(RuntimeError) { Task['testdata/x.xyo'].invoke }
end
def test_precedence_rule_vs_implicit
create_timed_files(OBJFILE, SRCFILE)
rule(/\.o$/ => ['.c']) do
@runs << :RULE
end
Task[OBJFILE].invoke
assert_equal [:RULE], @runs
end
def test_rule_with_two_sources
create_timed_files(OBJFILE, SRCFILE, SRCFILE2)
rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
@runs << :RULE
end
Task[OBJFILE].invoke
assert_equal [:RULE], @runs
end
def test_rule_with_two_sources_but_one_missing
create_timed_files(OBJFILE, SRCFILE)
delete_file(SRCFILE2)
rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
@runs << :RULE
end
Task[OBJFILE].invoke
assert_equal [], @runs
end
def test_rule_ordering_finding_second_rule
create_timed_files(OBJFILE, SRCFILE)
delete_file(SRCFILE2)
rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
@runs << :RULE1
end
rule OBJFILE => [lambda{SRCFILE}] do
@runs << :RULE2
end
Task[OBJFILE].invoke
assert_equal [:RULE2], @runs
end
def test_rule_ordering_finding_first_rule
create_timed_files(OBJFILE, SRCFILE, SRCFILE2)
rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
@runs << :RULE1
end
rule OBJFILE => [lambda{SRCFILE}] do
@runs << :RULE2
end
Task[OBJFILE].invoke
assert_equal [:RULE1], @runs
end
def test_rule_ordering_not_finding_second_rule
create_timed_files(OBJFILE, SRCFILE, SRCFILE2)
rule OBJFILE => [lambda{SRCFILE}] do
@runs << :RULE1
end
rule OBJFILE => [lambda{SRCFILE}, lambda{SRCFILE2}] do
@runs << :RULE2
end
Task[OBJFILE].invoke
assert_equal [:RULE1], @runs
end
def test_proc_dependent
ran = false
File.makedirs("testdata/src/jw")
create_file("testdata/src/jw/X.java")
rule %r(classes/.*\.class) => [
proc { |fn| fn.sub(/^classes/, 'testdata/src').sub(/\.class$/, '.java') }
] do |task|
assert_equal task.name, 'classes/jw/X.class'
assert_equal task.source, 'testdata/src/jw/X.java'
ran = true
end
Task['classes/jw/X.class'].invoke
assert ran, "Should have triggered rule"
ensure
rm_r("testdata/src", :verbose=>false) rescue nil
end
def test_recursive_rules
actions = []
create_file("testdata/abc.xml")
rule '.y' => '.xml' do actions << 'y' end
rule '.c' => '.y' do actions << 'c'end
rule '.o' => '.c' do actions << 'o'end
rule '.exe' => '.o' do actions << 'exe'end
Task["testdata/abc.exe"].invoke
assert_equal ['y', 'c', 'o', 'exe'], actions
end
def test_recursive_overflow
create_file("testdata/a.a")
prev = 'a'
('b'..'z').each do |letter|
rule ".#{letter}" => ".#{prev}" do |t| puts "#{t.name}" end
prev = letter
end
ex = assert_raises(Rake::RuleRecursionOverflowError) {
Task["testdata/a.z"].invoke
}
assert_match(/a\.z => testdata\/a.y/, ex.message)
end
end

View file

@ -1,77 +0,0 @@
#!/usr/bin/env ruby
require 'test/unit'
require 'fileutils'
require 'rake'
require 'test/filecreation'
######################################################################
class TestTask < Test::Unit::TestCase
include Rake
def setup
Task.clear
end
def test_create
arg = nil
t = Task.lookup(:name).enhance { |task| arg = task; 1234 }
assert_equal "name", t.name
assert_equal [], t.prerequisites
assert t.prerequisites.is_a?(FileList)
assert t.needed?
t.execute
assert_equal t, arg
assert_nil t.source
end
def test_invoke
runlist = []
t1 = Task.lookup(:t1).enhance([:t2, :t3]) { |t| runlist << t.name; 3321 }
t2 = Task.lookup(:t2).enhance { |t| runlist << t.name }
t3 = Task.lookup(:t3).enhance { |t| runlist << t.name }
assert_equal [:t2, :t3], t1.prerequisites
t1.invoke
assert_equal ["t2", "t3", "t1"], runlist
end
def test_no_double_invoke
runlist = []
t1 = Task.lookup(:t1).enhance([:t2, :t3]) { |t| runlist << t.name; 3321 }
t2 = Task.lookup(:t2).enhance([:t3]) { |t| runlist << t.name }
t3 = Task.lookup(:t3).enhance { |t| runlist << t.name }
t1.invoke
assert_equal ["t3", "t2", "t1"], runlist
end
def test_find
task :tfind
assert_equal "tfind", Task[:tfind].name
ex = assert_raises(RuntimeError) { Task[:leaves] }
assert_equal "Don't know how to build task 'leaves'", ex.message
end
def test_defined
assert ! Task.task_defined?(:a)
task :a
assert Task.task_defined?(:a)
end
def test_multi_invocations
runs = []
p = proc do |t| runs << t.name end
task({:t1=>[:t2,:t3]}, &p)
task({:t2=>[:t3]}, &p)
task(:t3, &p)
Task[:t1].invoke
assert_equal ["t1", "t2", "t3"], runs.sort
end
def test_task_list
task :t2
task :t1 => [:t2]
assert_equal ["t1", "t2"], Task.tasks.collect {|t| t.name}
end
end

View file

@ -1,76 +0,0 @@
#!/usr/bin/env ruby
require 'test/unit'
require 'rake/testtask'
class TestTestTask < Test::Unit::TestCase
include Rake
def setup
Task.clear
ENV['TEST'] = nil
end
def teardown
FileUtils.rm_rf("testdata")
end
def test_no_task
assert ! Task.task_defined?(:test)
end
def test_defaults
tt = Rake::TestTask.new do |t| end
assert_not_nil tt
assert_equal :test, tt.name
assert_equal ['lib'], tt.libs
assert_equal 'test/test*.rb', tt.pattern
assert_equal false, tt.verbose
assert Task.task_defined?(:test)
end
def test_non_defaults
tt = Rake::TestTask.new(:example) do |t|
t.libs = ['src', 'ext']
t.pattern = 'test/tc_*.rb'
t.verbose = true
end
assert_not_nil tt
assert_equal :example, tt.name
assert_equal ['src', 'ext'], tt.libs
assert_equal 'test/tc_*.rb', tt.pattern
assert_equal true, tt.verbose
assert Task.task_defined?(:example)
end
def test_pattern
ENV['TEST'] = nil
tt = Rake::TestTask.new do |t|
t.pattern = '*.rb'
end
assert_equal ['install.rb'], tt.file_list.to_a
end
def test_env_test
ENV['TEST'] = 'testfile.rb'
tt = Rake::TestTask.new do |t|
t.pattern = '*'
end
assert_equal ["testfile.rb"], tt.file_list.to_a
end
def test_test_files
tt = Rake::TestTask.new do |t|
t.test_files = FileList['a.rb', 'b.rb']
end
assert_equal ["a.rb", 'b.rb'], tt.file_list.to_a
end
def test_both_pattern_and_test_files
tt = Rake::TestTask.new do |t|
t.test_files = FileList['a.rb', 'b.rb']
t.pattern = '*.rb'
end
assert_equal ['a.rb', 'b.rb', 'install.rb'], tt.file_list.to_a
end
end