-
Notifications
You must be signed in to change notification settings - Fork 38
/
.releasinator.rb
77 lines (60 loc) · 2.04 KB
/
.releasinator.rb
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
72
73
74
75
76
77
configatron.product_name = "test product"
require_relative './lib/paypalhttp/version'
# Custom validations
def get_package_version
VERSION
end
def validate_version_match
package_version = get_package_version
if package_version != @current_release.version
Printer.fail("package version #{package_version} does not match changelog version #{@current_release.version}.")
abort()
end
Printer.success("package version #{package_version} matches latest changelog version #{@current_release.version}.")
end
def test
CommandProcessor.command("bundle exec rspec", live_output=true)
end
def validate_present(tool, install_command)
tool_path = `which #{tool}`
if tool_path.rstrip == ""
Printer.fail("#{tool} not installed - please run `#{install_command}`")
abort()
else
Printer.success("#{tool} found at #{tool_path}")
end
end
def validate_bundle
validate_present("bundle", "gem install bundler")
end
configatron.custom_validation_methods = [
method(:validate_version_match),
method(:validate_bundle),
method(:test)
]
# Update version, build, and publish to rubygems
def update_version_method(version, semver_type)
File.open("lib/paypalhttp/version.rb", "w") do |f|
f << "VERSION = \"#{version}\"\n"
end
end
configatron.update_version_method = method(:update_version_method)
def clean
CommandProcessor.command("rm -f paypalhttp-*.gem")
end
def build_method
clean
CommandProcessor.command("gem build paypalhttp.gemspec", live_output=true)
end
configatron.build_method = method(:build_method)
def publish_to_package_manager(version)
CommandProcessor.command("gem push paypalhttp-#{version}.gem", live_outout=true)
end
configatron.publish_to_package_manager_method = method(:publish_to_package_manager)
def wait_for_package_manager(version)
CommandProcessor.wait_for("wget -qO- https://rubygems.org/gems/paypalhttp/versions/#{version} | cat")
end
configatron.wait_for_package_manager_method = method(:wait_for_package_manager)
# Miscellania
configatron.prerelease_checklist_items = []
configatron.release_to_github = true