Sha256: 48af33b9179366b2155ac13494fbffbd19c8b3d1739605d6e215e22e6d6b83df
Contents?: true
Size: 1.6 KB
Versions: 1
Compression:
Stored size: 1.6 KB
Contents
require 'rake' require 'fileutils' # # Rake extensions # def before task_name, &block @task_counter ||= {} counter = (@task_counter[task_name] ||= 0) before_task_name = "#{task_name}_before_#{counter}" task before_task_name, &block task task_name => before_task_name @task_counter[task_name] += 1 end def after task_name, &block task task_name, &block end # # Spec # require 'rspec/core/rake_task' task :default => :spec RSpec::Core::RakeTask.new('spec') do |t| t.pattern = "spec/**/[^_]*_spec.rb" end # # Gem Spec, for sample look at Rakefile # def gem_spec options require 'rake/clean' require 'rake/gempackagetask' require 'tmpdir' spec = Gem::Specification.new do |s| (options.delete(:dependencies) || []).each{|d| s.add_dependency d} 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}/**/*")) # s.name = options[:name) # s.author = options[:author) # s.homepage = options[:homepage) options.each{|k, v| s.send "#{k}=", v} end package_dir = Dir.tmpdir 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}/#{options[:name]}*.gem").first system "gem push #{gem_file}" end task :clean do system "rm -r #{package_dir}" end task :release => [:gem, :push, :clean] end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby_ext-0.4.7 | lib/rake_ext.rb |