-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
89 lines (73 loc) · 2.79 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
# Localized Rails scaffolding with style...
require 'rubygems'
require 'rake/gempackagetask'
require 'find'
spec = Gem::Specification.new do |spec|
files = []
['generators', 'lib', 'rails'].each { |dir|
Find.find(dir) { |path| files << path if not File.stat(path).directory? } }
files+= FileList['Gemfile', 'README.rdoc', '*.rb', 'test/*.rb'].to_a
spec.platform = Gem::Platform::RUBY
spec.name = 'localized_scaffold'
spec.homepage = 'http://github.com/ulbrich/localized_scaffold'
spec.version = '0.9.7'
spec.author = 'Jan Ulbrich'
spec.email = 'jan @nospam@ ulbrich.net'
spec.summary = 'Localized Rails scaffolding with style...'
spec.files = files
spec.require_path = '.'
spec.test_files = Dir.glob('test/*.rb')
spec.has_rdoc = true
spec.executables = []
spec.extra_rdoc_files = ['README.rdoc']
spec.rdoc_options << '--exclude' << 'init.rb' <<
'--exclude' << 'install.rb' << '--exclude' << 'uninstall.rb' <<
'--exclude' << 'pkg' << '--exclude' << 'generators/templates' <<
'--exclude' << 'test' <<
'--title' << '"Localized Scaffold"' << '--main' << 'README.rdoc'
end
Rake::GemPackageTask.new(spec) do |pkg|
pkg.need_tar = true
end
task :default => "pkg/#{spec.name}-#{spec.version}.gem" do
puts 'Generated latest version.'
end
desc 'Remove directories "pkg" and "doc"'
task :clean do
puts 'Remove directories "pkg" and "doc".'
`rm -rf pkg doc`
end
desc 'Create rdoc documentation from the code'
task :doc do
`rm -rf doc`
puts 'Create rdoc documentation from the code'
puts `(rdoc --exclude init.rb --exclude install.rb --exclude uninstall.rb \
--exclude pkg --exclude generators/templates --exclude test \
--all --title "Localized Scaffold" --main README.rdoc \
README.rdoc generators) 1>&2`
end
desc 'Update the localized_scaffold.gemspec file with new snapshot of files to bundle'
task :gemspecs do
puts 'Update the localized_scaffold.gemspec file with new snapshot of files to bundle.'
# !!Warning: We can't use spec.to_ruby as this generates executable code
# which would break Github gem generation...
template = <<EOF
# Localized Rails scaffolding with style...
Gem::Specification.new do |spec|
spec.platform = #{spec.platform.inspect}
spec.name = #{spec.name.inspect}
spec.homepage = #{spec.homepage.inspect}
spec.version = "#{spec.version}"
spec.author = #{spec.author.inspect}
spec.email = #{spec.email.inspect}
spec.summary = #{spec.summary.inspect}
spec.files = #{spec.files.inspect}
spec.require_path = #{spec.require_path.inspect}
spec.has_rdoc = #{spec.has_rdoc}
spec.executables = #{spec.executables.inspect}
spec.extra_rdoc_files = #{spec.extra_rdoc_files.inspect}
spec.rdoc_options = #{spec.rdoc_options.inspect}
end
EOF
File.open('localized_scaffold.gemspec', 'w').write(template)
end