gitlink 0.0.1
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.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +56 -0
- data/README.md +37 -0
- data/Rakefile +44 -0
- data/bin/gitlink +84 -0
- data/gitlink.gemspec +23 -0
- data/gitlink.rdoc +49 -0
- data/lib/gitlink/version.rb +3 -0
- data/lib/gitlink.rb +1 -0
- data/test/support/aruba.rb +1 -0
- data/test/test_helper.rb +9 -0
- data/test/use_aruba_with_minitest.rb +14 -0
- metadata +119 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f99864fbd410f7431ca55f2f95a81f3e17e154df
|
4
|
+
data.tar.gz: 66f3fcd6baa8d98ed56a229ba2a765985d1ca6bf
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6cbd30e7d96cefb0e3d769927a8c22749b324eb2f4733cedf4c090a08dccf6bf0c969471c5d58a87fcd7076b53034b5a3d1b652ad6070c412928dda9913f98f8
|
7
|
+
data.tar.gz: fa6fa0d46f975bc6febb774658f32ce9943428a0725e06398f331a13b2a92a07fd78f2367fef71f2a8c14f0e6623baf4d7290d52012c4c3ee4333cc82efb823c
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
gitlink (0.0.1)
|
5
|
+
gli (= 2.13.4)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
aruba (0.12.0)
|
11
|
+
childprocess (~> 0.5.6)
|
12
|
+
contracts (~> 0.9)
|
13
|
+
cucumber (>= 1.3.19)
|
14
|
+
event-bus (~> 0.2)
|
15
|
+
ffi (~> 1.9.10)
|
16
|
+
rspec-expectations (>= 2.99)
|
17
|
+
thor (~> 0.19)
|
18
|
+
builder (3.2.2)
|
19
|
+
childprocess (0.5.8)
|
20
|
+
ffi (~> 1.0, >= 1.0.11)
|
21
|
+
contracts (0.12.0)
|
22
|
+
cucumber (2.1.0)
|
23
|
+
builder (>= 2.1.2)
|
24
|
+
cucumber-core (~> 1.3.0)
|
25
|
+
diff-lcs (>= 1.1.3)
|
26
|
+
gherkin3 (~> 3.1.0)
|
27
|
+
multi_json (>= 1.7.5, < 2.0)
|
28
|
+
multi_test (>= 0.1.2)
|
29
|
+
cucumber-core (1.3.1)
|
30
|
+
gherkin3 (~> 3.1.0)
|
31
|
+
diff-lcs (1.2.5)
|
32
|
+
event-bus (0.2.2)
|
33
|
+
ffi (1.9.10)
|
34
|
+
gherkin3 (3.1.2)
|
35
|
+
gli (2.13.4)
|
36
|
+
multi_json (1.11.2)
|
37
|
+
multi_test (0.1.2)
|
38
|
+
rake (10.4.2)
|
39
|
+
rdoc (4.2.1)
|
40
|
+
rspec-expectations (3.4.0)
|
41
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
+
rspec-support (~> 3.4.0)
|
43
|
+
rspec-support (3.4.1)
|
44
|
+
thor (0.19.1)
|
45
|
+
|
46
|
+
PLATFORMS
|
47
|
+
ruby
|
48
|
+
|
49
|
+
DEPENDENCIES
|
50
|
+
aruba (~> 0.12.0)
|
51
|
+
gitlink!
|
52
|
+
rake
|
53
|
+
rdoc
|
54
|
+
|
55
|
+
BUNDLED WITH
|
56
|
+
1.11.2
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# `gitlink`
|
2
|
+
Simple gem to open git remotes in the browser from the command line
|
3
|
+
|
4
|
+
#### Commands
|
5
|
+
|
6
|
+
Opens the project page
|
7
|
+
|
8
|
+
```shell
|
9
|
+
$ gitlink project
|
10
|
+
$ gitlink p #alias
|
11
|
+
```
|
12
|
+
Opens Pull Request page
|
13
|
+
|
14
|
+
```shell
|
15
|
+
$ gitlink pulls
|
16
|
+
$ gitlink p #alias
|
17
|
+
```
|
18
|
+
Opens project to specific branch
|
19
|
+
|
20
|
+
```shell
|
21
|
+
$ gitlink branch #default is master
|
22
|
+
$ gitlink branch branch-name
|
23
|
+
$ gitlink b branch-name #alias
|
24
|
+
```
|
25
|
+
Opens project wiki page
|
26
|
+
|
27
|
+
```shell
|
28
|
+
$ gitlink wiki
|
29
|
+
$ gitlink w #alias
|
30
|
+
```
|
31
|
+
|
32
|
+
*You can specify which remote you want to open*
|
33
|
+
|
34
|
+
```shell
|
35
|
+
$ gitlink --remote=other-remote project
|
36
|
+
$ gitlink -r other-remote branch my-branch
|
37
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rake/clean'
|
2
|
+
require 'rubygems'
|
3
|
+
require 'rubygems/package_task'
|
4
|
+
require 'rdoc/task'
|
5
|
+
require 'cucumber'
|
6
|
+
require 'cucumber/rake/task'
|
7
|
+
Rake::RDocTask.new do |rd|
|
8
|
+
rd.main = "README.rdoc"
|
9
|
+
rd.rdoc_files.include("README.rdoc","lib/**/*.rb","bin/**/*")
|
10
|
+
rd.title = 'Your application title'
|
11
|
+
end
|
12
|
+
|
13
|
+
spec = eval(File.read('gitlink.gemspec'))
|
14
|
+
|
15
|
+
Gem::PackageTask.new(spec) do |pkg|
|
16
|
+
end
|
17
|
+
CUKE_RESULTS = 'results.html'
|
18
|
+
CLEAN << CUKE_RESULTS
|
19
|
+
desc 'Run features'
|
20
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
21
|
+
opts = "features --format html -o #{CUKE_RESULTS} --format progress -x"
|
22
|
+
opts += " --tags #{ENV['TAGS']}" if ENV['TAGS']
|
23
|
+
t.cucumber_opts = opts
|
24
|
+
t.fork = false
|
25
|
+
end
|
26
|
+
|
27
|
+
desc 'Run features tagged as work-in-progress (@wip)'
|
28
|
+
Cucumber::Rake::Task.new('features:wip') do |t|
|
29
|
+
tag_opts = ' --tags ~@pending'
|
30
|
+
tag_opts = ' --tags @wip'
|
31
|
+
t.cucumber_opts = "features --format html -o #{CUKE_RESULTS} --format pretty -x -s#{tag_opts}"
|
32
|
+
t.fork = false
|
33
|
+
end
|
34
|
+
|
35
|
+
task :cucumber => :features
|
36
|
+
task 'cucumber:wip' => 'features:wip'
|
37
|
+
task :wip => 'features:wip'
|
38
|
+
require 'rake/testtask'
|
39
|
+
Rake::TestTask.new do |t|
|
40
|
+
t.libs << "test"
|
41
|
+
t.test_files = FileList['test/*_test.rb']
|
42
|
+
end
|
43
|
+
|
44
|
+
task :default => [:test,:features]
|
data/bin/gitlink
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'gli'
|
3
|
+
require 'gitlink'
|
4
|
+
|
5
|
+
include GLI::App
|
6
|
+
|
7
|
+
program_desc 'Allows you to quickly open your GitHub project in a web browser from the command line'
|
8
|
+
|
9
|
+
version Gitlink::VERSION
|
10
|
+
|
11
|
+
subcommand_option_handling :normal
|
12
|
+
arguments :strict
|
13
|
+
|
14
|
+
desc 'Name of remote'
|
15
|
+
arg_name 'remote_name'
|
16
|
+
default_value 'origin'
|
17
|
+
flag [:r, :remote]
|
18
|
+
|
19
|
+
desc 'Opens project\'s GitHub page'
|
20
|
+
command [:project, :p] do |c|
|
21
|
+
c.action do |global_options,options,args|
|
22
|
+
%x(open "#{@base_project_url}")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
desc 'Opens project\'s GitHub page to a specific branch'
|
27
|
+
arg_name 'Branch Name (leave blank for current)'
|
28
|
+
command [:branch, :b] do |c|
|
29
|
+
c.action do |global_options,options,args|
|
30
|
+
@current_branch = args.first if args.any?
|
31
|
+
%x(open "#{@base_project_url}/tree/#{@current_branch}")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
desc 'Opens project\'s pull requests page'
|
36
|
+
command [:pulls, :pr] do |c|
|
37
|
+
c.action do |global_options,options,args|
|
38
|
+
%x(open "#{@base_project_url}/pulls")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
desc 'Open project\'s wiki page'
|
43
|
+
command [:wiki, :w] do |c|
|
44
|
+
c.action do |global_options,options,args|
|
45
|
+
%x(open "#{@base_project_url}/wiki")
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
pre do |global,command,options,args|
|
50
|
+
no_repo_error = "gitlink only works from within git repos"
|
51
|
+
raise no_repo_error unless %x(git rev-parse --is-inside-work-tree)
|
52
|
+
|
53
|
+
@remote = global[:remote]
|
54
|
+
|
55
|
+
available_urls = %x(git remote -v)
|
56
|
+
remotes = available_urls.split("\n").select do |remote|
|
57
|
+
remote = remote.split("\t")
|
58
|
+
remote[0] == @remote
|
59
|
+
end
|
60
|
+
|
61
|
+
raise "this project does not have any remotes" if remotes.empty?
|
62
|
+
|
63
|
+
project_params = remotes.first.match(/\:(.*).git/)[1]
|
64
|
+
@base_project_url = "http://github.com/#{project_params}"
|
65
|
+
|
66
|
+
@current_branch = %x(git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||')
|
67
|
+
@current_branch.chomp!
|
68
|
+
|
69
|
+
true
|
70
|
+
end
|
71
|
+
|
72
|
+
post do |global,command,options,args|
|
73
|
+
# Post logic here
|
74
|
+
# Use skips_post before a command to skip this
|
75
|
+
# block on that command only
|
76
|
+
end
|
77
|
+
|
78
|
+
on_error do |exception|
|
79
|
+
# Error logic here
|
80
|
+
# return false to skip default error handling
|
81
|
+
true
|
82
|
+
end
|
83
|
+
|
84
|
+
exit run(ARGV)
|
data/gitlink.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Ensure we require the local version and not one we might have installed already
|
2
|
+
require File.join([File.dirname(__FILE__),'lib','gitlink','version.rb'])
|
3
|
+
spec = Gem::Specification.new do |s|
|
4
|
+
s.name = 'gitlink'
|
5
|
+
s.version = Gitlink::VERSION
|
6
|
+
s.author = 'Chase Clettenberg'
|
7
|
+
s.email = 'clettenberg@gmail.com'
|
8
|
+
s.homepage = 'http://cclettenberg.com'
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.summary = 'Open GitHub projects from the command line'
|
11
|
+
s.files = `git ls-files`.split("
|
12
|
+
")
|
13
|
+
s.require_paths << 'lib'
|
14
|
+
s.has_rdoc = true
|
15
|
+
s.extra_rdoc_files = ['README.md','gitlink.rdoc']
|
16
|
+
s.rdoc_options << '--title' << 'gitlink' << '--main' << 'README.rdoc' << '-ri'
|
17
|
+
s.bindir = 'bin'
|
18
|
+
s.executables << 'gitlink'
|
19
|
+
s.add_development_dependency('rake')
|
20
|
+
s.add_development_dependency('rdoc')
|
21
|
+
s.add_development_dependency('aruba')
|
22
|
+
s.add_runtime_dependency('gli','2.13.4')
|
23
|
+
end
|
data/gitlink.rdoc
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
== gitlink - Allows you to quickly open your GitHub project in a web browser from the command line
|
2
|
+
|
3
|
+
v0.0.1
|
4
|
+
|
5
|
+
=== Global Options
|
6
|
+
=== -r|--remote remote_name
|
7
|
+
|
8
|
+
Name of remote
|
9
|
+
|
10
|
+
[Default Value] origin
|
11
|
+
|
12
|
+
|
13
|
+
=== --help
|
14
|
+
Show this message
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
=== --version
|
19
|
+
Display the program version
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
=== Commands
|
24
|
+
==== Command: <tt>branch|b Branch Name (leave blank for current)</tt>
|
25
|
+
Opens project's GitHub page to a specific branch
|
26
|
+
|
27
|
+
|
28
|
+
==== Command: <tt>help command</tt>
|
29
|
+
Shows a list of commands or help for one command
|
30
|
+
|
31
|
+
Gets help for the application or its commands. Can also list the commands in a way helpful to creating a bash-style completion function
|
32
|
+
===== Options
|
33
|
+
===== -c
|
34
|
+
List commands one per line, to assist with shell completion
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
==== Command: <tt>project|p </tt>
|
39
|
+
Opens project's GitHub page
|
40
|
+
|
41
|
+
|
42
|
+
==== Command: <tt>pulls|pr </tt>
|
43
|
+
Opens project's pull requests page
|
44
|
+
|
45
|
+
|
46
|
+
==== Command: <tt>wiki|w </tt>
|
47
|
+
Open project's wiki page
|
48
|
+
|
49
|
+
|
data/lib/gitlink.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'gitlink/version.rb'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'aruba/api'
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
|
+
|
3
|
+
if RUBY_VERSION < '1.9.3'
|
4
|
+
::Dir.glob(::File.expand_path('../support/*.rb', __FILE__)).each { |f| require File.join(File.dirname(f), File.basename(f, '.rb')) }
|
5
|
+
::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require File.join(File.dirname(f), File.basename(f, '.rb')) }
|
6
|
+
else
|
7
|
+
::Dir.glob(::File.expand_path('../support/*.rb', __FILE__)).each { |f| require_relative f }
|
8
|
+
::Dir.glob(::File.expand_path('../support/**/*.rb', __FILE__)).each { |f| require_relative f }
|
9
|
+
end
|
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gitlink
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chase Clettenberg
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-01-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rdoc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: aruba
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: gli
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.13.4
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.13.4
|
69
|
+
description:
|
70
|
+
email: clettenberg@gmail.com
|
71
|
+
executables:
|
72
|
+
- gitlink
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files:
|
75
|
+
- README.md
|
76
|
+
- gitlink.rdoc
|
77
|
+
files:
|
78
|
+
- Gemfile
|
79
|
+
- Gemfile.lock
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- bin/gitlink
|
83
|
+
- gitlink.gemspec
|
84
|
+
- gitlink.rdoc
|
85
|
+
- lib/gitlink.rb
|
86
|
+
- lib/gitlink/version.rb
|
87
|
+
- test/support/aruba.rb
|
88
|
+
- test/test_helper.rb
|
89
|
+
- test/use_aruba_with_minitest.rb
|
90
|
+
homepage: http://cclettenberg.com
|
91
|
+
licenses: []
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options:
|
95
|
+
- "--title"
|
96
|
+
- gitlink
|
97
|
+
- "--main"
|
98
|
+
- README.rdoc
|
99
|
+
- "-ri"
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
requirements: []
|
114
|
+
rubyforge_project:
|
115
|
+
rubygems_version: 2.5.1
|
116
|
+
signing_key:
|
117
|
+
specification_version: 4
|
118
|
+
summary: Open GitHub projects from the command line
|
119
|
+
test_files: []
|