giturl 1.1.5 → 1.1.6

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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cd0034eb1d5897662378ec2299ed0ebb78aae1847310f8f6926a1933d7e24ef
4
- data.tar.gz: c253a97c533af3fea0f486a404de79bb10ab7d1a1494cb13140330e132be2b84
3
+ metadata.gz: fc8fdfa621eb908ed53215b27f9b2b6843d732d1632823a324e67fe34c9fa25a
4
+ data.tar.gz: 188bb25265cc309f3bff690773954bb3fbfd5d95f41afdee18a640dee750ab1d
5
5
  SHA512:
6
- metadata.gz: 87484d6e3e5c4ba8a7ad1e673d2f6e1f740c07e60a8dbd8bd4d86c8881542c9238a1d8cde82d15305f102a2222692eb48aab84d7892900db17af176df809baec
7
- data.tar.gz: 49097b99ce67f5dc95c125deed74d958e56188e5f7a6027c55f6b92585a97dba41c21fe5a4e2db180f677401932f0380643df6cf79afcc8d60d2b51aa5eee73a
6
+ metadata.gz: f442fa4c3ba58d96f8295ea4998cb50a7ce8ef312bbe0dcf5dd22833a4720e02faa9bf8a0b85a1605c552e6100b941d7a828ceddbb88638841233cf45438ba5c
7
+ data.tar.gz: c83343d8871c2147b11ef83ab3a5561b4eed94e006b8385a46b78f66fdb3c46a64594683310c9472c93192b18b46842c104a2ef313c89e95f64b75dd58b149b0
data/.gitignore CHANGED
@@ -6,5 +6,6 @@
6
6
  /doc/
7
7
  /pkg/
8
8
  /spec/reports/
9
+ /test/
9
10
  /tmp/
10
11
  Gemfile.lock
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
data/.rubocop.yml CHANGED
@@ -7,6 +7,9 @@
7
7
  # General guide-line is
8
8
  # https://github.com/rubocop-hq/ruby-style-guide
9
9
 
10
+ require:
11
+ - rubocop-rspec
12
+
10
13
  AllCops:
11
14
  TargetRubyVersion: 2.5
12
15
 
@@ -20,6 +23,15 @@ Layout/LineLength:
20
23
  AutoCorrect: false
21
24
  Max: 120
22
25
 
26
+ Metrics/BlockLength:
27
+ Enabled: true
28
+ Max: 30
29
+ ExcludedMethods: ['describe', 'context']
30
+
31
+ Metrics/MethodLength:
32
+ Enabled: true
33
+ Max: 30
34
+
23
35
  Style/HashEachMethods:
24
36
  Enabled: true
25
37
  AutoCorrect: true
data/CHANGELOG.md CHANGED
@@ -1,8 +1,22 @@
1
1
  # Changelog
2
2
 
3
- ## [1.1.5](https://github.com/shinyaohtani/giturl/tree/1.1.5) (2020-03-18)
3
+ ## [v1.1.6](https://github.com/shinyaohtani/giturl/tree/v1.1.6) (2020-03-23)
4
4
 
