Sha256: bdbe1cd54a3d00aa169effd10ec67a6070edcc2e53f1a9e82ba6fac9e60bd604

Contents?: true

Size: 1.45 KB

Versions: 75

Compression:

Stored size: 1.45 KB

Contents

require File.expand_path('../helper', __FILE__)
require 'fileutils'

class TestRakeDirectoryTask < Rake::TestCase
  include Rake

  def test_directory
    desc "DESC"

    directory "a/b/c"

    assert_equal FileCreationTask, Task["a"].class
    assert_equal FileCreationTask, Task["a/b"].class
    assert_equal FileCreationTask, Task["a/b/c"].class

    assert_nil             Task["a"].comment
    assert_nil             Task["a/b"].comment
    assert_equal "DESC",   Task["a/b/c"].comment

    verbose(false) {
      Task['a/b'].invoke
    }

    assert File.exist?("a/b")
    refute File.exist?("a/b/c")
  end

  if Rake::Win32.windows?
    def test_directory_win32
      desc "WIN32 DESC"
      directory 'c:/a/b/c'
      assert_equal FileTask, Task['c:'].class
      assert_equal FileCreationTask, Task['c:/a'].class
      assert_equal FileCreationTask, Task['c:/a/b'].class
      assert_equal FileCreationTask, Task['c:/a/b/c'].class
      assert_nil             Task['c:/'].comment
      assert_equal "WIN32 DESC",   Task['c:/a/b/c'].comment
      assert_nil             Task['c:/a/b'].comment
    end
  end

  def test_can_use_blocks
    runlist = []

    t1 = directory("a/b/c" => :t2) { |t| runlist << t.name }
    task(:t2) { |t| runlist << t.name }

    verbose(false) {
      t1.invoke
    }

    assert_equal Task["a/b/c"], t1
    assert_equal FileCreationTask, Task["a/b/c"].class
    assert_equal ["t2", "a/b/c"], runlist
    assert File.directory?("a/b/c")
  end
end

Version data entries

75 entries across 74 versions & 17 rubygems

Version Path
climine-0.0.7 vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/test/test_rake_directory_task.rb
sadui-0.0.4 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_directory_task.rb
sadui-0.0.4 vendor/bundle/ruby/2.1.0/gems/rake-10.1.1/test/test_rake_directory_task.rb
climine-0.0.6 vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/test/test_rake_directory_task.rb
climine-0.0.5 vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/test/test_rake_directory_task.rb
rake-10.2.0 test/test_rake_directory_task.rb
plyom_user-0.3.1 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_directory_task.rb
plyom_user-0.3.0 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_directory_task.rb
plyom_user-0.2.9 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_directory_task.rb
plyom_user-0.2.8 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_directory_task.rb
climine-0.0.4 vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/test/test_rake_directory_task.rb
vtd_xml-0.0.3-java bundle/jruby/1.9/gems/rake-10.1.1/test/test_rake_directory_task.rb
plyom_user-0.2.7 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_directory_task.rb
plyom_user-0.2.6 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_directory_task.rb
plyom_user-0.2.5 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_directory_task.rb
climine-0.0.3 vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/test/test_rake_directory_task.rb
plyom_user-0.2.4 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_directory_task.rb
plyom_user-0.2.3 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_directory_task.rb
plyom_user-0.2.2 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_directory_task.rb
plyom_user-0.2.1 vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_directory_task.rb