3333#
3434
3535require 'rubygems'
36- GEM_SPEC = eval ( File . read ( " rubytree.gemspec" ) ) # Load the gemspec.
36+ GEM_SPEC = eval ( File . read ( './ rubytree.gemspec' ) ) # Load the gemspec.
3737
3838PKG_NAME = GEM_SPEC . name
3939PKG_VER = GEM_SPEC . version
4040GEM_NAME = "#{ PKG_NAME } -#{ PKG_VER } .gem"
4141
42- desc " Default Task (Run the tests)"
42+ desc ' Default Task (Run the tests)'
4343task :default do
44- if ENV [ " COVERAGE" ]
45- Rake ::Task [ " test:coverage" ] . invoke
44+ if ENV [ ' COVERAGE' ]
45+ Rake ::Task [ ' test:coverage' ] . invoke
4646 else
47- Rake ::Task [ " test:unit" ] . invoke
48- Rake ::Task [ " spec" ] . invoke
47+ Rake ::Task [ ' test:unit' ] . invoke
48+ Rake ::Task [ ' spec' ] . invoke
4949 end
5050end
5151
52- desc " Display the current gem version"
52+ desc ' Display the current gem version'
5353task :version do
5454 puts "Current Version: #{ GEM_NAME } "
5555end
@@ -59,21 +59,21 @@ task :clean => 'gem:clobber_package'
5959CLEAN . include ( 'coverage' )
6060task :clobber => [ :clean , 'doc:clobber_rdoc' , 'doc:clobber_yard' ]
6161
62- desc " Open an irb session preloaded with this library"
62+ desc ' Open an irb session preloaded with this library'
6363task :console do
64- sh " irb -rubygems -r ./lib/tree.rb"
64+ sh ' irb -rubygems -r ./lib/tree.rb'
6565end
6666
6767namespace :doc do # ................................ Documentation
6868 begin
69- gem 'rdoc' , " >= 2.4.2" # To get around a stupid bug in Ruby 1.9.2 Rake.
69+ gem 'rdoc' , ' >= 2.4.2' # To get around a stupid bug in Ruby 1.9.2 Rake.
7070 require 'rdoc/task'
7171 Rake ::RDocTask . new do |rdoc |
7272 rdoc . rdoc_dir = 'rdoc'
7373 rdoc . title = "#{ PKG_NAME } -#{ PKG_VER } "
7474 rdoc . main = 'README.rdoc'
7575 rdoc . rdoc_files . include ( GEM_SPEC . extra_rdoc_files )
76- rdoc . rdoc_files . include ( 'lib/**/*.rb' )
76+ rdoc . rdoc_files . include ( './ lib/**/*.rb' )
7777 end
7878 rescue LoadError
7979 # Oh well.
@@ -83,19 +83,19 @@ namespace :doc do # ................................ Documentation
8383 require 'yard'
8484 YARD ::Rake ::YardocTask . new do |t |
8585 t . files = [ 'lib/**/*.rb' , '-' , GEM_SPEC . extra_rdoc_files ]
86- t . options = [ ' --no-private' , ' --embed-mixins' ]
86+ t . options = %w( --no-private --embed-mixins )
8787 end
8888 rescue LoadError
8989 # Oh well.
9090 end
9191
92- desc " Remove YARD Documentation"
92+ desc ' Remove YARD Documentation'
9393 task :clobber_yard do
9494 rm_rf 'doc'
9595 end
9696end
9797
98- desc " Run the test cases"
98+ desc ' Run the test cases'
9999task :test => 'test:unit'
100100
101101namespace :test do # ................................ Test related
@@ -107,23 +107,23 @@ namespace :test do # ................................ Test related
107107 test . verbose = false
108108 end
109109
110- desc " Run the examples"
110+ desc ' Run the examples'
111111 Rake ::TestTask . new ( :examples ) do |example |
112112 example . libs << 'lib' << 'examples'
113113 example . pattern = 'examples/**/example_*.rb'
114114 example . verbose = true
115115 example . warning = false
116116 end
117117
118- desc " Run the code coverage"
118+ desc ' Run the code coverage'
119119 task :coverage do
120120 ruby 'test/run_test.rb'
121121 end
122122
123123 begin
124124 require 'rcov/rcovtask'
125125 Rcov ::RcovTask . new ( :rcov ) do |t |
126- t . libs << " test"
126+ t . libs << ' test'
127127 t . test_files = FileList [ 'test/**/test_*.rb' ]
128128 t . verbose = true
129129 t . rcov_opts << '--exclude /gems/,/Library/,/usr/,spec,lib/tasks'
@@ -139,7 +139,7 @@ begin # ................................ rspec tests
139139
140140 RSpec ::Core ::RakeTask . new ( :spec ) do |t |
141141 t . fail_on_error = false
142- t . rspec_opts = [ " --color" , " --format doc" ]
142+ t . rspec_opts = [ ' --color' , ' --format doc' ]
143143 end
144144rescue LoadError
145145 # Cannot load rspec.
@@ -164,7 +164,7 @@ namespace :gem do # ................................ Gem related
164164 pkg . need_tar = true
165165 end
166166
167- desc " Push the gem into the Rubygems repository"
167+ desc ' Push the gem into the Rubygems repository'
168168 task :push => :gem do
169169 sh "gem push pkg/#{ GEM_NAME } "
170170 end
0 commit comments