@@ -5,6 +5,13 @@ RSpec::Core::RakeTask.new(:spec)
55
66task default : :spec
77
8+ # To avoid double "bundle exec" calls, e.g. bundle exec ... in bundle exec rake ...
9+ def bundle_exec ( command )
10+ Bundler . with_unbundled_env do
11+ sh "bundle exec #{ command } "
12+ end
13+ end
14+
815# We don't want to push tags to source control when releasing the gem
916Rake ::Task [ "release" ] . clear
1017
@@ -24,17 +31,19 @@ task :test_normal, [:skip_tag] do |_, args|
2431 rspec_opts = [ ]
2532 rspec_opts << "--tag '~#{ skip_tag } '" if skip_tag
2633
27- sh "bundle exec rspec --exclude-pattern 'spec/line/bot/line_bot_api_gem_spec.rb,spec/line/bot/line_bot_gem_spec.rb' #{ rspec_opts . join ( ' ' ) } "
34+ bundle_exec (
35+ "rspec --exclude-pattern 'spec/line/bot/line_bot_api_gem_spec.rb,spec/line/bot/line_bot_gem_spec.rb' #{ rspec_opts . join ( ' ' ) } "
36+ )
2837end
2938
3039desc "Test line-bot-api gem spec"
3140task :test_line_bot_api do
32- sh "bundle exec rspec --pattern 'spec/line/bot/line_bot_api_gem_spec.rb'"
41+ bundle_exec ( " rspec --pattern 'spec/line/bot/line_bot_api_gem_spec.rb'")
3342end
3443
3544desc "Test line/bot gem(?) spec"
3645task :test_line_bot do
37- sh "bundle exec rspec --pattern 'spec/line/bot/line_bot_gem_spec.rb'"
46+ bundle_exec ( " rspec --pattern 'spec/line/bot/line_bot_gem_spec.rb'")
3847end
3948
4049desc "Run all tests in separate processes"
4655
4756desc "Validate comment for YARD"
4857task :validate_yard_comment do
49- sh "bundle exec yard stats ./lib/line/bot/v2 --fail-on-warning"
58+ bundle_exec ( " yard stats ./lib/line/bot/v2 --fail-on-warning")
5059end
5160
5261desc "RBS type check"
5362task :rbs do
54- sh "bundle exec rbs collection install"
55- sh "bundle exec rbs -I sig validate"
63+ bundle_exec ( " rbs collection install")
64+ bundle_exec ( " rbs -I sig validate")
5665end
5766
5867desc "RBS type check (with steep)"
5968task :rbs_steep do
60- sh "bundle exec steep check"
69+ bundle_exec ( " steep check")
6170end
6271
6372desc "RBS type check (with test)"
8695
8796desc "Run rubocop"
8897task :rubocop do
89- sh "bundle exec rubocop"
98+ bundle_exec ( " rubocop")
9099end
91100
92101desc "Fix rubocop errors"
93102task :rubocop_fix do
94- sh "bundle exec rubocop -A"
103+ bundle_exec ( " rubocop -A")
95104end
96105
97106desc "Check buildable and its contents"
98107task :build_test do
99- sh "bundle exec rake build"
108+ bundle_exec ( " rake build")
100109 sh "tar -xvf pkg/line-bot-api-*.gem"
101110
102111 puts "<<Show the contents of the gem>>"
0 commit comments