git-whistles 0.8.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git-whistles (0.8.2)
4
+ git-whistles (0.9.0)
5
5
  pivotal-tracker (~> 0.5.6)
6
6
  term-ansicolor
7
7
 
data/README.md CHANGED
@@ -7,9 +7,6 @@ Install with:
7
7
 
8
8
  gem install git-whistles
9
9
 
10
- *Note*: if you installed a previous version of this by cloning the repository, you'll have to remove that clone from your `PATH`.
11
- Otherwise strange load issues may happen.
12
-
13
10
  Use it with:
14
11
 
15
12
 
@@ -25,6 +22,7 @@ Use it with:
25
22
  | `git select <story-id>` | Checkout a local branch with the matching number. If not found, lists remote branches |
26
23
  | `git latest-pushes [-n NR_RESULTS] [-p PATTERN]` | Show latest pushed branches to origin. Defaults to 20 results. Pattern is appended to refs/remotes/origin/ so include the team or project name to filter results. [[PedroCunha](https://github.com/PedroCunha)] |
27
24
  | `git pivotal-branch <story-id>` | Creates a branch name suggestion from the specified Pivotal Tracker story ID. It also comments on the story the branch name created and starts the story [[dncrht](https://github.com/dncrht)] |
25
+ | `git explore [-r REF] [-p PATH]` | Opens the remote origin interface on the given reference and path. Reference defaults to current branch and path to root [[PedroCunha](https://github.com/pedrocunha)]|
28
26
 
29
27
 
30
28
  ### More details on some of the commands
data/bin/git-explore ADDED
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: UTF-8
3
+ #
4
+ # git-explore [-r ref] [-p path]
5
+ #
6
+ # Explore the given reference on the remote origin website
7
+ #
8
+ require 'rubygems'
9
+ require 'optparse'
10
+ require 'term/ansicolor'
11
+ require 'git-whistles/app'
12
+
13
+ class App < Git::Whistles::App
14
+
15
+ GITHUB_URL = 'https://www.github.com'
16
+
17
+ def main(args)
18
+ super
19
+ parse_args!(args)
20
+
21
+ remote_origin_url = run!("git config --get remote.origin.url").strip
22
+
23
+ die 'Unknown origin. Only github supported at the moment', :usage => true unless github?(remote_origin_url)
24
+
25
+ # This has to support both variants
26
+ # https://github.com/mezis/git-whistles.git
27
+ # git@github.com:mezis/git-whistles.git
28
+ remote_origin_url.match /github\.com[:\/](.+)\.git/
29
+
30
+ die "Error parsing #{remote_origin_url} could not find repo" unless $1
31
+
32
+ repo = $1
33
+ reference = "tree/#{ options.ref.strip }"
34
+ path = options.path ? "#{ options.path.strip }" : ''
35
+
36
+ url = "#{GITHUB_URL}/#{repo}/#{reference}/#{path}"
37
+
38
+ puts "opening #{ url }..."
39
+ run! "open #{ url }"
40
+ end
41
+
42
+ def defaults
43
+ {
44
+ :ref => run!('git rev-parse --abbrev-ref HEAD'),
45
+ :file => nil
46
+ }
47
+ end
48
+
49
+ def option_parser
50
+ @option_parser ||= OptionParser.new do |op|
51
+ op.banner = "Usage: git explore [-b branch] [-f file]"
52
+
53
+ op.on("-r", "--ref REFERENCE", "Reference to explore. Defaults to current branch") do |ref|
54
+ options.ref = ref
55
+ end
56
+
57
+ op.on("-p", "--path PATH", "Path to explore. Defaults to /") do |path|
58
+ options.path = path
59
+ end
60
+
61
+ op.on_tail("-h", "--help", "Show this message") do
62
+ puts op
63
+ exit
64
+ end
65
+ end
66
+ end
67
+
68
+ private
69
+ def github?(origin)
70
+ origin.match %r{github.com}
71
+ end
72
+
73
+ end
74
+
75
+ App.run!
@@ -4,7 +4,7 @@ require 'pathname'
4
4
 
5
5
  module Git
6
6
  module Whistles
7
- VERSION = "0.8.2"
7
+ VERSION = "0.9.0"
8
8
  GEMDIR = Pathname.new(__FILE__).parent.parent.parent
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-whistles
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-12-17 00:00:00.000000000 Z
13
+ date: 2014-01-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -113,6 +113,7 @@ email:
113
113
  - julien.letessier@gmail.com
114
114
  executables:
115
115
  - git-chop
116
+ - git-explore
116
117
  - git-ff-all-branches
117
118
  - git-latest-pushes
118
119
  - git-list-branches
@@ -133,6 +134,7 @@ files:
133
134
  - README.md
134
135
  - Rakefile
135
136
  - bin/git-chop
137
+ - bin/git-explore
136
138
  - bin/git-ff-all-branches
137
139
  - bin/git-latest-pushes
138
140
  - bin/git-list-branches
@@ -168,7 +170,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
168
170
  version: '0'
169
171
  segments:
170
172
  - 0
171
- hash: -780717699858244118
173
+ hash: -3965311279452272986
172
174
  required_rubygems_version: !ruby/object:Gem::Requirement
173
175
  none: false
174
176
  requirements: