git-publish 0.0.1 → 0.0.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/git-publish.rb CHANGED
@@ -3,12 +3,8 @@ require 'git-publish/helpers'
3
3
  class GitPublish
4
4
  include Helpers
5
5
  def run
6
- init
7
- origin(ARGV[0])
8
- remote_branch_name(ARGV[1])
9
- %x|git push #{origin} #{@local_branch_name}:refs/heads/#{remote_branch_name}|
10
- %x|git fetch #{origin}|
11
- %x|git branch --track #{@local_branch_name} #{origin}/#{remote_branch_name}|
12
- %x|git checkout #{@local_branch_name}|
6
+ init(ARGV[0], ARGV[1])
7
+ %x|git push #{@origin} #{@local_branch_name}:refs/heads/#{@remote_branch_name}|
8
+ %x|git branch --set-upstream #{@local_branch_name} #{@origin}/#{@remote_branch_name}|
13
9
  end
14
10
  end
@@ -1,18 +1,12 @@
1
1
  require 'grit'
2
2
 
3
3
  module Helpers
4
- def init
4
+ def init(origin=nil, remote_branch_name=nil)
5
5
  git_dir = `git rev-parse --git-dir`
6
6
  repo = Grit::Repo.new(File.dirname(git_dir))
7
7
  @local_branch_name = repo.head.name
8
- end
9
-
10
- def origin(origin=nil)
11
- @origin ||= "origin"
12
- end
13
-
14
- def remote_branch_name(remote_branch_name=nil)
15
8
  @remote_branch_name ||= @local_branch_name
9
+ @origin ||= "origin"
16
10
  end
17
11
  end
18
12
 
@@ -1,5 +1,5 @@
1
1
  module Git
2
2
  module Publish
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
data/lib/git-unpublish.rb CHANGED
@@ -3,10 +3,8 @@ require 'git-publish/helpers'
3
3
  class GitUnpublish
4
4
  include Helpers
5
5
  def run
6
- init
7
- origin(ARGV[0])
8
- remote_branch_name(ARGV[1])
9
- %x|git push #{origin} :#{remote_branch_name}|
6
+ init(ARGV[0], ARGV[1])
7
+ %x|git push #{@origin} :#{@remote_branch_name}|
10
8
  puts %Q|\n Run \`git branch -d #{@local_branch_name}\` to delete the branch locally\n |
11
9
  end
12
10
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: git-publish
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Adam
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-18 00:00:00 +01:00
13
+ date: 2011-06-30 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency