guac 0.1.5 → 0.2.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
- SHA1:
3
- metadata.gz: 73bb215bbec1960b4bd3f61a508cf8538110b457
4
- data.tar.gz: fd2ff0aca3f2188d928f1496999b45519e056fec
2
+ SHA256:
3
+ metadata.gz: 3631527eb95fb8f6768cf7cb3d4902c0201753dae8b4af9733d2c07680413a31
4
+ data.tar.gz: 5d7a68d66973b2471c8803061ed4c4f02b18922d4a7578d38cdbb197ebfeba67
5
5
  SHA512:
6
- metadata.gz: ef720904de1321616e975bebf44625345a75be9a8f45417da52eb799e86d83cfd95ff645c715855f05034659c826321775d39bd9080202674d8c269c73c26c3e
7
- data.tar.gz: a659e1cf8f7ba50a57ab12e1ac5be1534475acd38feebd338412cce4ebd239ae6ae0f58793ca88dbdaea5e438b04bb46dcfe8d9067b1f3f502b316caa949cecc
6
+ metadata.gz: ee9988484fcd2fe65e0627b11a95789d57d8db27fec7c1b0c2185bc3d31f3fcd02a5283bc8eff714f10a6c54627504dea0edc645a0782ad2e4fca7a73cc72091
7
+ data.tar.gz: 594393a3dc3757864175bf6e4be1b13cae903b35b6a24f7cb0b9156b579324c4d7f126be7f43a6cbe0a3c84f546a87b87061caddb9611b247a178f867ad8b803
data/.rubocop.yml CHANGED
@@ -1,6 +1,5 @@
1
1
  # This is the configuration used to check the rubocop source code.
2
2
 
3
- inherit_from: .rubocop_todo.yml
4
3
  require:
5
4
  - rubocop/cop/internal_affairs
6
5
  - rubocop-rspec
@@ -21,7 +20,7 @@ Naming/PredicateName:
21
20
  - def_node_search
22
21
 
23
22
  Style/FrozenStringLiteralComment:
24
- EnforcedStyle: when_needed
23
+ Enabled: false
25
24
 
26
25
  Style/FormatStringToken:
27
26
  # Because we parse a lot of source codes from strings. Percent arrays
@@ -32,7 +31,76 @@ Style/FormatStringToken:
32
31
  Style/IpAddresses:
33
32
  # The test for this cop includes strings that would cause offenses
34
33
  Exclude:
35
- - spec/rubocop/cop/style/ip_addresses_spec.rb
34
+ - spec/rubocop/cop/style/ip_addresses_spec.rb
35
+
36
+ # Checks if uses of quotes match the configured preference.
37
+ Style/StringLiterals:
38
+ Enabled: false
39
+
40
+ Style/PercentLiteralDelimiters:
41
+ PreferredDelimiters:
42
+ '%i': '()'
43
+
44
+ # Don't complain about top-level class documentation comments.
45
+ Documentation:
46
+ Enabled: false
47
+
48
+ # Don't complain about long block lengths.
49
+ Metrics/BlockLength:
50
+ Enabled: false
51
+
52
+ Metrics/ClassLength:
53
+ CountComments: false # count full line comments?
54
+ Max: 150
55
+
56
+ Metrics/LineLength:
57
+ Max: 105
58
+ IgnoredPatterns:
59
+ - '(\A|\s)#' # Don't get upset at comments longer than the line length.
60
+ - 'authorize %' # Exclude Pundit authorization calls
61
+ - 'belongs_to :'
62
+ - 'has_many :'
63
+ - 'has_and_belongs_to_many :'
64
+ - 'has_one :'
65
+
66
+ Metrics/ModuleLength:
67
+ CountComments: false # count full line comments?
68
+ Max: 150
69
+
70
+ Style/AndOr:
71
+ # Whether `and` and `or` are banned only in conditionals (conditionals)
72
+ # or completely (always).
73
+ EnforcedStyle: always
74
+
75
+ Style/ClassAndModuleChildren:
76
+ Enabled: false
77
+
78
+ Style/Lambda:
79
+ EnforcedStyle: literal
80
+
81
+ Layout/EmptyLinesAroundClassBody:
82
+ Enabled: false
83
+
84
+ Layout/EmptyLinesAroundBlockBody:
85
+ Enabled: false
86
+
87
+ Layout/EndAlignment:
88
+ EnforcedStyleAlignWith: variable
89
+
90
+ Style/GuardClause:
91
+ Enabled: false
92
+
93
+ Style/PercentLiteralDelimiters:
94
+ Enabled: false
95
+
96
+ Style/TrailingCommaInArguments:
97
+ Enabled: false
98
+
99
+ Style/TrailingCommaInArrayLiteral:
100
+ Enabled: false
101
+
102
+ Style/TrailingCommaInHashLiteral:
103
+ Enabled: false
36
104
 
37
105
  Layout/EndOfLine:
38
106
  EnforcedStyle: lf
@@ -45,13 +113,13 @@ Layout/ClassStructure:
45
113
  - prepend
46
114
  - extend
47
115
  ExpectedOrder:
48
- - module_inclusion
49
- - constants
50
- - public_class_methods
51
- - initializer
52
- - instance_methods
53
- - protected_methods
54
- - private_methods
116
+ - module_inclusion
117
+ - constants
118
+ - public_class_methods
119
+ - initializer
120
+ - instance_methods
121
+ - protected_methods
122
+ - private_methods
55
123
 
56
124
  Layout/IndentHeredoc:
57
125
  EnforcedStyle: powerpack
@@ -86,10 +154,6 @@ Metrics/ModuleLength:
86
154
  Exclude:
87
155
  - 'spec/**/*.rb'
88
156
 
89
- Performance/Caller:
90
- Exclude:
91
- - spec/rubocop/cop/performance/caller_spec.rb
92
-
93
157
  RSpec/PredicateMatcher:
94
158
  EnforcedStyle: explicit
95
159
 
data/.rubocop_todo.yml CHANGED
@@ -1,263 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2018-12-09 15:12:18 -0600 using RuboCop version 0.61.1.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 1
10
- # Configuration parameters: Include.
11
- # Include: **/*.gemspec
12
- Gemspec/DuplicatedAssignment:
13
- Exclude:
14
- - 'guac.gemspec'
15
-
16
- # Offense count: 1
17
- # Cop supports --auto-correct.
18
- # Configuration parameters: EnforcedStyle.
19
- # SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only
20
- Layout/EmptyLinesAroundClassBody:
21
- Exclude:
22
- - 'lib/guac/commands/config.rb'
23
-
24
- # Offense count: 3
25
- # Cop supports --auto-correct.
26
- # Configuration parameters: EnforcedStyle.
27
- # SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
28
- Layout/IndentHeredoc:
29
- Exclude:
30
- - 'spec/integration/config_spec.rb'
31
- - 'spec/integration/status_spec.rb'
32
- - 'spec/integration/up_spec.rb'
33
-
34
- # Offense count: 1
35
- # Cop supports --auto-correct.
36
- # Configuration parameters: EnforcedStyle.
37
- # SupportedStyles: normal, rails
38
- Layout/IndentationConsistency:
39
- Exclude:
40
- - 'lib/guac/config.rb'
41
-
42
- # Offense count: 1
43
- # Cop supports --auto-correct.
44
- # Configuration parameters: Width, IgnoredPatterns.
45
- Layout/IndentationWidth:
46
- Exclude:
47
- - 'lib/guac/config.rb'
48
-
49
- # Offense count: 1
50
- # Cop supports --auto-correct.
51
- Layout/LeadingBlankLines:
52
- Exclude:
53
- - 'guac.gemspec'
54
-
55
- # Offense count: 1
56
- # Cop supports --auto-correct.
57
- # Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
58
- # SupportedStyles: space, no_space
59
- # SupportedStylesForEmptyBraces: space, no_space
60
- Layout/SpaceInsideBlockBraces:
61
- Exclude:
62
- - 'Gemfile'
63
-
64
- # Offense count: 1
65
- # Cop supports --auto-correct.
66
- # Configuration parameters: EnforcedStyle.
67
- # SupportedStyles: final_newline, final_blank_line
68
- Layout/TrailingBlankLines:
69
- Exclude:
70
- - 'lib/guac/config.rb'
71
-
72
- # Offense count: 3
73
- # Cop supports --auto-correct.
74
- # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
75
- Lint/UnusedMethodArgument:
76
- Exclude:
77
- - 'lib/guac/commands/config.rb'
78
- - 'lib/guac/commands/status.rb'
79
- - 'lib/guac/commands/up.rb'
80
-
81
- # Offense count: 2
82
- Lint/UselessAssignment:
83
- Exclude:
84
- - 'lib/guac/sys_command.rb'
85
-
86
- # Offense count: 2
87
- Metrics/AbcSize:
88
- Max: 19
89
-
90
- # Offense count: 1
91
- # Configuration parameters: CountComments, ExcludedMethods.
92
- # ExcludedMethods: refine
93
- Metrics/BlockLength:
94
- Max: 31
95
-
96
- # Offense count: 4
97
- # Configuration parameters: CountComments, ExcludedMethods.
98
- Metrics/MethodLength:
99
- Max: 15
100
-
101
- # Offense count: 3
102
- RSpec/DescribeClass:
103
- Exclude:
104
- - 'spec/integration/config_spec.rb'
105
- - 'spec/integration/status_spec.rb'
106
- - 'spec/integration/up_spec.rb'
107
-
108
- # Offense count: 3
109
- # Cop supports --auto-correct.
110
- # Configuration parameters: SkipBlocks, EnforcedStyle.
111
- # SupportedStyles: described_class, explicit
112
- RSpec/DescribedClass:
113
- Exclude:
114
- - 'spec/unit/config_spec.rb'
115
- - 'spec/unit/status_spec.rb'
116
- - 'spec/unit/up_spec.rb'
117
-
118
- # Offense count: 3
119
- # Configuration parameters: Max.
120
- RSpec/ExampleLength:
121
- Exclude:
122
- - 'spec/integration/config_spec.rb'
123
- - 'spec/integration/status_spec.rb'
124
- - 'spec/integration/up_spec.rb'
125
-
126
- # Offense count: 3
127
- # Configuration parameters: CustomTransform, IgnoreMethods.
128
- RSpec/FilePath:
129
- Exclude:
130
- - 'spec/unit/config_spec.rb'
131
- - 'spec/unit/status_spec.rb'
132
- - 'spec/unit/up_spec.rb'
133
-
134
- # Offense count: 2
135
- # Cop supports --auto-correct.
136
- Security/YAMLLoad:
137
- Exclude:
138
- - 'lib/guac/config.rb'
139
-
140
- # Offense count: 8
141
- Style/Documentation:
142
- Exclude:
143
- - 'spec/**/*'
144
- - 'test/**/*'
145
- - 'lib/guac.rb'
146
- - 'lib/guac/colors.rb'
147
- - 'lib/guac/commands/config.rb'
148
- - 'lib/guac/commands/status.rb'
149
- - 'lib/guac/commands/up.rb'
150
- - 'lib/guac/config.rb'
151
- - 'lib/guac/repo.rb'
152
- - 'lib/guac/sys_command.rb'
153
-
154
- # Offense count: 2
155
- # Cop supports --auto-correct.
156
- Style/ExpandPathArguments:
157
- Exclude:
158
- - 'guac.gemspec'
159
-
160
- # Offense count: 15
161
- # Cop supports --auto-correct.
162
- # Configuration parameters: EnforcedStyle.
163
- # SupportedStyles: when_needed, always, never
164
- Style/FrozenStringLiteralComment:
165
- Exclude:
166
- - 'Gemfile'
167
- - 'Rakefile'
168
- - 'bin/console'
169
- - 'guac.gemspec'
170
- - 'lib/guac.rb'
171
- - 'lib/guac/config.rb'
172
- - 'lib/guac/version.rb'
173
- - 'spec/guac_spec.rb'
174
- - 'spec/integration/config_spec.rb'
175
- - 'spec/integration/status_spec.rb'
176
- - 'spec/integration/up_spec.rb'
177
- - 'spec/spec_helper.rb'
178
- - 'spec/unit/config_spec.rb'
179
- - 'spec/unit/status_spec.rb'
180
- - 'spec/unit/up_spec.rb'
181
-
182
- # Offense count: 1
183
- # Cop supports --auto-correct.
184
- # Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
185
- # SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
186
- Style/HashSyntax:
187
- Exclude:
188
- - 'Rakefile'
189
-
190
- # Offense count: 1
191
- # Cop supports --auto-correct.
192
- Style/IfUnlessModifier:
193
- Exclude:
194
- - 'lib/guac/sys_command.rb'
195
-
196
- # Offense count: 1
197
- # Cop supports --auto-correct.
198
- Style/MutableConstant:
199
- Exclude:
200
- - 'lib/guac/version.rb'
201
-
202
- # Offense count: 1
203
- # Cop supports --auto-correct.
204
- # Configuration parameters: EnforcedStyle.
205
- # SupportedStyles: both, prefix, postfix
206
- Style/NegatedIf:
207
- Exclude:
208
- - 'exe/guac'
209
-
210
- # Offense count: 3
211
- # Cop supports --auto-correct.
212
- # Configuration parameters: PreferredDelimiters.
213
- Style/PercentLiteralDelimiters:
214
- Exclude:
215
- - 'lib/guac/cli.rb'
216
- - 'lib/guac/repo.rb'
217
-
218
- # Offense count: 2
219
- # Cop supports --auto-correct.
220
- # Configuration parameters: EnforcedStyle.
221
- # SupportedStyles: use_perl_names, use_english_names
222
- Style/SpecialGlobalVars:
223
- Exclude:
224
- - 'exe/guac'
225
-
226
- # Offense count: 20
227
- # Cop supports --auto-correct.
228
- # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
229
- # SupportedStyles: single_quotes, double_quotes
230
- Style/StringLiterals:
231
- Exclude:
232
- - 'Gemfile'
233
- - 'Rakefile'
234
- - 'bin/console'
235
- - 'lib/guac.rb'
236
- - 'lib/guac/version.rb'
237
- - 'spec/integration/config_spec.rb'
238
- - 'spec/integration/status_spec.rb'
239
- - 'spec/integration/up_spec.rb'
240
- - 'spec/spec_helper.rb'
241
- - 'spec/unit/config_spec.rb'
242
- - 'spec/unit/status_spec.rb'
243
- - 'spec/unit/up_spec.rb'
244
-
245
- # Offense count: 1
246
- # Cop supports --auto-correct.
247
- # Configuration parameters: EnforcedStyleForMultiline.
248
- # SupportedStylesForMultiline: comma, consistent_comma, no_comma
249
- Style/TrailingCommaInHashLiteral:
250
- Exclude:
251
- - 'lib/guac/commands/config.rb'
252
-
253
- # Offense count: 1
254
- # Cop supports --auto-correct.
255
- Style/UnneededCondition:
256
- Exclude:
257
- - 'lib/guac/repo.rb'
258
-
259
- # Offense count: 12
260
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
261
- # URISchemes: http, https
262
- Metrics/LineLength:
263
- Max: 101
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- guac (0.1.5)
4
+ guac (0.2.0)
5
5
  colorize (= 0.8.1)
