Skip to content

Commit e9d4914

Browse files
committed
chore: refactor rake task duplication
1 parent 470fc2e commit e9d4914

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

Rakefile

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,29 @@ def specs(dir)
44
FileList["spec/#{dir}/*_spec.rb"].shuffle.join(' ')
55
end
66

7+
def setup_project(pod_install = false)
8+
system('bundle install', exception: true)
9+
Bundler.with_unbundled_env do
10+
Dir.chdir('example/ios_app') do |path|
11+
system('bundle install', exception: true)
12+
system('bundle exec pod install', exception: true) if pod_install
13+
end
14+
end
15+
end
16+
717
desc 'Runs all the specs'
818
task :specs do
919
sh "bundle exec bacon #{specs('**')}"
1020
end
1121

1222
desc 'Setup example project'
1323
task :demo do
14-
system('bundle install', exception: true)
15-
Bundler.with_unbundled_env do
16-
Dir.chdir('example/ios_app') do |path|
17-
system('bundle install', exception: true)
18-
system('bundle exec pod install', exception: true)
19-
end
20-
end
24+
setup_project(true)
2125
end
2226

2327
desc 'Update lock files'
2428
task :update do
25-
system('bundle install', exception: true)
26-
Bundler.with_unbundled_env do
27-
Dir.chdir('example/ios_app') do |path|
28-
system('bundle install', exception: true)
29-
end
30-
end
29+
setup_project
3130
end
3231

3332
desc 'Publish to cocoapods plugins if not present'

0 commit comments

Comments
 (0)