summaryrefslogtreecommitdiffstats
path: root/tasks/setup.rb
blob: 5e69d02e40069c3ec92de1dbb64378316dc5628b (plain)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# -*- coding: UTF-8 -*-
#
require 'rubygems'
require 'rake'
require 'rake/clean'
require 'ostruct'

class OpenStruct; undef :gem; end

# TODO: make my own openstruct type object that includes descriptions
# TODO: use the descriptions to output help on the available bones options

PROJ = OpenStruct.new(
    # Project Defaults
    :name => nil,
    :summary => nil,
    :description => nil,
    :changes => nil,
    :authors => nil,
    :email => nil,
    :url => "\000",
    :version => ENV['VERSION'] || '0.0.0',
    :exclude => %w(tmp$ bak$ ~$ CVS \.svn/ \.git/ ^pkg/),
    :release_name => ENV['RELEASE'],

    # System Defaults
    :ruby_opts => %w(-w),
    :libs => [],
    :history_file => 'Changelog',
    :readme_file => 'README.rdoc',
    :ignore_file => '.bnsignore',

    # Announce
    :ann => OpenStruct.new(
        :file => 'announcement.txt',
        :text => nil,
        :paragraphs => [],
        :email => {
            :from     => nil,
            :to       => %w(ruby-talk@ruby-lang.org),
            :server   => 'localhost',
            :port     => 25,
            :domain   => ENV['HOSTNAME'],
            :acct     => nil,
            :passwd   => nil,
            :authtype => :plain,
            :tls      => true,
        }
    ),

    # Gem Packaging
    :gem => OpenStruct.new(
        :dependencies => [],
        :development_dependencies => [],
        :executables => nil,
        :extensions => FileList['ext/**/extconf.rb'],
        :files => nil,
        :need_tar => true,
        :need_zip => false,
        :extras => {}
    ),

    # File Annotations
    :notes => OpenStruct.new(
        :exclude => %w(^tasks/setup\.rb$),
        :extensions => %w(.txt .rb .erb .rdoc) << '',
        :tags => %w(FIXME OPTIMIZE TODO)
    ),

    # Rcov
    :rcov => OpenStruct.new(
        :dir => 'coverage',
        :opts => %w[--sort coverage -T -x lib/rcov],
        :threshold => 90.0,
        :threshold_exact => false
    ),

    # Rdoc
    :rdoc => OpenStruct.new(
        :opts => [],
        :include => %w(^lib/ ^bin/ ^ext/ \.txt$ \.rdoc$),
        :exclude => %w(extconf\.rb$),
        :main => nil,
        :dir => 'doc',
        :remote_dir => nil
    ),

    # Rubyforge
    :rubyforge => OpenStruct.new(
        :name => "\000"
    ),

    # Rspec
    :spec => OpenStruct.new(
        :files => FileList['spec/**/*_spec.rb'],
        :opts => []
    ),

    # Subversion Repository
    :svn => OpenStruct.new(
        :root => nil,
        :path => '',
        :trunk => 'trunk',
        :tags => 'tags',
        :branches => 'branches'
    ),

    # Test::Unit
    :test => OpenStruct.new(
        :files => FileList['test/**/test_*.rb'],
        :file  => 'test/all.rb',
        :opts  => []
    )
)

# Load the other rake files in the tasks folder
tasks_dir = File.expand_path(File.dirname(__FILE__))
post_load_fn = File.join(tasks_dir, 'post_load.rake')
rakefiles = Dir.glob(File.join(tasks_dir, '*.rake')).sort
rakefiles.unshift(rakefiles.delete(post_load_fn)).compact!
import(*rakefiles)

# Setup the project libraries
%w(lib ext).each {|dir| PROJ.libs << dir if test ?d, dir}

load './tasks/constants.rb'
load './tasks/helpers.rb'

# EOF