-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
71 lines (57 loc) · 1.49 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
require 'rake'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'yard'
require_relative 'lib/serpapi'
task :check do
if ENV['API_KEY']
puts 'check: found $API_KEY'
else
puts 'check: API_KEY must be defined'
exit 1
end
end
task readme: ['README.md.erb'] do
`erb -T '-' README.md.erb > README.md`
end
YARD::Rake::YardocTask.new(:doc) do |t|
t.files = ['lib/*/*.rb', 'README.md', 'LICENSE']
t.options = ['--markup=markdown']
t.stats_options = ['--list-undoc']
end
RSpec::Core::RakeTask.new(:test) do |t|
t.pattern = Dir.glob('test/*_spec.rb')
t.rspec_opts = '--format documentation'
end
RuboCop::RakeTask.new(:lint) do |t|
t.options = ['--display-cop-names']
end
task :dependency do
sh 'bundle install'
end
task :build do
sh 'gem build serpapi'
end
task :install do
sh "gem install ./serpapi-#{SerpApi::Client::VERSION}.gem"
end
task :demo do
sh 'ruby oobt/demo.rb'
end
task :version do
puts 'current version: ' + SerpApi::Client::VERSION
end
task :tag do
version = SerpApi::Client::VERSION
puts "create git tag #{version}"
sh "git tag #{version}"
puts "now publish the tag:\n$ git push origin #{version}"
end
task release: [:oobt] do
sh 'gem push `ls -t1 *.gem | head -1`'
puts 'release public on: https://rubygems.org/gems/serpapi/versions'
end
desc "run out of box testing using the gem file"
task oobt: %i[readme doc check build install demo]
desc "execute all the steps"
task default: %i[dependency version readme doc build test oobt]