ghit 0.1.0 → 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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzY1MzZhOTgwMTc5YWFlODdlNzhhN2ZkMzRiZmUwOTljM2VjZDg4MA==
4
+ YmU0ZGY0YTFiYWMyMzk0MWUwYTFlNTM3NGZjYzYwNTFhYzM5Y2MxNA==
5
5
  data.tar.gz: !binary |-
6
- MTUyZWVlOTZlMDBjOWU0Mjg2YjAzMjVmZWRmNDcwYmQyZWMyY2IzNA==
6
+ NDc2NGEyMjM4MjE0ZTdhNGJiZGRlNWZkYmNjNTUyOTAyZDU1NGI3MQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTRkODk3OTE1MjkyZjhiZDExNjE0OWQxOWY1YTA1YjdkN2RmYzY3MmE5Y2M1
10
- N2QwY2I1MGYwMzYxYjkwZGNjZjZjZDAzMDA1ZjE1NmU3YTFkOWYzNjRkMTcw
11
- ZjNkMzcwNGZlNDljY2M2MzM4ZGI3YmE0NWJlZTkwMzJjZDYyN2E=
9
+ MzdkMzY2ZWRmNTNjNjgyYTIxNjE2MDc4ZGM0NjdmNjJmYjQzOGE3YjY3OWIz
10
+ YTllYWJiZjgwYzllNDkzOTA0ZmViY2IzMzBiOGIxYjI0ZjZlM2NjNWMzOTlk
11
+ ZTY2Nzk5MmNiZTdlNjI4NzM4Y2YwMzI5OGY2ZGRhMzgzYmQ2ZTE=
12
12
  data.tar.gz: !binary |-
13
- OTEzODM5Nzc4YjNlYjA5MTkzYmYyM2Y2ZjBhNDgzMWEyNGY0M2Q3NDJjYjRl
14
- ZDg1ZTYxMTU0MWFhYWE1MDRjZWZlNjk1MDY5NjMzMTNlZDM2NWVjNzE5ZjY1
15
- MWRkOGVlZWUxNzcxMmJjZTRjYjA1NjcyOGM4ZWFmZTQ1ZGZhNjk=
13
+ MThjNTg4ZjcyODRhNTY5MzUzNjk0OTFiODgzZTFjYmE2ZjVlZGJiYzNmMTRh
14
+ NDA0OWVjZTBmODBlYWUyM2RkNmVmMThlODg2MWVjOGVkZTQ0NjUzY2U1NTEx
15
+ Yzc2OWVhMmM3YTcwNmJiMzU5M2M3OGJkNzJlMmJlMTBmYjhmOWY=
data/README.md CHANGED
@@ -4,7 +4,7 @@ Ghit
4
4
  ## What is this?
5
5
 
6
6
  Ghit is a collection of custom ```git``` commands that allows the user to easily navigate to
7
- certain Github pages of the repo (if it exists).
7
+ certain Github pages of the repo (if it exists), or get some repo statistics in the terminal.
8
8
 
9
9
  ## Installation
10
10
 
@@ -14,7 +14,7 @@ That's it!
14
14
 
15
15
  ## Usage
16
16
 
17
- There are 4 new ```git``` commands now.
17
+ There are 7 new ```git``` commands now.
18
18
 
19
19
  The following commands allow you to easily navigate to repo's Github (sub)page.
20
20
 
@@ -22,6 +22,9 @@ The following commands allow you to easily navigate to repo's Github (sub)page.
22
22
  * ```git pulls``` -> Opens the Github pull requests page of the repo in broswer.
23
23
  * ```git issues``` -> Opens the Github issues page of the repo in broswer.
24
24
  * ```git open``` -> Opens the Github repo page in browser.
25
+ * ```git freq``` -> Shows a table with weekly code frequency statistics (additions/deletions).
26
+ * ```git contributors``` -> Shows a table with all of the users that contributed to the repo.
27
+ * ```git punch-card``` -> Shows a (rather big) punch card with all of the commits traffic for the repo grouped by weekdays and time.
25
28
 
26
29
  ## Worth sayin'
27
30
  * Still has some rough edges. Needs tests, refactoring and various improvements.
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ path = File.expand_path(File.dirname(__FILE__))
3
+ $:<< "#{path}/../lib"
4
+
5
+ require 'ghit'
6
+ Ghit::Stats::Contributors.get!
data/bin/git-freq ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ path = File.expand_path(File.dirname(__FILE__))
3
+ $:<< "#{path}/../lib"
4
+
5
+ require 'ghit'
6
+ Ghit::Stats::CodeFrequency.get!
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ path = File.expand_path(File.dirname(__FILE__))
3
+ $:<< "#{path}/../lib"
4
+
5
+ require 'ghit'
6
+ Ghit::Stats::PunchCard.get!
data/bin/git-stats ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ path = File.expand_path(File.dirname(__FILE__))
3
+ $:<< "#{path}/../lib"
4
+
5
+ require 'ghit'
6
+ Ghit::RepoStatistics.new.code_frequency
data/ghit.gemspec CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.add_dependency 'github_api', '~> 0.12'
22
+ spec.add_dependency 'rainbow', '~> 2.0'
21
23
  spec.add_development_dependency "bundler", "~> 1.5"
22
24
  spec.add_development_dependency "rake", "~> 10.3"
23
25
  spec.add_development_dependency 'rspec', "~> 3.1"
@@ -0,0 +1,31 @@
1
+ module Ghit
2
+ class Globals
3
+ def initialize
4
+ @remote = Ghit::RemoteExtracter.extract!
5
+ @globals = if http_remote?
6
+ Ghit::HttpsGlobals.new @remote
7
+ else
8
+ Ghit::SshGlobals.new @remote
9
+ end
10
+ end
11
+
12
+ def url
13
+ @globals.url
14
+ end
15
+
16
+ def author
17
+ @globals.author
18
+ end
19
+
20
+ def repository
21
+ @globals.repository
22
+ end
23
+
24
+ private
25
+
26
+ def http_remote?
27
+ @remote =~ /https?/
28
+ end
29
+
30
+ end
31
+ end
@@ -0,0 +1,28 @@
1
+ module Ghit
2
+ class HttpsGlobals
3
+
4
+ attr_reader :url, :author, :repository
5
+
6
+ def initialize remote
7
+ @remote = remote
8
+ @url = extract_url
9
+ @author = extract_author
10
+ @repository = extract_repository_name
11
+ end
12
+
13
+ private
14
+
15
+ def extract_url
16
+ @remote.split[-2]
17
+ end
18
+
19
+ def extract_author
20
+ @remote.split('/')[-2]
21
+ end
22
+
23
+ def extract_repository_name
24
+ extract_url.split('/')[-1]
25
+ end
26
+
27
+ end
28
+ end
@@ -8,8 +8,8 @@ module Ghit
8
8
  end
9
9
 
10
10
  def initialize(page = nil)
11
- @remote = Ghit::RemoteExtracter.extract!
12
11
  @page = page
12
+ @globals = Ghit::Globals.new
13
13
  end
14
14
 
15
15
  def open
@@ -19,16 +19,9 @@ module Ghit
19
19
  private
20
20
 
21
21
  def build_url
22
- if is_http_remote?
23
- HttpRemoteUrlBuilder.new(@remote, @page).build
24
- else
25
- SshRemoteUrlBuilder.new(@remote, @page).build
26
- end
22
+ "#{@globals.url}/#{@page}"
27
23
  end
28
24
 
29
- def is_http_remote?
30
- @remote =~ /https?/
31
- end
32
25
  end
33
26
 
34
27
  end
@@ -0,0 +1,18 @@
1
+ module Ghit
2
+ class RepoStatistics
3
+ def initialize
4
+ @globals = Ghit::Globals.new
5
+ end
6
+
7
+ def code_frequency
8
+ code_frequency = Github::Client::Repos::Statistics.new.code_frequency(user: @globals.author, repo: @globals.repository).body
9
+ puts "From:\t\tAdditions\tDeletions"
10
+ puts "-" * 41
11
+ code_frequency.each do |date, additions, deletions|
12
+ date = DateTime.strptime(date.to_s, "%s")
13
+ puts "#{date.to_date.to_s}\t#{Rainbow(additions).green}\t\t#{Rainbow(deletions).red}"
14
+ end
15
+ puts "-" * 41
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,28 @@
1
+ module Ghit
2
+ class SshGlobals
3
+
4
+ attr_reader :url, :repository, :author
5
+
6
+ def initialize remote
7
+ @remote = remote
8
+ @author = extract_author
9
+ @repository = extract_repository
10
+ @url = extract_url
11
+ end
12
+
13
+ private
14
+
15
+ def extract_url
16
+ "https://github.com/#{@author}/#{@repository}"
17
+ end
18
+
19
+ def extract_author
20
+ @remote.split[-2].split("/")[0].split(":")[-1]
21
+ end
22
+
23
+ def extract_repository
24
+ @remote.scan(/\/(.*).git/).join
25
+ end
26
+
27
+ end
28
+ end
@@ -0,0 +1,50 @@
1
+ module Ghit
2
+ module Stats
3
+
4
+ class CodeFrequency
5
+ class << self
6
+ def get!
7
+ new.get
8
+ end
9
+ end
10
+
11
+ def initialize
12
+ @globals = Ghit::Globals.new
13
+ @stats = Github::Client::Repos::Statistics.new
14
+ end
15
+
16
+ def get
17
+ code_frequency = fetch_freq_data
18
+ print_output_heading
19
+ code_frequency.each do |date, additions, deletions|
20
+ date = unixtime_to_date date
21
+ format_and_print_freq_data date, additions, deletions
22
+ end
23
+ print_fourty_one_dashes
24
+ end
25
+
26
+ private
27
+
28
+ def format_and_print_freq_data date, additions, deletions
29
+ puts "#{date}\t#{Rainbow(additions).green}\t\t#{Rainbow(deletions).red}"
30
+ end
31
+
32
+ def unixtime_to_date timestamp
33
+ DateTime.strptime(timestamp.to_s, "%s").to_date.to_s
34
+ end
35
+
36
+ def fetch_freq_data
37
+ @stats.code_frequency(user: @globals.author, repo: @globals.repository).body
38
+ end
39
+
40
+ def print_output_heading
41
+ puts "From:\t\tAdditions\tDeletions"
42
+ print_fourty_one_dashes
43
+ end
44
+
45
+ def print_fourty_one_dashes
46
+ puts "-" * 41
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,54 @@
1
+ module Ghit
2
+ module Stats
3
+
4
+ class Contributors
5
+ class << self
6
+ def get!
7
+ new.get
8
+ end
9
+ end
10
+
11
+ def initialize
12
+ @globals = Ghit::Globals.new
13
+ @stats = Github::Client::Repos::Statistics.new
14
+ end
15
+
16
+ def get
17
+ contributors = fetch_contributors
18
+
19
+ print_output_heading
20
+ contributors.each do |c|
21
+ print_contributor_data c
22
+ end
23
+ print_fourty_dashes
24
+ end
25
+
26
+ private
27
+
28
+ def fetch_contributors
29
+ @stats.contributors(user: @globals.author, repo: @globals.repository).body
30
+ end
31
+
32
+ def print_output_heading
33
+ puts "List of contributors to this repository:"
34
+ print_fourty_dashes
35
+ puts "Username\t\tProfile URL"
36
+ print_fourty_dashes
37
+ end
38
+
39
+ def print_fourty_dashes
40
+ puts "-" * 40
41
+ end
42
+
43
+ def print_contributor_data contrib
44
+ if contrib.respond_to? :author
45
+ puts "#{contrib.author.login}\t\t#{contrib.author.html_url}"
46
+ else
47
+ puts "#{contrib.login}\t\t#{contrib.html_url}"
48
+ end
49
+ end
50
+
51
+ end
52
+
53
+ end
54
+ end
@@ -0,0 +1,69 @@
1
+ module Ghit
2
+ module Stats
3
+
4
+ class PunchCard
5
+ class << self
6
+ def get!
7
+ new.get
8
+ end
9
+ end
10
+
11
+ def initialize
12
+ @globals = Ghit::Globals.new
13
+ @stats = Github::Client::Repos::Statistics.new
14
+ end
15
+
16
+ def get
17
+ punch_card_data = fetch_punch_card_data
18
+ commits_by_day = group_data_by_day punch_card_data
19
+
20
+ print_hours_line
21
+ commits_by_day.each do |day_ordinal, daily_commits_per_hour|
22
+ print get_weekday day_ordinal
23
+ print_commits_count daily_commits_per_hour
24
+ end
25
+ end
26
+
27
+ private
28
+
29
+ def print_commits_count commits_group
30
+ commits_group.each {|day, hour, commits| print "#{commits}\t" }
31
+ puts
32
+ end
33
+
34
+ def fetch_punch_card_data
35
+ @stats.punch_card(user: @globals.author, repo: @globals.repository).body
36
+ end
37
+
38
+ def group_data_by_day punch_card_data
39
+ punch_card_data.group_by {|i| i.first }
40
+ end
41
+
42
+ def print_hours_line
43
+ print "\t"
44
+ (00..23).to_a.each {|num| print "#{num}:00\t" }
45
+ puts
46
+ end
47
+
48
+ def get_weekday day
49
+ case day
50
+ when 0
51
+ "Mon\t"
52
+ when 1
53
+ "Tue\t"
54
+ when 2
55
+ "Wed\t"
56
+ when 3
57
+ "Thu\t"
58
+ when 4
59
+ "Fri\t"
60
+ when 5
61
+ "Sat\t"
62
+ when 6
63
+ "Sun\t"
64
+ end
65
+ end
66
+
67
+ end
68
+ end
69
+ end
data/lib/ghit/stats.rb ADDED
@@ -0,0 +1,7 @@
1
+ module Ghit
2
+ module Stats
3
+ autoload :CodeFrequency, 'ghit/stats/code_frequency'
4
+ autoload :Contributors, 'ghit/stats/contributors'
5
+ autoload :PunchCard, 'ghit/stats/punch_card'
6
+ end
7
+ end
data/lib/ghit/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ghit
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/ghit.rb CHANGED
@@ -1,9 +1,13 @@
1
1
  require "ghit/version"
