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.
Files changed (4) hide show
  1. data/Gemfile.lock +1 -1
  2. data/README.md +3 -1
  3. data/bin/cb +15 -6
  4. metadata +2 -2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- codebase-cli (0.1.0)
4
+ codebase-cli (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Codebase Command Line Interface
2
2
 
3
- Command utilty to open codebase repositories in you browser
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
- CODEBASE_REPOSITORY_URL = "https://%s.codebasehq.com/projects/%s/repositories/%s/tree/master"
4
- CODEBASE_BRANCH_URL = "https://%s.codebasehq.com/projects/%s/repositories/%s/tree/%s"
5
- CODEBASE_BLOB_URL = "https://%s.codebasehq.com/projects/%s/repositories/%s/blob/master/%s"
6
- CODEBASE_COMMIT_URL = "https://%s.codebasehq.com/projects/%s/repositories/%s/commit/%s"
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 =~ /codebase/
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 CODEBASE_REPOSITORY_URL % repository_info
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.1.1
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-10-05 00:00:00.000000000 Z
12
+ date: 2012-11-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: step-up