git_commands 3.2.6 → 3.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/git_commands/cli.rb +6 -10
- data/lib/git_commands/{command.rb → computer.rb} +9 -3
- data/lib/git_commands/version.rb +1 -1
- data/lib/git_commands.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbe7c65035ffcdc39c81b47463b9314aa07ab8a3
|
4
|
+
data.tar.gz: e0ce45188c080726af5ce804af1da49f2c5ed874
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f165f80fcdb236a9da0549bd496f23573e996a3a8c4252a5b22e069350ac0007fd75268e585041eb6bb10546db5f597bc51eb48ae10f48bfa73e5736f3b266a
|
7
|
+
data.tar.gz: 9defaf6c85f58a02fcfe511e358443b4ff472074911f0ccea4ef4eca31c80f57e7416f42b990def0cae5b4b75bcada4107c23aed996923578aa0e535448f79ea
|
data/lib/git_commands/cli.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require "optparse"
|
2
|
-
require "git_commands/
|
2
|
+
require "git_commands/computer"
|
3
3
|
|
4
4
|
module GitCommands
|
5
5
|
class CLI
|
@@ -9,9 +9,9 @@ module GitCommands
|
|
9
9
|
|
10
10
|
class UnknownCommandError < ArgumentError; end
|
11
11
|
|
12
|
-
def initialize(command_name:, args: ARGV, out: STDOUT,
|
12
|
+
def initialize(command_name:, args: ARGV, out: STDOUT, computer_klass: Computer)
|
13
13
|
@command_name = check_command_name(command_name)
|
14
|
-
@
|
14
|
+
@computer_klass = computer_klass
|
15
15
|
@args = args
|
16
16
|
@out = out
|
17
17
|
@repo = nil
|
@@ -20,17 +20,13 @@ module GitCommands
|
|
20
20
|
|
21
21
|
def call
|
22
22
|
parser.parse!(@args)
|
23
|
-
|
24
|
-
|
25
|
-
rescue
|
23
|
+
computer = @computer_klass.new(repo: @repo, branches: @branches)
|
24
|
+
computer.send(@command_name)
|
25
|
+
rescue Computer::GitError, AbortError, Repository::InvalidError => e
|
26
26
|
error(e.message)
|
27
27
|
exit
|
28
28
|
end
|
29
29
|
|
30
|
-
private def create_command
|
31
|
-
return @command if @command
|
32
|
-
end
|
33
|
-
|
34
30
|
private def check_command_name(name)
|
35
31
|
return name if VALID_COMMANDS.include?(name)
|
36
32
|
fail UnknownCommandError, "#{name} is not a supported command"
|
@@ -6,7 +6,7 @@ require "git_commands/branch"
|
|
6
6
|
require "git_commands/repository"
|
7
7
|
|
8
8
|
module GitCommands
|
9
|
-
class
|
9
|
+
class Computer
|
10
10
|
include Prompt
|
11
11
|
|
12
12
|
class GitError < StandardError; end
|
@@ -44,10 +44,9 @@ module GitCommands
|
|
44
44
|
`git pull origin #{branch}`
|
45
45
|
next unless rebase_with_master
|
46
46
|
`git push -f origin #{branch}`
|
47
|
-
`git checkout #{Branch::MASTER}`
|
48
|
-
`git branch -D #{branch}`
|
49
47
|
success("Rebased successfully!")
|
50
48
|
end
|
49
|
+
remove_locals
|
51
50
|
end
|
52
51
|
end
|
53
52
|
end
|
@@ -98,5 +97,12 @@ module GitCommands
|
|
98
97
|
yield
|
99
98
|
end
|
100
99
|
end
|
100
|
+
|
101
|
+
private def remove_locals
|
102
|
+
`git checkout #{Branch::MASTER}`
|
103
|
+
@branches.each do |branch|
|
104
|
+
`git branch -D #{branch}`
|
105
|
+
end
|
106
|
+
end
|
101
107
|
end
|
102
108
|
end
|
data/lib/git_commands/version.rb
CHANGED
data/lib/git_commands.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_commands
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- costajob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -78,7 +78,7 @@ files:
|
|
78
78
|
- lib/git_commands/branch.rb
|
79
79
|
- lib/git_commands/cli.rb
|
80
80
|
- lib/git_commands/colorize.rb
|
81
|
-
- lib/git_commands/
|
81
|
+
- lib/git_commands/computer.rb
|
82
82
|
- lib/git_commands/prompt.rb
|
83
83
|
- lib/git_commands/repository.rb
|
84
84
|
- lib/git_commands/version.rb
|