1
0
Fork 0
mirror of https://github.com/omniauth/omniauth.git synced 2022-11-09 12:31:49 -05:00
omniauth--omniauth/Rakefile

53 lines
1.1 KiB
Text
Raw Normal View History

require 'bundler'
Bundler::GemHelper.install_tasks
2014-01-15 23:00:40 -05:00
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
2011-04-28 20:55:10 -04:00
task :test => :spec
2014-01-15 23:00:40 -05:00
begin
require 'rubocop/rake_task'
2014-06-03 13:52:08 -04:00
RuboCop::RakeTask.new
2014-01-15 23:00:40 -05:00
rescue LoadError
task :rubocop do
2014-06-03 13:52:08 -04:00
$stderr.puts 'RuboCop is disabled'
2014-01-15 23:00:40 -05:00
end
end
2017-09-28 13:07:45 -04:00
task :default => %i[spec rubocop]
namespace :perf do
task :setup do
require 'omniauth'
require 'rack/test'
app = Rack::Builder.new do |b|
b.use Rack::Session::Cookie, :secret => 'abc123'
b.use OmniAuth::Strategies::Developer
b.run lambda { |_env| [200, {}, ['Not Found']] }
end.to_app
@app = Rack::MockRequest.new(app)
def call_app(path = ENV['GET_PATH'] || '/')
result = @app.get(path)
2017-02-12 01:12:28 -05:00
raise "Did not succeed #{result.body}" unless result.status == 200
result
end
end
task :ips => :setup do
require 'benchmark/ips'
Benchmark.ips do |x|
x.report('ips') { call_app }
end
end
task :mem => :setup do
require 'memory_profiler'
num = Integer(ENV['CNT'] || 1)
report = MemoryProfiler.report do
num.times { call_app }
end
report.pretty_print
end
end