lib/rake_ext/project.rb in ruby_ext-0.4.10 vs lib/rake_ext/project.rb in ruby_ext-0.4.11
- old
+ new
@@ -3,11 +3,11 @@
#
def parse_project_gemfile
required_gems = []
gem_file = "#{project_dir}/lib/#{project[:name]}/gems.rb"
if File.exist? gem_file
- puts "Parsing gemfile #{gem_file}"
+ # puts "Parsing gemfile #{gem_file}"
code = File.open(gem_file){|f| f.read}
stub_class = Class.new
stub_class.send(:define_method, :gem){|*args| required_gems << args}
@@ -45,10 +45,12 @@
gems = parse_project_gemfile
gems.each{|name_version| s.add_dependency *name_version}
options = project.clone
+ options.delete(:name)
+ s.name = options.delete(:gem_name)
s.platform = options.delete(:platform) || Gem::Platform::RUBY
s.has_rdoc = options.delete(:has_rdoc) == nil ? false : true
s.require_path = options.delete(:lib) || "lib"
s.files = options.delete(:files) || (%w{Rakefile readme.md} + Dir.glob("{lib,spec}/**/*"))
@@ -57,28 +59,28 @@
# s.homepage = options[:homepage)
options.each{|k, v| s.send "#{k}=", v}
end
- package_dir = Dir.tmpdir + "/#{project[:name]}_tmp"
+ package_dir = Dir.tmpdir + "/#{project[:gem_name]}_tmp"
Rake::GemPackageTask.new(spec) do |p|
p.need_tar = true if RUBY_PLATFORM !~ /mswin/
p.need_zip = true
p.package_dir = package_dir
end
task :push do
- gem_file = Dir.glob("#{package_dir}/#{project[:name]}*.gem").first
+ gem_file = Dir.glob("#{package_dir}/#{project[:gem_name]}*.gem").first
system "gem push #{gem_file}"
end
task :clean do
system "rm -r #{package_dir}"
end
desc "List all gems required by project"
task :list do
- puts "Gems required for #{project[:name]}:"
+ puts "Gems required for #{project[:gem_name]}:"
puts parse_project_gemfile
end
desc "Build and publish project as gem"
task :release => [:gem, :push, :clean]
\ No newline at end of file