gitmore 0.3.0.pre.rc → 0.3.5.pre.alpha

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
  SHA256:
3
- metadata.gz: d89aa32035524ef0708667a3e6b92f45ca2922da9ae193b35a703f40c798c8f9
4
- data.tar.gz: 30135156da1a27c225cf2f665a561789c05e590b94a4f8b5180b065bb764153e
3
+ metadata.gz: 865fa4252f0a284fbc1b73b4d8b64621d328b0e3bbfe332de9ee126454d54e9f
4
+ data.tar.gz: 6d06b59216b74d3c6881f9fb3edcdb3ce23f372a219979538e74b74587028a76
5
5
  SHA512:
6
- metadata.gz: f42c56e61a60929ce788dd6e7242515088093113626a78b908a1890fd4334e89029a9c7f749dac8c1d75b6b1b7b10db3299c93f846d6360336da8f7741485b61
7
- data.tar.gz: 2dd9f11709b9c81be5cdc97e4a5a911d615140383651a218e5f1efa76815b22f82a8837aec335efb9eb8dc46b6dbb6bfa4ba36c949b2d929e50f5fd4fddb1de1
6
+ metadata.gz: d232f4c37078cb3a7190f4791caecd02d16c0237fdb0fab4231b3ac323a8afe149f8c72f8a63b41fc83acbb4a77a40f6faf64c48fbf54fa55a91989661e0883f
7
+ data.tar.gz: fc67acb0c39f8fc12b3a8fdd83db7de9a77f5e5a255a031057fd632b27bb0afa4e08b54517250e0f6b6cce92f3d408e4369d3ddc3be1ae03aaa9f7c92e2a4888
data/.gitignore CHANGED
@@ -9,3 +9,5 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ debug.gem
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitmore (0.3.0.pre.rc)
4
+ gitmore (0.3.5.pre.alpha)
5
5
  colorize
6
6
 
7
7
  GEM
data/README.org ADDED
@@ -0,0 +1,65 @@
1
+ * Gitmore
2
+
3
+ Get more out of git! This library provides extra git commands that make
4
+ handling multiple repositories at one time much easier. Let's say you
5
+ have a microservice architecture, organized locally as multiple git
6
+ repositories in a single directory. The feature you are currently working
7
+ on requires changes in a handful of them. You have created branches by the
8
+ same name in the associated repositories. You have finished your work and
9
+ need to switch back to master for the entire system. Instead of trying to
10
+ remember the 5 (or was it 6?) different services you made changes in...
11
+
12
+ Try ~git branches feature/my-cool-feature~ to print out all repos in the current
13
+ directory that are checked out to the branch.
14
+
15
+ #+BEGIN_SRC text
16
+ my-cool-service-repo
17
+ bug/thing-was-broken
18
+ feature/cool-new-thing
19
+ * feature/my-cool-feature
20
+ some-other-branch
21
+
22
+ another-cool-service-repo
23
+ some-branch
24
+ some-other-branch
25
+ * feature/my-cool-feature
26
+ #+END_SRC
27
+
28
+ Other gitmore commands to try:
29
+
30
+ ~git checkouts <branch-name>~ (default: master) - Check out all branches that have a branch
31
+ by the given name. Warns and prints unstaged changes when applicable, does not check out branch
32
+ on that repo.
33
+
34
+ ~git diffs~ - Print diffs on all repos in current directory
35
+
36
+ ~git fetches~ - Run ~git fetch~ on all repos in current directory
37
+
38
+ ~git pulls~ - Pulls changes on all repos in current directory
39
+
40
+ ~git gems~ - Print names of repos that are ruby gem projects
41
+
42
+ ~git logf~ - Alias for ~git log --name-status --graph~
43
+
44
+ ~git rollback~ - Alias for ~git reset HEAD~1~
45
+
46
+ ~git save <name>~ - Alias for ~git stash save <name>~
47
+
48
+ ~git sstash <filename>~ - Stash a single file
49
+
50
+ ~git statuses~ - Print ~git status~ for each repo in directory
51
+
52
+ ~git versions ruby~ - Print version of ruby being used on each repo in the
53
+ current directory containing ~.ruby-version~
54
+
55
+ More features documentation forthcoming! I whipped these up when working
56
+ on a project with at least 30 repositories that I found I needed an easier
57
+ way to manage. Much work is yet to be done, so please create an issue
58
+ for problems, suggestions, or feature requests. And of course, feel free
59
+ to contribute! Fork, play and create a pull request!
60
+
61
+ * Install
62
+
63
+ ~gem install gitmore~
64
+
65
+
data/bin/console CHANGED
@@ -10,5 +10,7 @@ require "gitmore"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
+ require 'byebug'
14
+
13
15
  require "irb"
