forked from square/cocoapods-generate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
50 lines (40 loc) · 1.33 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
# frozen_string_literal: true
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop/rake_task'
require 'inch_by_inch/rake_task'
RuboCop::RakeTask.new(:rubocop)
InchByInch::RakeTask.new(:inch)
namespace :spec do
RSpec::Core::RakeTask.new(:unit) do |t|
t.rspec_opts = %w[--format progress]
end
desc 'Run integration specs'
task :integration do
sh 'bundle', 'exec', 'bacon', 'spec/integration.rb', '-q'
end
namespace :integration do
desc 'Update integration spec fixtures'
task :update do
rm_rf 'spec/integration/tmp'
sh('bin/rake', 'spec:integration') {}
# Copy the files to the files produced by the specs to the after folders
FileList['spec/integration/tmp/*/transformed'].each do |source|
name = source.match(%r{tmp/([^/]+)/transformed$})[1]
destination = "spec/integration/#{name}/after"
rm_rf destination
mv source, destination
end
end
end
end
desc 'Update the cli usage in the readme'
task :readme do
contents = File.read('README.md')
cli_usage = `bin/cocoapods-gen --help`
contents.sub!(/(<!-- begin cli usage -->\n).+(\n<!-- end cli usage -->)/m, "\\1```\n#{cli_usage}```\\2")
File.write 'README.md', contents
end
desc 'Run all specs'
task spec: %w[spec:unit spec:integration]
task default: %w[spec rubocop inch readme]