-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
61 lines (50 loc) · 1.55 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
# frozen_string_literal: true
require 'bundler/gem_tasks'
require 'rake/testtask'
require 'rubocop/rake_task'
require_relative 'lib/fastlane-ext/version'
task default: 'test'
Rake::TestTask.new do |t|
t.libs << 'test'
t.test_files = FileList['test/fastlane-ext/*_test.rb']
t.warning = false
end
RuboCop::RakeTask.new(:lint) do |t|
t.options = %w[--display-cop-names]
end
desc 'deploy if there are no stoppers'
task :deploy_if_needed do
tags = `git tag`.lines.map(&:strip)
last_commit_msg = `git log -1 --pretty=%B`
version = FastlaneExt::VERSION
stop_keywords = ['STOP', 'WIP', 'WAIT', version]
exit(0) if stop_keywords.any? { |k| last_commit_msg.include?(k) }
exit(0) if tags.include?(version)
Rake::Task['deploy'].execute
end
desc 'auto-deploy'
task :deploy do
%w[push_gem add_tag bump_version push_branch].each do |t|
Rake::Task[t].execute
end
end
desc 'bump version'
task :bump_version do
cmd = 'gem bump --version patch --commit'
raise "Version bumping failed! Command execution error: '#{cmd}'" unless system(cmd)
end
desc 'add tag to the latest commit'
task :add_tag do
cmd = "git tag #{FastlaneExt::VERSION}"
raise "Tag creation failed! Command execution error: '#{cmd}'" unless system(cmd)
end
desc 'push repo to github'
task :push_branch do
cmd = 'git push origin HEAD:master --tags'
raise "Pushing failed! Command execution error: '#{cmd}'" unless system(cmd)
end
desc 'push gem to rubygems.org'
task :push_gem do
cmd = 'gem release'
raise "Release failed! Command execution error: '#{cmd}'" unless system(cmd)
end