14
16
  IRB.start(__FILE__)
data/exe/git-branches CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  require 'gitmore'
4
4
 
5
- branch_matcher = ARGV[0]
5
+ branch_string = ARGV[0]
6
6
  option = ARGV[1]
7
+ matcher = Gitmore::Matcher.new(branch_string, option)
7
8
 
8
- Gitmore.branches(branch_matcher, option)
9
+ matcher.branches
data/exe/git-checkouts CHANGED
@@ -3,5 +3,6 @@
3
3
  require 'gitmore'
4
4
 
5
5
  branch_matcher = ARGV[0]
6
+ matcher = Gitmore::Matcher.new(branch_string)
6
7
 
7
- Gitmore.checkouts(branch_matcher)
8
+ matcher.checkouts
data/exe/git-diffs CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  require 'gitmore'
4
4
 
5
- Gitmore.diffs
5
+ Gitmore::Matcher.new.diffs
data/exe/git-fetches CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  require 'gitmore'
4
4
 
5
- Gitmore.fetches
5
+ Gitmore::Matcher.new.fetches
data/exe/git-gems CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  require 'gitmore'
4
4
 
5
- Gitmore.gems
5
+ Gitmore::Matcher.new.gems
data/exe/git-pulls CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  require 'gitmore'
4
4
 
5
- Gitmore.pulls
5
+ Gitmore::Matcher.new.pulls
data/exe/git-statuses CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  require 'gitmore'
4
4
 
5
- Gitmore.statuses
5
+ Gitmore::Matcher.new.statuses
data/exe/git-updates ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/ruby
2
+
3
+ `git fetches && git pulls`
data/exe/git-versions CHANGED
@@ -3,4 +3,4 @@
3
3
  require 'gitmore'
4
4
 
5
5
  language = ARGV[0]
6
- Gitmore.versions(language)
6
+ Gitmore::Matcher.new.versions(language)
data/lib/gitmore.rb CHANGED
@@ -1,49 +1,53 @@
1
1
  require 'gitmore/version'
2
-
3
- require 'helpers/branch_helper.rb'
4
- require 'helpers/ruby_helper.rb'
5
- require 'branch_matcher.rb'
6
- require 'statustician.rb'
2
+ require 'gitmore/utils'
7
3
 
8
4
  module Gitmore
9
5
  class Error < StandardError; end
10
- def self.branches(branch_string, option=nil)
11
- repositories = Gitmore::BranchMatcher.new(branch_string, option)
12
- repositories.branches
13
- end
14
6
 
15
- def self.checkouts(branch_string=nil)
16
- repositories = Gitmore::BranchMatcher.new(branch_string)
17
- repositories.checkout
18
- end
7
+ class Matcher
8
+ attr_reader :branch_string, :option
19
9
 
20
- def self.statuses(branch_string=nil)
21
- repositories = Gitmore::BranchMatcher.new(branch_string)
22
- repositories.status
23
- end
10
+ def initialize(branch_string=nil, option=nil)
11
+ @branch_string = branch_string
12
+ @option = option
13
+ end
24
14
 
25
- def self.diffs(branch_string=nil)
26
- repositories = Gitmore::BranchMatcher.new(branch_string)
27
- repositories.diffs
28
- end
15
+ def branches
16
+ repositories.branches
17
+ end
29
18
 
30
- def self.gems(branch_string=nil)
31
- repositories = Gitmore::BranchMatcher.new(branch_string)
32
- repositories.gems
33
- end
19
+ def checkouts
20
+ repositories.checkout
21
+ end
34
22
 
35
- def self.versions( language)
36
- repositories = Gitmore::BranchMatcher.new
37
- repositories.versions(language)
38
- end
23
+ def statuses
24
+ repositories.status
25
+ end
39
26
 
40
- def self.fetches
41
- repositories = Gitmore::BranchMatcher.new
42
- repositories.fetches
43
- end
27
+ def diffs
28
+ repositories.diffs
29
+ end
30
+
31
+ def gems
32
+ repositories.gems
33
+ end
34
+
35
+ def versions(language)
36
+ repositories.versions(language)
37
+ end
38
+
39
+ def fetches
40
+ repositories.fetches
41
+ end
42
+
43
+ def pulls
44
+ repositories.pulls
45
+ end
46
+
47
+ private
44
48
 
