myobie-mime-types 1.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (8) hide show
  1. data/ChangeLog +101 -0
  2. data/Install +16 -0
  3. data/LICENCE +18 -0
  4. data/Rakefile +208 -0
  5. data/mime-types.gemspec +75 -0
  6. data/pre-setup.rb +46 -0
  7. data/setup.rb +1366 -0
  8. metadata +98 -0
data/ChangeLog ADDED
@@ -0,0 +1,101 @@
1
+ = MIME::Types Change Log
2
+
3
+ Unless explicitly stated differently are all changes produced by Austin
4
+ Ziegler <mime-types@halostatue.ca>.
5
+
6
+ == MIME::Types 1.15
7
+ * Removed lib/mime/type.rb to form a single MIME::Types database source. It
8
+ is unlikely that one will ever need MIME::Type without MIME::Types.
9
+ * Re-synchronized the MIME type list with the sources, focusing primarily on
10
+ the IANA list.
11
+ * Added more detailed source information for MIME::Type objects.
12
+ * Changed MIME::Types from a module to a class with a default instance. There
13
+ should be no difference in usage.
14
+ * Removed MIME::Types::DATA_VERSION; it is now an attribute on the
15
+ MIME::Types instance.
16
+ * NOTE: Synchronization with the Perl version of MIME::Types is no longer a
17
+ priority as of this release. The data format and information has changed.
18
+ * Removed MIME::Types.by_suffix and MIME::Types.by_mediatype.
19
+
20
+ == MIME::Types 1.13.1
21
+ * Fixed a problem with the installer running tests. This now works.
22
+ * Improved the implementation of MIME::Type.signature?
23
+ * Moved code around to use the class << self idiom instead of always
24
+ prepending the module/class name.
25
+ * Added two new best-guess implementations of functions found in Perl's
26
+ MIME::Types implementation (1.13). Do not rely on these until the purpose
27
+ and implementation is stabilised.
28
+ * Updated the MIME list to reflect changes noted by
29
+ Ville Skytt� <ville.skytta@iki.fi>.
30
+ * Added a new constant to MIME::Types, DATA_VERSION. This will allow the Ruby
31
+ version number to be updated separately from the Perl version while keeping
32
+ the MIME Type list version in sync.
33
+
34
+ == MIME::Types 1.13
35
+ ! WARNING: This version changes the API of MIME::Types !
36
+ ! WARNING: This version is compatible with Ruby 1.8 and higher ONLY !
37
+ * Removed dependency on InstallPackage; offering 1.13 as either .tar.gz or
38
+ .gem.
39
+ * Split into two files, mime/type.rb and mime/types.rb. This will make
40
+ maintaining the list of changes easier.
41
+ * Changed the MIME::Type construction API. Accepts only a single String
42
+ argument (but does no named type-checking) and yields self.
43
+ * Removed private methods #init_extensions, #init_encoding, and #init_system
44
+ and replaced with #extensions=, #encoding=, and #system=.
45
+ * Added #default_encoding to return 'quoted-printable' or 'base64' depending
46
+ on the media type of the MIME type.
47
+ * Added #raw_media_type and #raw_sub_type to provide the non-simplified
48
+ versions of the media type and subtype.
49
+ * Alternative constructors MIME::Type.from_array, MIME::Type.from_hash, and
50
+ MIME::Type.from_mime_type added to compensate for the removal of named type
51
+ checking in the original constructor.
52
+ * Added #to_str, #to_a, and #to_hash methods. The latter two will provide
53
+ output suitable for use in #from_array and #from_hash.
54
+ * Removed "binary" encoding and enforced the use of a valid encoding string.
55
+ * Added #system? returning true if the MIME::Type is an OS-specific
56
+ MIME::Type.
57
+ * Added #platform? returning true if the MIME::Type is an OS-specific
58
+ MIME::Type for the current RUBY_PLATFORM.
59
+ * Added #like? returning true if the simplified type matches the other value
60
+ provided. #<'application/x-excel'>.like?('application/excel') is true.
61
+ * Added #complete? returning true if the MIME::Type specifies an extension
62
+ list.
63
+ * Updated the MIME type list to reflect additions by Mark Overmeer for Perl's
64
+ MIME::Types 1.12 and the official IANA list as of 2004.04.06. A number of
65
+ formerly "registered" MIME types are now no longer registered (e.g.,
66
+ application/excel is now application/x-excel). This ensures that the
67
+ simplified type still works with applications, but does not report an
68
+ unregistered type as registered.
69
+ * Restored MIME type list to Mark Overmeer's format to facilitate easy
70
+ exchange between the two projects.
71
+ * Added additional unit tests from Mark Overmeer's 1.12 version.
72
+
73
+ == MIME::Types 1.07
74
+ * Changed version numbering to match Perl MIME::Types 1.07.
75
+ * Re-synchronized with Mark Overmeer's list in Perl PMIME::Types 1.07.
76
+ - [NN Poster] updated the attributes for the PGP types.
77
+
78
+ == MIME::Types 1.005
79
+ * Changed to Phil Thomson's InstallPackage.
80
+ * Added several types from Perl MIME::Types 1.005.
81
+ * Cleaned up data format; some data formats will show up with proper data now.
82
+
83
+ == MIME::Types 1.004
84
+ * Updated to match Perl MIME::Types 1.004, links credited to Dan Puro. Adds
85
+ new reference list to http://www.indiana.edu/cgi-bin-local/mimetypes
86
+ * Removed InvalidType and replaced with TypeError.
87
+ * Changed instances of #type to #class.
88
+ * Cleaned up how simplified versions are created.
89
+
90
+ == MIME::Types 1.003
91
+ * Initial release based on Perl MIME::Types 1.003.
92
+
93
+ #--
94
+ # MIME::Types for Ruby
95
+ # http://rubyforge.org/projects/mime-types/
96
+ # Copyright 2003 - 2006 Austin Ziegler.
97
+ # Licensed under a MIT-style licence.
98
+ #
99
+ # $Id$
100
+ #++
101
+ # vim: sts=2 sw=2 ts=4 et ai tw=77
data/Install ADDED
@@ -0,0 +1,16 @@
1
+ Installing this package is as simple as:
2
+
3
+ % ruby setup.rb
4
+
5
+ Alternatively, you can use the RubyGem version of MIME::Types available as
6
+ mime-types-1.15.gem from the usual sources.
7
+
8
+ #--
9
+ # MIME::Types for Ruby
10
+ # http://rubyforge.org/projects/mime-types/
11
+ # Copyright 2003 - 2006 Austin Ziegler.
12
+ # Licensed under a MIT-style licence.
13
+ #
14
+ # $Id$
15
+ #++
16
+ # vim: sts=2 sw=2 ts=4 et ai tw=77
data/LICENCE ADDED
@@ -0,0 +1,18 @@
1
+ = MIME::Types for Ruby
2
+ Homepage:: http://rubyforge.org/projects/mime-types/
3
+ Copyright:: Copyright (c) 2003 - 2006 Austin Ziegler.
4
+ Summary:: Ruby's licence, Perl Aristic Licence,
5
+ GNU GPL version 2 (or later)
6
+
7
+ The text of the Ruby licence can be found at:
8
+ http://www.ruby-lang.org/en/LICENSE.txt
9
+
10
+ The text of the Perl Artistic Licence can be found at:
11
+ http://www.perl.com/pub/a/language/misc/Artistic.html
12
+
13
+ The text of the GNU GPL can be found at: http://www.gnu.org/copyleft/gpl.html
14
+
15
+ If you do not accept one of these licences, you may not use this software.
16
+
17
+ $Id$
18
+ # vim: sts=2 sw=2 ts=4 et ai tw=77
data/Rakefile ADDED
@@ -0,0 +1,208 @@
1
+ #! /usr/bin/env rake
2
+ #--
3
+ # MIME::Types for Ruby
4
+ # http://rubyforge.org/projects/mime-types/
5
+ # Copyright 2003 - 2005 Austin Ziegler.
6
+ # Licensed under a MIT-style licence.
7
+ #
8
+ # $Id$
9
+ #++
10
+ require 'meta_project'
11
+ require 'rake/gempackagetask'
12
+ require 'rake/contrib/xforge'
13
+ require 'rake/clean'
14
+
15
+ require 'gmailer'
16
+
17
+ require 'archive/tar/minitar'
18
+ require 'zlib'
19
+
20
+ $LOAD_PATH.unshift('lib')
21
+
22
+ require 'mime/types'
23
+
24
+ $version = MIME::Types::VERSION
25
+ $name = MIME::Types.to_s
26
+ $project = MetaProject::Project::XForge::RubyForge.new('mime-types')
27
+ $distdir = "mime-types-#$version"
28
+ $tardist = "../#$distdir.tar.gz"
29
+
30
+ $release_date = nil
31
+ $release_date = Time.parse(ENV['RELEASE_DATE']) if ENV['RELEASE_DATE']
32
+
33
+ desc "Run the tests for #$name."
34
+ task :test do |t|
35
+ require 'test/unit/testsuite'
36
+ require 'test/unit/ui/console/testrunner'
37
+
38
+ runner = Test::Unit::UI::Console::TestRunner
39
+
40
+ $LOAD_PATH.unshift('tests')
41
+ $stderr.puts "Checking for test cases:" if t.verbose
42
+ Dir['tests/tc_*.rb'].each do |testcase|
43
+ $stderr.puts "\t#{testcase}" if t.verbose
44
+ load testcase
45
+ end
46
+
47
+ suite = Test::Unit::TestSuite.new($name)
48
+
49
+ ObjectSpace.each_object(Class) do |testcase|
50
+ suite << testcase.suite if testcase < Test::Unit::TestCase
51
+ end
52
+
53
+ runner.run(suite)
54
+ end
55
+
56
+ desc "Look for TODO and FIXME tags in the code"
57
+ task :todo do
58
+ rx = %r{#.*(FIXME|TODO|TBD|DEPRECATED)}
59
+ Pathname.new(File.dirname(__FILE__)).egrep(rx) do |match|
60
+ puts match
61
+ end
62
+ end
63
+
64
+ spec = eval(File.read("mime-types.gemspec"))
65
+ spec.version = $version
66
+ desc "Build the RubyGem for #$name."
67
+ task :gem => [ :test ]
68
+ Rake::GemPackageTask.new(spec) do |g|
69
+ g.need_tar = false
70
+ g.need_zip = false
71
+ g.package_dir = ".."
72
+ end
73
+
74
+ desc "Build a #$name .tar.gz distribution."
75
+ task :tar => [ $tardist ]
76
+ file $tardist => [ :test ] do |t|
77
+ current = File.basename(Dir.pwd)
78
+ Dir.chdir("..") do
79
+ begin
80
+ files = %W(bin/**/* lib/**/* tests/**/* ChangeLog README LICENCE
81
+ Rakefile mime-types.gemspec setup.rb pre-setup.rb)
82
+ files = FileList[files.map { |file| File.join(current, file) }].to_a
83
+ files.map! do |dd|
84
+ ddnew = dd.gsub(/^#{current}/, $distdir)
85
+ mtime = $release_date || File.stat(dd).mtime
86
+ if File.directory?(dd)
87
+ { :name => ddnew, :mode => 0755, :dir => true, :mtime => mtime }
88
+ else
89
+ if dd =~ %r{bin/}
90
+ mode = 0755
91
+ else
92
+ mode = 0644
93
+ end
94
+ data = File.open(dd, "rb") { |ff| ff.read }
95
+ { :name => ddnew, :mode => mode, :data => data, :size =>
96
+ data.size, :mtime => mtime }
97
+ end
98
+ end
99
+
100
+ ff = File.open(t.name.gsub(%r{^\.\./}o, ''), "wb")
101
+ gz = Zlib::GzipWriter.new(ff)
102
+ tw = Archive::Tar::Minitar::Writer.new(gz)
103
+
104
+ files.each do |entry|
105
+ if entry[:dir]
106
+ tw.mkdir(entry[:name], entry)
107
+ else
108
+ tw.add_file_simple(entry[:name], entry) { |os| os.write(entry[:data]) }
109
+ end
110
+ end
111
+ ensure
112
+ tw.close if tw
113
+ gz.finish if gz
114
+ ff.close
115
+ end
116
+ end
117
+ end
118
+ task $tardist => [ :test ]
119
+
120
+ desc "Build the RDoc documentation for #$name."
121
+ task :docs do
122
+ require 'rdoc/rdoc'
123
+ rdoc_options = %W(--title #$name --main README --line-numbers)
124
+ files = FileList[*%w(README LICENCE ChangeLog bin/**/*.rb lib/**/*.rb)]
125
+ rdoc_options += files.to_a
126
+ RDoc::RDoc.new.document(rdoc_options)
127
+ end
128
+
129
+ task :verify_rubyforge do
130
+ raise "RUBYFORGE_USER environment variable not set!" unless ENV['RUBYFORGE_USER']
131
+ raise "RUBYFORGE_PASSWORD environment variable not set!" unless ENV['RUBYFORGE_PASSWORD']
132
+ end
133
+
134
+ task :verify_gmail do
135
+ raise "GMAIL_USER environment variable not set!" unless ENV['GMAIL_USER']
136
+ raise "GMAIL_PASSWORD environment variable not set!" unless ENV['GMAIL_PASSWORD']
137
+ end
138
+
139
+ desc "Release files on RubyForge."
140
+ task :release_files => [ :verify_rubyforge, :tar, :gem ] do
141
+ release_files = FileList[$tardist, "../#$distdir.gem"]
142
+ Rake::XForge::Release.new($project) do |release|
143
+ release.user_name = ENV['RUBYFORGE_USER']
144
+ release.password = ENV['RUBYFORGE_PASSWORD']
145
+ release.files = release_files.to_a
146
+ release.release_name = "#$name #$version"
147
+ release.package_name = "mime-types"
148
+
149
+ notes = []
150
+ File.open("README") do |file|
151
+ file.each do |line|
152
+ line.chomp!
153
+ line.gsub!(/^#.*$/, '') and next
154
+ notes << line
155
+ end
156
+ end
157
+ release.release_notes = notes.join("\n")
158
+
159
+ changes = []
160
+ File.open("ChangeLog") do |file|
161
+ current = true
162
+
163
+ file.each do |line|
164
+ line.chomp!
165
+ current = false if current and line =~ /^==/
166
+ break if line.empty? and not current
167
+ changes << line
168
+ end
169
+ end
170
+ release.release_changes = changes.join("\n")
171
+ end
172
+ end
173
+
174
+ desc "Publish news on RubyForge"
175
+ task :publish_news => [ :verify_rubyforge, :tar, :gem ] do
176
+ Rake::XForge::NewsPublisher.new($project) do |news|
177
+ news.user_name = ENV['RUBYFORGE_USER']
178
+ news.password = ENV['RUBYFORGE_PASSWORD']
179
+ news.subject = "#$name #$version Released"
180
+ news.changes_file = nil
181
+
182
+ details = []
183
+ File.open("Release-Announcement") do |file|
184
+ file.each do |line|
185
+ line.chomp!
186
+ break if line =~ /^=/
187
+ details << line
188
+ end
189
+ end
190
+ news.details = details.join("\n")
191
+ end
192
+ end
193
+
194
+ desc "Post a release announcement via GMail."
195
+ task :email_announcement => [ :verify_gmail ] do
196
+ GMailer.connect(ENV["GMAIL_USER"], ENV["GMAIL_PASSWORD"]) do |gmail|
197
+ gmail.send :to => "ruby-talk@ruby-lang.org, #{ENV['GMAIL_USER']}@gmail.com",
198
+ :subject => "[ANN] #$name #$version",
199
+ :body => File.read("Release-Announcement")
200
+ end
201
+ end
202
+
203
+ desc "Release the latest version."
204
+ task :release => [ :verify_rubyforge, :verify_gmail, :release_files,
205
+ :publish_news, :email_announcement, :docs ]
206
+
207
+ desc "Build everything."
208
+ task :default => [ :tar, :gem ]
@@ -0,0 +1,75 @@
1
+ # Gem::Specification.new do |s|
2
+ # s.name = %q{mime-types}
3
+ # s.version = %q{1.15.1}
4
+ # s.summary = %q{Manages a MIME Content-Type that will return the Content-Type for a given filename.}
5
+ # s.platform = Gem::Platform::RUBY
6
+ #
7
+ # s.has_rdoc = true
8
+ # s.rdoc_options = %w(--title MIME::Types --main README --line-numbers)
9
+ # s.extra_rdoc_files = %w(README ChangeLog Install)
10
+ #
11
+ # s.test_files = %w{tests/testall.rb}
12
+ #
13
+ # s.require_paths = %w{lib}
14
+ #
15
+ # s.files = FileList[*%w(bin/**/* lib/**/* tests/**/* ChangeLog README
16
+ # LICENCE setup.rb Rakefile mime-types.gemspec
17
+ # pre-setup.rb)].to_a.delete_if do |item|
18
+ # item.include?("CVS") or item.include?(".svn") or
19
+ # item == "install.rb" or item =~ /~$/ or
20
+ # item =~ /gem(?:spec)?$/
21
+ # end
22
+ #
23
+ # s.author = %q{Austin Ziegler (Nathan Herald additions)}
24
+ # s.email = %q{austin@rubyforge.org (myobie@gmail.com)}
25
+ # s.rubyforge_project = %q(mime-types)
26
+ # s.homepage = %q{http://mime-types.rubyforge.org/}
27
+ #
28
+ # description = []
29
+ # File.open("README") do |file|
30
+ # file.each do |line|
31
+ # line.chomp!
32
+ # break if line.empty?
33
+ # description << "#{line.gsub(/\[\d\]/, '')}"
34
+ # end
35
+ # end
36
+ # s.description = description[1..-1].join(" ")
37
+ # end
38
+
39
+
40
+ Gem::Specification.new do |s|
41
+ s.name = "mime-types"
42
+ s.version = "1.15.1"
43
+ # s.date = "2008-11-07"
44
+ s.summary = "Manages a MIME Content-Type that will return the Content-Type for a given filename."
45
+ s.email = "austin@rubyforge.org"
46
+ s.homepage = "http://mime-types.rubyforge.org/"
47
+ s.description = "See README"
48
+ s.has_rdoc = true
49
+
50
+ s.authors = ["Austin Ziegler", "Nathan Herald"]
51
+
52
+ s.files = ["bin/**/*",
53
+ "lib/**/*",
54
+ "tests/**/*",
55
+ "ChangeLog",
56
+ "README",
57
+ "LICENCE",
58
+ "setup.rb",
59
+ "Rakefile",
60
+ "mime-types.gemspec",
61
+ "pre-setup.rb"]
62
+
63
+ s.test_files = ["test/tc_mime_type.rb",
64
+ "test/tc_mime_type.rb",
65
+ "text/testall.rb"]
66
+
67
+ s.require_paths = ["lib"]
68
+
69
+ s.rdoc_options = %w(--title MIME::Types --main README --line-numbers)
70
+ s.extra_rdoc_files = ["Install", "ChangeLog", "README"]
71
+
72
+ s.add_dependency("diff-lcs", ["> 0.0.0"])
73
+ s.add_dependency("mime-types", ["> 0.0.0"])
74
+ s.add_dependency("open4", ["> 0.0.0"])
75
+ end
data/pre-setup.rb ADDED
@@ -0,0 +1,46 @@
1
+ require 'rdoc/rdoc'
2
+ ##
3
+ # Build the rdoc documentation. Also, try to build the RI documentation.
4
+ #
5
+ def build_rdoc(options)
6
+ RDoc::RDoc.new.document(options)
7
+ rescue RDoc::RDocError => e
8
+ $stderr.puts e.message
9
+ rescue Exception => e
10
+ $stderr.puts "Couldn't build RDoc documentation\n#{e.message}"
11
+ end
12
+
13
+ def build_ri(files)
14
+ RDoc::RDoc.new(["--ri-site", "--merge"] + files)
15
+ rescue RDoc::RDocError => e
16
+ $stderr.puts e.message
17
+ rescue Exception => e
18
+ $stderr.puts "Couldn't build Ri documentation\n#{e.message}"
19
+ end
20
+
21
+ def run_tests(test_list)
22
+ return if test_list.empty?
23
+
24
+ require 'test/unit/ui/console/testrunner'
25
+ $:.unshift "lib"
26
+ test_list.each do |test|
27
+ next if File.directory?(test)
28
+ require test
29
+ end
30
+
31
+ tests = []
32
+ ObjectSpace.each_object { |o| tests << o if o.kind_of?(Class) }
33
+ tests.delete_if { |o| !o.ancestors.include?(Test::Unit::TestCase) }
34
+ tests.delete_if { |o| o == Test::Unit::TestCase }
35
+
36
+ tests.each { |test| Test::Unit::UI::Console::TestRunner.run(test) }
37
+ $:.shift
38
+ end
39
+
40
+ rdoc = %w(--main README --line-numbers
41
+ --title MIME::Types)
42
+ ri = %w(--ri-site --merge)
43
+ dox = %w(README ChangeLog lib)
44
+ build_rdoc rdoc + dox
45
+ build_ri ri + dox
46
+ run_tests Dir["tests/**/*"]