root/lang/ruby/rdoc/generators/template/html/resh/gem/Rakefile @ 428

Revision 428, 3.8 kB (checked in by cho45, 7 years ago)

lang/ruby/module-pluggable/Rakefile,
lang/ruby/cutagem/Rakefile,
lang/ruby/safeeval/Rakefile,
lang/ruby/rdoc/generators/template/html/resh/gem/Rakefile:

じぶんのところの gem source に必ずあぷろどするように。

Line 
1require 'rubygems'
2require 'rake'
3require 'rake/clean'
4require 'rake/testtask'
5require 'rake/packagetask'
6require 'rake/gempackagetask'
7require 'rake/rdoctask'
8require 'rake/contrib/rubyforgepublisher'
9require 'fileutils'
10include FileUtils
11
12NAME = "resh"
13AUTHOR = "cho45"
14EMAIL = "cho45@lowreal.net"
15DESCRIPTION = "A RDoc template."
16RUBYFORGE_PROJECT = "lowreal"
17HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org/#{NAME}/"
18BIN_FILES = %w(  )
19VERS = "0.0.1"
20
21REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
22CLEAN.include ['**/.*.sw?', '*.gem', '.config']
23CLOBBER.include ['lib/rdoc/generators/template/html/resh/*']
24RDOC_OPTS = ['--title', "#{NAME} documentation",
25        "--charset", "utf-8",
26        "--opname", "index.html",
27        "--line-numbers",
28        "--main", "README",
29        "--inline-source",
30]
31
32desc "Packages up #{NAME} gem."
33task :default => [:test]
34task :package => [:clean]
35
36Rake::TestTask.new("test") { |t|
37        t.libs << "test"
38        t.pattern = "test/**/*_test.rb"
39        t.verbose = true
40}
41
42spec = Gem::Specification.new do |s|
43        s.name              = NAME
44        s.version           = VERS
45        s.platform          = Gem::Platform::RUBY
46        s.has_rdoc          = true
47        s.extra_rdoc_files  = ["README", "ChangeLog"]
48        s.rdoc_options     += RDOC_OPTS + ['--exclude', '^(examples|extras)/']
49        s.summary           = DESCRIPTION
50        s.description       = DESCRIPTION
51        s.author            = AUTHOR
52        s.email             = EMAIL
53        s.homepage          = HOMEPATH
54        s.executables       = BIN_FILES
55        s.rubyforge_project = RUBYFORGE_PROJECT
56        s.bindir            = "bin"
57        s.require_path      = "lib"
58        s.autorequire       = "rdoc/generators/template/html/resh"
59        s.test_files        = Dir["test/test_*.rb"]
60
61        #s.add_dependency('activesupport', '>=1.3.1')
62        #s.required_ruby_version = '>= 1.8.2'
63
64        files = Dir["../*"]
65        files.delete("../#{File.basename(Dir.pwd)}")
66        FileUtils.cp_r files, "lib/rdoc/generators/template/html/resh/", :verbose => true
67        s.files = %w(README ChangeLog Rakefile) +
68                Dir.glob("{bin,doc,test,lib,templates,generator,extras,website,script}/**/*") +
69                Dir.glob("ext/**/*.{h,c,rb}") +
70                Dir.glob("examples/**/*.rb") +
71                Dir.glob("tools/*.rb")
72
73        s.extensions = FileList["ext/**/extconf.rb"].to_a
74end
75
76Rake::GemPackageTask.new(spec) do |p|
77        p.need_tar = true
78        p.gem_spec = spec
79end
80
81task :install do
82        name = "#{NAME}-#{VERS}.gem"
83        sh %{rake package}
84        sh %{sudo gem install pkg/#{name}}
85end
86
87task :uninstall => [:clean] do
88        sh %{sudo gem uninstall #{NAME}}
89end
90
91
92Rake::RDocTask.new do |rdoc|
93        rdoc.rdoc_dir = 'html'
94        rdoc.options += RDOC_OPTS
95        rdoc.template = "#{ENV["HOME"]}/coderepos/lang/ruby/rdoc/generators/template/html/resh/resh.rb"
96        #rdoc.template = "#{ENV['template']}.rb" if ENV['template']
97        if ENV['DOC_FILES']
98                rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
99        else
100                rdoc.rdoc_files.include('README', 'ChangeLog')
101                rdoc.rdoc_files.include('lib/**/*.rb')
102                rdoc.rdoc_files.include('ext/**/*.c')
103        end
104end
105
106desc "Publish to RubyForge"
107task :rubyforge => [:rdoc, :package] do
108        SshDirPublisher.new(
109                "cho45@rubyforge.org",
110                "/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/#{NAME}",
111                "html"
112        ).upload
113end
114
115desc 'Package and upload the release to rubyforge.'
116task :release => [:clean, :package, :release_local] do |t|
117        v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
118        abort "Versions don't match #{v} vs #{VERS}" unless v == VERS
119        pkg = "pkg/#{NAME}-#{VERS}"
120
121        rf = RubyForge.new
122        puts "Logging in"
123        rf.login
124
125        c = rf.userconfig
126#       c["release_notes"] = description if description
127#       c["release_changes"] = changes if changes
128        c["preformatted"] = true
129
130        files = [
131                "#{pkg}.tgz",
132                "#{pkg}.gem"
133        ].compact
134
135        puts "Releasing #{NAME} v. #{VERS}"
136        rf.add_release RUBYFORGE_PROJECT, NAME, VERS, *files
137end
138
139desc "Package and upload the release to local gem repos."
140task :release_local => [:clean, :package] do |t|
141        name = "#{NAME}-#{VERS}.gem"
142        sh %{scp pkg/#{name} c:/srv/www/lab.lowreal.net/public/gems/gems}
143end
Note: See TracBrowser for help on using the browser.