rake 0.8.2 → 0.8.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rake might be problematic. Click here for more details.

data/CHANGES CHANGED
@@ -1,6 +1,16 @@
1
1
 
2
2
  = Rake Changelog
3
3
 
4
+ == Version 0.8.3
5
+
6
+ * Enhanced the system directory detection in windows. We now check
7
+ HOMEDRIVE/HOMEPATH and USERPROFILE if APPDATA isn't found. (Patch
8
+ supplied by James Tucker). Rake no long aborts if it can't find the
9
+ directory.
10
+
11
+ * Added fix to handle ruby installations in directories with spaces in
12
+ their name.
13
+
4
14
  == Version 0.8.2
5
15
 
6
16
  * Fixed bug in package task so that it will include the subdir
data/README CHANGED
@@ -1,6 +1,6 @@
1
1
  = RAKE -- Ruby Make
2
2
 
3
- Supporting Rake version: 0.8.3
3
+ Supporting Rake version: 0.8.2
4
4
 
5
5
  This package contains Rake, a simple ruby build program with
6
6
  capabilities similar to make.
@@ -0,0 +1,112 @@
1
+ = Rake 0.8.3 Released
2
+
3
+ Rake version 0.8.3 is a bug-fix release of rake.
4
+
5
+ == Changes
6
+
7
+ === Bug Fixes in Version 0.8.3
8
+
9
+ * Enhanced the system directory detection in windows. We now check
10
+ HOMEDRIVE/HOMEPATH and USERPROFILE if APPDATA isn't found. (Patch
11
+ supplied by James Tucker). Rake no long aborts if it can't find the
12
+ directory.
13
+
14
+ * Added fix to handle ruby installations in directories with spaces in
15
+ their name.
16
+
17
+ == What is Rake
18
+
19
+ Rake is a build tool similar to the make program in many ways. But
20
+ instead of cryptic make recipes, Rake uses standard Ruby code to
21
+ declare tasks and dependencies. You have the full power of a modern
22
+ scripting language built right into your build tool.
23
+
24
+ == Availability
25
+
26
+ The easiest way to get and install rake is via RubyGems ...
27
+
28
+ gem install rake (you may need root/admin privileges)
29
+
30
+ Otherwise, you can get it from the more traditional places:
31
+
32
+ Home Page:: http://rake.rubyforge.org/
33
+ Download:: http://rubyforge.org/project/showfiles.php?group_id=50
34
+
35
+ == Task Argument Examples
36
+
37
+ Prior to version 0.8.0, rake was only able to handle command line
38
+ arguments of the form NAME=VALUE that were passed into Rake via the
39
+ ENV hash. Many folks had asked for some kind of simple command line
40
+ arguments, perhaps using "--" to separate regular task names from
41
+ argument values on the command line. The problem is that there was no
42
+ easy way to associate positional arguments on the command line with
43
+ different tasks. Suppose both tasks :a and :b expect a command line
44
+ argument: does the first value go with :a? What if :b is run first?
45
+ Should it then get the first command line argument.
46
+
47
+ Rake 0.8.0 solves this problem by explicitly passing values directly
48
+ to the tasks that need them. For example, if I had a release task
49
+ that required a version number, I could say:
50
+
51
+ rake release[0.8.3]
52
+
53
+ And the string "0.8.3" will be passed to the :release task. Multiple
54
+ arguments can be passed by separating them with a comma, for example:
55
+
56
+ rake name[john,doe]
57
+
58
+ Just a few words of caution. The rake task name and its arguments
59
+ need to be a single command line argument to rake. This generally
60
+ means no spaces. If spaces are needed, then the entire rake +
61
+ argument string should be quoted. Something like this:
62
+
63
+ rake "name[billy bob, smith]"
64
+
65
+ (Quoting rules vary between operating systems and shells, so make sure
66
+ you consult the proper docs for your OS/shell).
67
+
68
+ === Tasks that Expect Parameters
69
+
70
+ Parameters are only given to tasks that are setup to expect them. In
71
+ order to handle named parameters, the task declaration syntax for
72
+ tasks has been extended slightly.
73
+
74
+ For example, a task that needs a first name and last name might be
75
+ declared as:
76
+
77
+ task :name, :first_name, :last_name
78
+
79
+ The first argument is still the name of the task (:name in this case).
80
+ The next to argumements are the names of the parameters expected by
81
+ :name (:first_name and :last_name in the example).
82
+
83
+ To access the values of the paramters, the block defining the task
84
+ behaviour can now accept a second parameter:
85
+
86
+ task :name, :first_name, :last_name do |t, args|
87
+ puts "First name is #{args.first_name}"
88
+ puts "Last name is #{args.last_name}"
89
+ end
90
+
91
+ The first argument of the block "t" is always bound to the current
92
+ task object. The second argument "args" is an open-struct like object
93
+ that allows access to the task arguments. Extra command line
94
+ arguments to a task are ignored. Missing command line arguments are
95
+ given the nil value.
96
+
97
+ == Thanks
98
+
99
+ As usual, it was input from users that drove a alot of these changes. The
100
+ following people either contributed patches, made suggestions or made
101
+ otherwise helpful comments. Thanks to ...
102
+
103
+ * Edwin Pratomo
104
+ * Gavin Stark
105
+ * Adam Q. Salter
106
+ * Adam Majer
107
+ * Emanuel Inderm�hle
108
+ * Ittay Dror
109
+ * Bheeshmar Redheendran (for spending an afternoon with me debugging
110
+ windows issues)
111
+
112
+ -- Jim Weirich
@@ -29,16 +29,17 @@
29
29
  # as a library via a require statement, but it can be distributed
