forked from mime-types/mime-types-data
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
94 lines (75 loc) · 2.51 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# frozen_string_literal: true
require 'rubygems'
require 'hoe'
require 'rake/clean'
Hoe.plugin :doofus
Hoe.plugin :gemspec2
Hoe.plugin :git
Hoe.plugin :travis
Hoe.plugin :email unless ENV['CI'] or ENV['TRAVIS']
Hoe.spec 'mime-types-data' do
developer('Austin Ziegler', 'halostatue@gmail.com')
require_ruby_version '>= 2.0'
self.history_file = 'History.md'
self.readme_file = 'README.md'
license 'MIT'
extra_dev_deps << ['nokogiri', '~> 1.6']
extra_dev_deps << ['hoe-doofus', '~> 1.0']
extra_dev_deps << ['hoe-gemspec2', '~> 1.1']
extra_dev_deps << ['hoe-git', '~> 1.6']
extra_dev_deps << ['hoe-rubygems', '~> 1.0']
extra_dev_deps << ['rake', '~> 10.0']
extra_dev_deps << ['mime-types', '>= 3.2.1', '< 4']
end
$LOAD_PATH.unshift 'lib'
$LOAD_PATH.unshift 'support'
namespace :mime do
desc 'Download the current MIME type registrations from IANA.'
task :iana, [ :destination ] do |_, args|
require 'iana_registry'
IANARegistry.download(to: args.destination)
end
desc 'Download the current MIME type configuration from Apache.'
task :apache, [ :destination ] do |_, args|
require 'apache_mime_types'
ApacheMIMETypes.download(to: args.destination)
end
end
namespace :convert do
namespace :yaml do
desc 'Convert from YAML to JSON'
task :json, [ :source, :destination, :multiple_files ] => :support do |_, args|
require 'convert'
Convert.from_yaml_to_json(args)
end
desc 'Convert from YAML to Columnar'
task :columnar, [ :source, :destination ] => :support do |_, args|
require 'convert/columnar'
Convert::Columnar.from_yaml_to_columnar(args)
end
end
namespace :json do
desc 'Convert from JSON to YAML'
task :yaml, [ :source, :destination, :multiple_files ] => :support do |_, args|
require 'convert'
Convert.from_json_to_yaml(args)
end
end
end
namespace :update do
desc 'Update the release version'
task :version do
require 'mime/types'
major = Gem::Version.new(MIME::Types::VERSION).canonical_segments.first
minor = Date.today.strftime("%Y.%m%d")
file = IO.read('lib/mime/types/data.rb')
.sub(/VERSION = '[^']+'/, "VERSION = '#{major}.#{minor}'")
IO.write('lib/mime/types/data.rb', file)
end
end
desc 'Default conversion from YAML to JSON and Columnar'
task convert: [ 'convert:yaml:json', 'convert:yaml:columnar' ]
Rake::Task['gem'].prerequisites.unshift('convert')
Rake::Task['gem'].prerequisites.unshift('git:manifest')
Rake::Task['gem'].prerequisites.unshift('gemspec')
# vim: syntax=ruby