Rakefile in in_threads-0.0.1 vs Rakefile in in_threads-0.0.2

- old
+ new

@@ -1,20 +1,28 @@ -require 'rubygems' -require 'rake' -require 'rake/clean' -require 'fileutils' -require 'echoe' +begin + require 'jeweler' -version = YAML.load_file(File.join(File.dirname(__FILE__), 'VERSION.yml')).join('.') rescue nil + name = 'in_threads' + summary = 'Execute ruby blocks in parallel' -echoe = Echoe.new('in_threads', version) do |p| - p.author = 'toy' - p.summary = 'Execute ruby code in parallel.' - p.project = 'toytoy' -end + jewel = Jeweler::Tasks.new do |j| + j.name = name + j.summary = summary + j.homepage = "http://github.com/toy/#{name}" + j.authors = ["Boba Fat"] + end -desc "Replace system gem with symlink to this folder" -task :ghost do - path = Gem.searcher.find(echoe.name).full_gem_path - system 'sudo', 'rm', '-r', path - symlink File.expand_path('.'), path + Jeweler::GemcutterTasks.new + + require 'pathname' + desc "Replace system gem with symlink to this folder" + task 'ghost' do + gem_path = Pathname(Gem.searcher.find(name).full_gem_path) + current_path = Pathname('.').expand_path + cmd = gem_path.writable? && gem_path.parent.writable? ? %w() : %w(sudo) + system(*cmd + %W[rm -r #{gem_path}]) + system(*cmd + %W[ln -s #{current_path} #{gem_path}]) + end + +rescue LoadError + puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler" end