papa 0.4.0 → 0.4.1

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: e87718a595e00d18101632e567e76800eb8a4c18
4
- data.tar.gz: 710dd0ab237970178c13f774b14d049d20475fb3
3
+ metadata.gz: 29c3cafcfd5212f7d354e02cb1877aece9e90097
4
+ data.tar.gz: fcef6587e224a9c6681f801af755f86012f49e5c
5
5
  SHA512:
6
- metadata.gz: 0d6d937ed501f316b1203527f8ae2a6d6a104a88041fd37336978bd3b61b147b709faa9e3bec5e039d93060eaa78037151887c4750aa77503cc8a66a6dc04f77
7
- data.tar.gz: 7c47861b1d7a9cafd95efcb488a43b6beb1dc3affe89850f0011d4bf9078f612300d2621c045b97640a1c97df21368ed96d21a6b5df6f9316286243807dcd52a
6
+ metadata.gz: ea5bed3fe00376c47612c38a57cde14cbcd7667137f62c716a6a9006d2ab53fd851f24cd29c22ad0bdaca9c2111d9fcf61aa30de8612ef339c979abe602d7c68
7
+ data.tar.gz: f56b5d6c01acc1490b0d68bd7b336d17f30f688d8caf8c3a6cd799b69082cbb823c76659747e1519672ad2b4692a0d71e2e56079c33d89520d3d81f80e09686c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.1
4
+ * Check whether build branch exists before prompting vi
5
+ * Add preceeding newlines in vi prompt
6
+ * Make success and error messages easier to read
7
+
3
8
  ## 0.4.0
4
9
  * Classes have been housed into their own modules
5
10
  * Minor change to how commands are run, but shouldn't affect functionality
@@ -27,10 +27,12 @@ module Papa
27
27
  STDERR.puts message.strip.red
28
28
  end
29
29
 
30
- def self.failure_reason(messages)
31
- messages.each do |message|
32
- STDERR.puts " #{message}"
33
- end
30
+ def self.success_info(message)
31
+ puts message
32
+ end
33
+
34
+ def self.failure_info(message)
35
+ STDERR.puts message
34
36
  end
35
37
 
36
38
  def self.build_output(message)
@@ -24,6 +24,8 @@ module Papa
24
24
 
25
25
  def initialize_file
26
26
  content = <<-CONTENT
27
+
28
+
27
29
  # Add your branches here. One branch name per line.
28
30
  # Lines starting in pound (#) will be ignored
29
31
  # Sample:
@@ -45,7 +47,7 @@ module Papa
45
47
  else
46
48
  branch
47
49
  end
48
- end.compact
50
+ end.compact.uniq
49
51
  end
50
52
 
51
53
  def delete_file
@@ -14,10 +14,11 @@ module Papa
14
14
  module Common
15
15
  class Add
16
16
  def run
17
- check_branches
18
-
19
17
  @build_branch ||= "#{@build_type}/#{@version}"
20
18
 
19
+ check_if_build_branch_exists
20
+ check_if_branches_are_given
21
+
21
22
  success = true
22
23
  @success_branches = []
23
24
  @failed_branches = []
@@ -64,52 +65,60 @@ module Papa
64
65
 
65
66
  private
66
67
 
67
- def check_branches
68
+ def check_if_build_branch_exists
69
+ queue = [
70
+ Command::Git::Fetch.new('origin'),
71
+ Command::Git::Checkout.new(@build_branch)
72
+ ]
73
+ runner = Runner.new(queue)
74
+ return if runner.run
75
+ Helper::Output.failure 'Build branch does not exist.'
76
+ exit 1
77
+ end
78
+
79
+ def check_if_branches_are_given
68
80
  return unless @branches.empty?
69
81
  require 'papa/helper/vi'
70
82
  vi_file_helper = Helper::Vi.new
71
83
  @branches = vi_file_helper.run
72
84
  end
73
85
 
74
- def success_cleanup
75
- queue = @branches.map { |branch| Command::Git::BranchDelete.new(branch) }
76
- Runner.new(queue).run
77
- end
78
-
79
86
  def success_message
80
87
  return if @success_branches.empty?