30
30
  # independently as an application.
31
31
 
32
- RAKEVERSION = '0.8.2'
32
+ RAKEVERSION = '0.8.3'
33
33
 
34
34
  require 'rbconfig'
35
- require 'getoptlong'
36
35
  require 'fileutils'
37
36
  require 'singleton'
38
37
  require 'monitor'
39
38
  require 'optparse'
40
39
  require 'ostruct'
41
40
 
41
+ require 'rake/win32'
42
+
42
43
  ######################################################################
43
44
  # Rake extensions to Module.
44
45
  #
@@ -262,11 +263,6 @@ module Rake
262
263
  end
263
264
  end
264
265
 
265
- # Error indicating a problem in locating the home directory on a
266
- # Win32 system.
267
- class Win32HomeError < RuntimeError
268
- end
269
-
270
266
  # --------------------------------------------------------------------------
271
267
  # Rake module singleton methods.
272
268
  #
@@ -943,7 +939,8 @@ end
943
939
  # added to the FileUtils utility functions.
944
940
  #
945
941
  module FileUtils
946
- RUBY = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
942
+ RUBY = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']).
943
+ sub(/.*\s.*/m, '"\&"')
947
944
 
948
945
  OPT_TABLE['sh'] = %w(noop verbose)
949
946
  OPT_TABLE['ruby'] = %w(noop verbose)
@@ -989,23 +986,14 @@ module FileUtils
989
986
  end
990
987
 
991
988
  def rake_system(*cmd)
992
- if Rake.application.windows?
993
- rake_win32_system(*cmd)
989
+ if Rake::Win32.windows?
990
+ Rake::Win32.rake_system(*cmd)
994
991
  else
995
992
  system(*cmd)
996
993
  end
997
994
  end
998
995
  private :rake_system
999
996
 
1000
- def rake_win32_system(*cmd)
1001
- if cmd.size == 1
1002
- system("call #{cmd}")
1003
- else
1004
- system(*cmd)
1005
- end
1006
- end
1007
- private :rake_win32_system
1008
-
1009
997
  # Run a Ruby interpreter with the given arguments.
1010
998
  #
1011
999
  # Example:
@@ -1587,7 +1575,7 @@ module Rake
1587
1575
  class << self
1588
1576
 
1589
1577
  # Yield each file or directory component.
1590
- def each_dir_parent(dir)
1578
+ def each_dir_parent(dir) # :nodoc:
1591
1579
  old_length = nil
1592
1580
  while dir != '.' && dir.length != old_length
1593
1581
  yield(dir)
@@ -2145,7 +2133,7 @@ module Rake
2145
2133
  end
2146
2134
 
2147
2135
  def windows?
2148
- Config::CONFIG['host_os'] =~ /mswin/
2136
+ Win32.windows?
2149
2137
  end
2150
2138
 
2151
2139
  def truncate(string, width)
@@ -2346,7 +2334,7 @@ module Rake
2346
2334
  rakefile, location = find_rakefile_location
2347
2335
  if (! options.ignore_system) &&
2348
2336
  (options.load_system || rakefile.nil?) &&
2349
- directory?(system_dir)
2337
+ system_dir && File.directory?(system_dir)
2350
2338
  puts "(in #{Dir.pwd})" unless options.silent
2351
2339
  glob("#{system_dir}/*.rake") do |name|
2352
2340
  add_import name
@@ -2375,38 +2363,24 @@ module Rake
2375
2363
 
2376
2364
  # The directory path containing the system wide rakefiles.
2377
2365
  def system_dir
2378
- if ENV['RAKE_SYSTEM']
2379
- ENV['RAKE_SYSTEM']
2380
- elsif windows?
2381
- win32_system_dir
2382
- else
2383
- standard_system_dir
2384
- end
2366
+ @system_dir ||=
2367
+ begin
2368
+ if ENV['RAKE_SYSTEM']
2369
+ ENV['RAKE_SYSTEM']
2370
+ elsif Win32.windows?
2371
+ Win32.win32_system_dir
2372
+ else
2373
+ standard_system_dir
2374
+ end
2375
+ end
2385
2376
  end
2386
-
2377
+
2387
2378
  # The standard directory containing system wide rake files.
2388
2379
  def standard_system_dir #:nodoc:
2389
2380
  File.join(File.expand_path('~'), '.rake')
2390
2381
  end
2391
2382
  private :standard_system_dir
2392
2383
 
2393
- # The standard directory containing system wide rake files on Win
2394
- # 32 systems.
2395
- def win32_system_dir #:nodoc:
2396
- win32home = File.join(ENV['APPDATA'], 'Rake')
2397
- unless directory?(win32home)
2398
- raise Win32HomeError, "Unable to determine home path environment variable."
2399
- else
2400
- win32home
2401
- end
2402
- end
2403
- private :win32_system_dir
2404
-
2405
- def directory?(path)
2406
- File.directory?(path)
2407
- end
2408
- private :directory?
2409
-
2410
2384
  # Collect the list of tasks on the command line. If no tasks are
2411
2385
  # given, return a list containing only the default task.
2412
2386
  # Environmental assignments are processed at this time as well.
@@ -0,0 +1,54 @@
1
+ module Rake
2
+
3
+ # Win 32 interface methods for Rake. Windows specific functionality
4
+ # will be placed here to collect that knowledge in one spot.
5
+ module Win32
6
+
7
+ # Error indicating a problem in locating the home directory on a
8
+ # Win32 system.
9
+ class Win32HomeError < RuntimeError
10
+ end
11
+
12
+ class << self
13
+ # True if running on a windows system.
14
+ def windows?
15
+ Config::CONFIG['host_os'] =~ /mswin/
16
+ end
17
+
18
+ # Run a command line on windows.
19
+ def rake_system(*cmd)
20
+ if cmd.size == 1
21
+ system("call #{cmd}")
22
+ else
23
+ system(*cmd)
24
+ end
25
+ end
26
+
27
+ # The standard directory containing system wide rake files on
28
+ # Win 32 systems. Try the following environment variables (in
29
+ # order):
30
+ #
31
+ # * APPDATA
32
+ # * HOMEDRIVE + HOMEPATH
33
+ # * USERPROFILE
34
+ #
35
+ # If the above are not defined, the return nil.
36
+ def win32_system_dir #:nodoc:
37
+ win32_shared_path = ENV['APPDATA']
38
+ if win32_shared_path.nil? && ENV['HOMEDRIVE'] && ENV['HOMEPATH']
39
+ win32_shared_path = ENV['HOMEDRIVE'] + ENV['HOMEPATH']
40
+ end
41
+ win32_shared_path ||= ENV['USERPROFILE']
42
+ raise Win32HomeError, "Unable to determine home path environment variable." if
43
+ win32_shared_path.nil? or win32_shared_path.empty?
44
+ normalize(File.join(win32_shared_path, 'Rake'))
45
+ end
46
+
47
+ # Normalize a win32 path so that the slashes are all forward slashes.
48
+ def normalize(path)
49
+ path.gsub(/\\/, '/')
50
+ end
51
+
52
+ end
53
+ end
54
+ end
@@ -1,5 +1,10 @@
1
1
  # Common setup for all test files.
2
2
 
3
- require 'rubygems'
4
- gem 'flexmock'
3
+ begin
4
+ require 'rubygems'
5
+ gem 'flexmock'
6
+ rescue LoadError
7
+ # got no gems
8
+ end
9
+
5
10
  require 'flexmock/test_unit'
@@ -109,7 +109,7 @@ class TestApplication < Test::Unit::TestCase
109
109
  end
110
110
 
111
111
  def test_finding_rakefile
112
- assert_equal "rakefile", @app.instance_eval { have_rakefile }
112
+ assert_match(/[Rr]akefile/, @app.instance_eval { have_rakefile })
113
113
  end
114
114
 
115
115
  def test_not_finding_rakefile
@@ -193,10 +193,10 @@ class TestApplication < Test::Unit::TestCase
193
193
  end
194
194
 
195
195
  def test_load_from_system_rakefile_on_windows
196
- flexmock(@app, :windows? => true,
197
- :standard_system_dir => "XX")
196
+ flexmock(Rake::Win32, :windows? => true)
197
+ flexmock(@app, :standard_system_dir => "XX")
198
198
  flexmock(@app).should_receive(:directory?).with("/AD/Rake").and_return(true)
199
- flexmock(@app).should_receive(:load).and_return { |fn| puts "LOADING #{fn}" }
199
+ flexmock(@app).should_receive(:load).and_return(nil)
200
200
  in_environment('RAKE_SYSTEM' => nil, 'APPDATA' => '/AD') do
201
201
  @app.options.rakelib = []
