root/lang/ruby/cutagem/Rakefile @ 2212

Revision 436, 3.7 kB (checked in by cho45, 7 years ago)

/lang/ruby/cutagem/Rakefile,
/lang/ruby/cutagem/lib/cutagem.rb,
/lang/ruby/cutagem/ChangeLog,
/lang/ruby/cutagem/templates/default/Rakefile,
/lang/ruby/cutagem/templates/command/Rakefile:

require とか修正

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