Rakefile in mongo_mapper_ext-0.0.1 vs Rakefile in mongo_mapper_ext-0.1.0

- old
+ new

@@ -1,68 +1,66 @@ require 'rake' -require 'spec/rake/spectask' +require 'fileutils' +current_dir = File.expand_path(File.dirname(__FILE__)) +Dir.chdir current_dir -Dir.chdir File.dirname(__FILE__) +# # Specs +# +require 'spec/rake/spectask' + task :default => :spec Spec::Rake::SpecTask.new('spec') do |t| t.spec_files = FileList["spec/**/*_spec.rb"].select{|f| f !~ /\/_/} - t.libs = ['lib'].collect{|f| "#{File.dirname __FILE__}/#{f}"} + t.libs = ["#{current_dir}/lib"] end + +# # Gem +# require 'rake/clean' require 'rake/gempackagetask' -require 'fileutils' +gem_options = { + :name => "mongo_mapper_ext", + :version => "0.1.0", + :summary => "Extensions for MongoMapper", + :dependencies => %w(mongo_mapper) +} + +gem_name = gem_options[:name] spec = Gem::Specification.new do |s| - s.name = "mongo_mapper_ext" - s.version = "0.0.1" - s.summary = "Extensions for MongoMapper" - s.description = "Extensions for MongoMapper" - s.author = "Alexey Petrushin" - # s.email = "" - s.homepage = "http://github.com/alexeypetrushin/mongo_mapper_ext" + gem_options.delete(:dependencies).each{|d| s.add_dependency d} + gem_options.each{|k, v| s.send "#{k}=", v} - s.platform = Gem::Platform::RUBY - s.has_rdoc = true - # s.extra_rdoc_files = ["README.rdoc"] - - # s.files = (%w{rakefile readme.md .gitignore} + Dir.glob("{app,lib,spec,.git}/**/*")) - s.files = (['Rakefile', 'readme.md'] + Dir.glob("{lib,spec}/**/*")) - - s.require_paths = ["lib"] - - warn 'uncomment ruby_ext' - [ - # 'ruby_ext', - 'mongo_mapper', - ].each{|name| s.add_dependency(name)} - + s.name = gem_name + s.author = "Alexey Petrushin" + s.homepage = "http://github.com/alexeypetrushin/#{gem_options[:name]}" + s.require_path = "lib" + s.files = (%w{Rakefile readme.md} + Dir.glob("{lib,spec}/**/*")) + + s.platform = Gem::Platform::RUBY + s.has_rdoc = true end -PACKAGE_DIR = "#{File.expand_path File.dirname(__FILE__)}/build" - +package_dir = "#{current_dir}/build" Rake::GemPackageTask.new(spec) do |p| - package_dir = PACKAGE_DIR -# FileUtils.mkdir package_dir unless File.exist? package_dir - p.need_tar = true if RUBY_PLATFORM !~ /mswin/ - p.need_zip = true - p.package_dir = package_dir + p.need_tar = true if RUBY_PLATFORM !~ /mswin/ + p.need_zip = true + p.package_dir = package_dir end -# CLEAN.include [ 'pkg', '*.gem'] - task :push do - dir = Dir.chdir PACKAGE_DIR do - gem_file = Dir.glob("mongo_mapper_ext*.gem").first - system "gem push #{gem_file}" - end + # dir = Dir.chdir package_dir do + gem_file = Dir.glob("#{package_dir}/#{gem_name}*.gem").first + system "gem push #{gem_file}" + # end end task :clean do - system "rm -r #{PACKAGE_DIR}" + system "rm -r #{package_dir}" end task :release => [:gem, :push, :clean] \ No newline at end of file