git-publish 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/git-publish.rb +3 -7
- data/lib/git-publish/helpers.rb +2 -8
- data/lib/git-publish/version.rb +1 -1
- data/lib/git-unpublish.rb +2 -4
- metadata +2 -2
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
|
8
|
-
remote_branch_name
|
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
|
data/lib/git-publish/helpers.rb
CHANGED
@@ -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
|
|
data/lib/git-publish/version.rb
CHANGED
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
|
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.
|
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-
|
13
|
+
date: 2011-06-30 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|