Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated rakefile .

  • Loading branch information...
commit 58939cb61c6b60d2bafc0becab2a2e045c4bf09f 1 parent d98b767
@genki authored
Showing with 67 additions and 219 deletions.
  1. +41 −192 Rakefile
  2. +26 −27 mime-types.gemspec
View
233 Rakefile
@@ -1,209 +1,58 @@
-#! /usr/bin/env rake
-#--
-# MIME::Types for Ruby
-# http://rubyforge.org/projects/mime-types/
-# Copyright 2003 - 2005 Austin Ziegler.
-# Licensed under a MIT-style licence.
-#
-# $Id$
-#++
-#require 'meta_project'
+require 'rubygems'
require 'rake/gempackagetask'
-#require 'rake/contrib/xforge'
-require 'rake/clean'
-#require 'gmailer'
+require 'merb-core'
+require 'merb-core/tasks/merb'
-#require 'archive/tar/minitar'
-require 'zlib'
+GEM_NAME = "mime-types"
+GEM_VERSION = "1.15.1"
+AUTHOR = "Austin Ziegler"
+EMAIL = "austin@rubyforge.org"
+HOMEPAGE = "http://mime-types.rubyforge.org/"
+SUMMARY = "Manages a MIME Content-Type that will return the Content-Type for a given filename."
-$LOAD_PATH.unshift('lib')
-
-require 'mime/types'
-
-$version = MIME::Types::VERSION
-$name = MIME::Types.to_s
-$project = MetaProject::Project::XForge::RubyForge.new('mime-types')
-$distdir = "mime-types-#$version"
-$tardist = "../#$distdir.tar.gz"
-
-$release_date = nil
-$release_date = Time.parse(ENV['RELEASE_DATE']) if ENV['RELEASE_DATE']
-
-desc "Run the tests for #$name."
-task :test do |t|
- require 'test/unit/testsuite'
- require 'test/unit/ui/console/testrunner'
-
- runner = Test::Unit::UI::Console::TestRunner
-
- $LOAD_PATH.unshift('tests')
- $stderr.puts "Checking for test cases:" if t.verbose
- Dir['tests/tc_*.rb'].each do |testcase|
- $stderr.puts "\t#{testcase}" if t.verbose
- load testcase
- end
-
- suite = Test::Unit::TestSuite.new($name)
-
- ObjectSpace.each_object(Class) do |testcase|
- suite << testcase.suite if testcase < Test::Unit::TestCase
- end
-
- runner.run(suite)
-end
-
-desc "Look for TODO and FIXME tags in the code"
-task :todo do
- rx = %r{#.*(FIXME|TODO|TBD|DEPRECATED)}
- Pathname.new(File.dirname(__FILE__)).egrep(rx) do |match|
- puts match
- end
+spec = Gem::Specification.new do |s|
+ s.rubyforge_project = 'merb'
+ s.name = GEM_NAME
+ s.version = GEM_VERSION
+ s.platform = Gem::Platform::RUBY
+ s.has_rdoc = true
+ s.extra_rdoc_files = ["README"]
+ s.summary = SUMMARY
+ s.description = s.summary
+ s.author = AUTHOR
+ s.email = EMAIL
+ s.homepage = HOMEPAGE
+ s.add_dependency('merb', '>= 1.0.7.1')
+ s.require_path = 'lib'
+ s.files = %w(README Rakefile) + Dir.glob("{lib,spec}/**/*")
+
end
-spec = eval(File.read("mime-types.gemspec"))
-spec.version = $version
-desc "Build the RubyGem for #$name."
-task :gem => [ :test ]
-Rake::GemPackageTask.new(spec) do |g|
- g.need_tar = false
- g.need_zip = false
- g.package_dir = ".."
+Rake::GemPackageTask.new(spec) do |pkg|
+ pkg.gem_spec = spec
end
-desc "Build a #$name .tar.gz distribution."
-task :tar => [ $tardist ]
-file $tardist => [ :test ] do |t|
- current = File.basename(Dir.pwd)
- Dir.chdir("..") do
- begin
- files = %W(bin/**/* lib/**/* tests/**/* ChangeLog README LICENCE
- Rakefile mime-types.gemspec setup.rb pre-setup.rb)
- files = FileList[files.map { |file| File.join(current, file) }].to_a
- files.map! do |dd|
- ddnew = dd.gsub(/^#{current}/, $distdir)
- mtime = $release_date || File.stat(dd).mtime
- if File.directory?(dd)
- { :name => ddnew, :mode => 0755, :dir => true, :mtime => mtime }
- else
- if dd =~ %r{bin/}
- mode = 0755
- else
- mode = 0644
- end
- data = File.open(dd, "rb") { |ff| ff.read }
- { :name => ddnew, :mode => mode, :data => data, :size =>
- data.size, :mtime => mtime }
- end
- end
-
- ff = File.open(t.name.gsub(%r{^\.\./}o, ''), "wb")
- gz = Zlib::GzipWriter.new(ff)
- tw = Archive::Tar::Minitar::Writer.new(gz)
-
- files.each do |entry|
- if entry[:dir]
- tw.mkdir(entry[:name], entry)
- else
- tw.add_file_simple(entry[:name], entry) { |os| os.write(entry[:data]) }
- end
- end
- ensure
- tw.close if tw
- gz.finish if gz
- ff.close
- end
- end
+desc "install the plugin as a gem"
+task :install do
+ Merb::RakeHelper.install(GEM_NAME, :version => GEM_VERSION)
end
-task $tardist => [ :test ]
-desc "Build the RDoc documentation for #$name."
-task :docs do
- require 'rdoc/rdoc'
- rdoc_options = %W(--title #$name --main README --line-numbers)
- files = FileList[*%w(README LICENCE ChangeLog bin/**/*.rb lib/**/*.rb)]
- rdoc_options += files.to_a
- RDoc::RDoc.new.document(rdoc_options)
+desc "Uninstall the gem"
+task :uninstall do
+ Merb::RakeHelper.uninstall(GEM_NAME, :version => GEM_VERSION)
end
-task :verify_rubyforge do
- raise "RUBYFORGE_USER environment variable not set!" unless ENV['RUBYFORGE_USER']
- raise "RUBYFORGE_PASSWORD environment variable not set!" unless ENV['RUBYFORGE_PASSWORD']
-end
-
-#task :verify_gmail do
-# raise "GMAIL_USER environment variable not set!" unless ENV['GMAIL_USER']
-# raise "GMAIL_PASSWORD environment variable not set!" unless ENV['GMAIL_PASSWORD']
-#end
-
-desc "Release files on RubyForge."
-task :release_files => [ :verify_rubyforge, :tar, :gem ] do
- release_files = FileList[$tardist, "../#$distdir.gem"]
- Rake::XForge::Release.new($project) do |release|
- release.user_name = ENV['RUBYFORGE_USER']
- release.password = ENV['RUBYFORGE_PASSWORD']
- release.files = release_files.to_a
- release.release_name = "#$name #$version"
- release.package_name = "mime-types"
-
- notes = []
- File.open("README") do |file|
- file.each do |line|
- line.chomp!
- line.gsub!(/^#.*$/, '') and next
- notes << line
- end
- end
- release.release_notes = notes.join("\n")
-
- changes = []
- File.open("ChangeLog") do |file|
- current = true
-
- file.each do |line|
- line.chomp!
- current = false if current and line =~ /^==/
- break if line.empty? and not current
- changes << line
- end
- end
- release.release_changes = changes.join("\n")
+desc "Create a gemspec file"
+task :gemspec do
+ File.open("#{GEM_NAME}.gemspec", "w") do |file|
+ file.puts spec.to_ruby
end
end
-desc "Publish news on RubyForge"
-task :publish_news => [ :verify_rubyforge, :tar, :gem ] do
- Rake::XForge::NewsPublisher.new($project) do |news|
- news.user_name = ENV['RUBYFORGE_USER']
- news.password = ENV['RUBYFORGE_PASSWORD']
- news.subject = "#$name #$version Released"
- news.changes_file = nil
-
- details = []
- File.open("Release-Announcement") do |file|
- file.each do |line|
- line.chomp!
- break if line =~ /^=/
- details << line
- end
- end
- news.details = details.join("\n")
- end
+desc "Run spec"
+task :spec do
+ sh "spec spec --color"
end
-=begin
-desc "Post a release announcement via GMail."
-task :email_announcement => [ :verify_gmail ] do
- GMailer.connect(ENV["GMAIL_USER"], ENV["GMAIL_PASSWORD"]) do |gmail|
- gmail.send :to => "ruby-talk@ruby-lang.org",
- :subject => "[ANN] #$name #$version",
- :body => File.read("Release-Announcement")
- end
-end
-=end
-
-desc "Release the latest version."
-task :release => [ :verify_rubyforge, :verify_gmail, :release_files,
- :publish_news, :email_announcement, :docs ]
-desc "Build everything."
-task :default => [ :tar, :gem ]
+task :default => :spec
View
53 mime-types.gemspec
@@ -1,34 +1,33 @@
+# -*- encoding: utf-8 -*-
+
Gem::Specification.new do |s|
s.name = %q{mime-types}
- s.version = %q{1.15}
- s.summary = %q{Manages a MIME Content-Type that will return the Content-Type for a given filename.}
- s.platform = Gem::Platform::RUBY
-
- s.has_rdoc = true
- s.rdoc_options = %w(--title MIME::Types --main README --line-numbers)
- s.extra_rdoc_files = %w(README ChangeLog Install)
-
- s.test_files = %w{tests/testall.rb}
+ s.version = "1.15.1"
- s.require_paths = %w{lib}
-
- s.files = Dir.glob(%w(bin/**/* lib/**/* tests/**/* ChangeLog README
- LICENCE setup.rb Rakefile mime-types.gemspec
- pre-setup.rb))
- #.to_a.delete_if do |item|
- # item.include?("CVS") or item.include?(".svn") or
- # item == "install.rb" or item =~ /~$/ or
- # item =~ /gem(?:spec)?$/
- #end
-
- s.author = %q{Austin Ziegler}
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Austin Ziegler"]
+ s.date = %q{2009-02-14}
+ s.description = %q{Manages a MIME Content-Type that will return the Content-Type for a given filename.}
s.email = %q{austin@rubyforge.org}
- s.rubyforge_project = %q(mime-types)
+ s.extra_rdoc_files = ["README"]
+ s.files = ["README", "Rakefile", "lib/mime", "lib/mime/types.rb"]
+ s.has_rdoc = true
s.homepage = %q{http://mime-types.rubyforge.org/}
+ s.require_paths = ["lib"]
+ s.rubyforge_project = %q{merb}
+ s.rubygems_version = %q{1.3.1}
+ s.summary = %q{Manages a MIME Content-Type that will return the Content-Type for a given filename.}
+
+ if s.respond_to? :specification_version then
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+ s.specification_version = 2
- s.description = <<-"RUBY"
-This library allows for the identification of a file's likely MIME content
-type. This is release 1.15. The identification of MIME content type is based
-on a file's filename extensions.
- RUBY
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
+ s.add_runtime_dependency(%q<merb>, [">= 1.0.7.1"])
+ else
+ s.add_dependency(%q<merb>, [">= 1.0.7.1"])
+ end
+ else
+ s.add_dependency(%q<merb>, [">= 1.0.7.1"])
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.