GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Fork of francois/piston
Description: Piston is a utility that eases vendor branch management. This repository is a complete reimplementation of Piston to provide different backends, depending on the repositories and working copies you pistonize from.
Homepage: http://piston.rubyforge.org/
Clone URL: git://github.com/btakita/piston.git
piston / tasks / test.rake
100644 70 lines (61 sloc) 2.277 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
require "rake/testtask"
 
Rake.application.instance_variable_get("@tasks").delete("test")
Rake::TestTask.new("test") do |t|
  t.libs << "test"
  t.test_files = FileList['test/**/test_*.rb']
  t.verbose = true
  t.warning = false
end
 
namespace :test do
  Rake::TestTask.new("units") do |t|
    t.libs << "test"
    t.test_files = FileList['test/unit/**/test_*.rb']
    t.verbose = true
    t.warning = false
  end
 
  Rake::TestTask.new("integration") do |t|
    t.libs << "test"
    t.test_files = FileList['test/integration/**/test_*.rb']
    t.verbose = true
    t.warning = false
  end
 
  Rake::TestTask.new("recent") do |t|
    t.libs << "test"
    t.verbose = true
    t.warning = false
 
    # 10 minutes ago
    cutoff_at = Time.now - 10 * 60
 
    t.test_files = FileList["test/integration/**/test_*.rb", "test/unit/**/test_*.rb"].select do |path|
      File.mtime(path) > cutoff_at
    end
  end
 
  desc "Prepares an SVN and Git repository for manual testing"
  task :prep do
    require "pathname"
    PISTON_ROOT = Pathname.new(File.expand_path(Dir.pwd))
    MANUAL_ROOT = PISTON_ROOT + "tmp/manual"
    rm_rf MANUAL_ROOT; mkdir MANUAL_ROOT
    REPOS_ROOT = MANUAL_ROOT + "repos"
    REPOS_URL = "file://#{REPOS_ROOT}"
    WC_ROOT = MANUAL_ROOT + "wc"
 
    sh "svnadmin create #{REPOS_ROOT}"
    sh "svn checkout #{REPOS_URL} #{WC_ROOT}"
    Dir.chdir(WC_ROOT) do
      sh "svn mkdir project plugins plugins/libcalc plugins/libpower"
      Dir.chdir("plugins/libcalc") do
        File.open("README", "w") {|io| io.puts "libcalc\n-------\n\nThis is libcalc\n"}
        File.open("libcalc.rb", "w") {|io| io.puts "# libcaclc.rb\n# Ensure this is powerful enough\n"}
      end
      Dir.chdir("plugins/libpower") do
        File.open("README", "w") {|io| io.puts "libpower\n-------\n\nThis is libpower\n"}
      end
      sh "svn add plugins/libcalc/README plugins/libcalc/libcalc.rb plugins/libpower/README"
      sh "svn commit -m 'Initial revision'"
      sh "ruby -I#{PISTON_ROOT}/lib #{PISTON_ROOT}/bin/piston import #{REPOS_URL}"
      Dir.chdir("plugins/libcalc") do
        File.open("libcalc.rb", "w") {|io| io.puts "# libcalc.rb\n# Ensure this is powerful enough\n\nclass Libcalc\nend\n"}
      end
      sh "svn commit -m 'Implement libcalc'"
    end
  end
end