vcdetect 0.4 → 0.5

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 (5) hide show
  1. checksums.yaml +5 -5
  2. data/bin/vcdetect +31 -31
  3. data/lib/vcdetect.rb +72 -72
  4. data/lib/version.rb +1 -1
  5. metadata +6 -34
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: bd443b597e371b72c21240bce6935b91d4d9f174
4
- data.tar.gz: bce63f3d7a077fc0b2409318486408ce8229bb34
2
+ SHA256:
3
+ metadata.gz: 6908e71edc103e06510f428a942b4b2ed48cdd00ce4538667726ec0cd3889755
4
+ data.tar.gz: 6d111f3eec4a791bfdea2f27a6800e303587e99e6a5ca4d39028c7a8744c868e
5
5
  SHA512:
6
- metadata.gz: fb88ccc9a984dedcfde089bef0dcb6fadae19bca13b36aeb67483734d5e46ab2cc2d35762ba53d0038e75d479f645a5877d556e38f2b54582bd368d2683fd279
7
- data.tar.gz: ab2ab15687e5d92b1d3f3e8095468cf7cec26fdfa82b6987082d44bd95d26be143397f800f2e8ba3b80b7620f1f3858157257f6931c4f0361b38d6a67b452055
6
+ metadata.gz: 3b7e36da216d84003e528a0c721a84bf6c3f12bef08615e749aac210568a46f61eb5c50cb43505e4385fcbe416452111773003c8905b03be310d1968a2e68df2
7
+ data.tar.gz: ce1b8b17ef90896a8f9f53b604e47b08a0b9b1d6d3a412201efbb69c26e708388ce628f7a6ed8856b707b52d3f1d9c6c624cf0e521ef70edf15276db10c8ec68
@@ -5,47 +5,47 @@ require 'optparse'
5
5
  require 'vcdetect'
6
6
 
7
7
  def main
8
- option = OptionParser.new do |option|
9
- option.banner = 'Usage: vcdetect [options] <file path>'
10
-
11
- option.on('-h', '--help', 'Print usage info') do
12
- puts option
13
- exit
14
- end
15
-
16
- option.on('-v', '--version', 'Print version info') do
17
- puts "vcdetect #{VCDetect::VERSION}"
18
- exit
8
+ option = OptionParser.new do |option|
9
+ option.banner = 'Usage: vcdetect [options] <file path>'
10
+
11
+ option.on('-h', '--help', 'Print usage info') do
12
+ puts option
13
+ exit
14
+ end
15
+
16
+ option.on('-v', '--version', 'Print version info') do
17
+ puts "vcdetect #{VCDetect::VERSION}"
18
+ exit
19
+ end
19
20
  end
20
- end
21
21
 
22
- option.parse!
22
+ option.parse!
23
23
 
24
- if ARGV.length != 1
25
- puts option
26
- exit 1
27
- end
24
+ if ARGV.length != 1
25
+ puts option
26
+ exit 1
27
+ end
28
28
 
29
- path = ARGV.first
29
+ path = ARGV.first
30
30
 
31
- software = VCDetect.detect(path)
31
+ software = VCDetect.detect(path)
32
32
 
33
- if software.class == Array
34
- software = software.map do |s|
35
- s.to_s
36
- end.join(', ')
37
- end
33
+ if software.class == Array
34
+ software = software.map do |s|
35
+ s.to_s
36
+ end.join(', ')
37
+ end
38
38
 
39
- puts "#{path}: #{software}"
39
+ puts "#{path}: #{software}"
40
40
  end
41
41
 
42
42
  begin
43
- main
44
- # User may quit before completion.
43
+ main
44
+ # User may quit before completion.
45
45
  rescue Interrupt
46
- nil
47
- # May be piped to another program (e.g. `less`),
48
- # which is quit before completion.
46
+ nil
47
+ # May be piped to another program (e.g. `less`),
48
+ # which is quit before completion.
49
49
  rescue Errno::EPIPE, Errno::EMFILE
50
- nil
50
+ nil
51
51
  end
@@ -9,83 +9,83 @@ require_relative 'version'
9
9
  # software such as cvsnt, svk, and vss.
10
10
  #
11
11
  module VCDetect
12
- HOME = ENV['HOME']
13
- PARENT_OF_HOME = File.expand_path('..', HOME)
12
+ HOME = ENV['HOME']
13
+ PARENT_OF_HOME = File.expand_path('..', HOME)
14
14
 
15
- #
16
- # Version control software names (command line tools, as symbols)
17
- # to version control internal data file
18
- #
19
- VC2FILE = {
20
- accurev: 'site_slice',
21
- admsconsole: 'Vault',
22
- arx: '_arx',
23
- bk: 'BitKeeper',
24
- bzr: '.bzr',
25
- cleartool: 'default.magic',
26
- cmvc: 'vc',
27
- cvs: 'CVS',
28
- darcs: '_darcs',
29
- dcvs: 'DCVSMETA',
30
- fossil: '_FOSSIL_',
31
- git: '.git',
32
- hci: 'harvest.sig',
33
- hg: '.hg',
34
- mcvs: 'MCVS',
35
- mtn: '_MTN',
36
- p4: 'depot',
37
- plastic: '.plastic',
38
- qvcs: 'qvcsMetaData',
39
- razor: 'RAZOR_UNIVERSE',
40
- rcs: 'RCS',
41
- scss: 'SCSS',
42
- svn: '.svn',
43
- teamware: 'Codemgr_wsdata'
44
- }
15
+ #
16
+ # Version control software names (command line tools, as symbols)
17
+ # to version control internal data file
18
+ #
19
+ VC2FILE = {
20
+ accurev: 'site_slice',
21
+ admsconsole: 'Vault',
22
+ arx: '_arx',
23
+ bk: 'BitKeeper',
24
+ bzr: '.bzr',
25
+ cleartool: 'default.magic',
26
+ cmvc: 'vc',
27
+ cvs: 'CVS',
28
+ darcs: '_darcs',
29
+ dcvs: 'DCVSMETA',
30
+ fossil: '_FOSSIL_',
31
+ git: '.git',
32
+ hci: 'harvest.sig',
33
+ hg: '.hg',
34
+ mcvs: 'MCVS',
35
+ mtn: '_MTN',
36
+ p4: 'depot',
37
+ plastic: '.plastic',
38
+ qvcs: 'qvcsMetaData',
39
+ razor: 'RAZOR_UNIVERSE',
40
+ rcs: 'RCS',
41
+ scss: 'SCSS',
42
+ svn: '.svn',
43
+ teamware: 'Codemgr_wsdata'
44
+ }
45
45
 