202
202
  @app.instance_eval do
@@ -209,26 +209,6 @@ class TestApplication < Test::Unit::TestCase
209
209
  end
210
210
  end
211
211
 
212
- def test_load_from_system_rakefile_on_windows_with_no_appdata
213
- flexmock(@app, :windows? => true,
214
- :standard_system_dir => "XX"
215
- )
216
- flexmock(File).should_receive(:exists?).with("/AD/Rake").and_return(false)
217
- out = capture_stderr do
218
- assert_raise(SystemExit) do
219
- in_environment('RAKE_SYSTEM' => nil, 'APPDATA' => "/AD") do
220
- @app.options.rakelib = []
221
- @app.instance_eval do
222
- handle_options
223
- options.silent = true
224
- options.load_system = true
225
- load_rakefile
226
- end
227
- end
228
- end
229
- end
230
- end
231
-
232
212
  def test_loading_imports
233
213
  mock = flexmock("loader")
234
214
  mock.should_receive(:load).with("x.dummy").once
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+ require 'test/rake_test_setup'
5
+ require 'test/in_environment'
6
+
7
+ require 'rake'
8
+
9
+ class TestWin32 < Test::Unit::TestCase
10
+ include InEnvironment
11
+
12
+ Win32 = Rake::Win32
13
+
14
+ def test_win32_system_dir_uses_appdata_if_defined
15
+ in_environment('RAKE_SYSTEM' => nil, 'APPDATA' => '\\AD') do
16
+ assert_equal "/AD/Rake", Win32.win32_system_dir
17
+ end
18
+ end
19
+
20
+ def test_win32_system_dir_uses_homedrive_otherwise
21
+ in_environment(
22
+ 'RAKE_SYSTEM' => nil,
23
+ 'APPDATA' => nil,
24
+ 'HOMEDRIVE' => "C:",
25
+ "HOMEPATH" => "\\HP"
26
+ ) do
27
+ assert_equal "C:/HP/Rake", Win32.win32_system_dir
28
+ end
29
+ end
30
+
31
+ def test_win32_system_dir_uses_userprofile_otherwise
32
+ in_environment(
33
+ 'RAKE_SYSTEM' => nil,
34
+ 'APPDATA' => nil,
35
+ 'HOMEDRIVE' => nil,
36
+ "HOMEPATH" => nil,
37
+ "USERPROFILE" => '\\UP'
38
+ ) do
39
+ assert_equal "/UP/Rake", Win32.win32_system_dir
40
+ end
41
+ end
42
+
43
+ def test_win32_system_dir_nil_of_no_env_vars
44
+ in_environment(
45
+ 'RAKE_SYSTEM' => nil,
46
+ 'APPDATA' => nil,
47
+ 'HOMEDRIVE' => nil,
48
+ "HOMEPATH" => nil,
49
+ "USERPROFILE" => nil
50
+ ) do
51
+ assert_raise(Rake::Win32::Win32HomeError) do
52
+ Win32.win32_system_dir
53
+ end
54
+ end
55
+ end
56
+
57
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Weirich
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-09-09 00:00:00 -04:00
12
+ date: 2008-09-25 00:00:00 -04:00
13
13
  default_executable: rake
14
14
  dependencies: []
15
15
 
@@ -40,6 +40,7 @@ extra_rdoc_files:
40
40
  - doc/release_notes/rake-0.7.3.rdoc
41
41
  - doc/release_notes/rake-0.8.0.rdoc
42
42
  - doc/release_notes/rake-0.8.2.rdoc
43
+ - doc/release_notes/rake-0.8.3.rdoc
43
44
  files:
44
45
  - install.rb
45
46
  - CHANGES
@@ -65,6 +66,7 @@ files:
65
66
  - lib/rake/runtest.rb
66
67
  - lib/rake/tasklib.rb
67
68
  - lib/rake/testtask.rb
69
+ - lib/rake/win32.rb
68
70
  - lib/rake.rb
69
71
  - test/capture_stdout.rb
70
72
  - test/check_expansion.rb
@@ -104,6 +106,7 @@ files:
104
106
  - test/test_tasks.rb
105
107
  - test/test_test_task.rb
106
108
  - test/test_top_level_functions.rb
109
+ - test/test_win32.rb
107
110
  - test/data/imports/deps.mf
108
111
  - test/data/sample.mf
109
112
  - test/data/chains/Rakefile
@@ -141,6 +144,7 @@ files:
141
144
  - doc/release_notes/rake-0.7.3.rdoc
142
145
  - doc/release_notes/rake-0.8.0.rdoc
143
146
  - doc/release_notes/rake-0.8.2.rdoc
147
+ - doc/release_notes/rake-0.8.3.rdoc
144
148
  has_rdoc: true
145
149
  homepage: http://rake.rubyforge.org
146
150
  post_install_message: