git-publish 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in git-publish.gemspec
4
+ gemspec
data/LICENCE ADDED
@@ -0,0 +1,18 @@
1
+ Copyright (c) 2011 Adam Rogers
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to
5
+ deal in the Software without restriction, including without limitation the
6
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16
+ THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
data/Readme.markdown ADDED
@@ -0,0 +1,40 @@
1
+ # Usage #
2
+
3
+ ## Install ##
4
+
5
+ gem install git-publish
6
+
7
+ ## Publishing ##
8
+
9
+ $ git co -b my-test-branch
10
+ $ git publish
11
+ => create a remote branch called my-test-branch
12
+ and track it locally
13
+
14
+ $ git co -b my-test-branch
15
+ $ git publish heroku
16
+ => create a remote branch on "heroku" origin
17
+ rather than the default "origin"
18
+
19
+ $ git co -b my-test-branch
20
+ $ git publish heroku development
21
+ => publish my-test-branch on heroku and call it
22
+ development
23
+
24
+ $ git co -b my-test-branch
25
+ $ git publish origin feature-36
26
+ => publish my-test-branch on default "origin"
27
+ and call it "feature-36"
28
+
29
+ ## Unpublishing ##
30
+
31
+ Is pretty much as above, but subbing `publish` for `unpublish`.
32
+
33
+ # Inspiration #
34
+
35
+ Part proof-of-concept, part laziyness. I borrowed a lot
36
+ of ideas from [git-up](https://github.com/aanand/git-up) and [git_remote_branch](https://github.com/webmat/git_remote_branch).
37
+
38
+
39
+
40
+
data/bin/git-publish ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'git-publish'
4
+
5
+ GitPublish.new.run
data/bin/git-unpublish ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'git-unpublish'
4
+
5
+ GitUnpublish.new.run
6
+
@@ -0,0 +1,22 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "git-publish/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "git-publish"
7
+ s.version = Git::Publish::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = `git log --format='%aN' | sort -u`.split("\n")
10
+ s.email = ['adam@mintdigital.com']
11
+ s.homepage = ""
12
+ s.summary = %q{Easilly publish a topic branch}
13
+ s.description = %q{Easilly publish a topic branch}
14
+ s.rubyforge_project = "git-publish"
15
+
16
+ s.add_dependency "grit"
17
+
18
+ s.files = `git ls-files`.split("\n")
19
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+ end
@@ -0,0 +1,14 @@
1
+ require 'git-publish/helpers'
2
+
3
+ class GitPublish
4
+ include Helpers
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}|
13
+ end
14
+ end
@@ -0,0 +1,18 @@
1
+ require 'grit'
2
+
3
+ module Helpers
4
+ def init
5
+ git_dir = `git rev-parse --git-dir`
6
+ repo = Grit::Repo.new(File.dirname(git_dir))
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
+ @remote_branch_name ||= @local_branch_name
16
+ end
17
+ end
18
+
@@ -0,0 +1,5 @@
1
+ module Git
2
+ module Publish
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ require 'git-publish/helpers'
2
+
3
+ class GitUnpublish
4
+ include Helpers
5
+ def run
6
+ init
7
+ origin(ARGV[0])
8
+ remote_branch_name(ARGV[1])
9
+ %x|git push #{origin} :#{remote_branch_name}|
10
+ puts %Q|\n Run \`git branch -d #{@local_branch_name}\` to delete the branch locally\n |
11
+ end
12
+ end
13
+
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: git-publish
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Adam
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-06-18 00:00:00 +01:00
14
+ default_executable:
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: grit
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: "0"
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ description: Easilly publish a topic branch
28
+ email:
29
+ - adam@mintdigital.com
30
+ executables:
31
+ - git-publish
32
+ - git-unpublish
33
+ extensions: []
34
+
35
+ extra_rdoc_files: []
36
+
37
+ files:
38
+ - .gitignore
39
+ - Gemfile
40
+ - LICENCE
41
+ - Rakefile
42
+ - Readme.markdown
43
+ - bin/git-publish
44
+ - bin/git-unpublish
45
+ - git-publish.gemspec
46
+ - lib/git-publish.rb
47
+ - lib/git-publish/helpers.rb
48
+ - lib/git-publish/version.rb
49
+ - lib/git-unpublish.rb
50
+ has_rdoc: true
51
+ homepage: ""
52
+ licenses: []
53
+
54
+ post_install_message:
55
+ rdoc_options: []
56
+
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: "0"
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: "0"
71
+ requirements: []
72
+
73
+ rubyforge_project: git-publish
74
+ rubygems_version: 1.5.2
75
+ signing_key:
76
+ specification_version: 3
77
+ summary: Easilly publish a topic branch
78
+ test_files: []
79
+