6
6
  thor (= 0.20.0)
7
7
 
@@ -9,13 +9,18 @@ GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
11
  ast (2.4.0)
12
+ coderay (1.1.2)
12
13
  colorize (0.8.1)
13
14
  diff-lcs (1.3)
14
15
  jaro_winkler (1.5.1)
16
+ method_source (0.9.2)
15
17
  parallel (1.12.1)
16
18
  parser (2.5.3.0)
17
19
  ast (~> 2.4.0)
18
20
  powerpack (0.1.2)
21
+ pry (0.12.2)
22
+ coderay (~> 1.1.0)
23
+ method_source (~> 0.9.0)
19
24
  rainbow (3.0.0)
20
25
  rake (10.5.0)
21
26
  rspec (3.8.0)
@@ -51,10 +56,11 @@ PLATFORMS
51
56
  DEPENDENCIES
52
57
  bundler (~> 1.16)
53
58
  guac!
59
+ pry
54
60
  rake (~> 10.0)
55
61
  rspec (~> 3.0)
56
62
  rubocop (~> 0.61.1)
57
63
  rubocop-rspec (~> 1.30.1)
58
64
 
59
65
  BUNDLED WITH
60
- 1.17.1
66
+ 1.17.2
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018 Matt Boldt
3
+ Copyright (c) 2019 Matt Boldt
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
6
  this software and associated documentation files (the "Software"), to deal in
