Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 34 lines (29 sloc) 1.488 kb
9084398 @saberma init rails.
saberma authored
1 # Add your own tasks in files placed in lib/tasks ending in .rake,
2 # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
4 require File.expand_path('../config/application', __FILE__)
5 require 'rake'
6
6fd77b1 @saberma add resque rake.
saberma authored
7 require 'resque/tasks'
06c526c @saberma move index operation to resque job.
saberma authored
8 require 'resque_scheduler/tasks'
f9dfb48 @saberma generate theme archieve file. #149.
saberma authored
9 task "resque:setup" => :environment do
10 Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection } # 第二次执行resque任务时失败 PGError: ERROR: prepared statement "a3" already exists 参考 http://j.mp/rpVqhc http://j.mp/rqj9CQ ;Rails已经打了补丁,未发布版本 http://j.mp/ntPQMr
11 end
6fd77b1 @saberma add resque rake.
saberma authored
12
ed2965d @saberma try to use travis xvfb 2.
saberma authored
13 task :travis do
aa486a7 @saberma use concurrent test.
saberma authored
14 unit_test = ENV['UNIT_TEST']
15 integrate_test = ENV['INTEGRATE_TEST']
16 all_files = Dir.chdir(Rails.root) { Dir["spec/**/*_spec.rb"]}
17 integrate_files = Dir.chdir(Rails.root) { Dir["spec/requests/**/*_spec.rb"]}
16a044f @saberma fixed integrate test error.
saberma authored
18 %w(shop/shops_searches_spec.rb lookup_spec.rb).each do |searchable_spec|
19 integrate_files.delete "spec/requests/#{searchable_spec}" # 需要solr才能运行
20 end
aa486a7 @saberma use concurrent test.
saberma authored
21 files = if unit_test # 3个并发
22 unit_files = all_files - integrate_files
23 unit_files.in_groups(3)[unit_test.to_i-1].join(' ')
24 elsif integrate_test # 4个并发
25 integrate_files.in_groups(4)[integrate_test.to_i-1].join(' ')
e430859 @saberma split unit and integrate test in travis.
saberma authored
26 end
aa486a7 @saberma use concurrent test.
saberma authored
27 cmd = "rspec #{files}"
e430859 @saberma split unit and integrate test in travis.
saberma authored
28 puts "Starting to run #{cmd}..."
29 system("export DISPLAY=:99.0 && bundle exec #{cmd}")
30 raise "#{cmd} failed!" unless $?.exitstatus == 0
ed2965d @saberma try to use travis xvfb 2.
saberma authored
31 end
32
6fd77b1 @saberma add resque rake.
saberma authored
33 Shopqi::Application.load_tasks
Something went wrong with that request. Please try again.