46
- #
47
- # Version control internal data file
48
- # to version control software names (command line tools, as symbols)
49
- #
50
- FILE2VC = VC2FILE.invert
46
+ #
47
+ # Version control internal data file
48
+ # to version control software names (command line tools, as symbols)
49
+ #
50
+ FILE2VC = VC2FILE.invert
51
51
 
52
- #
53
- # Version control software names (command line tools, as symbols)
54
- #
55
- VCS = VC2FILE.keys
52
+ #
53
+ # Version control software names (command line tools, as symbols)
54
+ #
55
+ VCS = VC2FILE.keys
56
56
 
57
- #
58
- # Version control internal data files
59
- #
60
- FILES = VC2FILE.values
57
+ #
58
+ # Version control internal data files
59
+ #
60
+ FILES = VC2FILE.values
61
61
 
62
- #
63
- # Detect version control software managing a file path
64
- #
65
- # Assumes path exists.
66
- # Assuems path is reltive to $HOME.
67
- #
68
- # @path a file path (String)
69
- #
70
- def self.detect(path)
71
- parent = File.expand_path('..', path)
62
+ #
63
+ # Detect version control software managing a file path
64
+ #
65
+ # Assumes path exists.
66
+ # Assuems path is relative to $HOME.
67
+ #
68
+ # @path a file path (String)
69
+ #
70
+ def self.detect(path)
71
+ parent = File.expand_path('..', path)
72
72
 
73
- if !File.directory?(path)
74
- detect(parent)
75
- elsif path == PARENT_OF_HOME
76
- :unknown
77
- else
78
- software = FILES.select do |vc_dir|
79
- Dir.new(path).entries.include?(vc_dir)
80
- end
73
+ if !File.directory?(path)
74
+ detect(parent)
75
+ elsif path == PARENT_OF_HOME
76
+ :unknown
77
+ else
78
+ software = FILES.select do |vc_dir|
79
+ Dir.new(path).entries.include?(vc_dir)
80
+ end
81
81
 
82
- if software.length == 0
83
- detect(parent)
84
- elsif software.length == 1
85
- FILE2VC[software.first]
86
- else
87
- software.map do |s| FILE2VC[s] end
88
- end
82
+ if software.length == 0
83
+ detect(parent)
84
+ elsif software.length == 1
85
+ FILE2VC[software.first]
86
+ else
87
+ software.map do |s| FILE2VC[s] end
88
+ end
89
+ end
90
+ end
89
91
  end
90
- end
91
- end
@@ -2,5 +2,5 @@
2
2
  # VCDetect
3
3
  #
4
4
  module VCDetect
5
- VERSION = '0.4'
5
+ VERSION = '0.5'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vcdetect
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: '0.5'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Pennebaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-11 00:00:00.000000000 Z
11
+ date: 2019-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - ~>
130
130
  - !ruby/object:Gem::Version
131
- version: '0.24'
131
+ version: '0.49'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - ~>
137
137
  - !ruby/object:Gem::Version
138
- version: '0.24'
138
+ version: '0.49'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: tailor
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -150,34 +150,6 @@ dependencies:
150
150
  - - ~>
151
151
  - !ruby/object:Gem::Version
152
152
  version: '1.4'
153
- - !ruby/object:Gem::Dependency
154
- name: guard
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - ~>
158
- - !ruby/object:Gem::Version
159
- version: '2.6'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - ~>
165
- - !ruby/object:Gem::Version
166
- version: '2.6'
167
- - !ruby/object:Gem::Dependency
168
- name: guard-shell
169
- requirement: !ruby/object:Gem::Requirement
170
- requirements:
171
- - - ~>
172
- - !ruby/object:Gem::Version
173
- version: '0.6'
174
- type: :development
175
- prerelease: false
176
- version_requirements: !ruby/object:Gem::Requirement
177
- requirements:
178
- - - ~>
179
- - !ruby/object:Gem::Version
180
- version: '0.6'
181
153
  - !ruby/object:Gem::Dependency
182
154
  name: rspec
183
155
  requirement: !ruby/object:Gem::Requirement
@@ -229,7 +201,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
229
201
  requirements:
230
202
  - - '>='
231
203
  - !ruby/object:Gem::Version
232
- version: '1.9'
204
+ version: '2.0'
233
205
  required_rubygems_version: !ruby/object:Gem::Requirement
234
206
  requirements:
235
207
  - - '>='
@@ -237,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
237
209
  version: '0'
238
210
  requirements: []
239
211
  rubyforge_project:
240
- rubygems_version: 2.4.6
212
+ rubygems_version: 2.7.8
241
213
  signing_key:
242
214
  specification_version: 4
243
215
  summary: detect which version control software manages a file path