data/README.md CHANGED
@@ -1,11 +1,11 @@
1
- # Guac
1
+ # Guac 🥑
2
2
 
3
3
  [![Build Status](https://travis-ci.org/mattboldt/guac.svg?branch=master)](https://travis-ci.org/mattboldt/guac)
4
4
  [![Code Climate](https://codeclimate.com/github/mattboldt/guac/badges/gpa.svg)](https://codeclimate.com/github/mattboldt/guac)
5
5
  [![Gem Version](https://badge.fury.io/rb/guac.svg)](https://badge.fury.io/rb/guac)
6
6
  [![GitHub license](https://img.shields.io/github/license/mattboldt/guac.svg)](https://github.com/mattboldt/guac/blob/master/LICENSE.txt)
7
7
 
8
- Guac is a command line program to update multiple local git repos with one command. Guac stands for `git update cli`, but it's also just a very easy to type command. Furthermore, it's shorthand for Guacamole, e.g.: "Holy Guacamole, this gem makes updating all my repos very fast and easy".
8
+ Guac is a command line program to update multiple local git repos with one command. Guac stands for `git update-all cli`, but it's also just a very easy to type command. Furthermore, it's shorthand for Guacamole, e.g.: "Holy Guacamole, this gem makes updating all my repos very fast and easy".
9
9
 
10
10
  ![Guac](./assets/demo.gif)
11
11
 
@@ -19,13 +19,16 @@ Guac is written in Ruby, so you'll need to have that installed on your machine,
19
19
 
20
20
  ```bash
21
21
  # Run setup
22
- guac config
22
+ guac setup
23
23
 
24
24
  # Show all statuses
25
25
  guac status
26
+ guac st
26
27
 
27
- # Update all on master
28
- guac up master
28
+ # Update all on default branch (master)
29
+ guac up
30
+ # Update all on release_2019
31
+ guac up release_2019
29
32
  ```
30
33
 
31
34
  ## Development
@@ -38,10 +41,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
38
41
 
39
42
  Bug reports and pull requests are welcome on GitHub at https://github.com/mattboldt/guac. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
40
43
 
41
- ## Code of Conduct
42
-
43
- Everyone interacting in the Guac project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/mattboldt/guac/blob/master/CODE_OF_CONDUCT.md).
44
-
45
44
  ## Copyright
46
45
 
47
- Copyright (c) 2018 Matt Boldt. See [MIT License](LICENSE.txt) for further details.
46
+ Copyright (c) 2019 Matt Boldt. See [MIT License](LICENSE.txt) for further details.
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "bundler/setup"
4
- require "guac"
4
+ require "guac/cli"
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
data/exe/guac CHANGED
@@ -1,18 +1,26 @@
1
1
  #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
2
 
4
3
  lib_path = File.expand_path('../lib', __dir__)
5
4
  $:.unshift(lib_path) if !$:.include?(lib_path)
5
+ require 'pry'
6
+ require 'guac'
6
7
  require 'guac/cli'
7
8
 
8
9
  Signal.trap('INT') do
9
- warn("\n#{caller.join("\n")}: interrupted")
10
- exit(1)
10
+ warn "\n#{caller.join("\n")}: interrupted" if Guac.debug?
11
+
12
+ warn 'CMD+C interrupted'
13
+ warn "\nWELL EXCUUUUUUUUSE ME. NO 👏 GUAC 👏 FOR 👏 YOU 👏".red
14
+
15
+ exit 1
11
16
  end
12
17
 
13
18
  begin
14
19
  Guac::CLI.start
15
- rescue Guac::CLI::Error => err
16
- puts "ERROR: #{err.message}"
20
+ rescue Guac::Commands::Error => e
21
+ puts 'ERROR: '.red + e.message
22
+ exit 1
23
+ rescue Guac::CLI::Error => e
24
+ puts 'ERROR: '.red + e.message
17
25
  exit 1
18
26
  end
data/guac.gemspec CHANGED
@@ -10,8 +10,8 @@ Gem::Specification.new do |spec|
10
10
  spec.authors = ['Matt Boldt']
11
11
  spec.email = ['me@mattboldt.com']
12
12
 
13
- spec.summary = 'Git your gits'
14
- spec.description = 'Git your gits git'
13
+ spec.summary = 'Manage multiple git repos at once from the command line'
14
+ spec.description = 'Git update all CLI'
15
15
  spec.homepage = 'https://github.com/mattboldt/guac'
16
16
  spec.license = 'MIT'
17
17
 
@@ -34,13 +34,19 @@ Gem::Specification.new do |spec|
34
34
  spec.require_paths = ['lib']
35
35
 
36
36
  spec.post_install_message = %(
37
- 🥑🥑🥑 Thanks for installing 🥑🥑🥑 \n Please run `guac config`
37
+ 🥑🥑🥑🥑🥑🥑🥑🥑🥑🥑🥑🥑🥑🥑🥑🥑🥑
38
+ 🥑 🥑
39
+ 🥑 Thanks for installing 🥑
40
+ 🥑 Please run `guac setup` 🥑
41
+ 🥑 🥑
42
+ 🥑🥑🥑🥑🥑🥑🥑🥑🥑🥑🥑🥑🥑🥑🥑🥑🥑
38
43
  )
39
44
 
40
45
  spec.add_dependency 'colorize', '0.8.1'
41
46
  spec.add_dependency 'thor', '0.20.0'
42
47
 
43
48
  spec.add_development_dependency 'bundler', '~> 1.16'
49
+ spec.add_development_dependency 'pry'
44
50
  spec.add_development_dependency 'rake', '~> 10.0'
45
51
  spec.add_development_dependency 'rspec', '~> 3.0'
46
52
  spec.add_development_dependency 'rubocop', '~> 0.61.1'
data/lib/guac/cli.rb CHANGED
@@ -1,7 +1,4 @@
1
- # frozen_string_literal: true
2
-
3
1
  require 'thor'
4
- # require 'pry'
5
2
 
6
3
  module Guac
7
4
  # Handle the application command line parsing
@@ -19,14 +16,14 @@ module Guac
19
16
  end
20
17
  map %w(--version -v) => :version
21
18
 
22
- desc 'config', 'Configures local repos'
23
- method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information'
24
- def config(*)
19
+ desc 'setup', 'Configures local paths & git settings'
20
+ method_option :help, aliases: '-h', type: :boolean
21
+ def setup(*)
25
22
  if options[:help]
26
- invoke :help, ['config']
23
+ invoke :help, ['setup']
27
24
  else
28
- require_relative 'commands/config'
29
- Guac::Commands::Config.new(options, self).execute
25
+ require_relative 'commands/setup'
26
+ Guac::Commands::Setup.new(options, self).execute
30
27
  end
31
28
  end
32
29
 
@@ -44,15 +41,18 @@ module Guac
44
41
  map 'st' => 'status'
45
42
 
46
43
  desc 'up', 'Pull latest for all repos'
47
- method_option :help, aliases: '-h', type: :boolean, desc: 'Display usage information'
48
- method_option :branch, aliases: '-b', type: :string, desc: 'Checkout branch and pull updates'
44
+ method_option :help, aliases: '-h', type: :boolean
49
45
  def up(*)
50
46
  if options[:help]
51
47
  invoke :help, ['up']
52
48
  else
53
49
  require_relative 'commands/up'
54
- Guac::Commands::Up.new(options).execute
50
+ Guac::Commands::Up.new(options, ARGV).execute
55
51
  end
56
52
  end
57
53
  end
54
+
55
+ module Commands
56
+ Error = Class.new(StandardError)
57
+ end
58
58
  end
@@ -0,0 +1,110 @@
1
+ require_relative '../config'
2
+ require_relative '../repo'
3
+ require 'yaml'
4
+ require 'colorize'
5
+
6
+ module Guac
7
+ module Commands
8
+ class Setup
9
+
10
+ PROMPT_QUEUE = %i(
11
+ prompt_repos
12
+ prompt_branch_aliases
13
+ prompt_pull_strategy
14
+ prompt_default_branch
15
+ ).freeze
16
+
17
+ def initialize(options, thor)
18
+ @options = options
19
+ @config = Guac::Config.configs
20
+ @defaults = Guac::Config.defaults
21
+ @thor = thor
22
+ end
23
+
24
+ def execute(_input: $stdin, output: $stdout)
25
+ @output = output
26
+ @output.puts "\n🥑 Welcome to the tableside Guac builder 🥑\n".green
27
+
28
+ @body = @defaults.dup
29
+ @body.merge!(@config) unless @config.nil?
30
+
31
+ PROMPT_QUEUE.each do |prompt|
32
+ send(prompt)
33
+ @output.puts "\n"
34
+ end
35
+
36
+ Guac::Config.save_configs(@body)
37
+ @output.puts "🥑 Config saved in ~/.guacrc 🥑\n".bold.green
38
+ @output.puts Guac::Config.configs.to_yaml
39
+ end
40
+
41
+ private
42
+
43
+ def prompt_repos
44
+ @output.puts 'Git Repos (separated by spaces)'.bold.blue
45
+ @output.puts 'Input absolute paths or drag & drop folders here (e.g. ~/Repos/one ~/Repos/two)'
46
+ result = @thor.ask('Repos:'.bold, required: true)
47
+ dirs = result.split(/ \s*/)
48
+ validate_repos(dirs)
49
+
50
+ @body[:repos] = dirs.map do |r|
51
+ {
52
+ dir: r,
53
+ name: r.split('/').last,
54
+ }
55
+ end
56
+ end
57
+
58
+ def prompt_branch_aliases
59
+ @output.puts 'Git branch aliases'.bold.blue
60
+ @output.puts 'Input format: `branch_name:branch_name_alias`'
61
+ result = @thor.yes?('Would you like to configure aliases? (y/n)'.bold)
62
+ return unless result
63
+
64
+ @body[:repos].each do |repo|
65
+ result = @thor.ask("Alias for `#{repo[:name].colorize(:blue)}`:")
66
+ next unless valid_result?(result)
67
+
68
+ repo[:branch_aliases] = parse_branch_aliases(result)
69
+ end
70
+ end
71
+
72
+ def prompt_pull_strategy
73
+ @output.puts 'Pull strategy'.bold.blue
74
+ @output.puts "Default: `#{@defaults[:pull_strategy].bold}`"
75
+ result = @thor.ask('Enter strategy or press return for default:'.bold)
76
+
77
+ @body[:pull_strategy] = result if valid_result?(result)
78
+ end
79
+
80
+ def prompt_default_branch
81
+ @output.puts "Default branch".bold.blue
82
+ @output.puts "Default: `#{@defaults[:default_branch].bold}`"
83
+ result = @thor.ask('Enter branch or press return for default:'.bold)
84
+
85
+ @body[:default_branch] = result if valid_result?(result)
86
+ end
87
+
88
+ def valid_result?(result)
89
+ result && !result.strip.empty?
90
+ end
91
+
92
+ def parse_branch_aliases(result)
93
+ branch_pairs = result.split(/ \s*/)
94
+ {}.tap do |obj|
95
+ branch_pairs.each do |pair|
96
+ branches = pair.split(':')
97
+ obj[branches[0]] = branches[1]
98
+ end
99
+ end
100
+ end
101
+
102
+ def validate_repos(dirs)
103
+ return if Guac::Repo.valid?(dirs)
104
+
105
+ error = "1 or more directories could not be found, or are not git repos!".yellow.bold
106
+ raise Guac::Commands::Error, error
107
+ end
108
+ end
109
+ end
110
+ end
@@ -1,6 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../config'
4
1
  require_relative '../repo'
5
2
  require_relative '../colors'
6
3
 
@@ -9,11 +6,10 @@ module Guac
9
6
  class Status
10
7
  def initialize(options)
11
8
  @options = options
12
- @config = Guac::Config.load
13
- @repos = @config[:repos].map { |r| Guac::Repo.new(@config, r) }
9
+ @repos = Guac::Repo.build_from_config
14
10
  end
15
11
 
16
- def execute(input: $stdin, output: $stdout)
12
+ def execute(_input: $stdin, output: $stdout)
17
13
  threads = @repos.map do |repo|
18
14
  Thread.new do
19
15
  response = [repo.status]
@@ -24,7 +20,7 @@ module Guac
24
20
  end
25
21
  end
26
22
 
27
- puts threads.map(&:value)
23
+ output.puts threads.map(&:value)
28
24
  end
29
25
  end
30
26
  end
@@ -1,25 +1,18 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../config'
4
1
  require_relative '../repo'
5
2
  require_relative '../colors'
6
3
  require_relative '../sys_command'
7
- # require 'pry'
8
4
 
9
5
  module Guac
10
6
  module Commands
11
7
  class Up
12
- def initialize(options)
8
+ def initialize(options, args = [])
13
9
  @options = options
14
- @config = Guac::Config.load
15
- @repos = @config[:repos].map do |repo|
16
- Guac::Repo.new(@config, repo, ARGV[1])
17
- end
10
+ @repos = Guac::Repo.build_from_config(args[1])
18
11
  end
19
12
 
20
- def execute
13
+ def execute(_input: $stdin, output: $stdout)
21
14
  threads = @repos.map do |repo|
22
- puts "Updating #{repo.name.bold} on branch #{repo.branch.underline}".colorize(:blue)
15
+ output.puts "Updating #{repo.name.bold} on branch #{repo.branch.underline}".blue
23
16
 
24
17
  Thread.new do
25
18
  response = []
@@ -28,19 +21,19 @@ module Guac
28
21
  repo.checkout
29
22
  response << repo.pull
30
23
  rescue Guac::SysCommandError => e
31
- response << e.message.colorize(:red)
32
- break
24
+ response << repo.dir.bold.red
25
+ response << e.message.red
33
26
  end
34
27
 
35
28
  response.compact!
36
29
  response = Colors.paint(response)
37
- response.unshift(repo.name.bold.colorize(:blue))
30
+ response.unshift(repo.name.bold.blue)
38
31
  response.join("\n")
39
32
  end
40
33
  end
41
34
 
42
- puts '========'
43
- puts threads.map(&:value)
35
+ output.puts "\n"
36
+ output.puts threads.map(&:value)
44
37
  end
45
38
  end
46
39
  end
data/lib/guac/config.rb CHANGED
@@ -3,22 +3,65 @@ require 'colorize'
3
3
 
4
4
  module Guac
5
5
  class Config
6
- CONFIG_FILE = File.join(ENV['HOME'], '.guacrc').freeze
7
- DEFAULTS_FILE = File.join(File.dirname(__FILE__), 'templates/config/guacrc.yaml').freeze
6
+ CONFIG_FILE = File.join(ENV['HOME'], '.guacrc').freeze
7
+ DEFAULTS_FILE = File.join(__dir__, 'templates/config/guacrc.yml').freeze
8
+ REQUIRED_FIELDS = %i(repos pull_strategy default_branch).freeze
9
+ OH_NO_YOU_DONTS = %w(push merge rebase commit clone init mv rm reset).freeze
8
10
 
9
- def self.load(raise_error: true)
10
- @config ||= YAML.load(File.read(CONFIG_FILE)) if File.exist?(CONFIG_FILE)
11
+ class << self
12
+ def load
13
+ if configs.nil?
14
+ error = "#{CONFIG_FILE} not found\n".yellow
15
+ error += 'Please run ' + '`guac setup`'.green
16
+ raise Guac::Commands::Error, error
17
+ end
11
18
 
12
- if @config.nil? && raise_error
13
- puts 'ERROR: Please run config'.colorize(:red)
14
- raise
19
+ missing_fields = REQUIRED_FIELDS.select { |f| configs[f].nil? || configs[f].empty? }
20
+ if missing_fields.any?
21
+ error = "Missing config for #{missing_fields.join(', ')} \n".yellow
22
+ error += 'Please run ' + '`guac setup`'.green
23
+ raise Guac::Commands::Error, error
24
+ end
25
+
26
+ strategy = configs[:pull_strategy]
27
+ cmds = OH_NO_YOU_DONTS.select { |cmd| strategy.include?("git #{cmd}") }
28
+ if cmds.any?
29
+ error = "Your pull strategy is dangerous! `#{strategy.bold}`\n".red
30
+ error += "You really shouldn't use #{cmds.join(', ').bold}\n".yellow
31
+ error += 'Please run ' + '`guac setup`'.green
32
+ raise Guac::Commands::Error, error
33
+ end
34
+
35
+ configs
15
36
  end
16
37
 
17
- @config
18
- end
38
+ def defaults
39
+ parse(DEFAULTS_FILE)
40
+ end
41
+
42
+ def configs(reload: false)
43
+ if reload
44
+ parse(CONFIG_FILE)
45
+ else
46
+ @configs ||= parse(CONFIG_FILE)
47
+ end
48
+ end
19
49
 
20
- def self.defaults
21
- @defaults ||= YAML.load(File.read(DEFAULTS_FILE)) if File.exist?(DEFAULTS_FILE)
50
+ def save_configs(body)
51
+ file = File.new(CONFIG_FILE, 'w')
52
+ file.puts(body.to_yaml)
53
+ file.close
54
+ end
55
+
56
+ private
57
+
58
+ def parse(file)
59
+ return nil unless File.exist?(file)
60
+
61
+ res = YAML.load(File.read(file))
62
+ # Empty yaml returns `false`
63
+ res || nil
64
+ end
22
65
  end
23
66
  end
24
67
  end
data/lib/guac/repo.rb CHANGED
@@ -1,11 +1,15 @@
1
- # frozen_string_literal: true
2
-
3
1
  require_relative 'sys_command'
2
+ require_relative 'config'
4
3
 
5
4
  module Guac
6
5
  class Repo
7
6
  attr_reader :name, :dir
8
7
 
8
+ def self.build_from_config(*args)
9
+ config = Guac::Config.load
10
+ config[:repos].map { |r| new(config, r, *args) }
11
+ end
12
+
9
13
  def initialize(config, repo, branch = nil)
10
14
  @config = config
11
15
  @repo = repo
@@ -32,11 +36,15 @@ module Guac
32
36
  end
33
37
 
34
38
  def pull
35
- pull_cmd =
36
- @config[:pull_strategy] ? @config[:pull_strategy] : @defaults[:pull_strategy]
37
- pull_cmd = pull_cmd.split(/ \s*/)
38
-
39
+ pull_cmd = @config[:pull_strategy].split(/ \s*/)
39
40
  SysCommand.run(@dir, pull_cmd)
40
41
  end
42
+
43
+ def self.valid?(dirs)
44
+ !dirs.empty? && dirs.all? do |dir|
45
+ d = File.join(dir.sub('~', ENV['HOME']), '.git')
46
+ Dir.exist?(d)
47
+ end
48
+ end
41
49
  end
42
50
  end
@@ -1,4 +1,6 @@
1
1
  ---
2
2
  :repos:
3
+ - foo
4
+ - bar
3
5
  :pull_strategy: git pull --rebase --prune
4
6
  :default_branch: master
data/lib/guac/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Guac
2
- VERSION = "0.1.5"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/guac.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require "guac/version"
2
2
 
3
3
  module Guac
4
- # Your code goes here...
4
+ def self.debug?
5
+ !ENV['DEBUG'].nil?
6
+ end
5
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Boldt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-12-09 00:00:00.000000000 Z
11
+ date: 2019-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.16'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rake
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -108,7 +122,7 @@ dependencies:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
124
  version: 1.30.1
111
- description: Git your gits git
125
+ description: Git update all CLI
112
126
  email:
113
127
  - me@mattboldt.com
114
128
  executables:
@@ -121,7 +135,6 @@ files:
121
135
  - ".rubocop.yml"
122
136
  - ".rubocop_todo.yml"
123
137
  - ".travis.yml"
124
- - CODE_OF_CONDUCT.md
125
138
  - Gemfile
126
139
  - Gemfile.lock
127
140
  - LICENSE.txt
@@ -137,7 +150,7 @@ files:
137
150
  - lib/guac/cli.rb
138
151
  - lib/guac/colors.rb
139
152
  - lib/guac/commands/.gitkeep
140
- - lib/guac/commands/config.rb
153
+ - lib/guac/commands/setup.rb
141
154
  - lib/guac/commands/status.rb
142
155
  - lib/guac/commands/up.rb
143
156
  - lib/guac/config.rb
@@ -145,7 +158,7 @@ files:
145
158
  - lib/guac/sys_command.rb
146
159
  - lib/guac/templates/.gitkeep
147
160
  - lib/guac/templates/config/.gitkeep
148
- - lib/guac/templates/config/guacrc.yaml
161
+ - lib/guac/templates/config/guacrc.yml
149
162
  - lib/guac/templates/status/.gitkeep
150
163
  - lib/guac/templates/up/.gitkeep
151
164
  - lib/guac/version.rb
@@ -154,8 +167,11 @@ licenses:
154
167
  - MIT
155
168
  metadata:
156
169
  allowed_push_host: https://rubygems.org
157
- post_install_message: "\n \U0001F951\U0001F951\U0001F951 Thanks for installing
158
- \U0001F951\U0001F951\U0001F951 \n Please run `guac config`\n "
170
+ post_install_message: "\n \U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\n
171
+ \ \U0001F951 \U0001F951\n \U0001F951 Thanks
172
+ for installing \U0001F951\n \U0001F951 Please run `guac setup` \U0001F951\n
173
+ \ \U0001F951 \U0001F951\n \U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\U0001F951\n
174
+ \ "
159
175
  rdoc_options: []
160
176
  require_paths:
161
177
  - lib
@@ -170,9 +186,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
186
  - !ruby/object:Gem::Version
171
187
  version: '0'
172
188
  requirements: []
173
- rubyforge_project:
174
- rubygems_version: 2.6.14
189
+ rubygems_version: 3.0.3
175
190
  signing_key:
176
191
  specification_version: 4
177
- summary: Git your gits
192
+ summary: Manage multiple git repos at once from the command line
178
193
  test_files: []
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at me@mattboldt.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
@@ -1,95 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative '../config'
4
- require 'yaml'
5
- require 'colorize'
6
- # require 'pry'
7
-
8
- module Guac
9
- module Commands
10
- class Config
11
-
12
- def initialize(options, thor)
13
- @options = options
14
- @config = Guac::Config.load(raise_error: false)
15
- @defaults = Guac::Config.defaults
16
- @thor = thor
17
- end
18
-
19
- def execute(_input: $stdin, output: $stdout)
20
- body = @defaults
21
- body.merge!(@config) unless @config.nil?
22
-
23
- output.puts "============= \n\n\n"
24
- prompt_repos(body, output)
25
- output.puts "\n"
26
- prompt_branch_aliases(body, output)
27
- prompt_pull_strategy(body)
28
- prompt_default_branch(body)
29
- output.puts "\n"
30
-
31
- save_config(body)
32
- output.puts 'Config saved in ~/.guacrc'.colorize(:green)
33
- end
34
-
35
- private
36
-
37
- def prompt_repos(body, output)
38
- result = @thor.ask('Git Repos (separated by spaces):'.bold.colorize(:blue), required: true)
39
-
40
- dirs = result.split(/ \s*/)
41
- body[:repos] = dirs.map do |r|
42
- {
43
- dir: r,
44
- name: r.split('/').last,
45
- }
46
- end
47
- end
48
-
49
- def prompt_branch_aliases(body, output)
50
- output.puts 'Git branch aliases:'.bold.colorize(:blue)
51
- output.puts 'Input format: `branch_name:branch_name_alias`'
52
-
53
- result = @thor.yes?('Would you like to configure aliases? (y/n)')
54
- return unless result
55
-
56
- body[:repos].each do |repo|
57
- result = @thor.ask("Alias for `#{repo[:name].colorize(:blue)}`:")
58
- next unless valid_result?(result)
59
-
60
- branch_pairs = result.split(/ \s*/)
61
- repo[:branch_aliases] = {}.tap do |obj|
62
- branch_pairs.each do |pair|
63
- branches = pair.split(':')
64
- obj[branches[0]] = branches[1]
65
- end
66
- end
67
- end
68
- end
69
-
70
- def prompt_pull_strategy(body)
71
- default = "(default: `#{@defaults[:pull_strategy]}`)".colorize(:blue)
72
- result = @thor.ask("Pull strategy #{default}:")
73
-
74
- body[:pull_strategy] = result if valid_result?(result)
75
- end
76
-
77
- def prompt_default_branch(body)
78
- default = "(default: `#{@defaults[:default_branch]}`)".colorize(:blue)
79
- result = @thor.ask("Default branch #{default}:")
80
-
81
- body[:default_branch] = result if valid_result?(result)
82
- end
83
-
84
- def valid_result?(result)
85
- result && !result.strip.empty?
86
- end
87
-
88
- def save_config(body)
89
- file = File.new(Guac::Config::CONFIG_FILE, 'w')
90
- file.puts(body.to_yaml)
91
- file.close
92
- end
93
- end
94
- end
95
- end