relsr 0.0.6 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 132462a91273419bb80a8fdca225340f7353725e
4
- data.tar.gz: c935c023cd2f96f42dd8b8b8848f89c03a73b2e6
3
+ metadata.gz: 5fc15a9dcc78084e7b4e749784f098d5d6d96242
4
+ data.tar.gz: 63fa55f3009e71ddf4c1ead1e8941eae29fe5413
5
5
  SHA512:
6
- metadata.gz: c3292732f062bae8201805cbf13e2dcb3ddcb33a5253ba9f27dc5e377649d615d2c256c790574a3f0410711ae23472107c5ef143437f91aca1bed6f6c0a948b6
7
- data.tar.gz: 83afbad677ee8b0ff062491caae6335ef7b1feef71f7313ddffeed8f93ff89fb1c64e4cd06145d956338ae7fbd4b62351f91edde924d3544376691778437d232
6
+ metadata.gz: 4af2d0fe967d399e89071f2c59b1ed062717c8bfb6d8e8e992f08ffd4934d2372a55abd59b2bd101d9b2b51ad257402b63c988313133e6af2c1765cc7dadf50f
7
+ data.tar.gz: f41019d0116e94e3b806f02745d6214a80f97c64b44a6459d17f0ed68dbcf6bd275362aa3da0393bb28a1de9c0b2e2212a5d3f823f9097c5f30ac34d236af3d5
data/bin/relsr CHANGED
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'relsr'
3
+ require_relative '../lib/relsr'
4
4
 
5
- Relsr::Initializer.init
5
+ puts "Relsr version #{Relsr::VERSION}" if ARGV.empty? || ARGV[0] == 'help'
6
+
7
+ Relsr::Initializer.start(ARGV)
@@ -1,55 +1,30 @@
1
1
  require 'yaml'
2
- require 'optparse'
2
+ require 'thor'
3
3
 
4
4
  module Relsr
5
- class Initializer
5
+ class Initializer < Thor
6
6
 
7
7
  YAML_FILE = '.relsr.yml'
8
8
 
9
- def self.init
10
- parse_options
11
- parse_yaml
12
- process
9
+ desc 'release', 'Create a release branch and open a pull request'
10
+ option :'dry-run', type: :boolean, aliases: '-d'
11
+ option :'no-pr', type: :boolean, desc: "Don't create the pull request", default: false
12
+ option :add, desc: 'additional branches to add to the release', type: :array
13
+ def release
14
+ puts options
15
+ manager = release_manager
16
+ manager.create_release_branch
17
+ manager.create_pull_request unless options['no-pr']
13
18
  end
14
19
 
15
- def self.parse_options
16
- @options = {
17
- dry_run: false,
18
- extra_branches: []
19
- }
20
- OptionParser.new do |opts|
21
- opts.banner = "Usage: relsr [options]"
22
-
23
- opts.on("-r", "--release", "Create a release branch and open a pull request") do
24
- @options[:release_branch] = true
25
- @options[:pull_request] = true
26
- end
27
-
28
- opts.on("-b", "--branch", "Create a release branch only") do
29
- @options[:release_branch] = true
30
- end
31
-
32
- opts.on("-a", "--add BRANCH", "Add a branch to the release") do |v|
33
- @options[:extra_branches] << v
34
- end
35
-
36
- opts.on("-d", "--dry-run", "Dry run") do
37
- @options[:dry_run] = true
38
- end
39
-
40
- opts.on("-i", "--init", "Create #{YAML_FILE} for project in the current folder") do
41
- create_default_yaml
42
- exit 0
43
- end
44
-
45
- opts.on("-v", "--version", "Get version information") do
46
- version_info
47
- exit 0
48
- end
49
- end.parse!
20
+ desc 'init', "Create default #{YAML_FILE} in the current folder"
21
+ def init
22
+ create_default_yaml
50
23
  end
51
24
 
52
- def self.parse_yaml
25
+ private
26
+
27
+ def parse_yaml
53
28
  unless File.exist?(YAML_FILE)
54
29
  puts "Could not file #{YAML_FILE} file."
55
30
  exit 1
@@ -60,7 +35,7 @@ module Relsr
60
35
  raise 'label: has not been set' if config['label'].nil?
61
36
  @repo = config['repo']
62
37
  @label = config['label']
63
- @options[:extra_branches] += config['add_branches'] if config.key? 'add_branches'
38
+ @extra_branches += config['add_branches'] if config.key? 'add_branches'
64
39
 
65
40
  rescue StandardError => error
66
41
  puts "invalid #{YAML_FILE} file"
@@ -69,28 +44,25 @@ module Relsr
69
44
  end
70
45
  end
71
46
 
72
- def self.process
73
- manager = Relsr::ReleaseManager.new(
47
+ def release_manager
48
+ @extra_branches = options['add'].to_a
49
+ parse_yaml
50
+
51
+ Relsr::ReleaseManager.new(
74
52
  repo_name: @repo,
75
53
  label: @label,
76
- dry_run: @options[:dry_run],
77
- extra_branches: @options[:extra_branches]
54
+ dry_run: options['dry-run'],
55
+ extra_branches: @extra_branches.uniq
78
56
  )
79
- manager.create_release_branch if @options[:release_branch]
80
- manager.create_pull_request if @options[:pull_request]
81
57
  end
82
58
 
83
- def self.create_default_yaml
59
+ def create_default_yaml
84
60
  content = {
85
61
  'repo' => 'username/repo_name',
86
62
  'label' => 'acceptance-done'
87
63
  }
88
64
  File.open(YAML_FILE, 'w') {|f| f.write content.to_yaml }
89
65
  end
90
-
91
- def self.version_info
92
- puts "Relsr version #{Relsr::VERSION}"
93
- end
94
66
  end
95
-
96
67
  end
68
+
@@ -1,3 +1,3 @@
1
1
  module Relsr
2
- VERSION = '0.0.6'.freeze
2
+ VERSION = '0.1.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relsr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.1.0
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-27 00:00:00.000000000 Z
11
+ date: 2017-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thor
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.19'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.19'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: octokit
15
29
  requirement: !ruby/object:Gem::Requirement