codebase-cli 0.1.1 → 0.2.0
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/Gemfile.lock +1 -1
- data/README.md +3 -1
- data/bin/cb +15 -6
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Codebase Command Line Interface
|
2
2
|
|
3
|
-
Command utilty to open codebase repositories in
|
3
|
+
Command utilty to open codebase repositories in your browser
|
4
4
|
|
5
5
|
## Install
|
6
6
|
|
@@ -23,6 +23,8 @@ Command utilty to open codebase repositories in you browser
|
|
23
23
|
#### open the specified branch
|
24
24
|
$ cb -b <branch>
|
25
25
|
|
26
|
+
#### compare commits
|
27
|
+
$ cb -c <object1> [<object2>] # object2 is optional ('master' as default)
|
26
28
|
|
27
29
|
## Authors
|
28
30
|
|
data/bin/cb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
CODEBASE_COMPANY_URL = "https://%s.codebasehq.com"
|
4
|
+
CODEBASE_PROJECT_URL = "#{CODEBASE_COMPANY_URL}/projects/%s"
|
5
|
+
CODEBASE_REPOSITORY_URL = "#{CODEBASE_PROJECT_URL}/repositories/%s"
|
6
|
+
CODEBASE_BRANCH_URL = "#{CODEBASE_REPOSITORY_URL}/tree/%s"
|
7
|
+
CODEBASE_BLOB_URL = "#{CODEBASE_REPOSITORY_URL}/blob/master/%s"
|
8
|
+
CODEBASE_COMMIT_URL = "#{CODEBASE_REPOSITORY_URL}/commit/%s"
|
9
|
+
CODEBASE_COMPARE_URL = "#{CODEBASE_REPOSITORY_URL}/compare/%s...%s"
|
7
10
|
|
8
11
|
# Helper methods
|
9
12
|
#
|
@@ -25,7 +28,7 @@ def repository_info
|
|
25
28
|
if remote_info =~ /Fetch\sURL:\s(.+)\n/
|
26
29
|
remote_url = $1
|
27
30
|
|
28
|
-
if remote_url =~ /
|
31
|
+
if remote_url =~ /codebasehq\.com/
|
29
32
|
splited_url = remote_url.split('/')
|
30
33
|
|
31
34
|
if splited_url.size == 3
|
@@ -56,6 +59,8 @@ def help
|
|
56
59
|
puts "\t open the specified object"
|
57
60
|
puts 'cb -b | --branch <branch>'
|
58
61
|
puts "\t open the specified branch"
|
62
|
+
puts 'cb -c | --compare <ref1> [<ref2>]'
|
63
|
+
puts "\t open the diff page between commits. <ref2> is optional, as default value 'master'"
|
59
64
|
end
|
60
65
|
|
61
66
|
# CLI
|
@@ -69,8 +74,12 @@ when '--ref', '-r'
|
|
69
74
|
when '--branch', '-b'
|
70
75
|
branch = ARGV[1]
|
71
76
|
open CODEBASE_BRANCH_URL % (repository_info << branch)
|
77
|
+
when '--compare', '-c'
|
78
|
+
params = repository_info << ARGV[1]
|
79
|
+
params << (ARGV[2] || 'master')
|
80
|
+
open CODEBASE_COMPARE_URL % params
|
72
81
|
when nil
|
73
|
-
open
|
82
|
+
open CODEBASE_BRANCH_URL % (repository_info << 'master')
|
74
83
|
else
|
75
84
|
file = ARGV[0]
|
76
85
|
open CODEBASE_BLOB_URL % (repository_info << file)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codebase-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: step-up
|