Skip to content
This repository
Newer
Older
100644 52 lines (47 sloc) 1.15 kb
4ab38af8 »
2009-11-06 [gem_template] First commit
1 require 'rubygems'
2 require 'rake'
3 require 'rake/gempackagetask'
4 require 'spec/rake/spectask'
5 require 'gemspec'
6
7 desc "Generate gemspec"
8 task :gemspec do
9 File.open("#{Dir.pwd}/#{GEM_NAME}.gemspec", 'w') do |f|
10 f.write(GEM_SPEC.to_ruby)
11 end
12 end
13
14 desc "Install gem"
15 task :install do
16 Rake::Task['gem'].invoke
17 `sudo gem uninstall #{GEM_NAME} -x`
18 `sudo gem install pkg/#{GEM_NAME}*.gem`
19 `rm -Rf pkg`
20 end
21
22 desc "Package gem"
23 Rake::GemPackageTask.new(GEM_SPEC) do |pkg|
24 pkg.gem_spec = GEM_SPEC
25 end
26
085cb142 »
2009-11-09 [gem_template] Updating README
27 desc "Rename project"
28 task :rename do
29 name = ENV['NAME'] || File.basename(Dir.pwd)
4ab38af8 »
2009-11-06 [gem_template] First commit
30 begin
31 dir = Dir['**/gem_template*']
32 from = dir.pop
33 if from
34 rb = from.include?('.rb')
35 to = File.dirname(from) + "/#{name}#{'.rb' if rb}"
36 FileUtils.mv(from, to)
37 end
38 end while dir.length > 0
39 Dir["**/*"].each do |path|
40 next if path.include?('Rakefile')
41 if File.file?(path)
42 `sed -i "" 's/gem_template/#{name}/g' #{path}`
43 end
44 end
45 end
46
47 desc "Run specs"
48 Spec::Rake::SpecTask.new do |t|
49 t.rcov = true
50 t.spec_opts = ["--format", "specdoc", "--colour"]
51 t.spec_files = FileList["spec/**/*_spec.rb"]
52 end
Something went wrong with that request. Please try again.