cloulu 0.5.1 → 0.6.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 +8 -8
- data/lib/clouseau/detector.rb +137 -0
- data/lib/clouseau/detectors/django.rb +10 -0
- data/lib/clouseau/detectors/dotnet.rb +8 -0
- data/lib/clouseau/detectors/erlang.rb +8 -0
- data/lib/clouseau/detectors/flask.rb +12 -0
- data/lib/clouseau/detectors/grails.rb +11 -0
- data/lib/clouseau/detectors/java.rb +9 -0
- data/lib/clouseau/detectors/lift.rb +11 -0
- data/lib/clouseau/detectors/node.rb +11 -0
- data/lib/clouseau/detectors/php.rb +8 -0
- data/lib/clouseau/detectors/play.rb +12 -0
- data/lib/clouseau/detectors/python.rb +8 -0
- data/lib/clouseau/detectors/rack.rb +10 -0
- data/lib/clouseau/detectors/rails.rb +10 -0
- data/lib/clouseau/detectors/ruby.rb +8 -0
- data/lib/clouseau/detectors/sinatra.rb +11 -0
- data/lib/clouseau/detectors/spring.rb +16 -0
- data/lib/clouseau/detectors.rb +3 -0
- data/lib/clouseau/version.rb +3 -0
- data/lib/clouseau.rb +18 -0
- data/lib/vmc/detect.rb +1 -0
- data/lib/vmc/version.rb +1 -1
- metadata +21 -15
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDYwZjcxZmI4MmM2MmM0ZDc1NWFlOTQwYWQxOTkxNDlmNjAzZWQ1MQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjA5NmNlMDNiNGZkOTMzYjgwZWY3ZTMyY2RkODQwZDg4ZWMzZTg4Mg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTM5MTE1MTJhYjJiNGVlZmVjMGI5NDE1N2E0MWZmNTMzYzBhZmJhODUxNGQ0
|
10
|
+
MmVmMWMyOTdiYzdiZmE5ZGZmOWU5ZWJlODRiN2JjMjRiOWYxZTM3YzUxYTE0
|
11
|
+
MmEzM2QzN2UwYTYwNjU1MjgzZjIyMDUxZmEzOWVhMmUzY2M2YTc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NjU2ZTU5Y2QwNjY4ZjFjMmMzNjJkNWVjZThjYWQ4ODdhNTQxYjI2MWE3Zjc4
|
14
|
+
YmM1NTg0YjY2YzY5MTk1NDAzYTJhZjRkODMxOTBiYWFjY2MwYzcwMDA5OTQ3
|
15
|
+
MjViZWI0YWNjYjVhMzE5ZDhiNjYyMTk1ZGVhZDIyODliZjM1YjI=
|
@@ -0,0 +1,137 @@
|
|
1
|
+
require "zip/zipfilesystem"
|
2
|
+
|
3
|
+
module Clouseau
|
4
|
+
# array of registered detectors, in the order they'll be tried
|
5
|
+
#
|
6
|
+
# see Detector.inherited
|
7
|
+
def self.detectors
|
8
|
+
@detectors ||= []
|
9
|
+
end
|
10
|
+
|
11
|
+
class Detector
|
12
|
+
class << self
|
13
|
+
attr_accessor :framework_name, :language_name, :memory_suggestion
|
14
|
+
|
15
|
+
# each detection technique; an array of blocks which when called with
|
16
|
+
# a path yield true or false
|
17
|
+
def detection
|
18
|
+
@detection ||= []
|
19
|
+
end
|
20
|
+
|
21
|
+
# name of the detected framework
|
22
|
+
def framework_name
|
23
|
+
@framework_name || parent(:framework_name)
|
24
|
+
end
|
25
|
+
|
26
|
+
# name of the detected language
|
27
|
+
def language_name
|
28
|
+
@language_name || parent(:language_name)
|
29
|
+
end
|
30
|
+
|
31
|
+
# suggested minimum memory allocation for an application of this type
|
32
|
+
def memory_suggestion
|
33
|
+
@memory_suggestion || parent(:memory_suggestion)
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
# register the detector, ensuring it's prioritized over its superclass
|
39
|
+
def inherited(cls)
|
40
|
+
idx =
|
41
|
+
Clouseau.detectors.index { |d|
|
42
|
+
(cls <=> d) == -1
|
43
|
+
}
|
44
|
+
|
45
|
+
Clouseau.detectors.insert(idx || 0, cls)
|
46
|
+
end
|
47
|
+
|
48
|
+
# set detected framework name
|
49
|
+
def framework(name)
|
50
|
+
self.framework_name = name
|
51
|
+
end
|
52
|
+
|
53
|
+
# set detected language
|
54
|
+
def language(name)
|
55
|
+
self.language_name = name
|
56
|
+
end
|
57
|
+
|
58
|
+
# set suggested memory
|
59
|
+
def memory(size)
|
60
|
+
self.memory_suggestion = size
|
61
|
+
end
|
62
|
+
|
63
|
+
# check for given filenames
|
64
|
+
#
|
65
|
+
# if given a block, it is called with each file's contents, and if it
|
66
|
+
# ever returns true, it is a match
|
67
|
+
def file(*files, &check)
|
68
|
+
detection << proc { |path|
|
69
|
+
files.all? { |f|
|
70
|
+
file = "#{path}/#{f}"
|
71
|
+
|
72
|
+
if File.exists?(file)
|
73
|
+
!check || check.call(File.read(file))
|
74
|
+
end
|
75
|
+
}
|
76
|
+
}
|
77
|
+
end
|
78
|
+
|
79
|
+
# check for files described by glob
|
80
|
+
#
|
81
|
+
# if given a block, it is called with each file's contents, and if it
|
82
|
+
# ever returns true, it is a match
|
83
|
+
def glob(*globs, &check)
|
84
|
+
detection << proc { |path|
|
85
|
+
globs.all? do |glob|
|
86
|
+
files = Dir.glob("#{path}/#{glob}")
|
87
|
+
|
88
|
+
unless files.empty?
|
89
|
+
!check || files.any? { |f| check.call(f) }
|
90
|
+
end
|
91
|
+
end
|
92
|
+
}
|
93
|
+
end
|
94
|
+
|
95
|
+
# check for an archive (i.e. .war, .zip, .jar)
|
96
|
+
#
|
97
|
+
# if given a block, it is called with each entry in the archive, and if
|
98
|
+
# it ever returns true, it is a match
|
99
|
+
def zip(glob, &check)
|
100
|
+
detection << proc { |path|
|
101
|
+
archives =
|
102
|
+
if File.fnmatch(glob, path)
|
103
|
+
[path]
|
104
|
+
else
|
105
|
+
Dir.glob("#{path}/#{glob}")
|
106
|
+
end
|
107
|
+
|
108
|
+
archives.any? do |f|
|
109
|
+
found = false
|
110
|
+
|
111
|
+
Zip::ZipFile.foreach(f) do |entry|
|
112
|
+
if check.call(entry)
|
113
|
+
found = true
|
114
|
+
break
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
found
|
119
|
+
end
|
120
|
+
}
|
121
|
+
end
|
122
|
+
|
123
|
+
def parent(meth)
|
124
|
+
if superclass.respond_to? meth
|
125
|
+
superclass.send(meth)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
# run through the detection methods and return `true' if one matches
|
131
|
+
def detect(path)
|
132
|
+
self.class.detection.any? do |d|
|
133
|
+
d.call(path)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require "clouseau/detectors/java"
|
2
|
+
|
3
|
+
module Clouseau
|
4
|
+
class Spring < Java
|
5
|
+
zip "*.war" do |file|
|
6
|
+
case file.name
|
7
|
+
when /WEB-INF\/classes\/org\/springframework/,
|
8
|
+
/WEB-INF\/lib\/spring-core.*\.jar/,
|
9
|
+
/WEB-INF\/lib\/org\.springframework\.core.*\.jar/
|
10
|
+
true
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
framework :spring
|
15
|
+
end
|
16
|
+
end
|
data/lib/clouseau.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "clouseau/detector"
|
2
|
+
require "clouseau/detectors"
|
3
|
+
|
4
|
+
module Clouseau
|
5
|
+
class << self
|
6
|
+
def detect(path)
|
7
|
+
detectors.find do |d|
|
8
|
+
d.new.detect(path)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def matches(path)
|
13
|
+
detectors.select do |d|
|
14
|
+
d.new.detect(path)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/vmc/detect.rb
CHANGED
data/lib/vmc/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloulu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SKPlanet Cloulu Team
|
@@ -67,20 +67,6 @@ dependencies:
|
|
67
67
|
- - ~>
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '1.2'
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: clouseau
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
73
|
-
requirements:
|
74
|
-
- - ~>
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '0.0'
|
77
|
-
type: :runtime
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - ~>
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: '0.0'
|
84
70
|
- !ruby/object:Gem::Dependency
|
85
71
|
name: addressable
|
86
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -203,6 +189,26 @@ files:
|
|
203
189
|
- lib/cfoundry/version.rb
|
204
190
|
- lib/cfoundry/zip.rb
|
205
191
|
- lib/cfoundry.rb
|
192
|
+
- lib/clouseau/detector.rb
|
193
|
+
- lib/clouseau/detectors/django.rb
|
194
|
+
- lib/clouseau/detectors/dotnet.rb
|
195
|
+
- lib/clouseau/detectors/erlang.rb
|
196
|
+
- lib/clouseau/detectors/flask.rb
|
197
|
+
- lib/clouseau/detectors/grails.rb
|
198
|
+
- lib/clouseau/detectors/java.rb
|
199
|
+
- lib/clouseau/detectors/lift.rb
|
200
|
+
- lib/clouseau/detectors/node.rb
|
201
|
+
- lib/clouseau/detectors/php.rb
|
202
|
+
- lib/clouseau/detectors/play.rb
|
203
|
+
- lib/clouseau/detectors/python.rb
|
204
|
+
- lib/clouseau/detectors/rack.rb
|
205
|
+
- lib/clouseau/detectors/rails.rb
|
206
|
+
- lib/clouseau/detectors/ruby.rb
|
207
|
+
- lib/clouseau/detectors/sinatra.rb
|
208
|
+
- lib/clouseau/detectors/spring.rb
|
209
|
+
- lib/clouseau/detectors.rb
|
210
|
+
- lib/clouseau/version.rb
|
211
|
+
- lib/clouseau.rb
|
206
212
|
- lib/manifests-vmc-plugin/errors.rb
|
207
213
|
- lib/manifests-vmc-plugin/lib/manifests-vmc-plugin/errors.rb
|
208
214
|
- lib/manifests-vmc-plugin/lib/manifests-vmc-plugin/loader/builder.rb
|