rake-builder 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/Rakefile +8 -5
  2. data/examples/05_tests/Rakefile +3 -3
  3. data/examples/05_tests/include/units.h +2 -2
  4. data/lib/compiler.rb +25 -30
  5. data/lib/rake/builder.rb +135 -136
  6. data/lib/rake/builder/installer.rb +37 -0
  7. data/lib/rake/{local_config.rb → builder/local_config.rb} +13 -14
  8. data/lib/rake/builder/logger/formatter.rb +7 -1
  9. data/lib/rake/builder/presenters/makefile/builder_presenter.rb +66 -33
  10. data/lib/rake/builder/presenters/makefile_am/builder_presenter.rb +4 -4
  11. data/lib/rake/builder/qt_builder.rb +3 -8
  12. data/lib/rake/builder/task_definers/builder_task_definer.rb +1 -4
  13. data/lib/rake/builder/version.rb +1 -1
  14. data/lib/rake/{microsecond.rb → microsecond_task.rb} +22 -27
  15. data/lib/rake/once_task.rb +2 -7
  16. data/lib/rake/path.rb +1 -6
  17. data/spec/gather_rspec_coverage.rb +2 -0
  18. data/spec/spec_helper.rb +13 -98
  19. data/spec/unit/compiler_spec.rb +129 -0
  20. data/spec/unit/rake/builder/autoconf/version_spec.rb +62 -5
  21. data/spec/unit/rake/builder/configure_ac_spec.rb +53 -0
  22. data/spec/unit/rake/builder/install_spec.rb +101 -0
  23. data/spec/unit/rake/builder/local_config_spec.rb +53 -0
  24. data/spec/unit/rake/builder/logger/formatter_spec.rb +20 -0
  25. data/spec/unit/rake/builder/presenters/makefile/builder_presenter_spec.rb +163 -0
  26. data/spec/unit/rake/builder/presenters/makefile_am/builder_presenter_spec.rb +4 -2
  27. data/spec/unit/rake/builder/task_definers/builder_task_definer_spec.rb +6 -0
  28. data/spec/unit/rake/builder_spec.rb +391 -16
  29. data/spec/unit/rake/microsecond_task_spec.rb +63 -0
  30. metadata +39 -55
  31. data/examples/01_hello_world_cpp/vendor/bundle/gems/coderay-1.0.8/Rakefile +0 -35
  32. data/examples/01_hello_world_cpp/vendor/bundle/gems/json-1.7.6/Rakefile +0 -412
  33. data/examples/01_hello_world_cpp/vendor/bundle/gems/json-1.7.6/ext/json/ext/fbuffer/fbuffer.h +0 -185
  34. data/examples/01_hello_world_cpp/vendor/bundle/gems/json-1.7.6/ext/json/ext/generator/generator.c +0 -1427
  35. data/examples/01_hello_world_cpp/vendor/bundle/gems/json-1.7.6/ext/json/ext/generator/generator.h +0 -149
  36. data/examples/01_hello_world_cpp/vendor/bundle/gems/json-1.7.6/ext/json/ext/parser/parser.c +0 -2204
  37. data/examples/01_hello_world_cpp/vendor/bundle/gems/json-1.7.6/ext/json/ext/parser/parser.h +0 -77
  38. data/examples/01_hello_world_cpp/vendor/bundle/gems/method_source-0.8.1/Rakefile +0 -79
  39. data/examples/01_hello_world_cpp/vendor/bundle/gems/pry-0.9.11.3/Rakefile +0 -136
  40. data/examples/01_hello_world_cpp/vendor/bundle/gems/rake-10.0.3/Rakefile +0 -374
  41. data/examples/01_hello_world_cpp/vendor/bundle/gems/rake-10.0.3/doc/example/a.c +0 -6
  42. data/examples/01_hello_world_cpp/vendor/bundle/gems/rake-10.0.3/doc/example/b.c +0 -6
  43. data/examples/01_hello_world_cpp/vendor/bundle/gems/rake-10.0.3/doc/example/main.c +0 -11
  44. data/examples/01_hello_world_cpp/vendor/bundle/gems/slop-3.4.3/Rakefile +0 -29
  45. data/lib/rake/file_task_alias.rb +0 -24
  46. data/spec/c_project/main.c +0 -12
  47. data/spec/c_project/main.h +0 -6
  48. data/spec/c_project_spec.rb +0 -41
  49. data/spec/cpp_project/main.cpp +0 -12
  50. data/spec/cpp_project/main.h +0 -8
  51. data/spec/cpp_project_spec.rb +0 -203
  52. data/spec/generated_files_spec.rb +0 -65
  53. data/spec/libraries_spec.rb +0 -35
  54. data/spec/local_config_spec.rb +0 -95
  55. data/spec/logger_spec.rb +0 -25
  56. data/spec/microsecond_task_spec.rb +0 -32
  57. data/spec/objective_c_project/main.h +0 -1
  58. data/spec/objective_c_project/main.m +0 -18
  59. data/spec/objective_c_project_spec.rb +0 -72
  60. data/spec/paths_spec.rb +0 -19
  61. data/spec/project_spec.rb +0 -20
  62. data/spec/target_spec.rb +0 -48
