Rakefile 3.0 KB
Newer Older
X
Xavier Noria 已提交
1
require 'sdoc'
2
require 'net/http'
3

4 5
$:.unshift File.expand_path('..', __FILE__)
require "tasks/release"
6
require 'railties/lib/rails/api/task'
7 8 9 10 11

desc "Build gem files for all projects"
task :build => "all:build"

desc "Release all gems to gemcutter and create a tag"
C
Carl Lerche 已提交
12
task :release => "all:release"
13

14
PROJECTS = %w(activesupport activemodel actionpack actionmailer activerecord railties)
15 16

desc 'Run all tests by default'
17
task :default => %w(test test:isolated)
18

19
%w(test test:isolated package gem).each do |task_name|
20 21
  desc "Run #{task_name} task for all projects"
  task task_name do
22
    errors = []
23
    PROJECTS.each do |project|
24
      system(%(cd #{project} && #{$0} #{task_name})) || errors << project
25
    end
26
    fail("Errors in #{errors.join(', ')}") unless errors.empty?
27 28
  end
end
J
Jeremy Kemper 已提交
29

30 31 32
desc "Smoke-test all projects"
task :smoke do
  (PROJECTS - %w(activerecord)).each do |project|
33
    system %(cd #{project} && #{$0} test:isolated)
34
  end
35
  system %(cd activerecord && #{$0} sqlite3:isolated_test)
36
end
C
Carlhuda 已提交
37

J
José Valim 已提交
38
desc "Install gems for all projects."
39
task :install => :build do
40
  version = File.read("RAILS_VERSION").strip
41
  (PROJECTS - ["railties"]).each do |project|
C
Carlhuda 已提交
42
    puts "INSTALLING #{project}"
43
    system("gem install #{project}/pkg/#{project}-#{version}.gem --local --no-ri --no-rdoc")
44
  end
45 46
  system("gem install railties/pkg/railties-#{version}.gem --local --no-ri --no-rdoc")
  system("gem install pkg/rails-#{version}.gem --local --no-ri --no-rdoc")
47 48
end

J
Jeremy Kemper 已提交
49
desc "Generate documentation for the Rails framework"
X
Xavier Noria 已提交
50
Rails::API::RepoTask.new('rdoc')
J
Jeremy Kemper 已提交
51

52
desc 'Bump all versions to match version.rb'
53
task :update_versions do
54 55 56
  require File.dirname(__FILE__) + "/version"

  File.open("RAILS_VERSION", "w") do |f|
57
    f.puts Rails.version
58 59
  end

60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
  constants = {
    "activesupport"   => "ActiveSupport",
    "activemodel"     => "ActiveModel",
    "actionpack"      => "ActionPack",
    "actionmailer"    => "ActionMailer",
    "activerecord"    => "ActiveRecord",
    "railties"        => "Rails"
  }

  version_file = File.read("version.rb")

  PROJECTS.each do |project|
    Dir["#{project}/lib/*/version.rb"].each do |file|
      File.open(file, "w") do |f|
        f.write version_file.gsub(/Rails/, constants[project])
      end
    end
  end
end
79 80

#
P
Prathamesh Sonpatki 已提交
81
# We have a webhook configured in GitHub that gets invoked after pushes.
82 83 84 85 86 87 88 89 90
# This hook triggers the following tasks:
#
#   * updates the local checkout
#   * updates Rails Contributors
#   * generates and publishes edge docs
#   * if there's a new stable tag, generates and publishes stable docs
#
# Everything is automated and you do NOT need to run this task normally.
#
S
Santiago Pastorino 已提交
91
# We publish a new version by tagging, and pushing a tag does not trigger
92 93 94 95 96
# that webhook. Stable docs would be updated by any subsequent regular
# push, but if you want that to happen right away just run this.
#
desc 'Publishes docs, run this AFTER a new stable tag has been pushed'
task :publish_docs do
97
  Net::HTTP.new('api.rubyonrails.org', 8080).start do |http|
98 99 100 101 102
    request  = Net::HTTP::Post.new('/rails-master-hook')
    response = http.request(request)
    puts response.body
  end
end