5
- [Full Changelog](https://github.com/shinyaohtani/giturl/compare/v1.1.4...1.1.5)
5
+ [Full Changelog](https://github.com/shinyaohtani/giturl/compare/v1.1.5...v1.1.6)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Test code should be prepared [\#3](https://github.com/shinyaohtani/giturl/issues/3)
10
+
11
+ **Merged pull requests:**
12
+
13
+ - Feature/\#3 test code [\#9](https://github.com/shinyaohtani/giturl/pull/9) ([shinyaohtani](https://github.com/shinyaohtani))
14
+
15
+ # Changelog
16
+
17
+ ## [v1.1.5](https://github.com/shinyaohtani/giturl/tree/v1.1.5) (2020-03-18)
18
+
19
+ [Full Changelog](https://github.com/shinyaohtani/giturl/compare/v1.1.4...v1.1.5)
6
20
 
7
21
  **Implemented enhancements:**
8
22
 
data/README.md CHANGED
@@ -51,7 +51,7 @@ $ giturl --open --app="/Applications/any_browser_you_have.app" .
51
51
 
52
52
  ## Usecase
53
53
 
54
- Here is a example to open GitHub web page for current directory:
54
+ The following is an example of opening a GitHub web page for the current directory:
55
55
 
56
56
  ```sh
57
57
  $ git clone git@github.com:shinyaohtani/giturl.git
data/Rakefile CHANGED
@@ -1,13 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'bundler/gem_tasks'
4
- task default: :spec
4
+ require 'rspec/core/rake_task'
5
+ RSpec::Core::RakeTask.new(:spec)
5
6
 
6
7
  require 'github_changelog_generator/task'
7
-
8
8
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
9
9
  config.user = 'shinyaohtani'
10
10
  config.project = 'giturl'
11
11
  config.base = 'CHANGELOG.md'
12
- config.future_release = Giturl::VERSION
12
+ config.future_release = "v#{Giturl::VERSION}"
13
13
  end
14
+
15
+ task default: :spec
data/bin/giturl CHANGED
@@ -1,46 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require 'optparse'
5
- require 'giturl'
4
+ require 'command_giturl'
6
5
 
7
- params = {}
8
- OptionParser.new do |opts|
9
- opts.version = Giturl::VERSION
10
- opts.on('-o', '--open', 'Open the URL in your browser. default: no') { |v| v }
11
- opts.on('-a APPNAME', '--app=APPNAME', 'Specify a browser. "Safari.app"') { |v| v }
12
- opts.on('-v', '--verbose', 'Verbose mode. default: no') { |v| v }
13
- opts.on_tail('-h', '--help', 'Show this message') do
14
- puts opts
15
- exit
16
- end
17
- opts.on_tail('-V', '--version', 'Show version') do
18
- puts opts.ver
19
- exit
20
- end
21
- opts.banner = <<~BANNER
22
-
23
- #{opts.ver}
24
- A tiny utility that displays and opens GitHub URLs for your local directory.
25
- visit: https://github.com/shinyaohtani/giturl
26
-
27
- Usage: #{opts.program_name} [options] [dirs]
28
- [options] are:
29
- BANNER
30
-
31
- opts.parse!(ARGV, into: params)
32
- end
33
-
34
- ARGV.each do |arg|
35
- if Giturl::Giturl.git_managed?(arg)
36
- url = Giturl::Giturl.convert(arg)
37
- print "#{url}\n"
38
- if params[:open]
39
- comm = +"open #{url}"
40
- comm << " -a #{params[:app]}" if params[:app]
41
- system(comm)
42
- end
43
- elsif params[:verbose]
44
- print "Not git-managed-dir: #{arg}\n"
45
- end
46
- end
6
+ cg = Giturl::CommandGiturl.new
7
+ cg.parse_options
8
+ cg.run
data/giturl.gemspec CHANGED
@@ -35,8 +35,10 @@ Gem::Specification.new do |spec|
35
35
 
36
36
  spec.add_development_dependency 'bundler', '~> 2.0'
37
37
  spec.add_development_dependency 'github_changelog_generator', '>= 1.15.0'
38
- spec.add_development_dependency 'irb'
39
- spec.add_development_dependency 'pry'
38
+ spec.add_development_dependency 'pry', '>= 0.12.2'
39
+ spec.add_development_dependency 'pry-byebug', '>= 3.9.0'
40
40
  spec.add_development_dependency 'rake', '>= 12.3.3'
41
+ spec.add_development_dependency 'rspec', '>= 3.9.0'
41
42
  spec.add_development_dependency 'rubocop', '>= 0.80.1'
43
+ spec.add_development_dependency 'rubocop-rspec', '>= 1.38.1'
42
44
  end
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ # converter module from path to url
5
+ module Giturl
6
+ require 'optparse'
7
+ require 'giturl'
8
+
9
+ # command line wrapper
10
+ class CommandGiturl
11
+ attr_accessor :params
12
+
13
+ def parse_options
14
+ @params = {}
15
+ OptionParser.new do |opts|
16
+ opts.version = VERSION
17
+ opts.on('-o', '--open', 'Open the URL in your browser. default: no') { |v| v }
18
+ opts.on('-a APPNAME', '--app=APPNAME', 'Specify a browser. "Safari.app"') { |v| v }
19
+ opts.on('-v', '--verbose', 'Verbose mode. default: no') { |v| v }
20
+ opts.on_tail('-h', '--help', 'Show this message') do
21
+ puts opts
22
+ exit
23
+ end
24
+ opts.on_tail('-V', '--version', 'Show version') do
25
+ puts opts.ver
26
+ exit
27
+ end
28
+ opts.banner = <<~BANNER
29
+
30
+ #{opts.ver}
31
+ A tiny utility that displays and opens GitHub URLs for your local directory.
32
+ visit: https://github.com/shinyaohtani/giturl
33
+
34
+ Usage: #{opts.program_name} [options] [dirs]
35
+ [options] are:
36
+ BANNER
37
+
38
+ opts.parse!(ARGV, into: @params)
39
+ end
40
+ end
41
+
42
+ def run
43
+ ARGV.each do |arg|
44
+ if Giturl.git_managed?(arg)
45
+ url = Giturl.convert(arg)
46
+ print "#{url}\n"
47
+ if @params[:open]
48
+ comm = +"open #{url}"
49
+ comm << " -a #{@params[:app]}" if @params[:app]
50
+ system(comm)
51
+ end
52
+ elsif @params[:verbose]
53
+ print "Not git-managed-dir: #{arg}\n"
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Giturl
4
- VERSION = '1.1.5'
4
+ VERSION = '1.1.6'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: giturl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shinya Ohtani (shinyaohtani@github)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-18 00:00:00.000000000 Z
11
+ date: 2020-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -39,33 +39,33 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.15.0
41
41
  - !ruby/object:Gem::Dependency
42
- name: irb
42
+ name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 0.12.2
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 0.12.2
55
55
  - !ruby/object:Gem::Dependency
56
- name: pry
56
+ name: pry-byebug
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 3.9.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 3.9.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: 12.3.3
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 3.9.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 3.9.0
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rubocop
85
99
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +108,20 @@ dependencies:
94
108
  - - ">="
95
109
  - !ruby/object:Gem::Version
96
110
  version: 0.80.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: 1.38.1
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: 1.38.1
97
125
  description: |
98
126
  Show or open GitHub URL for your local directory.
99
127
  You can use giturl to display the URL corresponding to the git-managed directory given as an argument, and you can open the URL directly in your browser if needed.
@@ -105,6 +133,7 @@ extensions: []
105
133
  extra_rdoc_files: []
106
134
  files:
107
135
  - ".gitignore"
136
+ - ".rspec"
108
137
  - ".rubocop.yml"
109
138
  - CHANGELOG.md
110
139
  - Gemfile
@@ -115,6 +144,7 @@ files:
115
144
  - bin/giturl
116
145
  - bin/setup
117
146
  - giturl.gemspec
147
+ - lib/command_giturl.rb
118
148
  - lib/giturl.rb
119
149
  - lib/giturl/version.rb
120
150
  homepage: https://github.com/shinyaohtani/giturl