root/lang/ruby/safeeval/Rakefile @ 2163

Revision 428, 3.7 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
12AUTHOR = "cho45"
13EMAIL = "cho45@lowreal.net"
14DESCRIPTION = "More safe eval codes."
15RUBYFORGE_PROJECT = "safeeval"
16HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
17BIN_FILES = %w(  )
18VERS = "0.0.1"
19
20
21NAME = "safeeval"
22REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
23CLEAN.include ['**/.*.sw?', '*.gem', '.config']
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 = "safe_eval"
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        s.files = %w(README CHANGELOG Rakefile) +
65                Dir.glob("{bin,doc,test,lib,templates,generator,extras,website,script}/**/*") +
66                Dir.glob("ext/**/*.{h,c,rb}") +
67                Dir.glob("examples/**/*.rb") +
68                Dir.glob("tools/*.rb")
69
70        s.extensions = FileList["ext/**/extconf.rb"].to_a
71end
72
73Rake::GemPackageTask.new(spec) do |p|
74        p.need_tar = true
75        p.gem_spec = spec
76end
77
78task :install do
79        name = "#{NAME}-#{VERS}.gem"
80        sh %{rake package}
81        sh %{sudo gem install pkg/#{name}}
82end
83
84task :uninstall => [:clean] do
85        sh %{sudo gem uninstall #{NAME}}
86end
87
88
89Rake::RDocTask.new do |rdoc|
90        rdoc.rdoc_dir = 'html'
91        rdoc.options += RDOC_OPTS
92        rdoc.template = "#{ENV["HOME"]}/coderepos/lang/ruby/rdoc/generators/template/html/resh/resh.rb"
93        #rdoc.template = "#{ENV['template']}.rb" if ENV['template']
94        if ENV['DOC_FILES']
95                rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
96        else
97                rdoc.rdoc_files.include('README', 'CHANGELOG')
98                rdoc.rdoc_files.include('lib/**/*.rb')
99                rdoc.rdoc_files.include('ext/**/*.c')
100        end
101end
102
103desc "Publish to RubyForge"
104task :rubyforge => [:rdoc, :package] do
105        Rake::RubyForgePublisher.new(RUBYFORGE_PROJECT, 'cho45').upload
106end
107
108desc "Publish to lab"
109task :publab do
110        require 'rake/contrib/sshpublisher'
111
112        path = File.expand_path(File.dirname(__FILE__))
113
114        Rake::SshDirPublisher.new(
115                "cho45@lab.lowreal.net",
116                "/srv/www/lab.lowreal.net/public/site-ruby",
117                path + "/pkg"
118        ).upload
119end
120
121
122desc 'Package and upload the release to rubyforge.'
123task :release => [:clean, :package, :release_local] do |t|
124        v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
125        abort "Versions don't match #{v} vs #{VERS}" unless v == VERS
126        pkg = "pkg/#{NAME}-#{VERS}"
127
128        rf = RubyForge.new
129        puts "Logging in"
130        rf.login
131
132        c = rf.userconfig
133#       c["release_notes"] = description if description
134#       c["release_changes"] = changes if changes
135        c["preformatted"] = true
136
137        files = [
138                "#{pkg}.tgz",
139                "#{pkg}.gem"
140        ].compact
141
142        puts "Releasing #{NAME} v. #{VERS}"
143        rf.add_release RUBYFORGE_PROJECT, NAME, VERS, *files
144end
145
146desc "Package and upload the release to local gem repos."
147task :release_local => [:clean, :package] do |t|
148        name = "#{NAME}-#{VERS}.gem"
149        sh %{scp pkg/#{name} c:/srv/www/lab.lowreal.net/public/gems/gems}
150end
Note: See TracBrowser for help on using the browser.