diff options
author | murphy <murphy@rubychan.de> | 2011-06-12 00:55:04 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2011-06-12 00:55:04 +0000 |
commit | fcc956998d2142aefb9ea39ab23042cf6f324bfe (patch) | |
tree | 50e3a04117db9ecaec90faf2da0ad63614b49eb6 | |
parent | ff6ae481c2a20d66251d9af1c208ee0b23a5d4b4 (diff) | |
download | coderay-fcc956998d2142aefb9ea39ab23042cf6f324bfe.tar.gz |
cleaning up gem tasks
-rw-r--r-- | rake_tasks/gem.rake | 111 |
1 files changed, 40 insertions, 71 deletions
diff --git a/rake_tasks/gem.rake b/rake_tasks/gem.rake index 8274a7b..c9d8937 100644 --- a/rake_tasks/gem.rake +++ b/rake_tasks/gem.rake @@ -1,90 +1,60 @@ require 'rubygems/package_task'
-def gemspec
- Gem::Specification.new do |s|
- # Basic Information
- # s.name will be set later
- s.rubyforge_project = 'coderay'
- s.version = '0'
-
- s.platform = Gem::Platform::RUBY
- s.required_ruby_version = '>= 1.8.2'
- s.requirements = []
- s.date = Time.now.strftime '%Y-%m-%d'
- s.rdoc_options = '-SNw2', '-mlib/README', '-t CodeRay Documentation'
- s.extra_rdoc_files = EXTRA_RDOC_FILES
-
- # Description
- s.summary = <<-EOF
-Fast syntax highlighting for selected languages.
- EOF
- s.description = <<-EOF
-Fast and easy syntax highlighting for selected languages, written in Ruby.
-Comes with RedCloth integration and LOC counter.
- EOF
-
- # Files
- s.require_path = 'lib'
- s.executables = [ 'coderay', 'coderay_stylesheet' ]
-
- s.files = nil # defined later
+def svn_head_revision
+ @svn_head_revision ||= `svn up --ignore-externals && svn info`[/Revision: (\d+)/,1]
+end
- # Credits
- s.author = 'murphy'
- s.email = 'murphy@rubychan.de'
- s.homepage = 'http://coderay.rubychan.de'
+def coderay_version
+ @coderay_version ||= begin
+ $:.unshift './lib'
+ require 'coderay'
+
+ version = CodeRay::VERSION
+ if ENV['pre']
+ version + ".#{svn_head_revision}.pre"
+ elsif version[/.0$/]
+ version + ".#{svn_head_revision}"
+ end
end
end
-def svn_head_revision
- sh 'svn up --ignore-externals'
- `svn info`[/Revision: (\d+)/,1]
+def gemspec
+ Gem::Specification.new do |s|
+ s.name = 'coderay'
+ s.version = coderay_version
+ s.platform = Gem::Platform::RUBY
+ s.authors = ['murphy']
+ s.email = ['murphy@rubychan.de']
+ s.homepage = 'http://coderay.rubychan.de'
+ s.summary = 'Fast syntax highlighting for selected languages.'
+ s.description = 'Fast and easy syntax highlighting for selected languages, written in Ruby. Comes with RedCloth integration and LOC counter.'
+
+ s.files = Dir['lib/**/*.rb'] + %w(Rakefile lib/README LICENSE) + Dir['test/functional/*.rb']
+ s.test_files = Dir['test/functional/*.rb']
+ s.executables = [ 'coderay', 'coderay_stylesheet' ]
+ s.require_paths = ['lib']
+
+ s.rubyforge_project = s.name
+ s.rdoc_options = '-SNw2', '-mlib/README', '-t CodeRay Documentation'
+ s.extra_rdoc_files = EXTRA_RDOC_FILES
+ end
end
namespace :gem do
-
- gemtask = Gem::PackageTask.new(gemspec) do |pkg|
+ Gem::PackageTask.new gemspec do |pkg|
pkg.need_zip = true
pkg.need_tar = true
end
-
+
desc 'Create the Gem again'
- task :make => [:make_gemspec, :clean, :gem]
-
+ task :make => [:clean, :gem] do
+ puts "Created #{coderay_version}"
+ end
+
desc 'Delete previously created Gems'
task :clean do
Dir['pkg/*.gem'].each { |g| rm g }
end
-
- desc 'Find out the current CodeRay version'
- task :get_version do
- $gem_name = 'coderay'
- unless $version
- $:.unshift './lib'
- require 'coderay'
- $version = CodeRay::VERSION
- end
- puts 'Current Version: %s' % $version
- if ENV['pre']
- $version << '.' << svn_head_revision
- $version << '.pre'
- elsif $version[/.0$/]
- $version << '.' << svn_head_revision
- $gem_name << '-beta'
- end
- end
-
- task :make_gemspec => :get_version do
- s = gemtask.gem_spec
- s.files = Dir['./lib/**/*.rb'] +
- Dir['./demo/*.rb'] +
- Dir['./Rakefile'] +
- Dir['./test/functional/*'] +
- %w(./lib/README ./LICENSE)
- s.test_file = './test/functional/suite.rb'
- gemtask.version = s.version = $version
- gemtask.name = s.name = $gem_name
- end
task :set_pre do
ENV['pre'] = 'true'
@@ -92,7 +62,6 @@ namespace :gem do desc 'Make a prerelease Gem.'
task :prerelease => [:set_pre, :make]
-
end
task :gem => 'gem:make'
\ No newline at end of file |