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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2936c4e9f2983c15ed57ca5771dfa518d2aeecd9
4
- data.tar.gz: 095c33cffbb33c11c3069b62607892e8db2944fe
3
+ metadata.gz: fbe7c65035ffcdc39c81b47463b9314aa07ab8a3
4
+ data.tar.gz: e0ce45188c080726af5ce804af1da49f2c5ed874
5
5
  SHA512:
6
- metadata.gz: a88f137909b4d8607af9cb674eac69008e7fa88c9cbcd18403416a704cc50a1bd03f45d5dc1e03834ac7a1c7f1ba0884a2e558292791567cc0f8fd5e3e964e05
7
- data.tar.gz: f57c3a817cdb54dd6a9428071d2dc90baf5d905bd0d1aa1a190046ac1a2608132e2fe5e06562fb4588d567adc49f6ccba6e3bb49df0af3983c375891027c9b73
6
+ metadata.gz: 0f165f80fcdb236a9da0549bd496f23573e996a3a8c4252a5b22e069350ac0007fd75268e585041eb6bb10546db5f597bc51eb48ae10f48bfa73e5736f3b266a
7
+ data.tar.gz: 9defaf6c85f58a02fcfe511e358443b4ff472074911f0ccea4ef4eca31c80f57e7416f42b990def0cae5b4b75bcada4107c23aed996923578aa0e535448f79ea
@@ -1,5 +1,5 @@
1
1
  require "optparse"
2
- require "git_commands/command"
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, command_klass: Command)
12
+ def initialize(command_name:, args: ARGV, out: STDOUT, computer_klass: Computer)
13
13
  @command_name = check_command_name(command_name)
14
- @command_klass = command_klass
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
- command = @command_klass.new(repo: @repo, branches: @branches)
24
- command.send(@command_name)
25
- rescue Command::GitError, AbortError, Repository::InvalidError => e
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 Command
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
@@ -1,3 +1,3 @@
1
1
  module GitCommands
2
- VERSION = "3.2.6"
2
+ VERSION = "3.2.8"
3
3
  end
data/lib/git_commands.rb CHANGED
@@ -2,5 +2,5 @@ lib = File.expand_path("../../lib", __FILE__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  require "git_commands/version"
5
- require "git_commands/command"
5
+ require "git_commands/computer"
6
6
  require "git_commands/cli"
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.6
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-20 00:00:00.000000000 Z
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/command.rb
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