inqlude 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +23 -0
- data/{README → README.md} +0 -0
- data/TODO +24 -9
- data/accessing-inqlude-data.md +55 -0
- data/inqlude.gemspec +2 -1
- data/lib/cli.rb +36 -4
- data/lib/creator.rb +17 -32
- data/lib/distros/suse.rb +2 -2
- data/lib/downloader.rb +37 -0
- data/lib/exceptions.rb +2 -0
- data/lib/inqlude.rb +21 -15
- data/lib/json_object.rb +104 -0
- data/lib/kde_frameworks_creator.rb +14 -10
- data/lib/kde_frameworks_release.rb +14 -13
- data/lib/library.rb +4 -4
- data/lib/manifest.rb +165 -28
- data/lib/manifest_handler.rb +14 -16
- data/lib/verifier.rb +23 -48
- data/lib/version.rb +1 -1
- data/lib/view.rb +29 -26
- data/manifest-format.md +15 -0
- data/spec/data/inqlude-all-karchive.json +31 -0
- data/spec/data/inqlude-all.json +120 -0
- data/spec/data/invalid-schema.manifest +4 -0
- data/spec/data/karchive-release-5.4.manifest +29 -0
- data/spec/data/karchive-release.manifest +7 -7
- data/spec/data/karchive.readme +0 -6
- data/spec/data/newlib/newlib.manifest +11 -4
- data/spec/data/rendertest-generic.manifest +4 -1
- data/spec/integration/cli_create_spec.rb +24 -0
- data/spec/integration/cli_general_spec.rb +19 -0
- data/spec/integration/cli_get_involved_spec.rb +14 -0
- data/spec/integration/cli_help_spec.rb +21 -0
- data/spec/integration/cli_list_spec.rb +23 -0
- data/spec/integration/cli_verify_spec.rb +37 -0
- data/spec/integration/cli_view_spec.rb +28 -0
- data/spec/integration/spec_helper.rb +2 -0
- data/spec/{creator_spec.rb → unit/creator_spec.rb} +8 -41
- data/spec/unit/downloader_spec.rb +32 -0
- data/spec/unit/json_object_spec.rb +273 -0
- data/spec/{kde_frameworks_creator_spec.rb → unit/kde_frameworks_creator_spec.rb} +13 -14
- data/spec/{kde_frameworks_release_spec.rb → unit/kde_frameworks_release_spec.rb} +14 -10
- data/spec/{library_spec.rb → unit/library_spec.rb} +7 -7
- data/spec/{manifest_handler_spec.rb → unit/manifest_handler_spec.rb} +21 -17
- data/spec/unit/manifest_spec.rb +301 -0
- data/spec/{rpm_manifestizer_spec.rb → unit/rpm_manifestizer_spec.rb} +0 -0
- data/spec/{settings_spec.rb → unit/settings_spec.rb} +0 -0
- data/spec/{spec_helper.rb → unit/spec_helper.rb} +10 -12
- data/spec/{verifier_spec.rb → unit/verifier_spec.rb} +24 -15
- data/spec/{view_spec.rb → unit/view_spec.rb} +38 -7
- data/view/all.html.haml +4 -4
- data/view/commercial.html.haml +1 -1
- data/view/development.html.haml +3 -3
- data/view/get.html.haml +11 -2
- data/view/group.html.haml +4 -4
- data/view/index.html.haml +1 -1
- data/view/library.html.haml +8 -9
- data/view/unreleased.html.haml +1 -1
- data/yes_ship_it.conf +3 -0
- metadata +67 -51
- data/spec/manifest_spec.rb +0 -63
data/lib/verifier.rb
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
class Verifier
|
18
18
|
|
19
19
|
class Result
|
20
|
-
attr_accessor :
|
20
|
+
attr_accessor :errors, :name
|
21
21
|
|
22
22
|
def initialize
|
23
23
|
@valid = false
|
@@ -25,7 +25,7 @@ class Verifier
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def valid?
|
28
|
-
@
|
28
|
+
@errors.empty?
|
29
29
|
end
|
30
30
|
|
31
31
|
def print_result
|
@@ -43,79 +43,54 @@ class Verifier
|
|
43
43
|
|
44
44
|
def initialize settings
|
45
45
|
@settings = settings
|
46
|
-
|
47
|
-
@allowed_keys = [ "$schema", "name", "version", "release_date",
|
48
|
-
"summary", "urls", "licenses", "description", "authors", "maturity",
|
49
|
-
"platforms", "packages", "keywords", "dependencies", "filename",
|
50
|
-
"libraryname", "display_name", "schema_type", "schema_version", "group" ]
|
51
46
|
end
|
52
47
|
|
53
48
|
def verify manifest
|
54
49
|
@result = Result.new
|
55
50
|
|
56
|
-
if !manifest
|
51
|
+
if !manifest.filename
|
57
52
|
@result.errors.push "Unable to determine filename"
|
58
53
|
@result.name = "<unknown>"
|
59
54
|
else
|
60
|
-
@result.name = manifest
|
55
|
+
@result.name = manifest.filename
|
61
56
|
end
|
62
|
-
if !manifest
|
57
|
+
if !manifest.libraryname
|
63
58
|
@result.errors.push "Unable to determine libraryname"
|
64
59
|
end
|
65
|
-
if manifest["$schema"]
|
66
|
-
schema_type = manifest["schema_type"]
|
67
|
-
if schema_type != "generic" && schema_type != "release" &&
|
68
|
-
schema_type != "proprietary-release"
|
69
|
-
@result.errors.push "Unknown schema type '#{schema_type}'"
|
70
|
-
end
|
71
|
-
else
|
72
|
-
@result.errors.push "Unable to find $schema attribute"
|
73
|
-
end
|
74
60
|
|
75
61
|
if @result.errors.empty?
|
76
|
-
filename = manifest
|
77
|
-
expected_filename = ""
|
78
|
-
schema_type = manifest["schema_type"]
|
79
|
-
if schema_type == "generic"
|
80
|
-
expected_filename = "#{manifest["libraryname"]}.manifest"
|
81
|
-
elsif schema_type == "release" || schema_type == "proprietary-release"
|
82
|
-
expected_filename = "#{manifest["libraryname"]}.#{manifest["release_date"]}.manifest"
|
83
|
-
end
|
62
|
+
filename = manifest.filename
|
84
63
|
|
85
|
-
if filename != expected_filename
|
86
|
-
@result.errors.push "Expected file name: #{expected_filename}"
|
64
|
+
if filename != manifest.expected_filename
|
65
|
+
@result.errors.push "Expected file name: #{manifest.expected_filename}"
|
87
66
|
end
|
88
67
|
|
89
|
-
if manifest
|
90
|
-
@result.errors.push "Invalid release date: #{manifest
|
68
|
+
if manifest.release_date == "1970-01-01"
|
69
|
+
@result.errors.push "Invalid release date: #{manifest.release_date}"
|
91
70
|
end
|
92
71
|
|
93
|
-
manifest.
|
94
|
-
if !@allowed_keys.include? key
|
95
|
-
@result.errors.push "Illegal entry: #{key}"
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
schema_name = "#{manifest["schema_type"]}-manifest-v#{manifest["schema_version"]}"
|
72
|
+
schema_name = manifest.schema_name
|
100
73
|
schema_file = File.expand_path("../../schema/#{schema_name}", __FILE__)
|
101
74
|
|
102
|
-
errors = JSON::Validator.fully_validate(schema_file, manifest)
|
75
|
+
errors = JSON::Validator.fully_validate(schema_file, manifest.to_json)
|
103
76
|
errors.each do |error|
|
104
77
|
@result.errors.push "Schema validation error: #{error}"
|
105
78
|
end
|
106
79
|
end
|
107
|
-
|
108
|
-
|
109
|
-
@result.valid = true
|
110
|
-
return @result
|
111
|
-
else
|
112
|
-
@result.valid = false
|
113
|
-
return @result
|
114
|
-
end
|
80
|
+
|
81
|
+
@result
|
115
82
|
end
|
116
83
|
|
117
84
|
def verify_file filename
|
118
|
-
|
85
|
+
begin
|
86
|
+
manifest = Manifest.parse_file filename
|
87
|
+
rescue VerificationError => e
|
88
|
+
@result = Result.new
|
89
|
+
@result.name = filename
|
90
|
+
@result.errors.push e
|
91
|
+
return @result
|
92
|
+
end
|
93
|
+
|
119
94
|
verify manifest
|
120
95
|
end
|
121
96
|
|
data/lib/version.rb
CHANGED
data/lib/view.rb
CHANGED
@@ -36,6 +36,9 @@ class View
|
|
36
36
|
assert_dir "#{output_dir}/schema"
|
37
37
|
system "cp #{schema_dir}/* #{output_dir}/schema"
|
38
38
|
|
39
|
+
create_inqlude_all(output_dir)
|
40
|
+
|
41
|
+
|
39
42
|
@root = ""
|
40
43
|
|
41
44
|
render_template "index", output_dir
|
@@ -72,6 +75,12 @@ class View
|
|
72
75
|
end
|
73
76
|
end
|
74
77
|
|
78
|
+
def create_inqlude_all(output_dir)
|
79
|
+
File.open(File.join(output_dir, "inqlude-all.json"), "w") do |f|
|
80
|
+
f.write(@manifest_handler.generate_inqlude_all)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
75
84
|
def render_template name, output_dir, file_name = nil
|
76
85
|
layout = template "layout"
|
77
86
|
layout_engine = Haml::Engine.new layout
|
@@ -99,12 +108,8 @@ class View
|
|
99
108
|
"<link href='#{@root}public/inqlude.css' rel='stylesheet' type='text/css' />"
|
100
109
|
end
|
101
110
|
|
102
|
-
def m
|
103
|
-
|
104
|
-
@manifest[ attr ][ subattr ]
|
105
|
-
else
|
106
|
-
@manifest[ attr ]
|
107
|
-
end
|
111
|
+
def m
|
112
|
+
@manifest
|
108
113
|
end
|
109
114
|
|
110
115
|
def link_to_manifest name
|
@@ -123,7 +128,7 @@ class View
|
|
123
128
|
end
|
124
129
|
|
125
130
|
def list_attribute attribute
|
126
|
-
attr =
|
131
|
+
attr = @manifest.send(attribute)
|
127
132
|
return "" if !attr || attr.size == 0
|
128
133
|
|
129
134
|
# We assume attribute is plural formed by adding an 's'
|
@@ -151,13 +156,13 @@ class View
|
|
151
156
|
end
|
152
157
|
|
153
158
|
def version_content
|
154
|
-
if @manifest
|
155
|
-
raise "Can't get version for generic manifest '#{@manifest
|
159
|
+
if @manifest.class == ManifestGeneric
|
160
|
+
raise InqludeError.new("Can't get version for generic manifest '#{@manifest.name}'")
|
156
161
|
end
|
157
|
-
out = @manifest
|
158
|
-
out += " (#{@manifest
|
162
|
+
out = @manifest.version
|
163
|
+
out += " (#{@manifest.maturity})"
|
159
164
|
out += "<span class='release-date'>"
|
160
|
-
out += "released on #{@manifest
|
165
|
+
out += "released on #{@manifest.release_date}"
|
161
166
|
out += "</span>"
|
162
167
|
if !old_versions.empty?
|
163
168
|
out += "<span class='old-versions'>"
|
@@ -179,10 +184,10 @@ class View
|
|
179
184
|
end
|
180
185
|
|
181
186
|
def link_item key, label
|
182
|
-
if m(
|
187
|
+
if m.urls.send(key)
|
183
188
|
out = "<li><a href=\""
|
184
|
-
out += m(
|
185
|
-
out += "\">#{label}</a>"
|
189
|
+
out += m.urls.send(key)
|
190
|
+
out += "\">#{label}</a></li>"
|
186
191
|
return out
|
187
192
|
else
|
188
193
|
return ""
|
@@ -191,7 +196,7 @@ class View
|
|
191
196
|
|
192
197
|
def custom_urls
|
193
198
|
out = ""
|
194
|
-
urls =
|
199
|
+
urls = @manifest.urls.custom
|
195
200
|
if urls && !urls.empty?
|
196
201
|
urls.each do |text,url|
|
197
202
|
out += "<li><a href=\"#{url}\">#{text}</a></li>"
|
@@ -201,9 +206,6 @@ class View
|
|
201
206
|
end
|
202
207
|
|
203
208
|
def libraries maturity = nil
|
204
|
-
if @manifest_handler.libraries(maturity).empty?
|
205
|
-
@manifest_handler.read_remote
|
206
|
-
end
|
207
209
|
@manifest_handler.libraries(maturity)
|
208
210
|
end
|
209
211
|
|
@@ -231,9 +233,10 @@ class View
|
|
231
233
|
end
|
232
234
|
|
233
235
|
def more_urls?
|
234
|
-
|
235
|
-
|
236
|
-
|
236
|
+
@manifest.urls.class.all_keys.each do |key, type|
|
237
|
+
if key != :homepage && key != :screenshots && key != :logo &&
|
238
|
+
key != :description_source
|
239
|
+
if @manifest.urls.send(key)
|
237
240
|
return true
|
238
241
|
end
|
239
242
|
end
|
@@ -243,18 +246,18 @@ class View
|
|
243
246
|
|
244
247
|
def editor_url
|
245
248
|
url = "https://github.com/cornelius/inqlude-data/blob/master/"
|
246
|
-
url += @manifest
|
247
|
-
url += "/#{@manifest
|
249
|
+
url += @manifest.name
|
250
|
+
url += "/#{@manifest.name}.#{@manifest.release_date}.manifest"
|
248
251
|
url
|
249
252
|
end
|
250
253
|
|
251
254
|
def old_versions
|
252
|
-
versions = @library.versions.reject{ |v| v == @manifest
|
255
|
+
versions = @library.versions.reject{ |v| v == @manifest.version }
|
253
256
|
versions.reverse
|
254
257
|
end
|
255
258
|
|
256
259
|
def render_description
|
257
|
-
doc = Kramdown::Document.new(@manifest
|
260
|
+
doc = Kramdown::Document.new(@manifest.description)
|
258
261
|
doc.to_html
|
259
262
|
end
|
260
263
|
|
data/manifest-format.md
CHANGED
@@ -109,6 +109,10 @@ All URLs are represented as a key specifying the type of the URL and the
|
|
109
109
|
actual URL itself. Arbitrary types can be defined. Some types are used for
|
110
110
|
specific purposes and get special treatment.
|
111
111
|
|
112
|
+
All these URLs are meant to be consumed by humans, so they should work and make
|
113
|
+
sense when shown in a web browser. Other than that they don't have very strict
|
114
|
+
requirements. They are not necessarily meant to be read programmatically.
|
115
|
+
|
112
116
|
The following types are recognized:
|
113
117
|
|
114
118
|
* "homepage": Home page of the library. This is the main URL used as entry point
|
@@ -123,6 +127,8 @@ The following types are recognized:
|
|
123
127
|
* "description_source": If the description text is taken from another source
|
124
128
|
this URL points to the source.
|
125
129
|
* "announcement": Link to release announcement
|
130
|
+
* "mailing_list": Mailing list for discussing the library
|
131
|
+
* "contact": Contact information
|
126
132
|
* "custom": Array of pairs of title and URL of custom links
|
127
133
|
|
128
134
|
*the homepage is a mandatory url attribute*
|
@@ -214,3 +220,12 @@ entry.
|
|
214
220
|
|
215
221
|
Each entry contains the package_name, repository, and source_rpm attributes.
|
216
222
|
The repository contains an url and a name sub-attribute.
|
223
|
+
|
224
|
+
### group
|
225
|
+
|
226
|
+
Name of a group
|
227
|
+
|
228
|
+
The group optionally specifies the name of a group of libraries the library
|
229
|
+
described my the manifest belongs to.
|
230
|
+
|
231
|
+
At the moment only the value "kde-frameworks" is used.
|
@@ -0,0 +1,31 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"$schema": "http://inqlude.org/schema/release-manifest-v1#",
|
4
|
+
"name": "karchive",
|
5
|
+
"display_name": "KArchive",
|
6
|
+
"release_date": "2014-03-04",
|
7
|
+
"version": "4.97.0",
|
8
|
+
"summary": "Reading, creating, and manipulating file archives",
|
9
|
+
"urls": {
|
10
|
+
"homepage": "https://projects.kde.org/projects/frameworks/karchive",
|
11
|
+
"download": "ftp://ftp.kde.org/pub/kde/stable/karchive/",
|
12
|
+
"vcs": "https://projects.kde.org/projects/frameworks/karchive/repository",
|
13
|
+
"mailing_list": "https://mail.kde.org/mailman/listinfo/kde-frameworks-devel"
|
14
|
+
},
|
15
|
+
"licenses": [
|
16
|
+
"LGPLv2.1+"
|
17
|
+
],
|
18
|
+
"description": "KArchive provides classes for easy reading, creation and manipulation of\n\"archive\" formats like ZIP and TAR.\n\nIf also provides transparent compression and decompression of data, like the\nGZip format, via a subclass of QIODevice.",
|
19
|
+
"authors": [
|
20
|
+
"The KDE Community"
|
21
|
+
],
|
22
|
+
"maturity": "alpha",
|
23
|
+
"platforms": [
|
24
|
+
"Linux"
|
25
|
+
],
|
26
|
+
"packages": {
|
27
|
+
"source": "ftp://ftp.kde.org/pub/kde/stable/karchive/karchive-4.97.0.tar.bz2"
|
28
|
+
},
|
29
|
+
"group": "kde-frameworks"
|
30
|
+
}
|
31
|
+
]
|
@@ -0,0 +1,120 @@
|
|
1
|
+
[
|
2
|
+
{
|
3
|
+
"$schema": "http://inqlude.org/schema/release-manifest-v1#",
|
4
|
+
"name": "awesomelib",
|
5
|
+
"release_date": "2013-09-08",
|
6
|
+
"version": "0.2.0",
|
7
|
+
"summary": "Awesome library",
|
8
|
+
"urls": {
|
9
|
+
"homepage": "http://example.com",
|
10
|
+
"download": "http://example.com/download"
|
11
|
+
},
|
12
|
+
"licenses": [
|
13
|
+
"LGPLv2.1+",
|
14
|
+
"Commercial"
|
15
|
+
],
|
16
|
+
"description": "This is an awesome library.",
|
17
|
+
"authors": [
|
18
|
+
"Cornelius Schumacher <schumacher@kde.org>"
|
19
|
+
],
|
20
|
+
"maturity": "stable",
|
21
|
+
"platforms": [
|
22
|
+
"Linux"
|
23
|
+
],
|
24
|
+
"packages": {
|
25
|
+
"source": "ftp://example.com/download/awesomelib-0.2.0.tar.gz"
|
26
|
+
},
|
27
|
+
"group": "kde-frameworks"
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"$schema": "http://inqlude.org/schema/release-manifest-v1#",
|
31
|
+
"name": "bleedingedge",
|
32
|
+
"release_date": "2012-01-01",
|
33
|
+
"version": "edge",
|
34
|
+
"summary": "Bleeding edge version of a library",
|
35
|
+
"urls": {
|
36
|
+
"homepage": "http://example.org",
|
37
|
+
"download": "http://example.org/download"
|
38
|
+
},
|
39
|
+
"licenses": [
|
40
|
+
"GPLv3"
|
41
|
+
],
|
42
|
+
"description": "This is an awesome library. It's bleeding edge.",
|
43
|
+
"authors": [
|
44
|
+
"Cornelius Schumacher <schumacher@kde.org>"
|
45
|
+
],
|
46
|
+
"maturity": "edge",
|
47
|
+
"platforms": [
|
48
|
+
"Linux"
|
49
|
+
],
|
50
|
+
"packages": {
|
51
|
+
"source": "ftp://example.org/download/bleedingedge-latest.tar.gz"
|
52
|
+
},
|
53
|
+
"group": "kde-frameworks"
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"$schema": "http://inqlude.org/schema/generic-manifest-v1#",
|
57
|
+
"name": "commercial",
|
58
|
+
"summary": "Commercial library",
|
59
|
+
"urls": {
|
60
|
+
"homepage": "http://commercial.example.org"
|
61
|
+
},
|
62
|
+
"licenses": [
|
63
|
+
"Commercial"
|
64
|
+
],
|
65
|
+
"description": "Library only available under commercial license.",
|
66
|
+
"authors": [
|
67
|
+
"John Doe <doe@example.org>"
|
68
|
+
],
|
69
|
+
"maturity": "stable",
|
70
|
+
"platforms": [
|
71
|
+
"Linux",
|
72
|
+
"Windows"
|
73
|
+
]
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"$schema": "http://inqlude.org/schema/generic-manifest-v1#",
|
77
|
+
"name": "newlib",
|
78
|
+
"summary": "A new lib under heavy development",
|
79
|
+
"urls": {
|
80
|
+
"homepage": "http://new.example.org",
|
81
|
+
"download": "http://new.example.org/download"
|
82
|
+
},
|
83
|
+
"licenses": [
|
84
|
+
"GPLv3"
|
85
|
+
],
|
86
|
+
"description": "This is an awesome library. It's new.",
|
87
|
+
"authors": [
|
88
|
+
"Cornelius Schumacher <schumacher@kde.org>"
|
89
|
+
],
|
90
|
+
"platforms": [
|
91
|
+
"Linux",
|
92
|
+
"Windows"
|
93
|
+
]
|
94
|
+
},
|
95
|
+
{
|
96
|
+
"$schema": "http://inqlude.org/schema/proprietary-release-manifest-v1#",
|
97
|
+
"name": "proprietarylib",
|
98
|
+
"release_date": "2013-12-22",
|
99
|
+
"version": "1.2.1",
|
100
|
+
"summary": "Awesome proprietary library",
|
101
|
+
"urls": {
|
102
|
+
"homepage": "http://xyz.example.com",
|
103
|
+
"download": "http://xyz.example.com/download"
|
104
|
+
},
|
105
|
+
"licenses": [
|
106
|
+
"LGPLv2.1+",
|
107
|
+
"Commercial"
|
108
|
+
],
|
109
|
+
"description": "This is an awesome proprietarylibrary.",
|
110
|
+
"authors": [
|
111
|
+
"Cool Company"
|
112
|
+
],
|
113
|
+
"maturity": "stable",
|
114
|
+
"platforms": [
|
115
|
+
"Linux",
|
116
|
+
"Windows",
|
117
|
+
"OS X"
|
118
|
+
]
|
119
|
+
}
|
120
|
+
]
|