45
- def self.pulls
46
- repositories = Gitmore::BranchMatcher.new
47
- repositories.pulls
49
+ def repositories
50
+ Gitmore::Repositories.get_for(branch_string, option)
51
+ end
48
52
  end
49
53
  end
@@ -0,0 +1,3 @@
1
+ require_relative './helpers/branch_helper'
2
+ require_relative './helpers/ruby_helper'
3
+
@@ -6,9 +6,10 @@ module Gitmore
6
6
  !`git rev-parse --verify --quiet #{matcher}`.to_s.empty?
7
7
  end
8
8
 
9
- def format_branch_info(repository, result)
9
+ def format_branch_info(repository, result, color=:on_green)
10
10
  return unless result
11
- puts repository.colorize(:black).on_green
11
+ # puts repository.colorize(:black).on_green
12
+ puts repository.colorize(:black).send(color)
12
13
  puts puts result
13
14
  end
14
15
 
File without changes
@@ -0,0 +1,6 @@
1
+ require_relative './helpers'
2
+
3
+ require_relative './utils/repositories'
4
+ require_relative './utils/branches'
5
+ require_relative './utils/statustician'
6
+ require_relative './utils/branch_matcher'
@@ -1,9 +1,3 @@
1
- require_relative 'helpers/branch_helper.rb'
2
- require_relative 'helpers/ruby_helper.rb'
3
- require_relative 'repositories.rb'
4
- require_relative 'branches.rb'
5
- require_relative 'statustician.rb'
6
-
7
1
  module Gitmore
8
2
  class BranchMatcher
9
3
  attr_accessor :matcher, :option, :repositories
@@ -28,6 +28,14 @@ module Gitmore
28
28
  non_matching_repositories.each do |name|
29
29
  puts name.colorize(:red)
30
30
  end
31
+
32
+ puts puts
33
+
34
+ non_matching_repositories.each do |repository|
35
+ Dir.chdir(repository) do
36
+ format_branch_info(repository, `git branch --color`, :on_red)
37
+ end
38
+ end
31
39
  end
32
40
  end
33
41
 
@@ -1,5 +1,9 @@
1
1
  module Gitmore
2
2
  module Repositories
3
+ def self.get_for(branch_string, option)
4
+ Gitmore::BranchMatcher.new(branch_string, option)
5
+ end
6
+
3
7
  def self.get
4
8
  directories.select { |dir| Dir.entries(dir).include?('.git') }
5
9
  end
@@ -1,3 +1,3 @@
1
1
  module Gitmore
2
- VERSION = '0.3.0-rc'
2
+ VERSION = '0.3.5-alpha'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitmore
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0.pre.rc
4
+ version: 0.3.5.pre.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - son1112
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-28 00:00:00.000000000 Z
11
+ date: 2020-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -95,6 +95,7 @@ executables:
95
95
  - git-save
96
96
  - git-sstash
97
97
  - git-statuses
98
+ - git-updates
98
99
  - git-versions
99
100
  extensions: []
100
101
  extra_rdoc_files: []
@@ -107,6 +108,7 @@ files:
107
108
  - Gemfile
108
109
  - Gemfile.lock
109
110
  - LICENSE.txt
111
+ - README.org
110
112
  - Rakefile
111
113
  - bin/console
112
114
  - bin/setup
@@ -121,16 +123,19 @@ files:
121
123
  - exe/git-save
122
124
  - exe/git-sstash
123
125
  - exe/git-statuses
126
+ - exe/git-updates
124
127
  - exe/git-versions
125
128
  - gitmore.gemspec
126
- - lib/branch_matcher.rb
127
- - lib/branches.rb
128
129
  - lib/gitmore.rb
130
+ - lib/gitmore/helpers.rb
131
+ - lib/gitmore/helpers/branch_helper.rb
132
+ - lib/gitmore/helpers/ruby_helper.rb
133
+ - lib/gitmore/utils.rb
134
+ - lib/gitmore/utils/branch_matcher.rb
135
+ - lib/gitmore/utils/branches.rb
136
+ - lib/gitmore/utils/repositories.rb
137
+ - lib/gitmore/utils/statustician.rb
129
138
  - lib/gitmore/version.rb
130
- - lib/helpers/branch_helper.rb
131
- - lib/helpers/ruby_helper.rb
132
- - lib/repositories.rb
133
- - lib/statustician.rb
134
139
  homepage: https://github.com/son1112/gitmore
135
140
  licenses:
136
141
  - MIT