Skip to content
Newer
Older
100644 85 lines (72 sloc) 2.43 KB
baeb175 @lsegal Add YardocTask Rake task
authored
1 require File.dirname(__FILE__) + '/lib/yard'
f4075ea @lsegal Add support for RubyGems 1.7.x
authored
2 require File.dirname(__FILE__) + '/lib/yard/rubygems/specification'
acfba72 @lsegal Better rake support for windows
authored
3 require 'rbconfig'
96f0302 Added gemspec
loren authored
4
f27213b @lsegal Add YARD_VERSION env to Rakefile. Allows installing as arbitrary gem …
authored
5 YARD::VERSION.replace(ENV['YARD_VERSION']) if ENV['YARD_VERSION']
acfba72 @lsegal Better rake support for windows
authored
6 WINDOWS = (Config::CONFIG['host_os'] =~ /mingw|win32|cygwin/ ? true : false) rescue false
bb7abaa @lsegal Add yard.gemspec and move Gem specific stuff out of Rakefile
authored
7 SUDO = WINDOWS ? '' : 'sudo'
8
1e4d5e9 @lsegal Change default rake task to run specs
authored
9 task :default => :specs
96f0302 Added gemspec
loren authored
10
0f77917 @lsegal Remove gem package Rake tasks and use simplified gem build functionality
authored
11 desc "Builds the gem"
12 task :gem do
7e550af @lsegal gemspec date can be set with Ruby!
authored
13 Gem::Builder.new(eval(File.read('yard.gemspec'))).build
22cdc42 Add better exception handling, add 'rake install' task
loren authored
14 end
15
0f77917 @lsegal Remove gem package Rake tasks and use simplified gem build functionality
authored
16 desc "Installs the gem"
5824a94 @lsegal Only build .gem for install
authored
17 task :install => :gem do
0f77917 @lsegal Remove gem package Rake tasks and use simplified gem build functionality
authored
18 sh "#{SUDO} gem install yard-#{YARD::VERSION}.gem --no-rdoc --no-ri"
e54b06f @lsegal Consolidate gemspec into Rakefile and add specs task
authored
19 end
20
08977a2 @lsegal Add 'rake suite' task to run specs across all(?) supported ruby versi…
authored
21 desc 'Run spec suite'
22 task :suite do
23 ['ruby186', 'ruby18', 'ruby19', 'ruby192', 'jruby'].each do |ruby|
24 2.times do |legacy|
7796941 @lsegal Run ruby18 through test suite with ripper
authored
25 next if legacy == 1 && ruby =~ /^jruby|186/
08977a2 @lsegal Add 'rake suite' task to run specs across all(?) supported ruby versi…
authored
26 puts "Running specs with #{ruby}#{legacy == 1 ? ' (in legacy mode)' : ''}"
27 cmd = "#{ruby} -S rake specs SUITE=1 #{legacy == 1 ? 'LEGACY=1' : ''}"
28 puts cmd
29 system(cmd)
30 end
31 end
32 end
33
1c189a0 @lsegal Allow rake to function without RSpec
authored
34 begin
3cafb47 @lsegal Make rakefile backwards compatible for rspec 1.x users
authored
35 hide = '_spec\.rb$,spec_helper\.rb$,ruby_lex\.rb$,autoload\.rb$'
bdd8a8f @lsegal Update specs to allow toggling on and off of LEGACY environment varia…
authored
36 if YARD::Parser::SourceParser.parser_type == :ruby
37 hide += ',legacy\/.+_handler'
1ee355e @lsegal Backport new-style parser to 1.8 compatible syntax (and semantics) fo…
authored
38 else
bdd8a8f @lsegal Update specs to allow toggling on and off of LEGACY environment varia…
authored
39 hide += ',ruby_parser\.rb$,ast_node\.rb$,handlers\/ruby\/[^\/]+\.rb$'
1ee355e @lsegal Backport new-style parser to 1.8 compatible syntax (and semantics) fo…
authored
40 end
3cafb47 @lsegal Make rakefile backwards compatible for rspec 1.x users
authored
41
b2ee971 @gioele Minimal update to RSpec 2
gioele authored
42 require 'rspec'
43 require 'rspec/core/rake_task'
1c189a0 @lsegal Allow rake to function without RSpec
authored
44
45 desc "Run all specs"
b2ee971 @gioele Minimal update to RSpec 2
gioele authored
46 RSpec::Core::RakeTask.new("specs") do |t|
1c189a0 @lsegal Allow rake to function without RSpec
authored
47 $DEBUG = true if ENV['DEBUG']
08977a2 @lsegal Add 'rake suite' task to run specs across all(?) supported ruby versi…
authored
48 t.rspec_opts = ENV['SUITE'] ? ['--format', 'progress'] : ["--colour", "--format", "documentation"]
b2ee971 @gioele Minimal update to RSpec 2
gioele authored
49 t.rspec_opts += ["--require", File.join(File.dirname(__FILE__), 'spec', 'spec_helper')]
08977a2 @lsegal Add 'rake suite' task to run specs across all(?) supported ruby versi…
authored
50 t.rspec_opts += ['-I', YARD::ROOT]
b2ee971 @gioele Minimal update to RSpec 2
gioele authored
51 t.pattern = "spec/**/*_spec.rb"
08977a2 @lsegal Add 'rake suite' task to run specs across all(?) supported ruby versi…
authored
52 t.verbose = $DEBUG ? true : false
0d541b7 @lsegal Ignore files from RCov stats
authored
53
1c189a0 @lsegal Allow rake to function without RSpec
authored
54 if ENV['RCOV']
55 t.rcov = true
56 t.rcov_opts = ['-x', hide]
57 end
0d541b7 @lsegal Ignore files from RCov stats
authored
58 end
1c189a0 @lsegal Allow rake to function without RSpec
authored
59 task :spec => :specs
60 rescue LoadError
3cafb47 @lsegal Make rakefile backwards compatible for rspec 1.x users
authored
61 begin # Try for rspec 1.x
62 require 'spec'
63 require 'spec/rake/spectask'
64
65 Spec::Rake::SpecTask.new("specs") do |t|
66 $DEBUG = true if ENV['DEBUG']
67 t.spec_opts = ["--format", "specdoc", "--colour"]
68 t.spec_opts += ["--require", File.join(File.dirname(__FILE__), 'spec', 'spec_helper')]
69 t.pattern = "spec/**/*_spec.rb"
70
71 if ENV['RCOV']
72 t.rcov = true
73 t.rcov_opts = ['-x', hide]
74 end
75 end
76 task :spec => :specs
77 rescue LoadError
78 warn "warn: RSpec tests not available. `gem install rspec` to enable them."
79 end
baeb175 @lsegal Add YardocTask Rake task
authored
80 end
81
c351a2c @lsegal Add support for --files switch to specify extra static files to inclu…
authored
82 YARD::Rake::YardocTask.new do |t|
0e14ccb @lsegal Move some options to yardopts
authored
83 t.options += ['--title', "YARD #{YARD::VERSION} Documentation"]
5b8d227 @nex3 Add spec as an alias for the specs Rake task.
nex3 authored
84 end
Something went wrong with that request. Please try again.