Top Level Namespace
Defined Under Namespace
Classes: GithubReleaseParty
Instance Method Summary
collapse
Instance Method Details
#fly_deploy(args = []) ⇒ Object
5
6
7
8
9
|
# File 'lib/github-release-party/tasks/fly.rb', line 5
def fly_deploy(args=[])
cmd = %w[fly deploy] + args
puts "Executing: #{cmd.join(" ")}"
return system(*cmd)
end
|
#fly_releases ⇒ Object
11
12
13
14
15
16
17
18
19
|
# File 'lib/github-release-party/tasks/fly.rb', line 11
def fly_releases()
data = `fly releases --json`
abort unless $?.success?
return JSON.parse(data)
rescue => err
puts "There was a problem getting the release number."
puts "The error was: #{err.message}"
abort
end
|
#github_tag(hash, ver) ⇒ Object
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
|
# File 'lib/github-release-party/tasks/fly.rb', line 21
def github_tag(hash, ver)
repo = GithubReleaseParty.repo
tag_name = "fly/#{ver}"
last_tag = `git describe --tags --abbrev=0 --match 'fly/v*' 2> /dev/null`.strip
if last_tag.empty?
last_tag = `git rev-list --max-parents=0 HEAD`.strip[0..6]
first_deploy = true
end
commits = `git log #{last_tag}..#{hash} --reverse --first-parent --pretty=format:"- [%s](https://github.com/#{repo}/commit/%H)"`
message = "Deploy #{hash[0..6]}\n\nDiff: https://github.com/#{repo}/compare/#{last_tag}...#{tag_name}\n#{commits}"
if first_deploy
message = "#{message.strip}\n"+`git show #{last_tag} -s --pretty=format:"- [%s](https://github.com/#{repo}/commit/%H)"`
end
puts
puts "Tagging #{tag_name}."
success = system "git tag -a -m #{Shellwords.shellescape(message)} #{tag_name} #{hash}"
puts "Ignoring error." unless success
puts
success = system "git push origin #{tag_name}"
puts "Ignoring error." unless success
puts
puts "Waiting 3 seconds to let GitHub process the new tag."
sleep(3)
GithubReleaseParty.create(tag_name, message)
end
|
#heroku_push(args = []) ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/github-release-party/tasks/heroku.rb', line 5
def heroku_push(args=[])
cmd = %w[git push heroku HEAD:master] + args
puts "Executing: #{cmd.join(" ")}"
ver = Open3.popen2e(*cmd) do |stdin, output, thread|
v = nil
output.each do |line|
puts line
if /Released (v\d+)/ =~ line
v = $~[1]
end
end
v
end
return ver
end
|