2
+ require 'github_api'
3
+ require 'rainbow'
2
4
 
3
5
  module Ghit
4
- autoload :RepoLocator, 'ghit/repo_locator.rb'
5
- autoload :Errors, 'ghit/errors.rb'
6
- autoload :HttpRemoteUrlBuilder, 'ghit/http_remote_url_builder.rb'
7
- autoload :SshRemoteUrlBuilder, 'ghit/ssh_remote_url_builder.rb'
8
- autoload :RemoteExtracter, 'ghit/remote_extracter.rb'
6
+ autoload :Globals, 'ghit/globals'
7
+ autoload :HttpGlobals, 'ghit/http_globals'
8
+ autoload :SshGlobals, 'ghit/ssh_globals'
9
+ autoload :RepoLocator, 'ghit/repo_locator'
10
+ autoload :Errors, 'ghit/errors'
11
+ autoload :RemoteExtracter, 'ghit/remote_extracter'
12
+ autoload :Stats, 'ghit/stats'
9
13
  end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe Ghit::Globals do
4
+ subject { described_class.new }
5
+
6
+ before :each do
7
+ expect(Ghit::RemoteExtracter).to receive(:extract!).and_return "origin\tgit@github.com:someone/something.git (fetch)"
8
+ end
9
+
10
+ it '#author - returns author Github username' do
11
+ expect(subject.author).to eq "someone"
12
+ end
13
+
14
+ it '#repository - returns Github repository name' do
15
+ expect(subject.repository).to eq "something"
16
+ end
17
+
18
+ it '#url - returns Github repository url' do
19
+ expect(subject.url).to eq "https://github.com/someone/something"
20
+ end
21
+
22
+ end
@@ -0,0 +1,21 @@
1
+ require './lib/ghit/https_globals'
2
+
3
+ describe Ghit::HttpsGlobals do
4
+
5
+ let(:remote){ "origin\thttps://github.com/someone/something (fetch)" }
6
+
7
+ subject{ described_class.new(remote) }
8
+
9
+ it 'extracts author name from remote' do
10
+ expect(subject.author).to eq "someone"
11
+ end
12
+
13
+ it 'extracts repo name from remote' do
14
+ expect(subject.repository).to eq "something"
15
+ end
16
+
17
+ it 'extracts repo url from remote' do
18
+ expect(subject.url).to eq "https://github.com/someone/something"
19
+ end
20
+
21
+ end
@@ -0,0 +1,20 @@
1
+ require './lib/ghit/ssh_globals'
2
+
3
+ describe Ghit::SshGlobals do
4
+
5
+ let(:remote) { "origin\tgit@github.com:author/name.git (fetch)" }
6
+ subject{ described_class.new(remote) }
7
+
8
+ it 'extracts author name from remote' do
9
+ expect(subject.author).to eq "author"
10
+ end
11
+
12
+ it 'extracts repo name from remote' do
13
+ expect(subject.repository).to eq "name"
14
+ end
15
+
16
+ it 'extracts repo url from remote' do
17
+ expect(subject.url).to eq "https://github.com/author/name"
18
+ end
19
+
20
+ end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ile Eftimov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-11 00:00:00.000000000 Z
11
+ date: 2014-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: github_api
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '0.12'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '0.12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rainbow
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: bundler
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -57,9 +85,13 @@ description: Ghit is a gem that adds more git commands for a better command line
57
85
  email:
58
86
  - ileeftimov@gmail.com
59
87
  executables:
88
+ - git-contributors
89
+ - git-freq
60
90
  - git-issues
61
91
  - git-open
62
92
  - git-pulls
93
+ - git-punch-card
94
+ - git-stats
63
95
  - git-wiki
64
96
  extensions: []
65
97
  extra_rdoc_files: []
@@ -71,23 +103,34 @@ files:
71
103
  - LICENSE.txt
