Sha256: 0e571c007ee88110aba954ecb6ab083b05afbfb083b24bb6e64a350c6c01275e
Contents?: true
Size: 1.41 KB
Versions: 2
Compression:
Stored size: 1.41 KB
Contents
require 'rake' require 'fileutils' # # Spec # begin require 'rspec/core/rake_task' task :default => :spec RSpec::Core::RakeTask.new('spec') do |t| t.pattern = "spec/**/[^_]*_spec.rb" end namespace :spec do desc "Run RSpec code exapmples in isolated mode (every spec file in another Ruby process)" task :isolated do Dir.glob("spec/**/[^_]*_spec.rb").each do |spec_file| Kernel.system "rspec #{spec_file}" end end end rescue LoadError task :default do puts "default rake task is :rspec but there's no rspec gem installed, install it first" end end # # project_dir # PROJECT_DIR = ( caller.find{|line| line =~ /\/Rakefile\:/} || raise("You can include the '' file only in Rakefile!") ).sub(/\/Rakefile\:.*/, '') def project_dir PROJECT_DIR end # # before & after task # 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 # # project # def project options = nil if options @options = {} options.each{|k, v| @options[k.to_sym] = v} @options[:name] || raise("project name not defined") require 'rake_ext/project' end @options || raise("project not defined!") end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby_ext-0.4.10 | lib/rake_ext.rb |
ruby_ext-0.4.9 | lib/rake_ext.rb |