jimweirich-rake 0.8.1.10 → 0.8.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGES CHANGED
@@ -53,6 +53,10 @@
53
53
  However, if RAKE_COLUMNS is explicitly set, it will be honored in
54
54
  any case. (Patch provided by Gavin Stark).
55
55
 
56
+ * Numerous fixes for running under windows. A big thanks to Bheeshmar
57
+ Redheendran for spending a good part of the afternoon at the
58
+ Lonestar Ruby Conference to help me work out these issues.
59
+
56
60
  == Version 0.8.1
57
61
 
58
62
  * Removed requires on parsedate.rb (in Ftptools)
data/README CHANGED
@@ -1,6 +1,6 @@
1
1
  = RAKE -- Ruby Make
2
2
 
3
- Supporting Rake version: 0.8.2
3
+ Supporting Rake version: 0.8.3
4
4
 
5
5
  This package contains Rake, a simple ruby build program with
6
6
  capabilities similar to make.
@@ -53,7 +53,8 @@ Download and install rake with the following.
53
53
 
54
54
  If you wish to run the unit and functional tests that come with Rake:
55
55
 
56
- * Install the 'session' gem in order to run the functional tests.
56
+ * Install the 'session' gem in order to run the functional tests. adf
57
+ asdf asdf
57
58
  * CD into the top project directory of rake.
58
59
  * Type one of the following:
59
60
 
@@ -208,10 +209,10 @@ Options are:
208
209
  Do not echo commands from FileUtils.
209
210
 
210
211
  [<tt>--rakefile</tt> _filename_ (-f)]
211
- Use _filename_ as the name of the rakefile. The default rakefile
212
+ Use _filename_ as the name of the rakefile. The default rakefile
212
213
  names are +rakefile+ and +Rakefile+ (with +rakefile+ taking
213
- precedence). If the rakefile is not found in the current
214
- directory, +rake+ will search parent directories for a match. The
214
+ precedence). If the rakefile is not found in the current
215
+ directory, +rake+ will search parent directories for a match. The
215
216
  directory where the Rakefile is found will become the current
216
217
  directory for the actions executed in the Rakefile.
217
218
 
@@ -227,12 +228,24 @@ Options are:
227
228
  [<tt>--silent (-s)]
228
229
  Like --quiet, but also suppresses the 'in directory' announcement.
229
230
 
231
+ [<tt>--system</tt> (-g)]
232
+ Use the system wide (global) rakefiles. The project Rakefile is
233
+ ignored. By default, the system wide rakefiles are used only if no
234
+ project Rakefile is found. On Unix-like system, the system wide
235
+ rake files are located in $HOME/.rake. On a windows system they
236
+ are stored in $APPDATA/Rake.
237
+
238
+ [<tt>--no-system</tt> (-G)]
239
+ Use the project level Rakefile, ignoring the system-wide (global)
240
+ rakefiles.
241
+
230
242
  [<tt>--tasks</tt> (-T)]
231
243
  Display a list of the major tasks and their comments. Comments
232
244
  are defined using the "desc" command.
233
245
 
234
246
  [<tt>--trace</tt> (-t)]
235
- Turn on invoke/execute tracing. Also enable full backtrace on errors.
247
+ Turn on invoke/execute tracing. Also enable full backtrace on
248
+ errors.
236
249
 
237
250
  [<tt>--usage</tt> (-h)]
238
251
  Display a usage message and exit.
data/Rakefile CHANGED
@@ -16,7 +16,7 @@ require 'rake/clean'
16
16
  require 'rake/testtask'
17
17
  require 'rake/rdoctask'
18
18
 
19
- CLEAN.include('**/*.o', '*.dot')
19
+ CLEAN.include('**/*.o', '*.dot', '**/.*.rbc')
20
20
  CLOBBER.include('doc/example/main', 'testdata')
21
21
  CLOBBER.include('test/data/**/temp_*')
22
22
  CLOBBER.include('test/data/chains/play.*')
data/lib/rake/rdoctask.rb CHANGED
@@ -102,7 +102,7 @@ module Rake
102
102
 
103
103
  directory @rdoc_dir
104
104
  task name => [rdoc_target]
105
- file rdoc_target => @rdoc_files + [$rakefile] do
105
+ file rdoc_target => @rdoc_files + [Rake.application.rakefile] do
106
106
  rm_r @rdoc_dir rescue nil
107
107
  args = option_list + @rdoc_files
108
108
  if @external
data/lib/rake.rb CHANGED
@@ -29,7 +29,7 @@
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.1.10'
32
+ RAKEVERSION = '0.8.1.11'
33
33
 
34
34
  require 'rbconfig'
35
35
  require 'getoptlong'
@@ -983,11 +983,29 @@ module FileUtils
983
983
  rake_check_options options, :noop, :verbose
984
984
  rake_output_message cmd.join(" ") if options[:verbose]
985
985
  unless options[:noop]
986
- res = system(*cmd)
986
+ res = rake_system(*cmd)
987
987
  block.call(res, $?)
988
988
  end
989
989
  end
990
990
 
991
+ def rake_system(*cmd)
992
+ if Rake.application.windows?
993
+ rake_win32_system(*cmd)
994
+ else
995
+ system(*cmd)
996
+ end
997
+ end
998
+ private :rake_system
999
+
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
+
991
1009
  # Run a Ruby interpreter with the given arguments.
992
1010
  #
993
1011
  # Example:
@@ -2123,7 +2141,7 @@ module Rake
2123
2141
  end
2124
2142
 
2125
2143
  def unix?
