public
Description: A gem providing “time travel” and “time freezing” capabilities, making it dead simple to test time-dependent code. It provides a unified method to mock Time.now, Date.today, and DateTime.now in a single call.
Homepage: http://www.smartlogicsolutions.com/open-source-projects
Clone URL: git://github.com/jtrupiano/timecop.git
commit  4e343b36e66ea06776906ae91eba2327a90fdbe1
tree    8bfeae56bf3ce718659a20b8b5bfdb1dccd28408
parent  8950ff4b869081159d6786ba938c3ac5b5a75e3e
timecop / Rakefile
100644 72 lines (62 sloc) 2.513 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
71
72
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
 
gem 'jeweler', '~> 0.9.2'
 
begin
  require 'jeweler'
  Jeweler::Tasks.new do |s|
    s.name = "timecop"
    s.rubyforge_project = 'johntrupiano' # if different than lowercase project name
    s.description = %q(A gem providing simple ways to temporarily override Time.now, Date.today, and DateTime.now. It provides "time travel" capabilities, making it dead simple to test time-dependent code.)
    s.summary = s.description # More details later??
    s.email = "jtrupiano@gmail.com"
    s.homepage = "http://github.com/jtrupiano/timecop"
    s.authors = ["John Trupiano"]
    s.files = FileList["[A-Z]*", "{bin,lib,test}/**/*"]
    #s.add_dependency 'schacon-git'
  end
rescue LoadError
  puts "Jeweler, or one of its dependencies, is not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
end
 
# Override the test task and instruct them how to actually run the tests.
Rake.application.send(:eval, "@tasks.delete('test')")
desc "Does not execute tests. Manually run shell script ./run_tests.sh to execute tests."
task :test do
  puts <<-MSG
In order to run the test suite, run: cd test && ./run_tests.sh
The tests need to be run with different libraries loaded, which rules out using Rake
to automate them.
MSG
end
 
require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
  config = YAML.load(File.read('VERSION.yml'))
  rdoc.rdoc_dir = 'rdoc'
  rdoc.title = "timecop #{config[:major]}.#{config[:minor]}.#{config[:patch]}"
  rdoc.options << '--line-numbers' << '--inline-source'
  rdoc.rdoc_files.include('README*')
  rdoc.rdoc_files.include('lib/**/*.rb')
end
 
# Rubyforge documentation task
begin
  require 'rake/contrib/sshpublisher'
  namespace :rubyforge do
    
    desc "release gem and documentation to rubyforge"
    task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
    
    namespace :release do
      desc "Publish RDoc to RubyForge."
      task :docs => [:rdoc] do
        config = YAML.load(
          File.read(File.expand_path('~/.rubyforge/user-config.yml'))
        )
 
        host = "#{config['username']}@rubyforge.org"
        remote_dir = "/var/www/gforge-projects/johntrupiano/timecop"
        local_dir = 'rdoc'
 
        Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
      end
    end
  end
rescue LoadError
  puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
end
 
task :default => :test