81
- output = ''
82
- output << "Successfully added these branches to #{@build_branch}:\n"
88
+ Helper::Output.success "Successfully added these branches to #{@build_branch}:\n"
89
+ info = ''
83
90
  @success_branches.each_with_index do |branch, index|
84
- output << " #{index + 1}.) #{branch}\n"
91
+ info << " #{index + 1}.) #{branch}\n"
85
92
  end
86
- Helper::Output.success output
87
- end
88
-
89
- def failure_cleanup
93
+ Helper::Output.success_info info
90
94
  end
91
95
 
92
96
  def failure_message
93
97
  return if @failed_branches.empty?
94
98
 
95
- output = ''
96
-
97
- output << "Failed to add these branches to #{@build_branch}:\n"
99
+ Helper::Output.failure "Failed to add these branches to #{@build_branch}:\n"
100
+ info = ''
98
101
  @failed_branches.each_with_index do |failed_branch, index|
99
102
  branch = failed_branch[:branch]
100
103
  message = failed_branch[:message]
101
- output << " #{index + 1}.) #{branch}\n"
102
- output << " - #{message}\n"
104
+ info << " #{index + 1}.) #{branch}\n"
105
+ info << " - #{message}\n"
103
106
  end
104
-
105
- output << "\n"
107
+ info << "\n"
106
108
 
107
109
  branch_names = @failed_branches.map { |f| f[:branch] }
110
+ info << "When the above problems are resolved, you can re-run this with:\n"
111
+ info << " papa #{@build_type} add -v #{@version} -b #{branch_names.join(' ')}"
112
+
113
+ Helper::Output.failure_info info
114
+ end
108
115
 
109
- output << "When the above problems are resolved, you can re-run this with:\n"
110
- output << " papa #{@build_type} add -v #{@version} -b #{branch_names.join(' ')}"
116
+ def success_cleanup
117
+ queue = @branches.map { |branch| Command::Git::BranchDelete.new(branch) }
118
+ Runner.new(queue).run
119
+ end
111
120
 
112
- Helper::Output.failure output
121
+ def failure_cleanup
113
122
  end
114
123
  end
115
124
  end
@@ -49,22 +49,22 @@ module Papa
49
49
  private
50
50
 
51
51
  def success_message
52
- output = ''
53
- output << "Successfully merged #{@build_branch} to these branches:\n"
52
+ Helper::Output.success "Successfully merged #{@build_branch} to these branches:\n"
53
+ info = ''
54
54
  @success_branches.each_with_index do |branch, index|
55
- output << " #{index + 1}.) #{branch}\n"
55
+ info << " #{index + 1}.) #{branch}\n"
56
56
  end
57
- Helper::Output.success output
57
+ Helper::Output.success_info info
58
58
  end
59
59
 
60
60
  def failure_message
61
61
  failed_branches = @base_branches - @success_branches
62
- output = ''
63
- output << "Failed to merge #{@build_branch} to these branches:\n"
62
+ Helper::Output.failure "Failed to merge #{@build_branch} to these branches:\n"
63
+ info = ''
64
64
  failed_branches.each_with_index do |branch, index|
65
- output << " #{index + 1}.) #{branch}\n"
65
+ info << " #{index + 1}.) #{branch}\n"
66
66
  end
67
- Helper::Output.failure output
67
+ Helper::Output.failure_info info
68
68
  end
69
69
  end
70
70
  end
data/lib/papa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Papa
2
- VERSION = '0.4.0'
2
+ VERSION = '0.4.1'
3
3
  end
data/papa.gemspec CHANGED
@@ -28,4 +28,6 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency "bundler", "~> 1.15"
29
29
  spec.add_development_dependency "rake", "~> 10.0"
30
30
  spec.add_development_dependency "rspec", "~> 3.0"
31
+ spec.add_development_dependency "pry"
32
+ spec.add_development_dependency "pry-byebug"
31
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: papa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - boggs
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-11-28 00:00:00.000000000 Z
11
+ date: 2017-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry-byebug
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  description: Helper gem for inDinero's git workflow
70
98
  email:
71
99
  - hello@boggs.xyz