2126
- RUBY_PLATFORM =~ /(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux|)/i
2144
+ RUBY_PLATFORM =~ /(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i
2127
2145
  end
2128
2146
 
2129
2147
  def windows?
@@ -2330,7 +2348,7 @@ module Rake
2330
2348
  (options.load_system || rakefile.nil?) &&
2331
2349
  directory?(system_dir)
2332
2350
  puts "(in #{Dir.pwd})" unless options.silent
2333
- Dir["#{system_dir}/*.rake"].each do |name|
2351
+ glob("#{system_dir}/*.rake") do |name|
2334
2352
  add_import name
2335
2353
  end
2336
2354
  else
@@ -2341,13 +2359,20 @@ module Rake
2341
2359
  puts "(in #{Dir.pwd})" unless options.silent
2342
2360
  $rakefile = @rakefile if options.classic_namespace
2343
2361
  load File.expand_path(@rakefile) if @rakefile && @rakefile != ''
2344
- end
2345
- options.rakelib.each do |rlib|
2346
- Dir["#{rlib}/*.rake"].each do |name| add_import name end
2362
+ options.rakelib.each do |rlib|
2363
+ glob("#{rlib}/*.rake") do |name|
2364
+ add_import name
2365
+ end
2366
+ end
2347
2367
  end
2348
2368
  load_imports
2349
2369
  end
2350
2370
 
2371
+ def glob(path, &block)
2372
+ Dir[path.gsub("\\", '/')].each(&block)
2373
+ end
2374
+ private :glob
2375
+
2351
2376
  # The directory path containing the system wide rakefiles.
2352
2377
  def system_dir
2353
2378
  if ENV['RAKE_SYSTEM']
@@ -0,0 +1,5 @@
1
+ if ARGV[0] != ARGV[1]
2
+ exit 1
3
+ else
4
+ exit 0
5
+ end
@@ -4,7 +4,6 @@ module InEnvironment
4
4
  # Create an environment for a test. At the completion of the yielded
5
5
  # block, the environment is restored to its original conditions.
6
6
  def in_environment(settings)
7
- original_dir = Dir.pwd
8
7
  original_settings = set_env(settings)
9
8
  yield
10
9
  ensure
@@ -17,6 +16,7 @@ module InEnvironment
17
16
  settings.each do |k, v|
18
17
  result[k] = ENV[k]
19
18
  if k == 'PWD'
19
+ result[k] = Dir.pwd
20
20
  Dir.chdir(v)
21
21
  elsif v.nil?
22
22
  ENV.delete(k)
@@ -102,6 +102,20 @@ class FunctionalTest < Test::Unit::TestCase
102
102
  assert_match %r{^SYS1}, @out
103
103
  end
104
104
 
105
+ def test_system_excludes_rakelib_files_too
106
+ in_environment('RAKE_SYSTEM' => 'test/data/sys') do
107
+ rake '-g', "sys1", '-T', 'extra'
108
+ end
109
+ assert_no_match %r{extra:extra}, @out
110
+ end
111
+
112
+ def test_by_default_rakelib_files_are_include
113
+ in_environment('RAKE_SYSTEM' => 'test/data/sys') do
114
+ rake '-T', 'extra'
115
+ end
116
+ assert_match %r{extra:extra}, @out
117
+ end
118
+
105
119
  def test_implicit_system
106
120
  in_environment('RAKE_SYSTEM' => File.expand_path('test/data/sys'), "PWD" => "/") do
107
121
  rake "sys1", "--trace"
@@ -320,5 +334,4 @@ class FunctionalTest < Test::Unit::TestCase
320
334
  def assert_status(expected_status=0)
321
335
  assert_equal expected_status, @status
322
336
  end
323
-
324
337
  end
@@ -6,7 +6,7 @@ require 'rake'
6
6
  class TestEarlyTime < Test::Unit::TestCase
7
7
  def test_create
8
8
  early = Rake::EarlyTime.instance
9
- time = Time.mktime(1920, 1, 1, 0, 0, 0)
9
+ time = Time.mktime(1970, 1, 1, 0, 0, 0)
10
10
  assert early <= Time.now
11
11
  assert early < Time.now
12
12
  assert early != Time.now
@@ -21,7 +21,7 @@ class TestEarlyTime < Test::Unit::TestCase
21
21
  end
22
22
 
23
23
  def test_original_time_compare_is_not_messed_up
24
- t1 = Time.mktime(1920, 1, 1, 0, 0, 0)
24
+ t1 = Time.mktime(1970, 1, 1, 0, 0, 0)
25
25
  t2 = Time.now
26
26
  assert t1 < t2
27
27
  assert t2 > t1
@@ -119,36 +119,37 @@ class TestFileUtils < Test::Unit::TestCase
119
119
  end
120
120
 
121
121
  def test_sh
122
- verbose(false) { sh %{test/shellcommand.rb} }
122
+ verbose(false) { sh %{ruby test/shellcommand.rb} }
123
123
  assert true, "should not fail"
124
124
  end
125
125
 
126
126
  def test_sh_multiple_arguments
127
127
  ENV['RAKE_TEST_SH'] = 'someval'
128
+ expanded = windows? ? '%RAKE_TEST_SH%' : '$RAKE_TEST_SH'
128
129
  # This one gets expanded by the shell
129
- verbose(false) { sh %{test $RAKE_TEST_SH = someval} }
130
+ verbose(false) { sh %{ruby test/check_expansion.rb #{expanded} someval} }
130
131
  assert true, "should not fail"
131
132
  assert_raises(RuntimeError) {
132
133
  # This one does not get expanded
133
- verbose(false) { sh 'test','$RAKE_TEST_SH', '=', 'someval' }
134
+ verbose(false) { sh 'ruby', 'test/check_expansion.rb', expanded, 'someval' }
134
135
  }
135
136
  end
136
137
 
137
138
  def test_sh_failure
138
139
  assert_raises(RuntimeError) {
139
- verbose(false) { sh %{test/shellcommand.rb 1} }
140
+ verbose(false) { sh %{ruby test/shellcommand.rb 1} }
140
141
  }
141
142
  end
142
143
 
143
144
  def test_sh_special_handling
144
145
  count = 0
145
146
  verbose(false) {
146
- sh(%{test/shellcommand.rb}) do |ok, res|
147
+ sh(%{ruby test/shellcommand.rb}) do |ok, res|
147
148
  assert(ok)
148
149
  assert_equal 0, res.exitstatus
149
150
  count += 1
150
151
  end
151
- sh(%{test/shellcommand.rb 1}) do |ok, res|
152
+ sh(%{ruby test/shellcommand.rb 1}) do |ok, res|
152
153
  assert(!ok)
153
154
  assert_equal 1, res.exitstatus
154
155
  count += 1
@@ -199,21 +200,26 @@ class TestFileUtils < Test::Unit::TestCase
199
200
  ENV['RAKE_TEST_RUBY'] = "123"
200
201
  block_run = false
201
202
  # This one gets expanded by the shell
202
- ruby %{-e "exit $RAKE_TEST_RUBY"} do |ok, status|
203
+ env_var = windows? ? '%RAKE_TEST_RUBY%' : '$RAKE_TEST_RUBY'
204
+ ruby %{-e "exit #{env_var}"} do |ok, status| # " (emacs wart)
203
205
  assert(!ok)
204
206
  assert_equal 123, status.exitstatus
205
207
  block_run = true
206
208
  end
207
209
  assert block_run, "The block must be run"
208
210
 
209
- # This one does not get expanded
210
- block_run = false
211
- ruby '-e', 'exit "$RAKE_TEST_RUBY".length' do |ok, status|
212
- assert(!ok)
213
- assert_equal 15, status.exitstatus
214
- block_run = true
211
+ if windows?
212
+ puts "SKIPPING test_ruby/part 2 when in windows"
213
+ else
214
+ # This one does not get expanded
215
+ block_run = false
216
+ ruby '-e', %{exit "#{env_var}".length} do |ok, status| # " (emacs wart)
217
+ assert(!ok)
218
+ assert_equal 15, status.exitstatus
219
+ block_run = true
220
+ end
221
+ assert block_run, "The block must be run"
215
222
  end
216
- assert block_run, "The block must be run"
217
223
  end
218
224
  end
219
225
 
@@ -236,4 +242,9 @@ class TestFileUtils < Test::Unit::TestCase
236
242
  ensure
237
243
  $stderr = old_err
238
244
  end
245
+
246
+ def windows?
247
+ ! File::ALT_SEPARATOR.nil?
248
+ end
249
+
239
250
  end
data/test/test_rake.rb CHANGED
@@ -8,8 +8,15 @@ class TestRake < Test::Unit::TestCase
8
8
  assert_equal ['a'], alldirs('a')
9
9
  assert_equal ['a/b', 'a'], alldirs('a/b')
10
10
  assert_equal ['/a/b', '/a', '/'], alldirs('/a/b')
11
- assert_equal ['c:/a/b', 'c:/a', 'c:'], alldirs('c:/a/b')
12
- assert_equal ['c:a/b', 'c:a'], alldirs('c:a/b')
11
+ if File.dirname("c:/foo") == "c:"
12
+ # Under Unix
13
+ assert_equal ['c:/a/b', 'c:/a', 'c:'], alldirs('c:/a/b')
14
+ assert_equal ['c:a/b', 'c:a'], alldirs('c:a/b')
15
+ else
16
+ # Under Windows
17
+ assert_equal ['c:/a/b', 'c:/a', 'c:/'], alldirs('c:/a/b')
18
+ assert_equal ['c:a/b', 'c:a'], alldirs('c:a/b')
19
+ end
13
20
  end
14
21
 
15
22
  def alldirs(fn)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jimweirich-rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1.10
4
+ version: 0.8.1.11
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-08-31 21:00:00 -07:00
12
+ date: 2008-09-07 21:00:00 -07:00
13
13
  default_executable: rake
14
14
  dependencies: []
15
15
 
@@ -46,7 +46,6 @@ files:
46
46
  - MIT-LICENSE
47
47
  - Rakefile
48
48
  - README
49
- - TAGS
50
49
  - TODO
51
50
  - bin/rake
52
51
  - lib/rake/classic_namespace.rb
@@ -68,6 +67,7 @@ files:
68
67
  - lib/rake/testtask.rb
69
68
  - lib/rake.rb
70
69
  - test/capture_stdout.rb
70
+ - test/check_expansion.rb
71
71
  - test/contrib/test_sys.rb
72
72
  - test/data/rakelib/test1.rb
73
73
  - test/data/rbext/rakefile.rb