build-detect 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.md +23 -0
- data/bin/build-detect +51 -0
- data/lib/build_detect.rb +87 -0
- data/lib/version.rb +6 -0
- metadata +258 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 053187b8a13d334a9f18b31075957957c8030e53
|
4
|
+
data.tar.gz: 588d7aef17c645dc608f53b29c0d64418bb7ecad
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 20779c9a155cb3124afd266236c474fde2c46f4051c2bb28bb6848ce0439a7cf5f875358eda1580f9364b6a3f155e35af6e055910ead4d2c26f64f4bb6ffed35
|
7
|
+
data.tar.gz: 413e549e35fd1b0b81f656970c1bad6953a06ef3ac81031e8f4a1ca096b5b500d2353c5a7bc309e0b9152eacc534ebba415b08ac2d1bb47c70bbd68c2bef7573
|
data/LICENSE.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# FreeBSD License
|
2
|
+
|
3
|
+
# Copyright 2015 Andrew Pennebaker. All rights reserved.
|
4
|
+
|
5
|
+
Redistribution and use in source and binary forms, with or without modification,
|
6
|
+
are permitted provided that the following conditions are met:
|
7
|
+
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
9
|
+
list of conditions and the following disclaimer.
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
11
|
+
this list of conditions and the following disclaimer in the documentation and/or
|
12
|
+
other materials provided with the distribution.
|
13
|
+
|
14
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
15
|
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
16
|
+
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
17
|
+
SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
18
|
+
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
19
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
20
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
21
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
22
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
23
|
+
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/bin/build-detect
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'optparse'
|
5
|
+
require 'build_detect'
|
6
|
+
|
7
|
+
def main
|
8
|
+
option = OptionParser.new do |option|
|
9
|
+
option.banner = 'Usage: build-detect [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 "build-detect #{BuildDetect::VERSION}"
|
18
|
+
exit
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
option.parse!
|
23
|
+
|
24
|
+
if ARGV.length != 1
|
25
|
+
puts option
|
26
|
+
exit 1
|
27
|
+
end
|
28
|
+
|
29
|
+
path = ARGV.first
|
30
|
+
|
31
|
+
software = BuildDetect.detect(path)
|
32
|
+
|
33
|
+
if software.class == Array
|
34
|
+
software = software.map do |s|
|
35
|
+
s.to_s
|
36
|
+
end.join(', ')
|
37
|
+
end
|
38
|
+
|
39
|
+
puts "#{path}: #{software}"
|
40
|
+
end
|
41
|
+
|
42
|
+
begin
|
43
|
+
main
|
44
|
+
# User may quit before completion.
|
45
|
+
rescue Interrupt
|
46
|
+
nil
|
47
|
+
# May be piped to another program (e.g. `less`),
|
48
|
+
# which is quit before completion.
|
49
|
+
rescue Errno::EPIPE, Errno::EMFILE
|
50
|
+
nil
|
51
|
+
end
|
data/lib/build_detect.rb
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
require_relative 'version'
|
2
|
+
|
3
|
+
require 'dotsmack'
|
4
|
+
|
5
|
+
#
|
6
|
+
# BuildDetect - detect build system for file paths
|
7
|
+
#
|
8
|
+
# Assumes build data is stored on the file system in
|
9
|
+
# plain, unambiguous, per-project fashion.
|
10
|
+
#
|
11
|
+
module BuildDetect
|
12
|
+
HOME = ENV['HOME']
|
13
|
+
PARENT_OF_HOME = File.expand_path('..', HOME)
|
14
|
+
|
15
|
+
#
|
16
|
+
# Build system names (command line tools, as symbols)
|
17
|
+
# to build internal data file
|
18
|
+
#
|
19
|
+
BS2FILE = {
|
20
|
+
make: 'Makefile*',
|
21
|
+
rake: 'Rakefile*',
|
22
|
+
maven: 'pom.xml',
|
23
|
+
sbt: 'build.sbt',
|
24
|
+
ant: 'build.xml',
|
25
|
+
gradle: 'build.gradle',
|
26
|
+
grunt: 'Gruntfile.js',
|
27
|
+
gulp: 'Gulp.js',
|
28
|
+
npm: 'package.json',
|
29
|
+
bower: 'bower.json',
|
30
|
+
perl: 'Makefile.PL',
|
31
|
+
invoke: 'tasks.py',
|
32
|
+
cabal: '*.cabal',
|
33
|
+
leiningen: 'project.clj',
|
34
|
+
scons: 'SConstruct',
|
35
|
+
cmake: 'CMakeLists',
|
36
|
+
waf: 'wscript',
|
37
|
+
setuptools: 'setup.py',
|
38
|
+
pip: 'requirements.txt',
|
39
|
+
chicken_install: '*.setup'
|
40
|
+
}
|
41
|
+
|
42
|
+
#
|
43
|
+
# Build internal data file
|
44
|
+
# to build system names (command line tools, as symbols)
|
45
|
+
#
|
46
|
+
FILE2BS = BS2FILE.invert
|
47
|
+
|
48
|
+
#
|
49
|
+
# Build system names (command line tools, as symbols)
|
50
|
+
#
|
51
|
+
BSS = BS2FILE.keys
|
52
|
+
|
53
|
+
#
|
54
|
+
# Build internal data files
|
55
|
+
#
|
56
|
+
FILES = BS2FILE.values
|
57
|
+
|
58
|
+
#
|
59
|
+
# Detect build system managing a file path
|
60
|
+
#
|
61
|
+
# Assumes path exists.
|
62
|
+
# Assuems path is relative to $HOME.
|
63
|
+
#
|
64
|
+
# @path a file path (String)
|
65
|
+
#
|
66
|
+
def self.detect(path)
|
67
|
+
parent = File.expand_path('..', path)
|
68
|
+
|
69
|
+
if !File.directory?(path)
|
70
|
+
detect(parent)
|
71
|
+
elsif path == PARENT_OF_HOME
|
72
|
+
:unknown
|
73
|
+
else
|
74
|
+
software = FILES.select do |bs_pattern|
|
75
|
+
Dir.new(path).entries.any? { |path| Dotsmack::fnmatch?(bs_pattern, path) }
|
76
|
+
end
|
77
|
+
|
78
|
+
if software.length == 0
|
79
|
+
detect(parent)
|
80
|
+
elsif software.length == 1
|
81
|
+
FILE2BS[software.first]
|
82
|
+
else
|
83
|
+
software.map do |s| FILE2BS[s] end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
data/lib/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,258 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: build-detect
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrew Pennebaker
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: dotsmack
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: reek
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: flay
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.5'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.5'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: flog
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '4.3'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '4.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: roodi
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '4.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '4.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: churn
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: cane
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.6'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ~>
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.6'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: excellent
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ~>
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.1'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ~>
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '2.1'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ~>
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.24'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ~>
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.24'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: tailor
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ~>
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '1.4'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ~>
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '1.4'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: guard
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ~>
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '2.6'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ~>
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '2.6'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: guard-shell
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ~>
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0.6'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ~>
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0.6'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: rspec
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ~>
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '3.0'
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ~>
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '3.0'
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: cucumber
|
211
|
+
requirement: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - ~>
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '1.3'
|
216
|
+
type: :development
|
217
|
+
prerelease: false
|
218
|
+
version_requirements: !ruby/object:Gem::Requirement
|
219
|
+
requirements:
|
220
|
+
- - ~>
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '1.3'
|
223
|
+
description: See README.md for example usage
|
224
|
+
email: andrew.pennebaker@gmail.com
|
225
|
+
executables:
|
226
|
+
- build-detect
|
227
|
+
extensions: []
|
228
|
+
extra_rdoc_files: []
|
229
|
+
files:
|
230
|
+
- LICENSE.md
|
231
|
+
- bin/build-detect
|
232
|
+
- lib/build_detect.rb
|
233
|
+
- lib/version.rb
|
234
|
+
homepage: https://github.com/mcandre/build-detect
|
235
|
+
licenses:
|
236
|
+
- FreeBSD
|
237
|
+
metadata: {}
|
238
|
+
post_install_message:
|
239
|
+
rdoc_options: []
|
240
|
+
require_paths:
|
241
|
+
- lib
|
242
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
243
|
+
requirements:
|
244
|
+
- - '>='
|
245
|
+
- !ruby/object:Gem::Version
|
246
|
+
version: '1.9'
|
247
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
248
|
+
requirements:
|
249
|
+
- - '>='
|
250
|
+
- !ruby/object:Gem::Version
|
251
|
+
version: '0'
|
252
|
+
requirements: []
|
253
|
+
rubyforge_project:
|
254
|
+
rubygems_version: 2.4.6
|
255
|
+
signing_key:
|
256
|
+
specification_version: 4
|
257
|
+
summary: detect which build system manages a file path
|
258
|
+
test_files: []
|