72
104
  - README.md
73
105
  - Rakefile
106
+ - bin/git-contributors
107
+ - bin/git-freq
74
108
  - bin/git-issues
75
109
  - bin/git-open
76
110
  - bin/git-pulls
111
+ - bin/git-punch-card
112
+ - bin/git-stats
77
113
  - bin/git-wiki
78
114
  - ghit.gemspec
79
115
  - lib/ghit.rb
80
116
  - lib/ghit/errors.rb
81
- - lib/ghit/http_remote_url_builder.rb
117
+ - lib/ghit/globals.rb
118
+ - lib/ghit/https_globals.rb
82
119
  - lib/ghit/remote_extracter.rb
83
120
  - lib/ghit/repo_locator.rb
84
- - lib/ghit/ssh_remote_url_builder.rb
121
+ - lib/ghit/repo_statistics.rb
122
+ - lib/ghit/ssh_globals.rb
123
+ - lib/ghit/stats.rb
124
+ - lib/ghit/stats/code_frequency.rb
125
+ - lib/ghit/stats/contributors.rb
126
+ - lib/ghit/stats/punch_card.rb
85
127
  - lib/ghit/version.rb
86
- - spec/http_remote_url_builder_spec.rb
128
+ - spec/globals_spec.rb
129
+ - spec/https_globals_spec.rb
87
130
  - spec/remote_extracter_spec.rb
88
131
  - spec/repo_locator_spec.rb
89
132
  - spec/spec_helper.rb
90
- - spec/ssh_remote_url_builder_spec.rb
133
+ - spec/ssh_globals_spec.rb
91
134
  homepage: https://github.com/fteem/ghit
92
135
  licenses:
93
136
  - MIT
@@ -113,9 +156,10 @@ signing_key:
113
156
  specification_version: 4
114
157
  summary: More git commands for your enjoyment.
115
158
  test_files:
116
- - spec/http_remote_url_builder_spec.rb
159
+ - spec/globals_spec.rb
160
+ - spec/https_globals_spec.rb
117
161
  - spec/remote_extracter_spec.rb
118
162
  - spec/repo_locator_spec.rb
119
163
  - spec/spec_helper.rb
120
- - spec/ssh_remote_url_builder_spec.rb
164
+ - spec/ssh_globals_spec.rb
121
165
  has_rdoc:
@@ -1,26 +0,0 @@
1
- module Ghit
2
- class HttpRemoteUrlBuilder
3
- def initialize remote, page = nil
4
- @remote = remote
5
- @page = page
6
- end
7
-
8
- def build
9
- "https://github.com/#{author}/#{name}/#{@page}"
10
- end
11
-
12
- private
13
-
14
- def repo_url
15
- @remote.split[1]
16
- end
17
-
18
- def author
19
- repo_url.split('/')[-2]
20
- end
21
-
22
- def name
23
- repo_url.split('/')[-1]
24
- end
25
- end
26
- end
@@ -1,27 +0,0 @@
1
- module Ghit
2
- class SshRemoteUrlBuilder
3
- def initialize remote, page = nil
4
- @remote = remote
5
- @page = page
6
- end
7
-
8
- def build
9
- "https://github.com/#{author}/#{name}/#{@page}"
10
- end
11
-
12
- private
13
-
14
- def name
15
- repo_data.split('/').last.gsub(/\.git/, '').strip
16
- end
17
-
18
- def author
19
- repo_data.split('/').first.strip
20
- end
21
-
22
- def repo_data
23
- @remote.split(':').last.split.first
24
- end
25
-
26
- end
27
- end
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Ghit::HttpRemoteUrlBuilder do
4
- let(:raw_origin) { "origin https://github.com/fteem/ghit (fetch)" }
5
-
6
- it 'creates valid URL out of raw remote string' do
7
- expect(described_class.new(raw_origin).build).to eq "https://github.com/fteem/ghit/"
8
- end
9
-
10
- it 'appends optional page parameter to url' do
11
- expect(described_class.new(raw_origin, 'something').build).to eq "https://github.com/fteem/ghit/something"
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Ghit::SshRemoteUrlBuilder do
4
- let(:raw_origin) { "origin git@github.com:fteem/ghit.git (fetch)" }
5
-
6
- it 'creates valid URL out of raw remote string' do
7
- expect(described_class.new(raw_origin).build).to eq "https://github.com/fteem/ghit/"
8
- end
9
-
10
- it 'appends optional page parameter to url' do
11
- expect(described_class.new(raw_origin, 'something').build).to eq "https://github.com/fteem/ghit/something"
12
- end
13
- end