gitswitch 0.3.2 → 0.5.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 +7 -0
- data/.github/workflows/tests.yml +32 -0
- data/.gitignore +1 -4
- data/Gemfile +1 -1
- data/README.rdoc +2 -10
- data/Rakefile +0 -1
- data/bin/gitswitch +2 -1
- data/gitswitch.gemspec +16 -12
- data/lib/gitswitch.rb +5 -2
- data/lib/gitswitch/cli.rb +169 -122
- data/lib/gitswitch/commands.rb +65 -81
- data/lib/gitswitch/git.rb +33 -0
- data/lib/gitswitch/version.rb +3 -3
- data/spec/git_spec.rb +12 -0
- data/spec/gitswitch_spec.rb +27 -38
- data/spec/spec_helper.rb +12 -4
- data/spec/tmp/.gitkeep +0 -0
- metadata +105 -87
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: e495045a498536c929c7ee81a01d0d4c2d2dde1622d9df5c4a09bf374fcee99e
|
|
4
|
+
data.tar.gz: 4f59cc61dec0c72ad4e0561743cd218b1e27af1d72750b97a1f533497cdeeeb8
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 1bcc6bed6d628b752034312cfbf58a30c9b7b8e0bc373b5d596538b7930de38f1f13e423171a9aeb2cf838da1430349797a93fed5c15c916fa0f5e835e7e6a0b
|
|
7
|
+
data.tar.gz: 6c0393c27ad23ddabc7d51e75616b63ef523006494303fab6176026c65acd0dbe5923fc741de46a8318ea047bb34a9cd9bb771485736958792abd43dc3484eb9
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: Ruby CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
paths-ignore:
|
|
8
|
+
- 'README.rdoc'
|
|
9
|
+
pull_request:
|
|
10
|
+
branches:
|
|
11
|
+
- main
|
|
12
|
+
paths-ignore:
|
|
13
|
+
- 'README.rdoc'
|
|
14
|
+
jobs:
|
|
15
|
+
test:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
if: "contains(github.event.commits[0].message, '[ci skip]') == false"
|
|
18
|
+
|
|
19
|
+
strategy:
|
|
20
|
+
matrix:
|
|
21
|
+
ruby: [3.0.2, 2.7.4, 2.6.8, 2.5.9]
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- name: Checkout
|
|
25
|
+
uses: actions/checkout@v2
|
|
26
|
+
- name: Setup Ruby
|
|
27
|
+
uses: ruby/setup-ruby@v1
|
|
28
|
+
with:
|
|
29
|
+
ruby-version: ${{ matrix.ruby }}
|
|
30
|
+
bundler-cache: true
|
|
31
|
+
- name: Test
|
|
32
|
+
run: bundle exec rake spec
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
source "
|
|
1
|
+
source "https://rubygems.org"
|
|
2
2
|
gemspec
|
data/README.rdoc
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
= gitswitch
|
|
2
2
|
|
|
3
|
-
Easily set/switch your current git user info for a git repo .git/config or your global ~/.gitconfig file.
|
|
3
|
+
Easily set/switch your current git user info for a git repo .git/config or your global ~/.gitconfig file.
|
|
4
4
|
|
|
5
5
|
This gem should come in handy if you have work and personal repositories. It also might help with switching between users while pair programming.
|
|
6
6
|
|
|
@@ -53,15 +53,7 @@ Delete a current entry. [TAG] parameter is optional. If omitted, you'll see a
|
|
|
53
53
|
# gitswitch delete [TAG]
|
|
54
54
|
|
|
55
55
|
Update your global .git user instead of your current repository
|
|
56
|
-
# gitswitch
|
|
56
|
+
# gitswitch switch work --global
|
|
57
57
|
|
|
58
58
|
Show your current git user info. If you are in a git repo directory, it will show you the info associated with the current repository. Outside a repo (or if you use the --global option), it will show you the info from your global .git config.
|
|
59
59
|
# gitswitch info
|
|
60
|
-
|
|
61
|
-
== What's with all the aliases?
|
|
62
|
-
|
|
63
|
-
I initially wrote the gem using optparse and used the '-r' style params to keep the commands as short as possible. Now, I've decided to lean toward a rake-style descriptive method of passing commands -- which meshes well with the way Thor likes to do things. But the old command line options still work fine in case you got used to it.
|
|
64
|
-
|
|
65
|
-
== Copyright
|
|
66
|
-
|
|
67
|
-
Copyright (c) 2010 Joe Alba. See LICENSE for details.
|
data/Rakefile
CHANGED
data/bin/gitswitch
CHANGED
data/gitswitch.gemspec
CHANGED
|
@@ -8,30 +8,34 @@ Gem::Specification.new do |s|
|
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
|
9
9
|
|
|
10
10
|
s.authors = ["Joe Alba"]
|
|
11
|
-
s.date = %q{
|
|
12
|
-
s.
|
|
13
|
-
s.homepage = %q{http://github.com/joealba/gitswitch}
|
|
11
|
+
s.date = %q{2012-04-29}
|
|
12
|
+
s.homepage = %q{https://github.com/joealba/gitswitch}
|
|
14
13
|
s.description = %q{Easily switch your git name/e-mail user info -- Handy for work vs. personal and for pair programming}
|
|
15
14
|
s.summary = %q{Easy git user switching}
|
|
16
15
|
s.email = %q{joe@joealba.com}
|
|
17
|
-
|
|
16
|
+
s.metadata = {
|
|
17
|
+
"bug_tracker_uri" => "#{s.homepage}/issues",
|
|
18
|
+
"changelog_uri" => "#{s.homepage}/blob/main/CHANGELOG.md",
|
|
19
|
+
"documentation_uri" => s.homepage.to_s,
|
|
20
|
+
"homepage_uri" => s.homepage.to_s,
|
|
21
|
+
"source_code_uri" => s.homepage.to_s
|
|
22
|
+
}
|
|
23
|
+
|
|
18
24
|
s.extra_rdoc_files = [
|
|
19
25
|
"LICENSE",
|
|
20
26
|
"README.rdoc"
|
|
21
27
|
]
|
|
22
|
-
|
|
28
|
+
|
|
23
29
|
s.files = `git ls-files`.split("\n")
|
|
24
30
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
25
31
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
26
32
|
s.require_paths = ["lib"]
|
|
27
33
|
|
|
28
34
|
s.rdoc_options = ["--charset=UTF-8"]
|
|
29
|
-
s.rubygems_version = %q{1.3.7}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
s.add_dependency('rake')
|
|
33
|
-
s.add_dependency('thor')
|
|
34
|
-
s.add_development_dependency(%q<rspec>, [">= 2.5.0"])
|
|
35
35
|
|
|
36
|
+
s.add_dependency('rake')
|
|
37
|
+
s.add_dependency('dry-cli')
|
|
38
|
+
s.add_dependency('tty-prompt')
|
|
39
|
+
s.add_development_dependency(%q<rspec>, [">= 3.3.0"])
|
|
40
|
+
s.add_development_dependency 'simplecov'
|
|
36
41
|
end
|
|
37
|
-
|
data/lib/gitswitch.rb
CHANGED
data/lib/gitswitch/cli.rb
CHANGED
|
@@ -1,160 +1,207 @@
|
|
|
1
|
-
require
|
|
1
|
+
require "dry/cli"
|
|
2
|
+
require "tty-prompt"
|
|
3
|
+
|
|
4
|
+
module Gitswitch
|
|
5
|
+
module CLI
|
|
6
|
+
module Helpers
|
|
7
|
+
def prompt_for_email_and_name
|
|
8
|
+
prompt = TTY::Prompt.new
|
|
9
|
+
email = prompt.ask(" E-mail address: ").to_s.chomp
|
|
10
|
+
if email.empty?
|
|
11
|
+
puts "No e-mail address provided"
|
|
12
|
+
exit Gitswitch::EXIT_MISSING_INFO
|
|
13
|
+
end
|
|
2
14
|
|
|
15
|
+
default_name = Gitswitch::get_git_user_info({global: true})[:name]
|
|
16
|
+
name = prompt.ask(" Name: (ENTER to use \"" + default_name + "\") ").to_s.chomp
|
|
17
|
+
name = default_name if name.empty?
|
|
3
18
|
|
|
4
|
-
|
|
5
|
-
|
|
19
|
+
if name.empty?
|
|
20
|
+
puts "No name provided"
|
|
21
|
+
end
|
|
6
22
|
|
|
23
|
+
return [email, name]
|
|
24
|
+
end
|
|
25
|
+
end
|
|
7
26
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
27
|
+
module Commands
|
|
28
|
+
extend Dry::CLI::Registry
|
|
29
|
+
|
|
30
|
+
class Init < Dry::CLI::Command
|
|
31
|
+
desc "Initialize your .gitswitch file"
|
|
32
|
+
|
|
33
|
+
def call(*)
|
|
34
|
+
prompt = TTY::Prompt.new
|
|
35
|
+
|
|
36
|
+
if !Gitswitch::gitswitch_file_exists
|
|
37
|
+
if prompt.yes?("Gitswitch users file ~/.gitswitch not found. Would you like to create one? (y/n):")
|
|
38
|
+
Gitswitch.create_fresh_gitswitch_file
|
|
39
|
+
else
|
|
40
|
+
puts "Ok, that's fine. Exiting."
|
|
41
|
+
exit Gitswitch::EXIT_OK
|
|
42
|
+
end
|
|
43
|
+
else
|
|
44
|
+
if prompt.yes?("Gitswitch users file ~/.gitswitch already exists. Would you like to wipe it out and create a fresh one? (y/n):")
|
|
45
|
+
Gitswitch.create_fresh_gitswitch_file
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Grab the current global info to drop into the default slot -- if available
|
|
50
|
+
user = Gitswitch.get_git_user_info({global: true})
|
|
51
|
+
if user[:name].empty? && user[:email].empty?
|
|
52
|
+
puts "No global git user.name and user.email configurations were found. Set up a default now."
|
|
53
|
+
add('default')
|
|
54
|
+
else
|
|
55
|
+
puts "Adding your global .gitconfig user info to the \"default\" tag..."
|
|
56
|
+
Gitswitch.set_gitswitch_entry('default', user[:email], user[:name])
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
exit Gitswitch::EXIT_OK
|
|
21
60
|
end
|
|
22
61
|
end
|
|
23
62
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
63
|
+
class Info < Dry::CLI::Command
|
|
64
|
+
desc "Show the current git user"
|
|
65
|
+
option :global, type: :boolean, default: false, desc: "Show global config"
|
|
66
|
+
|
|
67
|
+
def call(**options)
|
|
68
|
+
puts Gitswitch.current_user_info(options)
|
|
69
|
+
|
|
70
|
+
exit Gitswitch::EXIT_OK
|
|
71
|
+
end
|
|
32
72
|
end
|
|
33
73
|
|
|
34
|
-
|
|
74
|
+
class List < Dry::CLI::Command
|
|
75
|
+
desc "Show all the git user tags you have configured"
|
|
35
76
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
desc "version", "Show the gitswitch version"
|
|
39
|
-
map ["-v","--version"] => :version
|
|
40
|
-
def version
|
|
41
|
-
puts Gitswitch::VERSION
|
|
42
|
-
end
|
|
77
|
+
def call(*)
|
|
78
|
+
puts Gitswitch.list_users
|
|
43
79
|
|
|
80
|
+
exit Gitswitch::EXIT_OK
|
|
81
|
+
end
|
|
82
|
+
end
|
|
44
83
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def info
|
|
50
|
-
puts Gitswitch.current_user_info(options)
|
|
51
|
-
end
|
|
84
|
+
class Switch < Dry::CLI::Command
|
|
85
|
+
desc "Switch git user"
|
|
86
|
+
argument :tag, desc: "Tag name"
|
|
87
|
+
option :global, type: :boolean, default: false, desc: "Set global config"
|
|
52
88
|
|
|
89
|
+
def call(tag: "default", **options)
|
|
90
|
+
options[:global] ? Gitswitch.switch_global_user(tag) : Gitswitch.switch_repo_user(tag)
|
|
91
|
+
puts Gitswitch.current_user_info(options)
|
|
53
92
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
def list
|
|
58
|
-
puts Gitswitch.new.list_users
|
|
59
|
-
end
|
|
93
|
+
exit Gitswitch::EXIT_OK
|
|
94
|
+
end
|
|
95
|
+
end
|
|
60
96
|
|
|
97
|
+
class Global < Dry::CLI::Command
|
|
98
|
+
desc "Switch the global git user info (your ~/.gitconfig file)"
|
|
99
|
+
argument :tag, desc: "Tag name"
|
|
61
100
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
map "-r" => :switch
|
|
65
|
-
method_option :global, :type => :boolean, :aliases => ["-s","--global"] ## To support the deprecated behavior
|
|
66
|
-
method_option :repository, :type => :boolean, :aliases => "-r"
|
|
67
|
-
def switch(tag = 'default')
|
|
68
|
-
options[:global] ? global(tag) : Gitswitch.new.switch_repo_user(tag)
|
|
69
|
-
puts Gitswitch.current_user_info(options)
|
|
70
|
-
end
|
|
101
|
+
def call(tag: "default", **)
|
|
102
|
+
Gitswitch.switch_global_user(tag)
|
|
71
103
|
|
|
104
|
+
exit Gitswitch::EXIT_OK
|
|
105
|
+
end
|
|
106
|
+
end
|
|
72
107
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
end
|
|
108
|
+
class Add < Dry::CLI::Command
|
|
109
|
+
include ::Gitswitch::CLI::Helpers
|
|
110
|
+
|
|
111
|
+
desc "Add a new tagged user entry"
|
|
112
|
+
argument :tag, desc: "Tag name"
|
|
79
113
|
|
|
114
|
+
def call(tag: "", **)
|
|
115
|
+
tag = tag.gsub(/\W+/,'')
|
|
116
|
+
if (tag.nil? || tag.empty?)
|
|
117
|
+
prompt = TTY::Prompt.new
|
|
118
|
+
tag = prompt.ask("Enter a tag to describe this git user entry: ").to_s.gsub(/\W+/,'')
|
|
119
|
+
end
|
|
80
120
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
gs = Gitswitch.new
|
|
121
|
+
if tag.empty?
|
|
122
|
+
puts "You must enter a short tag to describe the git user entry you would like to save."
|
|
123
|
+
exit Gitswitch::EXIT_MISSING_INFO
|
|
124
|
+
end
|
|
86
125
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
exit
|
|
126
|
+
puts "Adding a new gitswitch user entry for tag '#{tag}'"
|
|
127
|
+
(email, name) = prompt_for_email_and_name
|
|
128
|
+
Gitswitch.set_gitswitch_entry(tag, email, name)
|
|
129
|
+
exit Gitswitch::EXIT_OK
|
|
130
|
+
end
|
|
93
131
|
end
|
|
94
132
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
gs.set_gitswitch_entry(tag, email, name)
|
|
98
|
-
end
|
|
133
|
+
class Delete < Dry::CLI::Command
|
|
134
|
+
desc "Delete a tagged user entry"
|
|
99
135
|
|
|
136
|
+
def call(tag: "")
|
|
137
|
+
tag_table = Gitswitch.get_tag_display
|
|
100
138
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
puts "Updating #{tag} entry..."
|
|
114
|
-
(email, name) = prompt_for_email_and_name
|
|
115
|
-
Gitswitch.new.set_gitswitch_entry(tag, email, name)
|
|
116
|
-
end
|
|
139
|
+
tag = tag.gsub(/\W+/, '')
|
|
140
|
+
if (tag.empty?)
|
|
141
|
+
puts tag_table
|
|
142
|
+
prompt = TTY::Prompt.new
|
|
143
|
+
tag = prompt.ask("\nWhich tag would you like to delete: ").to_s.gsub(/\W+/,'')
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
if tag.empty?
|
|
147
|
+
puts "No tag chosen"
|
|
148
|
+
exit Gitswitch::EXIT_MISSING_INFO
|
|
149
|
+
end
|
|
117
150
|
|
|
151
|
+
Gitswitch.delete_gitswitch_entry(tag)
|
|
118
152
|
|
|
119
|
-
|
|
120
|
-
desc "delete [TAG]", "Delete a tagged user entry"
|
|
121
|
-
def delete(tag = '')
|
|
122
|
-
gs = Gitswitch.new
|
|
153
|
+
puts Gitswitch.get_tag_display
|
|
123
154
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
tag.gsub!(/\W+/,'')
|
|
127
|
-
if (tag.nil? || tag.empty?)
|
|
128
|
-
tag = ask("Which tag would you like to delete: \n#{tag_table}").gsub(/\W+/,'')
|
|
155
|
+
exit Gitswitch::EXIT_OK
|
|
156
|
+
end
|
|
129
157
|
end
|
|
130
158
|
|
|
131
|
-
|
|
132
|
-
|
|
159
|
+
class Update < Dry::CLI::Command
|
|
160
|
+
include ::Gitswitch::CLI::Helpers
|
|
133
161
|
|
|
162
|
+
desc "Update a tagged user entry"
|
|
163
|
+
argument :tag, desc: "Tag name"
|
|
134
164
|
|
|
135
|
-
|
|
136
|
-
|
|
165
|
+
def call(tag: "", **)
|
|
166
|
+
tag_table = Gitswitch.get_tag_display
|
|
137
167
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
168
|
+
tag = tag.gsub(/\W+/, '')
|
|
169
|
+
if (tag.empty?)
|
|
170
|
+
prompt = TTY::Prompt.new
|
|
171
|
+
tag = prompt.ask("Which tag would you like to update: \n#{tag_table}\nTag: ").to_s.gsub(/\W+/,'')
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
if tag.empty?
|
|
175
|
+
puts "No tag chosen"
|
|
176
|
+
exit Gitswitch::EXIT_MISSING_INFO
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
puts "Updating #{tag} entry..."
|
|
180
|
+
(email, name) = prompt_for_email_and_name
|
|
181
|
+
Gitswitch.set_gitswitch_entry(tag, email, name)
|
|
182
|
+
|
|
183
|
+
exit Gitswitch::EXIT_OK
|
|
184
|
+
end
|
|
145
185
|
end
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
186
|
+
|
|
187
|
+
class Version < Dry::CLI::Command
|
|
188
|
+
desc "Show the gitswitch version"
|
|
189
|
+
|
|
190
|
+
def call(*)
|
|
191
|
+
puts Gitswitch::VERSION
|
|
192
|
+
|
|
193
|
+
exit Gitswitch::EXIT_OK
|
|
194
|
+
end
|
|
153
195
|
end
|
|
154
196
|
|
|
155
|
-
|
|
197
|
+
register "add", Add, aliases: ["-a", "--add"]
|
|
198
|
+
register "delete", Delete, aliases: ["remove"]
|
|
199
|
+
register "info", Info, aliases: ["-i", "--info"]
|
|
200
|
+
register "init", Init
|
|
201
|
+
register "list", List, aliases: ["-l", "--list"]
|
|
202
|
+
register "switch", Switch, aliases: ["-r"]
|
|
203
|
+
register "update", Update, aliases: ["-o","--overwrite"]
|
|
204
|
+
register "version", Version, aliases: ["-v", "--version"]
|
|
156
205
|
end
|
|
157
|
-
|
|
158
|
-
|
|
159
206
|
end
|
|
160
|
-
end
|
|
207
|
+
end
|
data/lib/gitswitch/commands.rb
CHANGED
|
@@ -1,45 +1,42 @@
|
|
|
1
1
|
require 'yaml'
|
|
2
|
-
require 'shellwords' if !String.new.methods.include?('shellescape')
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class Gitswitch
|
|
6
|
-
GITSWITCH_CONFIG_FILE = File.join ENV["HOME"], ".gitswitch"
|
|
7
|
-
GIT_BIN = '/usr/bin/env git'
|
|
8
|
-
|
|
9
|
-
attr_reader :users
|
|
10
2
|
|
|
3
|
+
module Gitswitch
|
|
4
|
+
def self.gitswitch_config_file
|
|
5
|
+
ENV['GITSWITCH_CONFIG_FILE'] || File.join(ENV["HOME"], ".gitswitch")
|
|
6
|
+
end
|
|
11
7
|
|
|
12
8
|
##############################################################
|
|
13
|
-
def
|
|
14
|
-
@users
|
|
9
|
+
def self.users
|
|
10
|
+
@users ||= load_users
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.load_users
|
|
14
|
+
user_hash = {}
|
|
15
15
|
if Gitswitch::gitswitch_file_exists
|
|
16
|
-
|
|
17
|
-
if @users.nil?
|
|
18
|
-
puts "Error loading .gitswitch file. Delete the file and start fresh."
|
|
19
|
-
exit
|
|
20
|
-
end
|
|
16
|
+
user_hash = YAML::load_file gitswitch_config_file
|
|
21
17
|
end
|
|
18
|
+
user_hash
|
|
22
19
|
end
|
|
23
|
-
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
@users = {}
|
|
29
|
-
save_gitswitch_file
|
|
21
|
+
## Create a .gitswitch file with the current user defaults
|
|
22
|
+
def self.create_fresh_gitswitch_file
|
|
23
|
+
save_gitswitch_file({})
|
|
30
24
|
end
|
|
31
25
|
|
|
32
26
|
def self.gitswitch_file_exists
|
|
33
|
-
File.exists?
|
|
27
|
+
File.exists? gitswitch_config_file
|
|
34
28
|
end
|
|
35
29
|
|
|
36
|
-
def save_gitswitch_file
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
def self.save_gitswitch_file(users_hash)
|
|
31
|
+
begin
|
|
32
|
+
File.open(gitswitch_config_file, 'w') do |fh|
|
|
33
|
+
fh.write(users_hash.to_yaml)
|
|
34
|
+
end
|
|
35
|
+
rescue
|
|
36
|
+
warn "ERROR: Could not open/write the gitswitch config file: #{gitswitch_config_file}: #{$!}"
|
|
37
|
+
exit
|
|
42
38
|
end
|
|
39
|
+
@users = nil
|
|
43
40
|
end
|
|
44
41
|
|
|
45
42
|
|
|
@@ -49,68 +46,57 @@ class Gitswitch
|
|
|
49
46
|
# * +tag+ - Required. The tag you want to add to your .gitswitch file
|
|
50
47
|
# * +email+ - Required
|
|
51
48
|
# * +name+ - Required
|
|
52
|
-
def set_gitswitch_entry(tag, email, name)
|
|
53
|
-
|
|
54
|
-
save_gitswitch_file
|
|
49
|
+
def self.set_gitswitch_entry(tag, email, name)
|
|
50
|
+
users[tag] = {name: name, email: email}
|
|
51
|
+
save_gitswitch_file(users)
|
|
55
52
|
end
|
|
56
53
|
|
|
57
|
-
def delete_gitswitch_entry(tag)
|
|
54
|
+
def self.delete_gitswitch_entry(tag)
|
|
58
55
|
if tag == 'default'
|
|
59
56
|
puts "Cannot delete the default tag. Use the update command instead"
|
|
60
57
|
exit
|
|
61
58
|
end
|
|
62
|
-
|
|
63
|
-
save_gitswitch_file
|
|
59
|
+
users.delete(tag)
|
|
60
|
+
save_gitswitch_file(users)
|
|
64
61
|
end
|
|
65
62
|
|
|
66
|
-
def get_user(tag)
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
def self.get_user(tag)
|
|
64
|
+
## TODO: Stop coding so defensively.
|
|
65
|
+
if !users.empty? && users[tag] && !users[tag].empty?
|
|
66
|
+
users[tag]
|
|
69
67
|
end
|
|
70
68
|
end
|
|
71
69
|
|
|
72
|
-
def get_tags
|
|
73
|
-
|
|
70
|
+
def self.get_tags
|
|
71
|
+
users.keys
|
|
74
72
|
end
|
|
75
73
|
|
|
76
|
-
def get_tag_display
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
def self.get_tag_display
|
|
75
|
+
users.map do |key, user|
|
|
76
|
+
item = "#{key}:\n"
|
|
77
|
+
item << " Name: #{user[:name]}\n" if !user[:name].to_s.empty?
|
|
78
|
+
item << " E-mail: #{user[:email]}\n"
|
|
79
|
+
item
|
|
80
|
+
end.join("\n")
|
|
79
81
|
end
|
|
80
82
|
|
|
81
|
-
def list_users
|
|
82
|
-
response =
|
|
83
|
-
response <<
|
|
84
|
-
|
|
85
|
-
response << "#{key}:\n"
|
|
86
|
-
response << " Name: #{user[:name]}\n" if !user[:name].to_s.empty?
|
|
87
|
-
response << " E-mail: #{user[:email]}\n\n"
|
|
88
|
-
end
|
|
83
|
+
def self.list_users
|
|
84
|
+
response = "\nCurrent git user options --\n"
|
|
85
|
+
response << get_tag_display
|
|
86
|
+
|
|
89
87
|
response
|
|
90
88
|
end
|
|
91
89
|
|
|
92
90
|
## Return active user information.
|
|
93
91
|
## If you're in a git repo, show that user info. Otherwise, display the global info.
|
|
94
92
|
def self.current_user_info(options = {})
|
|
95
|
-
response = !Gitswitch::in_a_git_repo || options[:global] ? "Your git user information from your global config:\n" : "Your git user information from the current repository:\n"
|
|
96
93
|
current_git_user = Gitswitch::get_git_user_info(options)
|
|
97
|
-
response << "Name: #{current_git_user[:name]}\n"
|
|
98
|
-
response << "E-mail: #{current_git_user[:email]}\n"
|
|
99
|
-
response
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def self.in_a_git_repo
|
|
103
|
-
%x(#{GIT_BIN} status 2>&1 | head -n 1).to_s =~ /^fatal/i ? false : true
|
|
104
|
-
end
|
|
105
94
|
|
|
95
|
+
response = !Gitswitch::in_a_git_repo || options[:global] ? "Your git user information from your global config:\n" : "Your git user information from the current repository:\n"
|
|
96
|
+
response << "Name: #{current_git_user[:name]}\n"
|
|
97
|
+
response << "E-mail: #{current_git_user[:email]}\n"
|
|
106
98
|
|
|
107
|
-
|
|
108
|
-
def git_config(user, options = {})
|
|
109
|
-
git_args = 'config --replace-all'
|
|
110
|
-
git_args += ' --global' if options[:global]
|
|
111
|
-
|
|
112
|
-
%x(#{GIT_BIN} #{git_args} user.email #{user[:email].to_s.shellescape})
|
|
113
|
-
%x(#{GIT_BIN} #{git_args} user.name #{user[:name].to_s.shellescape}) if !user[:name].to_s.empty?
|
|
99
|
+
response
|
|
114
100
|
end
|
|
115
101
|
|
|
116
102
|
|
|
@@ -118,21 +104,21 @@ class Gitswitch
|
|
|
118
104
|
# Switch git user in your global .gitconfig file
|
|
119
105
|
# ==== Parameters
|
|
120
106
|
# * +tag+ - The tag associated with your desired git info in .gitswitch. Defaults to "default".
|
|
121
|
-
def switch_global_user
|
|
107
|
+
def self.switch_global_user(tag = "default")
|
|
122
108
|
if user = get_user(tag)
|
|
123
109
|
puts "Switching your .gitconfig user info to \"#{tag}\" tag (#{user[:name]} <#{user[:email]}>)."
|
|
124
|
-
git_config(user, {:
|
|
110
|
+
git_config(user, {global: true})
|
|
125
111
|
else
|
|
126
112
|
puts "ERROR: Could not find info for tag \"#{tag}\" in your .gitswitch file"
|
|
127
113
|
end
|
|
128
114
|
end
|
|
129
115
|
|
|
130
116
|
|
|
117
|
+
##############################################################
|
|
131
118
|
# Set the git user information for current repository
|
|
132
119
|
# ==== Parameters
|
|
133
120
|
# * +tag+ - The tag associated with your desired git info in .gitswitch. Defaults to "default".
|
|
134
|
-
def switch_repo_user(tag = "default")
|
|
135
|
-
## TODO: See if we're actually in a git repo
|
|
121
|
+
def self.switch_repo_user(tag = "default")
|
|
136
122
|
if !Gitswitch::in_a_git_repo
|
|
137
123
|
puts "You do not appear to currently be in a git repository directory"
|
|
138
124
|
false
|
|
@@ -146,19 +132,17 @@ class Gitswitch
|
|
|
146
132
|
end
|
|
147
133
|
end
|
|
148
134
|
|
|
135
|
+
##############################################################
|
|
136
|
+
# TODO: Straight delegation through to Gitswitch::Git
|
|
137
|
+
def self.in_a_git_repo
|
|
138
|
+
Gitswitch::Git.in_a_git_repo
|
|
139
|
+
end
|
|
149
140
|
|
|
150
|
-
|
|
151
|
-
|
|
141
|
+
def self.git_config(user, options = {})
|
|
142
|
+
Gitswitch::Git.git_config(user, options)
|
|
143
|
+
end
|
|
152
144
|
|
|
153
|
-
# Show the current git user info
|
|
154
145
|
def self.get_git_user_info(options = {})
|
|
155
|
-
|
|
156
|
-
git_args += ' --global' if options[:global]
|
|
157
|
-
|
|
158
|
-
{
|
|
159
|
-
:name => %x(#{GIT_BIN} #{git_args} user.name).to_s.chomp,
|
|
160
|
-
:email => %x(#{GIT_BIN} #{git_args} user.email).to_s.chomp
|
|
161
|
-
}
|
|
146
|
+
Gitswitch::Git.get_git_user_info(options)
|
|
162
147
|
end
|
|
163
|
-
|
|
164
148
|
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'shellwords' if !String.new.methods.include?('shellescape')
|
|
2
|
+
|
|
3
|
+
module Gitswitch
|
|
4
|
+
module Git
|
|
5
|
+
GIT_BIN = '/usr/bin/env git'
|
|
6
|
+
|
|
7
|
+
def self.version
|
|
8
|
+
%x(#{GIT_BIN} --version).to_s.gsub(/^git version\s*/, '')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.in_a_git_repo
|
|
12
|
+
%x(#{GIT_BIN} status 2>&1 | head -n 1).to_s =~ /^fatal/i ? false : true
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.git_config(user, options = {})
|
|
16
|
+
git_args = 'config --replace-all'
|
|
17
|
+
git_args += ' --global' if options[:global]
|
|
18
|
+
|
|
19
|
+
%x(#{GIT_BIN} #{git_args} user.email #{user[:email].to_s.shellescape})
|
|
20
|
+
%x(#{GIT_BIN} #{git_args} user.name #{user[:name].to_s.shellescape}) if !user[:name].to_s.empty?
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.get_git_user_info(options = {})
|
|
24
|
+
git_args = 'config --get'
|
|
25
|
+
git_args += ' --global' if options[:global]
|
|
26
|
+
|
|
27
|
+
{
|
|
28
|
+
name: %x(#{GIT_BIN} #{git_args} user.name).to_s.chomp,
|
|
29
|
+
email: %x(#{GIT_BIN} #{git_args} user.email).to_s.chomp
|
|
30
|
+
}
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
data/lib/gitswitch/version.rb
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
end
|
|
1
|
+
module Gitswitch
|
|
2
|
+
VERSION = "0.5.0"
|
|
3
|
+
end
|
data/spec/git_spec.rb
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Gitswitch::Git do
|
|
4
|
+
it "finds the git executable" do
|
|
5
|
+
result = %x[#{Gitswitch::Git::GIT_BIN} --version]
|
|
6
|
+
expect($?.exitstatus).to eq 0
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
it "grabs the local git version" do
|
|
10
|
+
expect(Gitswitch::Git.version).to match /^\d+\.+\d+/ # Should start off looking like a version number
|
|
11
|
+
end
|
|
12
|
+
end
|
data/spec/gitswitch_spec.rb
CHANGED
|
@@ -1,68 +1,57 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Gitswitch do
|
|
4
|
-
|
|
5
4
|
describe "basics" do
|
|
6
5
|
it "should have a VERSION" do
|
|
7
|
-
Gitswitch::VERSION.
|
|
6
|
+
expect(Gitswitch::VERSION).not_to eq ''
|
|
8
7
|
end
|
|
9
|
-
|
|
10
|
-
it "should find the git executable" do
|
|
11
|
-
result = %x[#{Gitswitch::GIT_BIN} --version]
|
|
12
|
-
$?.exitstatus.should == 0
|
|
13
|
-
end
|
|
14
8
|
end
|
|
15
9
|
|
|
16
|
-
|
|
17
10
|
describe "read-only" do
|
|
18
|
-
it "
|
|
19
|
-
|
|
20
|
-
end
|
|
21
|
-
it "should show the current list of available gitswitch tags" do
|
|
22
|
-
pending
|
|
11
|
+
it "shows the current list of available gitswitch tags" do
|
|
12
|
+
skip
|
|
23
13
|
end
|
|
24
14
|
end
|
|
25
15
|
|
|
26
|
-
|
|
27
16
|
describe "write methods" do
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
pending
|
|
17
|
+
before :each do
|
|
18
|
+
Gitswitch.create_fresh_gitswitch_file
|
|
31
19
|
end
|
|
32
20
|
|
|
33
|
-
it "
|
|
34
|
-
|
|
21
|
+
it "allows you to add a new user entry" do
|
|
22
|
+
initial_user_count = Gitswitch.users.keys.count
|
|
23
|
+
set_test_entry
|
|
24
|
+
expect(Gitswitch.users.keys.count > initial_user_count).to eq true
|
|
35
25
|
end
|
|
36
26
|
|
|
37
|
-
it "
|
|
38
|
-
|
|
27
|
+
it "allows you to update a user entry" do
|
|
28
|
+
set_test_entry
|
|
29
|
+
test_entry = get_test_entry
|
|
30
|
+
Gitswitch.set_gitswitch_entry(test_entry[0], 'testing@test.com', test_entry[2])
|
|
31
|
+
expect(Gitswitch.get_user(test_entry[0])[:email]).to eq 'testing@test.com'
|
|
32
|
+
expect(Gitswitch.get_user(test_entry[0])[:name]).to eq test_entry[2]
|
|
39
33
|
end
|
|
40
34
|
|
|
41
|
-
it "
|
|
42
|
-
|
|
35
|
+
it "allows you to delete a user entry" do
|
|
36
|
+
set_test_entry
|
|
37
|
+
Gitswitch.delete_gitswitch_entry(get_test_entry[0])
|
|
38
|
+
expect(Gitswitch.users.keys.count).to eq 0
|
|
43
39
|
end
|
|
44
40
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
it "should allow you to change the global git user credentials" do
|
|
51
|
-
pending
|
|
41
|
+
it "allows you to overwrite the current .gitswitch file and start fresh" do
|
|
42
|
+
set_test_entry
|
|
43
|
+
Gitswitch.create_fresh_gitswitch_file
|
|
44
|
+
expect(Gitswitch.users.keys.count).to eq 0
|
|
52
45
|
end
|
|
53
|
-
|
|
54
|
-
it "should allow you to change a specific repository's user credentials" do
|
|
55
|
-
pending
|
|
56
|
-
end
|
|
57
46
|
end
|
|
58
47
|
|
|
59
|
-
|
|
60
48
|
describe "weird outlier cases" do
|
|
61
|
-
|
|
62
49
|
it "in a git repo directory with no user info specified, show the global config header and user info" do
|
|
63
|
-
|
|
50
|
+
skip
|
|
64
51
|
end
|
|
65
|
-
|
|
66
52
|
end
|
|
67
53
|
|
|
54
|
+
it "shows the current git user credentials" do
|
|
55
|
+
expect(Gitswitch.current_user_info).to match /^Your git user/
|
|
56
|
+
end
|
|
68
57
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
|
+
require 'simplecov'
|
|
2
|
+
SimpleCov.start
|
|
3
|
+
|
|
1
4
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
|
2
5
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
3
|
-
|
|
6
|
+
|
|
4
7
|
require 'gitswitch'
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
RSpec.configure do |c|
|
|
10
|
+
end
|
|
8
11
|
|
|
12
|
+
ENV['GITSWITCH_CONFIG_FILE'] = File.join(File.dirname(__FILE__), 'tmp', '.gitswitch')
|
|
9
13
|
|
|
10
|
-
|
|
14
|
+
def get_test_entry
|
|
15
|
+
['test','test@null.com', 'A. Tester']
|
|
16
|
+
end
|
|
11
17
|
|
|
18
|
+
def set_test_entry
|
|
19
|
+
Gitswitch.set_gitswitch_entry(*get_test_entry)
|
|
12
20
|
end
|
data/spec/tmp/.gitkeep
ADDED
|
File without changes
|
metadata
CHANGED
|
@@ -1,82 +1,101 @@
|
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gitswitch
|
|
3
|
-
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
5
|
-
prerelease:
|
|
6
|
-
segments:
|
|
7
|
-
- 0
|
|
8
|
-
- 3
|
|
9
|
-
- 2
|
|
10
|
-
version: 0.3.2
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.5.0
|
|
11
5
|
platform: ruby
|
|
12
|
-
authors:
|
|
6
|
+
authors:
|
|
13
7
|
- Joe Alba
|
|
14
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
15
9
|
bindir: bin
|
|
16
10
|
cert_chain: []
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
dependencies:
|
|
21
|
-
- !ruby/object:Gem::Dependency
|
|
11
|
+
date: 2012-04-29 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
22
14
|
name: rake
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '0'
|
|
20
|
+
type: :runtime
|
|
23
21
|
prerelease: false
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: dry-cli
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
27
31
|
- - ">="
|
|
28
|
-
- !ruby/object:Gem::Version
|
|
29
|
-
|
|
30
|
-
segments:
|
|
31
|
-
- 0
|
|
32
|
-
version: "0"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
33
34
|
type: :runtime
|
|
34
|
-
version_requirements: *id001
|
|
35
|
-
- !ruby/object:Gem::Dependency
|
|
36
|
-
name: thor
|
|
37
35
|
prerelease: false
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
requirements:
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
41
38
|
- - ">="
|
|
42
|
-
- !ruby/object:Gem::Version
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: tty-prompt
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
47
48
|
type: :runtime
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
50
56
|
name: rspec
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 3.3.0
|
|
62
|
+
type: :development
|
|
51
63
|
prerelease: false
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: 3.3.0
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: simplecov
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
55
73
|
- - ">="
|
|
56
|
-
- !ruby/object:Gem::Version
|
|
57
|
-
|
|
58
|
-
segments:
|
|
59
|
-
- 2
|
|
60
|
-
- 5
|
|
61
|
-
- 0
|
|
62
|
-
version: 2.5.0
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
63
76
|
type: :development
|
|
64
|
-
|
|
65
|
-
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
description: Easily switch your git name/e-mail user info -- Handy for work vs. personal
|
|
84
|
+
and for pair programming
|
|
66
85
|
email: joe@joealba.com
|
|
67
|
-
executables:
|
|
86
|
+
executables:
|
|
68
87
|
- gitswitch
|
|
69
88
|
extensions: []
|
|
70
|
-
|
|
71
|
-
extra_rdoc_files:
|
|
89
|
+
extra_rdoc_files:
|
|
72
90
|
- LICENSE
|
|
73
91
|
- README.rdoc
|
|
74
|
-
files:
|
|
75
|
-
- .bundle/config
|
|
76
|
-
- .document
|
|
77
|
-
- .gemtest
|
|
78
|
-
- .
|
|
79
|
-
- .
|
|
92
|
+
files:
|
|
93
|
+
- ".bundle/config"
|
|
94
|
+
- ".document"
|
|
95
|
+
- ".gemtest"
|
|
96
|
+
- ".github/workflows/tests.yml"
|
|
97
|
+
- ".gitignore"
|
|
98
|
+
- ".rspec"
|
|
80
99
|
- Gemfile
|
|
81
100
|
- LICENSE
|
|
82
101
|
- README.rdoc
|
|
@@ -86,43 +105,42 @@ files:
|
|
|
86
105
|
- lib/gitswitch.rb
|
|
87
106
|
- lib/gitswitch/cli.rb
|
|
88
107
|
- lib/gitswitch/commands.rb
|
|
108
|
+
- lib/gitswitch/git.rb
|
|
89
109
|
- lib/gitswitch/version.rb
|
|
110
|
+
- spec/git_spec.rb
|
|
90
111
|
- spec/gitswitch_spec.rb
|
|
91
112
|
- spec/spec_helper.rb
|
|
92
|
-
|
|
93
|
-
homepage:
|
|
113
|
+
- spec/tmp/.gitkeep
|
|
114
|
+
homepage: https://github.com/joealba/gitswitch
|
|
94
115
|
licenses: []
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
116
|
+
metadata:
|
|
117
|
+
bug_tracker_uri: https://github.com/joealba/gitswitch/issues
|
|
118
|
+
changelog_uri: https://github.com/joealba/gitswitch/blob/main/CHANGELOG.md
|
|
119
|
+
documentation_uri: https://github.com/joealba/gitswitch
|
|
120
|
+
homepage_uri: https://github.com/joealba/gitswitch
|
|
121
|
+
source_code_uri: https://github.com/joealba/gitswitch
|
|
122
|
+
post_install_message:
|
|
123
|
+
rdoc_options:
|
|
124
|
+
- "--charset=UTF-8"
|
|
125
|
+
require_paths:
|
|
100
126
|
- lib
|
|
101
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
|
102
|
-
|
|
103
|
-
requirements:
|
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
104
129
|
- - ">="
|
|
105
|
-
- !ruby/object:Gem::Version
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
version: "0"
|
|
110
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
|
-
none: false
|
|
112
|
-
requirements:
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: '0'
|
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
|
+
requirements:
|
|
113
134
|
- - ">="
|
|
114
|
-
- !ruby/object:Gem::Version
|
|
115
|
-
|
|
116
|
-
segments:
|
|
117
|
-
- 0
|
|
118
|
-
version: "0"
|
|
135
|
+
- !ruby/object:Gem::Version
|
|
136
|
+
version: '0'
|
|
119
137
|
requirements: []
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
signing_key:
|
|
124
|
-
specification_version: 3
|
|
138
|
+
rubygems_version: 3.2.22
|
|
139
|
+
signing_key:
|
|
140
|
+
specification_version: 4
|
|
125
141
|
summary: Easy git user switching
|
|
126
|
-
test_files:
|
|
142
|
+
test_files:
|
|
143
|
+
- spec/git_spec.rb
|
|
127
144
|
- spec/gitswitch_spec.rb
|
|
128
145
|
- spec/spec_helper.rb
|
|
146
|
+
- spec/tmp/.gitkeep
|