gitswitch 0.3.1 → 0.3.2
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.
- data/lib/gitswitch/cli.rb +12 -2
- data/lib/gitswitch/commands.rb +1 -8
- data/lib/gitswitch/version.rb +1 -1
- metadata +4 -4
data/lib/gitswitch/cli.rb
CHANGED
@@ -20,6 +20,17 @@ class Gitswitch
|
|
20
20
|
Gitswitch::new.create_fresh_gitswitch_file
|
21
21
|
end
|
22
22
|
end
|
23
|
+
|
24
|
+
# Grab the current global info to drop into the default slot -- if available
|
25
|
+
user = Gitswitch::get_git_user_info({:global => true})
|
26
|
+
if user[:name].empty? && user[:email].empty?
|
27
|
+
puts "No global git user.name and user.email configurations were found. Set up a default now."
|
28
|
+
add('default')
|
29
|
+
else
|
30
|
+
puts "Adding your global .gitconfig user info to the \"default\" tag..."
|
31
|
+
Gitswitch::new.set_gitswitch_entry('default', user[:email], user[:name])
|
32
|
+
end
|
33
|
+
|
23
34
|
end
|
24
35
|
|
25
36
|
|
@@ -55,7 +66,7 @@ class Gitswitch
|
|
55
66
|
method_option :repository, :type => :boolean, :aliases => "-r"
|
56
67
|
def switch(tag = 'default')
|
57
68
|
options[:global] ? global(tag) : Gitswitch.new.switch_repo_user(tag)
|
58
|
-
puts Gitswitch.current_user_info
|
69
|
+
puts Gitswitch.current_user_info(options)
|
59
70
|
end
|
60
71
|
|
61
72
|
|
@@ -64,7 +75,6 @@ class Gitswitch
|
|
64
75
|
map "-s" => :global
|
65
76
|
def global(tag = 'default')
|
66
77
|
Gitswitch.new.switch_global_user(tag)
|
67
|
-
puts Gitswitch.current_user_info
|
68
78
|
end
|
69
79
|
|
70
80
|
|
data/lib/gitswitch/commands.rb
CHANGED
@@ -26,14 +26,7 @@ class Gitswitch
|
|
26
26
|
# Create a .gitswitch file with the current user defaults
|
27
27
|
def create_fresh_gitswitch_file
|
28
28
|
@users = {}
|
29
|
-
|
30
|
-
if user[:name].empty? && user[:email].empty?
|
31
|
-
puts "ERROR: You must set up a default git user.name and user.email first."
|
32
|
-
else
|
33
|
-
puts "Adding your global .gitconfig user info to the \"default\" tag..."
|
34
|
-
set_gitswitch_entry('default', user[:email], user[:name])
|
35
|
-
save_gitswitch_file
|
36
|
-
end
|
29
|
+
save_gitswitch_file
|
37
30
|
end
|
38
31
|
|
39
32
|
def self.gitswitch_file_exists
|
data/lib/gitswitch/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitswitch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 2
|
10
|
+
version: 0.3.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Joe Alba
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
requirements: []
|
120
120
|
|
121
121
|
rubyforge_project:
|
122
|
-
rubygems_version: 1.5.
|
122
|
+
rubygems_version: 1.5.2
|
123
123
|
signing_key:
|
124
124
|
specification_version: 3
|
125
125
|
summary: Easy git user switching
|