Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' of git://github.com/jimweirich/rake
  • Loading branch information
quix committed Jan 26, 2011
2 parents 0594591 + 71d58da commit 7411bcc
Show file tree
Hide file tree
Showing 30 changed files with 93 additions and 109 deletions.
Empty file added .gemtest
Empty file.
1 change: 1 addition & 0 deletions Rakefile
Expand Up @@ -168,6 +168,7 @@ end
# tar, zip and gem files.

PKG_FILES = FileList[
'.gemtest',
'install.rb',
'[A-Z]*',
'bin/drake',
Expand Down
2 changes: 1 addition & 1 deletion doc/command_line_usage.rdoc
Expand Up @@ -9,7 +9,7 @@ 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>'].
the value by using ENV['<em>name</em>'].

[<tt>--classic-namespace</tt> (-n)]
Import the Task, FileTask, and FileCreateTask into the top-level
Expand Down
2 changes: 1 addition & 1 deletion doc/glossary.rdoc
Expand Up @@ -39,7 +39,7 @@
[<b>prerequisites</b>]
Every task has a set (possibility empty) of prerequisites. A
prerequisite P to Task T is itself a task that must be invoked
before Task T.
before Task T.

[<b>rule</b>]
A rule is a recipe for synthesizing a task when no task is
Expand Down
4 changes: 2 additions & 2 deletions doc/jamis.rb
Expand Up @@ -183,7 +183,7 @@ module Page
CSS

XHTML_PREAMBLE = %{<?xml version="1.0" encoding="%charset%"?>
<!DOCTYPE html
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
}
Expand Down Expand Up @@ -510,7 +510,7 @@ module Page
<!--
body {
background-color: #EEE;
font-family: #{FONTS};
font-family: #{FONTS};
color: #000;
margin: 0px;
}
Expand Down
44 changes: 22 additions & 22 deletions doc/proto_rake.rdoc
Expand Up @@ -4,54 +4,54 @@ 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
Expand All @@ -66,44 +66,44 @@ This is the original 100 line prototype rake program.
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
Expand All @@ -119,9 +119,9 @@ This is the original 100 line prototype rake program.
rescue Exception => ex
puts "rake aborted ... #{ex.message}"
puts ex.backtrace.find {|str| str =~ /Rakefile/ } || ""
end
end
end

if __FILE__ == $0 then
rake
end
Binary file modified doc/rake.1.gz
Binary file not shown.
6 changes: 3 additions & 3 deletions doc/rational.rdoc
Expand Up @@ -38,7 +38,7 @@ 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.
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.

Expand Down Expand Up @@ -97,7 +97,7 @@ Here's another task with dependencies ...
end

Task :clobber depends upon task :clean, so :clean will be run before
:clobber is executed.
: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
Expand All @@ -115,7 +115,7 @@ Here is a file based dependency that will compile "hello.cc" to

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.
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
Expand Down
2 changes: 1 addition & 1 deletion doc/release_notes/rake-0.4.15.rdoc
Expand Up @@ -9,7 +9,7 @@ changes. This release includes:
revised for 1.8.2 test task.

* Updated the docs on --trace to indicate that it also enables a full
backtrace on errors.
backtrace on errors.

* Several fixes for new warnings generated.

Expand Down
2 changes: 1 addition & 1 deletion doc/release_notes/rake-0.5.0.rdoc
@@ -1,7 +1,7 @@
= Rake 0.5.0 Released

It has been a long time in coming, but we finally have a new version
of Rake available.
of Rake available.

== Changes

Expand Down
4 changes: 2 additions & 2 deletions lib/rake/contrib/compositepublisher.rb
Expand Up @@ -7,12 +7,12 @@ 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 }
Expand Down
2 changes: 1 addition & 1 deletion lib/rake/contrib/ftptools.rb
Expand Up @@ -133,7 +133,7 @@ def upload_files(wildcard)
upload(fn)
end
end

# Close the uploader.
def close
@ftp.close
Expand Down
4 changes: 2 additions & 2 deletions lib/rake/contrib/rubyforgepublisher.rb
Expand Up @@ -6,13 +6,13 @@ 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
2 changes: 1 addition & 1 deletion lib/rake/default_loader.rb
@@ -1,5 +1,5 @@
module Rake

# Default Rakefile loader used by +import+.
class DefaultLoader
def load(fn)
Expand Down
2 changes: 1 addition & 1 deletion lib/rake/file_task.rb
Expand Up @@ -29,7 +29,7 @@ def timestamp

# Are there any prerequisites with a later time than the given time stamp?
def out_of_date?(stamp)
@prerequisites.any? { |n| application[n, @scope].timestamp >= stamp}
@prerequisites.any? { |n| application[n, @scope].timestamp > stamp}
end

# ----------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion lib/rake/loaders/makefile.rb
Expand Up @@ -33,7 +33,7 @@ def process_line(line)
file file_task => dependents
end
end

def respace(str)
str.gsub(/#{SPACE_MARK}/, ' ')
end
Expand Down
18 changes: 9 additions & 9 deletions lib/rake/packagetask.rb
Expand Up @@ -25,13 +25,13 @@ module Rake
# 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).
# 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).
# 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).
# 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).
Expand Down Expand Up @@ -74,7 +74,7 @@ class PackageTask < TaskLib
# Zip command for zipped archives. The default is 'zip'.
attr_accessor :zip_command

# Create a Package Task with the given name and version.
# Create a Package Task with the given name and version.
def initialize(name=nil, version=nil)
init(name, version)
yield self if block_given?
Expand Down Expand Up @@ -102,11 +102,11 @@ def define

desc "Build all the packages"
task :package

desc "Force a rebuild of the package files"
task :repackage => [:clobber_package, :package]
desc "Remove package products"

desc "Remove package products"
task :clobber_package do
rm_r package_dir rescue nil
end
Expand All @@ -127,7 +127,7 @@ def define
end
end
end

if need_zip
task :package => ["#{package_dir}/#{zip_file}"]
file "#{package_dir}/#{zip_file}" => [package_dir_path] + package_files do
Expand Down Expand Up @@ -159,7 +159,7 @@ def define
def package_name
@version ? "#{@name}-#{@version}" : @name
end

def package_dir_path
"#{package_dir}/#{package_name}"
end
Expand Down
8 changes: 4 additions & 4 deletions lib/rake/win32.rb
Expand Up @@ -5,12 +5,12 @@ module Rake
# Win 32 interface methods for Rake. Windows specific functionality
# will be placed here to collect that knowledge in one spot.
module Win32

# Error indicating a problem in locating the home directory on a
# Win32 system.
class Win32HomeError < RuntimeError
end

class << self
# True if running on a windows system.
def windows?
Expand All @@ -21,7 +21,7 @@ def windows?
def rake_system(*cmd)
AltSystem.system(*cmd)
end

# The standard directory containing system wide rake files on
# Win 32 systems. Try the following environment variables (in
# order):
Expand Down Expand Up @@ -49,7 +49,7 @@ def win32_system_dir #:nodoc:
def normalize(path)
path.gsub(/\\/, '/')
end

end
end
end

0 comments on commit 7411bcc

Please sign in to comment.