@@ -1,77 +0,0 @@
1
- #ifndef _PARSER_H_
2
- #define _PARSER_H_
3
-
4
- #include "ruby.h"
5
-
6
- #ifndef HAVE_RUBY_RE_H
7
- #include "re.h"
8
- #endif
9
-
10
- #ifdef HAVE_RUBY_ST_H
11
- #include "ruby/st.h"
12
- #else
13
- #include "st.h"
14
- #endif
15
-
16
- #define option_given_p(opts, key) RTEST(rb_funcall(opts, i_key_p, 1, key))
17
-
18
- /* unicode */
19
-
20
- typedef unsigned long UTF32; /* at least 32 bits */
21
- typedef unsigned short UTF16; /* at least 16 bits */
22
- typedef unsigned char UTF8; /* typically 8 bits */
23
-
24
- #define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
25
- #define UNI_SUR_HIGH_START (UTF32)0xD800
26
- #define UNI_SUR_HIGH_END (UTF32)0xDBFF
27
- #define UNI_SUR_LOW_START (UTF32)0xDC00
28
- #define UNI_SUR_LOW_END (UTF32)0xDFFF
29
-
30
- typedef struct JSON_ParserStruct {
31
- VALUE Vsource;
32
- char *source;
33
- long len;
34
- char *memo;
35
- VALUE create_id;
36
- int max_nesting;
37
- int current_nesting;
38
- int allow_nan;
39
- int parsing_name;
40
- int symbolize_names;
41
- int quirks_mode;
42
- VALUE object_class;
43
- VALUE array_class;
44
- int create_additions;
45
- VALUE match_string;
46
- FBuffer *fbuffer;
47
- } JSON_Parser;
48
-
49
- #define GET_PARSER \
50
- GET_PARSER_INIT; \
51
- if (!json->Vsource) rb_raise(rb_eTypeError, "uninitialized instance")
52
- #define GET_PARSER_INIT \
53
- JSON_Parser *json; \
54
- Data_Get_Struct(self, JSON_Parser, json)
55
-
56
- #define MinusInfinity "-Infinity"
57
- #define EVIL 0x666
58
-
59
- static UTF32 unescape_unicode(const unsigned char *p);
60
- static int convert_UTF32_to_UTF8(char *buf, UTF32 ch);
61
- static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *result);
62
- static char *JSON_parse_value(JSON_Parser *json, char *p, char *pe, VALUE *result);
63
- static char *JSON_parse_integer(JSON_Parser *json, char *p, char *pe, VALUE *result);
64
- static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *result);
65
- static char *JSON_parse_array(JSON_Parser *json, char *p, char *pe, VALUE *result);
66
- static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd);
67
- static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *result);
68
- static VALUE convert_encoding(VALUE source);
69
- static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self);
70
- static VALUE cParser_parse(VALUE self);
71
- static JSON_Parser *JSON_allocate();
72
- static void JSON_mark(JSON_Parser *json);
73
- static void JSON_free(JSON_Parser *json);
74
- static VALUE cJSON_parser_s_allocate(VALUE klass);
75
- static VALUE cParser_source(VALUE self);
76
-
77
- #endif
@@ -1,79 +0,0 @@
1
- dlext = RbConfig::CONFIG['DLEXT']
2
- direc = File.dirname(__FILE__)
3
-
4
- require 'rake/clean'
5
- require 'rubygems/package_task'
6
- require "#{direc}/lib/method_source/version"
7
-
8
- CLOBBER.include("**/*.#{dlext}", "**/*~", "**/*#*", "**/*.log", "**/*.o")
9
- CLEAN.include("ext/**/*.#{dlext}", "ext/**/*.log", "ext/**/*.o",
10
- "ext/**/*~", "ext/**/*#*", "ext/**/*.obj", "**/*.rbc",
11
- "ext/**/*.def", "ext/**/*.pdb", "**/*_flymake*.*", "**/*_flymake")
12
-
13
- def apply_spec_defaults(s)
14
- s.name = "method_source"
15
- s.summary = "retrieve the sourcecode for a method"
16
- s.version = MethodSource::VERSION
17
- s.date = Time.now.strftime '%Y-%m-%d'
18
- s.author = "John Mair (banisterfiend)"
19
- s.email = 'jrmair@gmail.com'
20
- s.description = s.summary
21
- s.require_path = 'lib'
22
-
23
- s.add_development_dependency("bacon","~>1.1.0")
24
- s.add_development_dependency("rake", "~>0.9")
25
- s.homepage = "http://banisterfiend.wordpress.com"
26
- s.has_rdoc = 'yard'
27
- s.files = `git ls-files`.split("\n")
28
- s.test_files = `git ls-files -- test/*`.split("\n")
29
- end
30
-
31
- task :test do
32
- sh "bacon -q #{direc}/test/test.rb #{direc}/test/test_code_helpers.rb"
33
- end
34
-
35
- desc "reinstall gem"
36
- task :reinstall => :gems do
37
- sh "gem uninstall method_source" rescue nil
38
- sh "gem install #{direc}/pkg/method_source-#{MethodSource::VERSION}.gem"
39
- end
40
-
41
- desc "Set up and run tests"
42
- task :default => [:test]
43
-
44
- desc "Build the gemspec file"
45
- task :gemspec => "ruby:gemspec"
46
-
47
- namespace :ruby do
48
- spec = Gem::Specification.new do |s|
49
- apply_spec_defaults(s)
50
- s.platform = Gem::Platform::RUBY
51
- end
52
-
53
- Gem::PackageTask.new(spec) do |pkg|
54
- pkg.need_zip = false
55
- pkg.need_tar = false
56
- end
57
-
58
- desc "Generate gemspec file"
59
- task :gemspec do
60
- File.open("#{spec.name}.gemspec", "w") do |f|
61
- f << spec.to_ruby
62
- end
63
- end
64
- end
65
-
66
- desc "build all platform gems at once"
67
- task :gems => [:rmgems, "ruby:gem"]
68
-
69
- desc "remove all platform gems"
70
- task :rmgems => ["ruby:clobber_package"]
71
-
72
- desc "build and push latest gems"
73
- task :pushgems => :gems do
74
- chdir("#{direc}/pkg") do
75
- Dir["*.gem"].each do |gemfile|
76
- sh "gem push #{gemfile}"
77
- end
78
- end
79
- end
@@ -1,136 +0,0 @@
1
- require 'rake/clean'
2
- require 'rubygems/package_task'
3
-
4
- $:.unshift 'lib'
5
- require 'pry/version'
6
-
7
- CLOBBER.include('**/*~', '**/*#*', '**/*.log')
8
- CLEAN.include('**/*#*', '**/*#*.*', '**/*_flymake*.*', '**/*_flymake', '**/*.rbc', '**/.#*.*')
9
-
10
- def check_dependencies
11
- require 'bundler'
12
- Bundler.definition.missing_specs
13
-
14
- eval('nil', TOPLEVEL_BINDING, '<main>') # workaround for issue #395
15
- rescue LoadError
16
- # if Bundler isn't installed, we'll just assume your setup is ok.
17
- rescue Bundler::GemNotFound
18
- raise RuntimeError, "You're missing one or more required gems. Run `bundle install` first."
19
- end
20
-
21
- desc "Set up and run tests"
22
- task :default => [:test]
23
-
24
- unless [].respond_to? :shuffle!
25
- class Array
26
- def shuffle!
27
- # TODO: fill this in if anyone cares
28
- self
29
- end
30
- end
31
- end
32
-
33
- def run_specs paths
34
- quiet = ENV['VERBOSE'] ? '' : '-q'
35
- exec "bacon -Ispec -rubygems #{quiet} #{paths.join ' '}"
36
- end
37
-
38
- desc "Run tests"
39
- task :test do
40
- check_dependencies unless ENV['SKIP_DEP_CHECK']
41
- paths =
42
- if explicit_list = ENV['run']
43
- explicit_list.split(',')
44
- else
45
- Dir['spec/**/*_spec.rb'].shuffle!
46
- end
47
- run_specs paths
48
- end
49
- task :spec => :test
50
-
51
- task :recspec do
52
- all = Dir['spec/**/*_spec.rb'].sort_by{|path| File.mtime(path)}.reverse
53
- warn "Running all, sorting by mtime: #{all[0..2].join(' ')} ...etc."
54
- run_specs all
55
- end
56
-
57
- desc "Run pry"
58
- task :pry do
59
- check_dependencies unless ENV['SKIP_DEP_CHECK']
60
- load 'bin/pry'
61
- end
62
-
63
- desc "Show pry version"
64
- task :version do
65
- puts "Pry version: #{Pry::VERSION}"
66
- end
67
-
68
- desc "Profile pry's startup time"
69
- task :profile do
70
- require 'profile'
71
- require 'pry'
72
- Pry.start(TOPLEVEL_BINDING, :input => StringIO.new('exit'))
73
- end
74
-
75
- def modify_base_gemspec
76
- eval(File.read('pry.gemspec')).tap { |s| yield s }
77
- end
78
-
79
- namespace :ruby do
80
- spec = modify_base_gemspec do |s|
81
- s.platform = Gem::Platform::RUBY
82
- end
83
-
84
- Gem::PackageTask.new(spec) do |pkg|
85
- pkg.need_zip = false
86
- pkg.need_tar = false
87
- end
88
- end
89
-
90
- namespace :jruby do
91
- spec = modify_base_gemspec do |s|
92
- s.add_dependency('spoon', '~> 0.0')
93
- s.platform = 'java'
94
- end
95
-
96
- Gem::PackageTask.new(spec) do |pkg|
97
- pkg.need_zip = false
98
- pkg.need_tar = false
99
- end
100
- end
101
-
102
-
103
- [:mingw32, :mswin32].each do |v|
104
- namespace v do
105
- spec = modify_base_gemspec do |s|
106
- s.add_dependency('win32console', '~> 1.3')
107
- s.platform = "i386-#{v}"
108
- end
109
-
110
- Gem::PackageTask.new(spec) do |pkg|
111
- pkg.need_zip = false
112
- pkg.need_tar = false
113
- end
114
- end
115
- end
116
-
117
- desc "build all platform gems at once"
118
- task :gems => [:clean, :rmgems, 'ruby:gem', 'mswin32:gem', 'mingw32:gem', 'jruby:gem']
119
-
120
- desc "remove all platform gems"
121
- task :rmgems => ['ruby:clobber_package']
122
-
123
- desc "reinstall gem"
124
- task :reinstall => :gems do
125
- sh "gem uninstall pry" rescue nil
126
- sh "gem install #{File.dirname(__FILE__)}/pkg/pry-#{Pry::VERSION}.gem"
127
- end
128
-
129
- desc "build and push latest gems"
130
- task :pushgems => :gems do
131
- chdir("#{File.dirname(__FILE__)}/pkg") do
132
- Dir["*.gem"].each do |gemfile|
133
- sh "gem push #{gemfile}"
134
- end
135
- end
136
- end
@@ -1,374 +0,0 @@
1
- # Rakefile for rake -*- ruby -*-
2
-
3
- # Copyright 2003, 2004, 2005 by Jim Weirich (jim@weirichhouse.org)
4
- # All rights reserved.
5
-
6
- # This file may be distributed under an MIT style license. See
7
- # MIT-LICENSE for details.
8
-
9
- require 'rbconfig'
10
- require 'rubygems'
11
-
12
- system_rake = File.join RbConfig::CONFIG['rubylibdir'], 'rake.rb'
13
-
14
- # Use our rake, not the installed rake from system
15
- if $".include? system_rake or $".grep(/rake\/name_space\.rb$/).empty? then
16
- exec Gem.ruby, '-Ilib', 'bin/rake', *ARGV
17
- end
18
-
19
- require 'rubygems/package_task'
20
-
21
- require 'rake/clean'
22
- require 'rake/testtask'
23
-
24
- begin
25
- gem 'rdoc'
26
- require 'rdoc/task'
27
- rescue Gem::LoadError
28
- end
29
-
30
- CLEAN.include('**/*.o', '*.dot', '**/*.rbc')
31
- CLOBBER.include('doc/example/main')
32
- CLOBBER.include('TAGS')
33
- CLOBBER.include('coverage', 'rcov_aggregate')
34
-
35
- # Prevent OS X from including extended attribute junk in the tar output
36
- ENV['COPY_EXTENDED_ATTRIBUTES_DISABLE'] = 'true'
37
-
38
- def announce(msg='')
39
- STDERR.puts msg
40
- end
41
-
42
- # Determine the current version of the software
43
-
44
- if `ruby -Ilib ./bin/rake --version` =~ /rake, version ([0-9a-z.]+)$/
45
- CURRENT_VERSION = $1
46
- else
47
- CURRENT_VERSION = "0.0.0"
48
- end
49
-
50
- $package_version = CURRENT_VERSION
51
-
52
- SRC_RB = FileList['lib/**/*.rb']
53
-
54
- # The default task is run if rake is given no explicit arguments.
55
-
56
- desc "Default Task"
57
- task :default => :test
58
-
59
- # Test Tasks ---------------------------------------------------------
60
-
61
- Rake::TestTask.new do |t|
62
- files = FileList['test/helper.rb', 'test/test_*.rb']
63
- t.loader = :rake
64
- t.test_files = files
65
- t.libs << "."
66
- t.warning = true
67
- end
68
-
69
- begin
70
- require 'rcov/rcovtask'
71
- IGNORE_COVERAGE_IN = FileList[
72
- 'lib/rake/rdoctask.rb',
73
- 'lib/rake/testtask.rb',
74
- 'lib/rake/packagetask.rb',
75
- 'lib/rake/clean.rb',
76
- ]
77
-
78
- unless File::ALT_SEPARATOR
79
- IGNORE_COVERAGE_IN.include(
80
- 'lib/rake/alt_system.rb',
81
- 'lib/rake/win32.rb')
82
- end
83
-
84
- Rcov::RcovTask.new do |t|
85
- t.libs << "test"
86
- t.rcov_opts = [
87
- '-xRakefile', '-xrakefile', '-xpublish.rf',
88
- '-xlib/rake/contrib', '-x/Library', '-x.rvm',
89
- '--text-report',
90
- '--sort coverage'
91
- ] + FileList['rakelib/*.rake'].pathmap("-x%p") +
92
- IGNORE_COVERAGE_IN.map { |fn| "-x#{fn}" }
93
- t.test_files = FileList[
94
- 'test/lib/*_test.rb',
95
- 'test/contrib/*_test.rb',
96
- 'test/functional/*_test.rb'
97
- ]
98
- t.output_dir = 'coverage'
99
- t.verbose = true
100
- end
101
- rescue LoadError
102
- task :rcov do
103
- puts "RCov is not available"
104
- end
105
- end
106
-
107
- # CVS Tasks ----------------------------------------------------------
108
-
109
- # Install rake using the standard install.rb script.
110
-
111
- desc "Install the application"
112
- task :install do
113
- ruby "install.rb"
114
- end
115
-
116
- # Create a task to build the RDOC documentation tree.
117
-
118
- BASE_RDOC_OPTIONS = [
119
- '--line-numbers', '--show-hash',
120
- '--main', 'README.rdoc',
121
- '--title', 'Rake -- Ruby Make'
122
- ]
123
-
124
- if defined?(RDoc::Task) then
125
- RDoc::Task.new do |rdoc|
126
- rdoc.rdoc_dir = 'html'
127
- rdoc.title = "Rake -- Ruby Make"
128
- rdoc.options = BASE_RDOC_OPTIONS.dup
129
-
130
- rdoc.rdoc_files.include('README.rdoc', 'MIT-LICENSE', 'TODO', 'CHANGES')
131
- rdoc.rdoc_files.include('lib/**/*.rb', 'doc/**/*.rdoc')
132
- rdoc.rdoc_files.exclude(/\bcontrib\b/)
133
- end
134
- else
135
- warn "RDoc 2.4.2+ is required to build documentation"
136
- end
137
-
138
- # ====================================================================
139
- # Create a task that will package the Rake software into distributable
140
- # tar, zip and gem files.
141
-
142
- PKG_FILES = FileList[
143
- '.gemtest',
144
- 'install.rb',
145
- 'CHANGES',
146
- 'MIT-LICENSE',
147
- 'README.rdoc',
148
- 'Rakefile',
149
- 'TODO',
150
- 'bin/rake',
151
- 'lib/**/*.rb',
152
- 'test/**/*.rb',
153
- 'doc/**/*'
154
- ]
155
- PKG_FILES.exclude('doc/example/*.o')
156
- PKG_FILES.exclude('TAGS')
157
- PKG_FILES.exclude(%r{doc/example/main$})
158
-
159
- if ! defined?(Gem)
160
- puts "Package Target requires RubyGems"
161
- else
162
- SPEC = Gem::Specification.new do |s|
163
- s.name = 'rake'
164
- s.version = $package_version
165
- s.summary = "Ruby based make-like utility."
166
- s.description = <<-EOF.delete "\n"
167
- Rake is a Make-like program implemented in Ruby. Tasks and dependencies are
168
- specified in standard Ruby syntax.
169
- EOF
170
-
171
- s.required_ruby_version = '>= 1.8.6'
172
- s.required_rubygems_version = '>= 1.3.2'
173
- s.add_development_dependency 'minitest', '~> 2.1'
174
-
175
- s.files = PKG_FILES.to_a
176
-
177
- s.executables = ["rake"]
178
-
179
- s.extra_rdoc_files = FileList[
180
- 'README.rdoc',
181
- 'MIT-LICENSE',
182
- 'TODO',
183
- 'CHANGES',
184
- 'doc/**/*.rdoc'
185
- ]
186
-
187
- s.rdoc_options = BASE_RDOC_OPTIONS
188
-
189
- s.author = "Jim Weirich"
190
- s.email = "jim@weirichhouse.org"
191
- s.homepage = "http://rake.rubyforge.org"
192
- s.rubyforge_project = "rake"
193
- end
194
-
195
- Gem::PackageTask.new(SPEC) do |pkg|
196
- pkg.need_zip = true
197
- pkg.need_tar = true
198
- end
199
-
200
- file "rake.gemspec" => ["Rakefile", "lib/rake.rb"] do |t|
201
- require 'yaml'
202
- open(t.name, "w") { |f| f.puts SPEC.to_yaml }
203
- end
204
-
205
- desc "Create a stand-alone gemspec"
206
- task :gemspec => "rake.gemspec"
207
- end
208
-
209
- # Misc tasks =========================================================
210
-
211
- def count_lines(filename)
212
- lines = 0
213
- codelines = 0
214
- open(filename) { |f|
215
- f.each do |line|
216
- lines += 1
217
- next if line =~ /^\s*$/
218
- next if line =~ /^\s*#/
219
- codelines += 1
220
- end
221
- }
222
- [lines, codelines]
223
- end
224
-
225
- def show_line(msg, lines, loc)
226
- printf "%6s %6s %s\n", lines.to_s, loc.to_s, msg
227
- end
228
-
229
- desc "Count lines in the main rake file"
230
- task :lines do
231
- total_lines = 0
232
- total_code = 0
233
- show_line("File Name", "LINES", "LOC")
234
- SRC_RB.each do |fn|
235
- lines, codelines = count_lines(fn)
236
- show_line(fn, lines, codelines)
237
- total_lines += lines
238
- total_code += codelines
239
- end
240
- show_line("TOTAL", total_lines, total_code)
241
- end
242
-
243
- # Define an optional publish target in an external file. If the
244
- # publish.rf file is not found, the publish targets won't be defined.
245
-
246
- load "publish.rf" if File.exist? "publish.rf"
247
-
248
- # Support Tasks ------------------------------------------------------
249
-
250
- RUBY_FILES = FileList['**/*.rb'].exclude('pkg')
251
-
252
- desc "Look for TODO and FIXME tags in the code"
253
- task :todo do
254
- RUBY_FILES.egrep(/#.*(FIXME|TODO|TBD)/)
255
- end
256
-
257
- desc "List all ruby files"
258
- task :rubyfiles do
259
- puts RUBY_FILES
260
- puts FileList['bin/*'].exclude('bin/*.rb')
261
- end
262
- task :rf => :rubyfiles
263
-
264
- # --------------------------------------------------------------------
265
- # Creating a release
266
-
267
- def plugin(plugin_name)
268
- require "rake/plugins/#{plugin_name}"
269
- end
270
-
271
- task :noop
272
- #plugin "release_manager"
273
-
274
- desc "Make a new release"
275
- task :release, [:rel, :reuse, :reltest] => [
276
- :prerelease,
277
- :clobber,
278
- :test,
279
- :update_version,
280
- :package,
281
- :tag
282
- ] do
283
- announce
284
- announce "**************************************************************"
285
- announce "* Release #{$package_version} Complete."
286
- announce "* Packages ready to upload."
287
- announce "**************************************************************"
288
- announce
289
- end
290
-
291
- # Validate that everything is ready to go for a release.
292
- task :prerelease, :rel, :reuse, :reltest do |t, args|
293
- $package_version = args.rel
294
- announce
295
- announce "**************************************************************"
296
- announce "* Making RubyGem Release #{$package_version}"
297
- announce "* (current version #{CURRENT_VERSION})"
298
- announce "**************************************************************"
299
- announce
300
-
301
- # Is a release number supplied?
302
- unless args.rel
303
- fail "Usage: rake release[X.Y.Z] [REUSE=tag_suffix]"
304
- end
305
-
306
- # Is the release different than the current release.
307
- # (or is REUSE set?)
308
- if $package_version == CURRENT_VERSION && ! args.reuse
309
- fail "Current version is #{$package_version}, must specify REUSE=tag_suffix to reuse version"
310
- end
311
-
312
- # Are all source files checked in?
313
- if args.reltest
314
- announce "Release Task Testing, skipping checked-in file test"
315
- else
316
- announce "Checking for unchecked-in files..."
317
- data = `svn st`
318
- unless data =~ /^$/
319
- abort "svn status is not clean ... do you have unchecked-in files?"
320
- end
321
- announce "No outstanding checkins found ... OK"
322
- end
323
- end
324
-
325
- task :update_version, [:rel, :reuse, :reltest] => [:prerelease] do |t, args|
326
- if args.rel == CURRENT_VERSION
327
- announce "No version change ... skipping version update"
328
- else
329
- announce "Updating Rake version to #{args.rel}"
330
- open("lib/rake.rb") do |rakein|
331
- open("lib/rake.rb.new", "w") do |rakeout|
332
- rakein.each do |line|
333
- if line =~ /^RAKEVERSION\s*=\s*/
334
- rakeout.puts "RAKEVERSION = '#{args.rel}'"
335
- else
336
- rakeout.puts line
337
- end
338
- end
339
- end
340
- end
341
- mv "lib/rake.rb.new", "lib/rake.rb"
342
- if args.reltest
343
- announce "Release Task Testing, skipping commiting of new version"
344
- else
345
- sh %{svn commit -m "Updated to version #{args.rel}" lib/rake.rb} # "
346
- end
347
- end
348
- end
349
-
350
- desc "Tag all the CVS files with the latest release number (REL=x.y.z)"
351
- task :tag, [:rel, :reuse, :reltest] => [:prerelease] do |t, args|
352
- reltag = "REL_#{args.rel.gsub(/\./, '_')}"
353
- reltag << args.reuse.gsub(/\./, '_') if args.reuse
354
- announce "Tagging Repository with [#{reltag}]"
355
- if args.reltest
356
- announce "Release Task Testing, skipping CVS tagging"
357
- else
358
- sh %{svn copy svn+ssh://rubyforge.org/var/svn/rake/trunk svn+ssh://rubyforge.org/var/svn/rake/tags/#{reltag} -m 'Commiting release #{reltag}'} ###'
359
- end
360
- end
361
-
362
- # Require experimental XForge/Metaproject support.
363
-
364
- load 'xforge.rf' if File.exist?('xforge.rf')
365
-
366
- desc "Where is the current directory. This task displays\nthe current rake directory"
367
- task :where_am_i do
368
- puts Rake.original_dir
369
- end
370
-
371
- task :failure => :really_fail
372
- task :really_fail do
373
- fail "oops"
374
- end