github_url 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00dbc7f5bcc97f99d25e08bf39365959e500c7a9
4
- data.tar.gz: 8bf8551e9eb8f1706ac51a9634331ed99a87924c
3
+ metadata.gz: 7c1e812031e6490a4c515f52399627ca1ad0b576
4
+ data.tar.gz: d9b41ea78c68d875418090643cb7167a95b679cb
5
5
  SHA512:
6
- metadata.gz: 0aaab09f30f4dd78a45aef1b9818e78ae232fd632b358087b910f77e373d6bf8114cef5eba97777f2a3f1b2b90fe3f6b0e76948bfa4bd3918990c31e31d8bb45
7
- data.tar.gz: 7ae6af3605abc174d113b3c026ceaf33b73c7e0974718d3cb9dee9320ec5ece25b149f6bbc0aa167b333ed3106660006a31524dc9ae8bc7ec024e8724db941f4
6
+ metadata.gz: be0e7242f02345fb931c8293925d01192232b906baca993792951c2b8785a863238b80bea6af1e71de0ae10e505788de9f4bef1653ca6773cbfce76c938a1885
7
+ data.tar.gz: 02d474f354eb98aca9bbed1ffce75f0ce0c86d91d48bf965c6e722b42a9eefaeb275834a9cfadc5a5745176cdd343f5ccaa8a4eb40c4b4e570352f3eeff30d95
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ .idea/*
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  A small ruby gem for parsing Github URLs
4
4
 
5
+ [![CircleCI](https://circleci.com/gh/GalvanizeOpenSource/github_url.svg?style=svg)](https://circleci.com/gh/GalvanizeOpenSource/github_url)
6
+
5
7
  ## Installation
6
8
 
7
9
  Add this line to your application's Gemfile:
@@ -23,13 +25,19 @@ Or install it yourself as:
23
25
  Initializing a GithubUrl
24
26
 
25
27
  ```ruby
26
- url = GithubUrl.new('https://github.com/GalvanizeOpenSource/github_url/blob/master/lib/github_url.rb')
28
+ url = GithubUrl.new(url: 'https://github.com/GalvanizeOpenSource/github_url/blob/master/lib/github_url.rb')
29
+ ```
30
+
31
+ Initializing a GithubUrl using a specific default branch
32
+
33
+ ```ruby
34
+ url_with_branch = GithubUrl.new(url: 'https://github.com/GalvanizeOpenSource/github_url/blob/master/lib/github_url.rb', default_branch: 'branch-besides-master')
27
35
  ```
28
36
 
29
- Initializing a GithubUrl using a specific branch
37
+ Initializing a GithubUrl using an override host
30
38
 
31
39
  ```ruby
32
- url_with_branch = GithubUrl.new('https://github.com/GalvanizeOpenSource/github_url/blob/master/lib/github_url.rb', 'branch-besides-master')
40
+ url_with_host = GithubUrl.new(url: "https://git.sum.enterprise.org/peterparker/web", host: "git.sum.enterprise.org")
33
41
  ```
34
42
 
35
43
  Getting the organization
data/Rakefile CHANGED
@@ -7,4 +7,4 @@ Rake::TestTask.new(:test) do |t|
7
7
  t.test_files = FileList["test/**/*_test.rb"]
8
8
  end
9
9
 
10
- task :default => :test
10
+ task default: :test
data/circle.yml ADDED
@@ -0,0 +1,12 @@
1
+ dependencies:
2
+ pre:
3
+ - gem install bundler
4
+
5
+ test:
6
+ pre:
7
+ - bundle exec rubocop
8
+ override:
9
+ - bundle exec rspec -r rspec_junit_formatter --format progress --format RspecJunitFormatter -o $CIRCLE_TEST_REPORTS/rspec/junit.xml:
10
+ parallel: true
11
+ files:
12
+ - spec/*.rb
data/github_url.gemspec CHANGED
@@ -1,6 +1,7 @@
1
1
  # coding: utf-8
2
+
2
3
  lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ $:.unshift(lib) unless $:.include?(lib)
4
5
  require "github_url/version"
5
6
 
6
7
  Gem::Specification.new do |spec|
@@ -9,20 +10,11 @@ Gem::Specification.new do |spec|
9
10
  spec.authors = ["dizehacioglu"]
10
11
  spec.email = ["dh1272@nyu.edu"]
11
12
 
12
- spec.summary = %q{A small ruby gem for parsing Github URLs}
13
+ spec.summary = %q(A small ruby gem for parsing Github URLs)
13
14
  spec.homepage = "https://github.com/GalvanizeOpenSource/github_url"
14
15
  spec.license = "MIT"
15
16
 
16
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
- # to allow pushing to a single host or delete this section to allow pushing to any host.
18
- # if spec.respond_to?(:metadata)
19
- # spec.metadata["allowed_push_host"] = "https://rubygems.org"
20
- # else
21
- # raise "RubyGems 2.0 or newer is required to protect against " \
22
- # "public gem pushes."
23
- # end
24
-
25
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
26
18
  f.match(%r{^(test|spec|features)/})
27
19
  end
28
20
  spec.bindir = "exe"
@@ -31,5 +23,6 @@ Gem::Specification.new do |spec|
31
23
 
32
24
  spec.add_development_dependency "bundler", "~> 1.15"
33
25
  spec.add_development_dependency "rspec", "~> 3.0"
26
+ spec.add_development_dependency "rspec_junit_formatter"
34
27
  spec.add_development_dependency "rubocop"
35
28
  end
@@ -1,3 +1,3 @@
1
1
  class GithubUrl
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/github_url.rb CHANGED
@@ -1,14 +1,15 @@
1
1
  class GithubUrl
2
- attr_accessor :url, :default_branch
2
+ attr_accessor :url
3
3
 
4
- GITHUB_HOST = "github.com"
4
+ GITHUB_HOST = "github.com".freeze
5
5
 
6
6
  class Invalid < StandardError
7
7
  end
8
8
 
9
- def initialize(url, default_branch = "master")
9
+ def initialize(url:, default_branch: "master", host: GITHUB_HOST)
10
10
  @default_branch = default_branch
11
11
  @url = url
12
+ @host = host
12
13
 
13
14
  validate_url
14
15
  end
@@ -36,7 +37,7 @@ class GithubUrl
36
37
  end
37
38
 
38
39
  def validate_url
39
- raise(Invalid, "Must contain #{GITHUB_HOST}") unless url.split("/").any? { |e| e.include?(GITHUB_HOST) }
40
+ raise(Invalid, "Must contain #{@host}") unless url.split("/").any? { |e| e.include?(@host) }
40
41
  raise(Invalid, "Missing organization") if organization.nil?
41
42
  raise(Invalid, "Missing repository") if repository.nil?
42
43
  raise(Invalid, "Missing branch") if !default_branch? && url_path[3].nil?
@@ -44,7 +45,7 @@ class GithubUrl
44
45
 
45
46
  def url_path
46
47
  url_arr = url.split("/")
47
- github_index = url_arr.index { |e| e.include?(GITHUB_HOST) }
48
- url_arr[github_index + 1..-1]
48
+ host_index = url_arr.index { |e| e.include?(@host) }
49
+ url_arr[host_index + 1..-1]
49
50
  end
50
51
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_url
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
  - dizehacioglu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-21 00:00:00.000000000 Z
11
+ date: 2017-07-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec_junit_formatter
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'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rubocop
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -69,6 +83,7 @@ files:
69
83
  - Rakefile
70
84
  - bin/console
71
85
  - bin/setup
86
+ - circle.yml
72
87
  - github_url.gemspec
73
88
  - lib/github_url.rb
74
89
  - lib/github_url/version.rb
@@ -92,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
107
  version: '0'
93
108
  requirements: []
94
109
  rubyforge_project:
95
- rubygems_version: 2.6.12
110
+ rubygems_version: 2.6.6
96
111
  signing_key:
97
112
  specification_version: 4
98
113
  summary: A small ruby gem for parsing Github URLs