relsr 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/relsr/initializer.rb +30 -9
- data/lib/relsr/release_manager.rb +13 -8
- data/lib/relsr/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e42a687376bdf3e930c6ec27635cfe87aa755e1
|
4
|
+
data.tar.gz: 0916625438359e56c7f8b228027f9503dde072d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b748307bb79ee8843db68b6ffcebb4bb2b5eb8656919b5a4f478dde1274e7f462491800a4d384a08acd1d91798f1f3266eef68e64ed9766bf39b0022338d268f
|
7
|
+
data.tar.gz: 8c74b26cac6ee86f629cb8807c6c32c03ffd97640303b7ee679477c72752287f034d53ed07b3bede4f44bc731d363944d23f76524991af9d3835440c64339bd2
|
data/lib/relsr/initializer.rb
CHANGED
@@ -15,27 +15,39 @@ module Relsr
|
|
15
15
|
private
|
16
16
|
|
17
17
|
def self.parse_options
|
18
|
-
@options = {
|
18
|
+
@options = {
|
19
|
+
dry_run: false,
|
20
|
+
extra_branches: []
|
21
|
+
}
|
19
22
|
OptionParser.new do |opts|
|
20
23
|
opts.banner = "Usage: relsr [options]"
|
21
24
|
|
22
|
-
opts.on("-r", "--release", "Create a release branch and open a pull request") do
|
23
|
-
@options[:
|
25
|
+
opts.on("-r", "--release", "Create a release branch and open a pull request") do
|
26
|
+
@options[:release_branch] = true
|
24
27
|
@options[:pull_request] = true
|
25
28
|
end
|
26
29
|
|
27
|
-
opts.on("-b", "--branch", "Create a release branch only") do
|
28
|
-
@options[:
|
30
|
+
opts.on("-b", "--branch", "Create a release branch only") do
|
31
|
+
@options[:release_branch] = true
|
32
|
+
end
|
33
|
+
|
34
|
+
opts.on("-a", "--add BRANCH", "Add a branch to the release") do |v|
|
35
|
+
@options[:extra_branches] << v
|
29
36
|
end
|
30
37
|
|
31
|
-
opts.on("-d", "--dry-run", "Dry run") do
|
38
|
+
opts.on("-d", "--dry-run", "Dry run") do
|
32
39
|
@options[:dry_run] = true
|
33
40
|
end
|
34
41
|
|
35
|
-
opts.on("-i", "--init", "Create #{YAML_FILE} for project") do
|
42
|
+
opts.on("-i", "--init", "Create #{YAML_FILE} for project in the current folder") do
|
36
43
|
create_default_yaml
|
37
44
|
exit 0
|
38
45
|
end
|
46
|
+
|
47
|
+
opts.on("-v", "--version", "Get version information") do
|
48
|
+
version_info
|
49
|
+
exit 0
|
50
|
+
end
|
39
51
|
end.parse!
|
40
52
|
end
|
41
53
|
|
@@ -58,8 +70,13 @@ module Relsr
|
|
58
70
|
end
|
59
71
|
|
60
72
|
def self.process
|
61
|
-
manager = Relsr::ReleaseManager.new(
|
62
|
-
|
73
|
+
manager = Relsr::ReleaseManager.new(
|
74
|
+
repo_name: @repo,
|
75
|
+
label: @label,
|
76
|
+
dry_run: @options[:dry_run],
|
77
|
+
extra_branches: @options[:extra_branches]
|
78
|
+
)
|
79
|
+
manager.create_release_branch if @options[:release_branch]
|
63
80
|
manager.create_pull_request if @options[:pull_request]
|
64
81
|
end
|
65
82
|
|
@@ -70,6 +87,10 @@ module Relsr
|
|
70
87
|
}
|
71
88
|
File.open(YAML_FILE, 'w') {|f| f.write content.to_yaml }
|
72
89
|
end
|
90
|
+
|
91
|
+
def self.version_info
|
92
|
+
puts "Relsr version #{Relsr::VERSION}"
|
93
|
+
end
|
73
94
|
end
|
74
95
|
|
75
96
|
end
|
@@ -4,16 +4,17 @@ require 'colorize'
|
|
4
4
|
module Relsr
|
5
5
|
class ReleaseManager
|
6
6
|
|
7
|
-
def initialize(repo_name
|
7
|
+
def initialize(repo_name:, label:, extra_branches: [], dry_run: false)
|
8
8
|
@repo_name = repo_name
|
9
9
|
@label = label
|
10
10
|
@release_branch_name = Time.now.strftime('release/%Y%m%d-%H%M%S')
|
11
11
|
@dry_run = dry_run
|
12
|
+
@extra_branches = extra_branches
|
12
13
|
Octokit.auto_paginate = true
|
13
14
|
end
|
14
15
|
|
15
|
-
def
|
16
|
-
|
16
|
+
def create_release_branch
|
17
|
+
initialize_release_branch
|
17
18
|
merge_work_branches
|
18
19
|
end
|
19
20
|
|
@@ -27,14 +28,13 @@ module Relsr
|
|
27
28
|
@release_branch_name,
|
28
29
|
pr_body
|
29
30
|
)
|
30
|
-
|
31
31
|
end
|
32
32
|
puts 'done'.green
|
33
33
|
end
|
34
34
|
|
35
35
|
private
|
36
36
|
|
37
|
-
def
|
37
|
+
def initialize_release_branch
|
38
38
|
print_and_flush "Creating release branch '#{@release_branch_name}' on '#{@repo_name}'..."
|
39
39
|
unless @dry_run
|
40
40
|
client.create_ref(@repo_name, "heads/#{@release_branch_name}", master.object.sha)
|
@@ -79,7 +79,7 @@ module Relsr
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
end
|
82
|
-
branches_to_merge
|
82
|
+
branches_to_merge + @extra_branches
|
83
83
|
end
|
84
84
|
|
85
85
|
def master
|
@@ -91,9 +91,14 @@ module Relsr
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def pr_body
|
94
|
-
issues.collect do |issue|
|
94
|
+
messages = issues.collect do |issue|
|
95
95
|
"Connects ##{issue.number} - #{issue.title}"
|
96
|
-
end
|
96
|
+
end
|
97
|
+
messages += @extra_branches.collect do |branch|
|
98
|
+
"Merging in additional branch '#{branch}'"
|
99
|
+
end
|
100
|
+
|
101
|
+
messages.join("\n")
|
97
102
|
end
|
98
103
|
|
99
104
|
def print_and_flush(msg)
|
data/lib/relsr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: relsr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Cleary
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|