Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 73 lines (61 sloc) 1.741 kb
efebcbe Winton Welsh Getting rid of bundler
authored
1 require File.dirname(__FILE__) + '/lib/gem_template/gems'
4ab38af Winton Welsh [gem_template] First commit
authored
2
eca33a4 Winton Welsh New system for specifying gem versions, gemspec info, activating gems
authored
3 GemTemplate::Gems.activate %w(rake rspec)
efebcbe Winton Welsh Getting rid of bundler
authored
4
5 require 'rake'
6 require 'rake/gempackagetask'
7 require 'spec/rake/spectask'
c542e7f Winton Welsh Using Bundler instead of Require
authored
8
9 def gemspec
10 @gemspec ||= begin
11 file = File.expand_path('../gem_template.gemspec', __FILE__)
12 eval(File.read(file), binding, file)
13 end
14 end
15
16 if defined?(Rake::GemPackageTask)
17 Rake::GemPackageTask.new(gemspec) do |pkg|
18 pkg.gem_spec = gemspec
19 end
20 task :gem => :gemspec
21 end
22
23 if defined?(Spec::Rake::SpecTask)
24 desc "Run specs"
25 Spec::Rake::SpecTask.new do |t|
26 t.spec_files = FileList['spec/**/*_spec.rb']
27 t.spec_opts = %w(-fs --color)
28 t.warning = true
29 end
30 task :spec
31 end
32
efebcbe Winton Welsh Getting rid of bundler
authored
33 namespace :gems do
3bcd4eb Winton Welsh Removing rake:rename in favor of putting it in separate gem, fixing rake...
authored
34 desc "Install gems (DEV=0 DOCS=0 GEMSPEC=default SUDO=0)"
efebcbe Winton Welsh Getting rid of bundler
authored
35 task :install do
3bcd4eb Winton Welsh Removing rake:rename in favor of putting it in separate gem, fixing rake...
authored
36 dev = ENV['DEV'] == '1'
37 docs = ENV['DOCS'] == '1' ? '' : '--no-ri --no-rdoc'
38 gemset = ENV['GEMSET']
39 sudo = ENV['SUDO'] == '1' ? 'sudo' : ''
efebcbe Winton Welsh Getting rid of bundler
authored
40
3bcd4eb Winton Welsh Removing rake:rename in favor of putting it in separate gem, fixing rake...
authored
41 GemTemplate::Gems.gemset = gemset if gemset
42
43 if dev
44 gems = GemTemplate::Gems.gemspec.development_dependencies
efebcbe Winton Welsh Getting rid of bundler
authored
45 else
3bcd4eb Winton Welsh Removing rake:rename in favor of putting it in separate gem, fixing rake...
authored
46 gems = GemTemplate::Gems.gemspec.dependencies
efebcbe Winton Welsh Getting rid of bundler
authored
47 end
48
3bcd4eb Winton Welsh Removing rake:rename in favor of putting it in separate gem, fixing rake...
authored
49 gems.each do |name|
50 name = name.to_s
51 version = GemTemplate::Gems.versions[name]
efebcbe Winton Welsh Getting rid of bundler
authored
52 if Gem.source_index.find_name(name, version).empty?
53 version = version ? "-v #{version}" : ''
54 system "#{sudo} gem install #{name} #{version} #{docs}"
55 else
56 puts "already installed: #{name} #{version}"
57 end
58 end
59 end
60 end
61
c542e7f Winton Welsh Using Bundler instead of Require
authored
62 desc "Validate the gemspec"
63 task :gemspec do
64 gemspec.validate
65 end
66
3bcd4eb Winton Welsh Removing rake:rename in favor of putting it in separate gem, fixing rake...
authored
67 desc "Install gem locally"
68 task :install => :package do
69 sh %{gem install pkg/#{gemspec.name}-#{gemspec.version}}
70 end
c542e7f Winton Welsh Using Bundler instead of Require
authored
71
3bcd4eb Winton Welsh Removing rake:rename in favor of putting it in separate gem, fixing rake...
authored
72 task :default => :spec
73 task :package => :gemspec
Something went wrong with that request. Please try again.