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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 573c8fedcc92906cd34469ffa7023636abf3e6b4
4
- data.tar.gz: ee9b2213e2fcd3373efa59f810615f60cbbf35f8
3
+ metadata.gz: 2e42a687376bdf3e930c6ec27635cfe87aa755e1
4
+ data.tar.gz: 0916625438359e56c7f8b228027f9503dde072d2
5
5
  SHA512:
6
- metadata.gz: be4e56435ddc5002ee418ea55416eee091227ec1ce8f194bce21557d0ce42dcec188ecab54e626e09647c5bac3c2afe7118ec0a41902171c8773a560e2740c78
7
- data.tar.gz: 13ed7e2e54734ddf2cccf46fd19d21863ba6631a048bd8f61a3c2279861e5d2c5aebd292e4b9a89bf4fc0efc2d2a3880b4d054030c03bde6ccdd8b99f4e3c86d
6
+ metadata.gz: b748307bb79ee8843db68b6ffcebb4bb2b5eb8656919b5a4f478dde1274e7f462491800a4d384a08acd1d91798f1f3266eef68e64ed9766bf39b0022338d268f
7
+ data.tar.gz: 8c74b26cac6ee86f629cb8807c6c32c03ffd97640303b7ee679477c72752287f034d53ed07b3bede4f44bc731d363944d23f76524991af9d3835440c64339bd2
@@ -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 |v|
23
- @options[:branch] = true
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 |v|
28
- @options[:branch] = true
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 |v|
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 |v|
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(@repo, @label, @options[:dry_run])
62
- manager.create_release if @options[:branch]
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, label, dry_run = false)
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 create_release
16
- create_release_branch
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 create_release_branch
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.join("\n")
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)
@@ -1,3 +1,3 @@
1
1
  module Relsr
2
- VERSION = '0.0.3'.freeze
2
+ VERSION = '0.0.4'.freeze
3
3
  end
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.3
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-05 00:00:00.000000000 Z
11
+ date: 2017-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit