inqlude 0.0.8 → 0.7.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.
Files changed (63) hide show
  1. data/.gitignore +1 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +3 -0
  4. data/README +35 -1
  5. data/TODO +50 -15
  6. data/inqlude.gemspec +7 -2
  7. data/lib/cli.rb +70 -6
  8. data/lib/creator.rb +32 -8
  9. data/lib/git_hub_tool.rb +92 -0
  10. data/lib/inqlude.rb +7 -0
  11. data/lib/kde_frameworks_creator.rb +173 -0
  12. data/lib/kde_frameworks_release.rb +61 -0
  13. data/lib/library.rb +26 -1
  14. data/lib/manifest.rb +43 -0
  15. data/lib/manifest_handler.rb +59 -17
  16. data/lib/rpm_manifestizer.rb +2 -2
  17. data/lib/settings.rb +21 -10
  18. data/lib/verifier.rb +29 -18
  19. data/lib/version.rb +1 -1
  20. data/lib/view.rb +55 -10
  21. data/manifest-format.md +27 -12
  22. data/schema/generic-manifest-v1 +54 -0
  23. data/schema/proprietary-release-manifest-v1 +63 -0
  24. data/schema/release-manifest-v1 +73 -0
  25. data/spec/creator_spec.rb +94 -34
  26. data/spec/data/awesomelib/awesomelib.2013-09-08.manifest +14 -6
  27. data/spec/data/bleedingedge/bleedingedge.2012-01-01.manifest +3 -2
  28. data/spec/data/commercial/commercial.manifest +13 -0
  29. data/spec/data/karchive-generic.manifest +22 -0
  30. data/spec/data/karchive-release-beta.manifest +29 -0
  31. data/spec/data/karchive-release.manifest +29 -0
  32. data/spec/data/karchive-release2.manifest +29 -0
  33. data/spec/data/karchive.authors +10 -0
  34. data/spec/data/karchive.readme +35 -0
  35. data/spec/data/kservice-generic.manifest +22 -0
  36. data/spec/data/kservice.readme +9 -0
  37. data/spec/data/newlib/newlib.manifest +13 -0
  38. data/spec/data/proprietarylib/proprietarylib.2013-12-22.manifest +16 -0
  39. data/spec/data/rendertest-generic.manifest +20 -0
  40. data/spec/data/testcontent +1 -0
  41. data/spec/kde_frameworks_creator_spec.rb +263 -0
  42. data/spec/kde_frameworks_release_spec.rb +72 -0
  43. data/spec/library_spec.rb +54 -2
  44. data/spec/manifest_handler_spec.rb +102 -8
  45. data/spec/manifest_spec.rb +63 -0
  46. data/spec/rpm_manifestizer_spec.rb +2 -2
  47. data/spec/settings_spec.rb +53 -4
  48. data/spec/spec_helper.rb +40 -1
  49. data/spec/verifier_spec.rb +53 -22
  50. data/spec/view_spec.rb +145 -0
  51. data/view/all.html.haml +24 -0
  52. data/view/commercial.html.haml +17 -0
  53. data/view/contribute.html.haml +7 -3
  54. data/view/development.html.haml +36 -0
  55. data/view/favicon.ico +0 -0
  56. data/view/group.html.haml +20 -0
  57. data/view/index.html.haml +11 -1
  58. data/view/layout.html.haml +0 -5
  59. data/view/library.html.haml +4 -4
  60. data/view/public/inqlude.css +2 -2
  61. data/view/unreleased.html.haml +18 -0
  62. metadata +172 -97
  63. data/view/edge.html.haml +0 -9
@@ -16,11 +16,17 @@
16
16
 
17
17
  class Settings
18
18
 
19
+ include XDG::BaseDir::Mixin
20
+
21
+ def subdirectory
22
+ "inqlude"
23
+ end
24
+
19
25
  attr_accessor :offline, :manifest_path
20
26
 
21
27
  def initialize
22
28
  @offline = false
23
- @manifest_path = local_path "manifests"
29
+ @manifest_path = File.join(xdg_data_path.to_s, "manifests")
24
30
  end
25
31
 
26
32
  def data_path
@@ -28,24 +34,29 @@ class Settings
28
34
  end
29
35
 
30
36
  def cache_dir
31
- local_dir "cache"
37
+ make_dir(File.join(xdg_cache_path.to_s))
38
+ end
39
+
40
+ def manifest_dir
41
+ make_dir(@manifest_path)
32
42
  end
33
43
 
34
44
  def version
35
45
  Inqlude::VERSION
36
46
  end
37
47
 
38
- private
48
+ def xdg_data_path
49
+ data.home
50
+ end
39
51
 
40
- def local_path dirname
41
- home = ENV["HOME"] + "/.inqlude/"
42
- Dir::mkdir home unless File.exists? home
43
- home + dirname
52
+ def xdg_cache_path
53
+ cache.home
44
54
  end
45
55
 
46
- def local_dir dirname
47
- path = local_path dirname
48
- Dir::mkdir path unless File.exists? path
56
+ private
57
+
58
+ def make_dir path
59
+ FileUtils.mkdir_p(path)
49
60
  path
50
61
  end
51
62
 
@@ -1,4 +1,4 @@
1
- # Copyright (C) 2011 Cornelius Schumacher <schumacher@kde.org>
1
+ # Copyright (C) 2011-2013 Cornelius Schumacher <schumacher@kde.org>
2
2
  #
3
3
  # This program is free software; you can redistribute it and/or modify
4
4
  # it under the terms of the GNU General Public License as published by
@@ -44,32 +44,44 @@ class Verifier
44
44
  def initialize settings
45
45
  @settings = settings
46
46
 
47
- @allowed_keys = [ "schema_version", "name", "version", "release_date",
47
+ @allowed_keys = [ "$schema", "name", "version", "release_date",
48
48
  "summary", "urls", "licenses", "description", "authors", "maturity",
49
49
  "platforms", "packages", "keywords", "dependencies", "filename",
50
- "libraryname" ]
51
- @mandatory_keys = [ "schema_version", "name", "version", "release_date",
52
- "summary", "urls", "licenses", "description", "maturity",
53
- "platforms", "packages" ]
50
+ "libraryname", "display_name", "schema_type", "schema_version", "group" ]
54
51
  end
55
52
 
56
53
  def verify manifest
57
54
  @result = Result.new
58
55
 
59
56
  if !manifest["filename"]
60
- @result.errors = "Unable to determine filename"
57
+ @result.errors.push "Unable to determine filename"
61
58
  @result.name = "<unknown>"
62
59
  else
63
60
  @result.name = manifest["filename"]
64
61
  end
65
62
  if !manifest["libraryname"]
66
- @result.errors = "Unable to determine libraryname"
63
+ @result.errors.push "Unable to determine libraryname"
64
+ 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"
67
73
  end
68
74
 
69
75
  if @result.errors.empty?
70
76
  filename = manifest["filename"]
71
- expected_filename = "#{manifest["libraryname"]}.#{manifest["release_date"]}.manifest"
72
-
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
84
+
73
85
  if filename != expected_filename
74
86
  @result.errors.push "Expected file name: #{expected_filename}"
75
87
  end
@@ -84,10 +96,12 @@ class Verifier
84
96
  end
85
97
  end
86
98
 
87
- @mandatory_keys.each do |key|
88
- if !manifest.keys.include? key
89
- @result.errors.push "Mandatory attribute is missing: #{key}"
90
- end
99
+ schema_name = "#{manifest["schema_type"]}-manifest-v#{manifest["schema_version"]}"
100
+ schema_file = File.expand_path("../../schema/#{schema_name}", __FILE__)
101
+
102
+ errors = JSON::Validator.fully_validate(schema_file, manifest)
103
+ errors.each do |error|
104
+ @result.errors.push "Schema validation error: #{error}"
91
105
  end
92
106
  end
93
107
 
@@ -101,10 +115,7 @@ class Verifier
101
115
  end
102
116
 
103
117
  def verify_file filename
104
- manifest = JSON File.read filename
105
- manifest["filename"] = filename
106
- filename =~ /^(.*?)\./
107
- manifest["libraryname"] = $1
118
+ manifest = Manifest.parse_file filename
108
119
  verify manifest
109
120
  end
110
121
 
@@ -1,5 +1,5 @@
1
1
  module Inqlude
2
2
 
3
- VERSION = "0.0.8"
3
+ VERSION = "0.7.0"
4
4
 
5
5
  end
@@ -16,8 +16,7 @@
16
16
 
17
17
  class View
18
18
 
19
- attr_accessor :enable_disqus
20
- attr_accessor :enable_search
19
+ attr_accessor :enable_disqus,:enable_search,:manifest,:library,:group_name
21
20
  attr_reader :root
22
21
 
23
22
  def initialize handler
@@ -29,17 +28,36 @@ class View
29
28
 
30
29
  assert_dir output_dir
31
30
 
31
+ system "cp #{view_dir}/favicon.ico #{output_dir}"
32
+
32
33
  assert_dir "#{output_dir}/public"
33
34
  system "cp #{view_dir}/public/* #{output_dir}/public/"
35
+
36
+ assert_dir "#{output_dir}/schema"
37
+ system "cp #{schema_dir}/* #{output_dir}/schema"
34
38
 
35
39
  @root = ""
36
40
 
37
41
  render_template "index", output_dir
38
- render_template "edge", output_dir
42
+ render_template "development", output_dir
43
+ render_template "unreleased", output_dir
44
+ render_template "commercial", output_dir
45
+ render_template "all", output_dir
39
46
  render_template "about", output_dir
40
47
  render_template "get", output_dir
41
48
  render_template "contribute", output_dir
42
49
  render_template "search", output_dir
50
+
51
+
52
+ groups_path = "#{output_dir}/groups/"
53
+ assert_dir groups_path
54
+
55
+ @root = "../"
56
+
57
+ @group_name = "kde-frameworks"
58
+ file_name = "groups/kde-frameworks"
59
+ render_template "group", output_dir, file_name
60
+
43
61
 
44
62
  library_path = "#{output_dir}/libraries/"
45
63
  assert_dir library_path
@@ -48,7 +66,7 @@ class View
48
66
 
49
67
  @manifest_handler.libraries.each do |library|
50
68
  @library = library
51
- @manifest = library.manifests.last
69
+ @manifest = library.latest_manifest
52
70
  file_name = "libraries/" + library.name
53
71
  render_template "library", output_dir, file_name
54
72
  end
@@ -90,7 +108,7 @@ class View
90
108
  end
91
109
 
92
110
  def link_to_manifest name
93
- "<a href=\"libraries/#{name}.html\">#{name}</a>"
111
+ "<a href=\"#{@root}libraries/#{name}.html\">#{name}</a>"
94
112
  end
95
113
 
96
114
  def link url
@@ -133,6 +151,9 @@ class View
133
151
  end
134
152
 
135
153
  def version_content
154
+ if @manifest["schema_type"] == "generic"
155
+ raise "Can't get version for generic manifest '#{@manifest["name"]}'"
156
+ end
136
157
  out = @manifest["version"]
137
158
  out += " (#{@manifest["maturity"]})"
138
159
  out += "<span class='release-date'>"
@@ -185,7 +206,26 @@ class View
185
206
  end
186
207
  @manifest_handler.libraries(maturity)
187
208
  end
209
+
210
+ def unreleased_libraries
211
+ @manifest_handler.unreleased_libraries
212
+ end
188
213
 
214
+ def commercial_libraries
215
+ @manifest_handler.commercial_libraries
216
+ end
217
+
218
+ def group_title
219
+ if @group_name == "kde-frameworks"
220
+ return "KDE Frameworks"
221
+ end
222
+ ""
223
+ end
224
+
225
+ def group
226
+ @manifest_handler.group(@group_name)
227
+ end
228
+
189
229
  def disqus_enabled?
190
230
  @enable_disqus
191
231
  end
@@ -209,14 +249,15 @@ class View
209
249
  end
210
250
 
211
251
  def old_versions
212
- versions = Array.new
213
- count = @library.manifests.count
214
- if count > 1
215
- versions = @library.manifests[0..count-2].map {|m| m["version"] }
216
- end
252
+ versions = @library.versions.reject{ |v| v == @manifest["version"] }
217
253
  versions.reverse
218
254
  end
219
255
 
256
+ def render_description
257
+ doc = Kramdown::Document.new(@manifest["description"])
258
+ doc.to_html
259
+ end
260
+
220
261
  private
221
262
 
222
263
  def assert_dir name
@@ -231,4 +272,8 @@ class View
231
272
  File.expand_path( File.dirname( __FILE__ ) + "/../view/" ) + "/"
232
273
  end
233
274
 
275
+ def schema_dir
276
+ File.expand_path( File.dirname( __FILE__ ) + "/../schema/" ) + "/"
277
+ end
278
+
234
279
  end
@@ -32,19 +32,33 @@ concrete file.
32
32
 
33
33
  These are the attributes:
34
34
 
35
- ### schema_version
35
+ ### $schema
36
36
 
37
- Version number of the schema used in this manifest
37
+ This is a reference to the schema which is used in the manifest file. The
38
+ schema follows the [JSON Schema](http://json-schema.org) specification.
38
39
 
39
- This is used to make expectations of tools and processing explicit and adapt
40
- to schema changes.
40
+ The schema comes in three flavors: "generic", "release", and
41
+ "proprietary-release". They differe in what fields are required, the meaning of
42
+ fields is the same in all. "generic" is a subset of "proprietary-release", which
43
+ is a subset of "release".
44
+
45
+ Each schema has an identifier. The current identifier for the release schema is
46
+ "http://inqlude.org/schema/release-manifest-v1#". It includes the version
47
+ number. The other identifiers are the same, but instead of "release" they use
48
+ the corresponding sub string identifying the flavor.
49
+
50
+ The schema and its versioning is used to make expectations of tools and
51
+ processing explicit and adapt to schema changes.
41
52
 
42
53
  If the schema is changed in a way incompatible with processing tools, the
43
54
  schema version number has to be increased.
44
55
 
45
- This document specifies schema version 1.
56
+ As Inqlude currently still is in alpha, changes to the schema are to be expected
57
+ and while we will try to not break things, there might be some incompatible
58
+ changes without changing the version number during development. This will stop,
59
+ when we have reached beta state.
46
60
 
47
- *schema_version is a mandatory attribute*
61
+ *$schema is a mandatory attribute*
48
62
 
49
63
  ### name
50
64
 
@@ -71,13 +85,13 @@ representing the different versions of the library.
71
85
 
72
86
  Date, when the version was released
73
87
 
74
- *release_date is a mandatory attribute*
88
+ *release_date is a mandatory attribute in the release schemas*
75
89
 
76
90
  ### version
77
91
 
78
92
  Version of the release
79
93
 
80
- *version is a mandatory attribute*
94
+ *version is a mandatory attribute in the release schemas*
81
95
 
82
96
  ### summary
83
97
 
@@ -132,8 +146,8 @@ strings for the most often used licenses:
132
146
  Full description of the library
133
147
 
134
148
  The description is a text describing the library. It can be of arbitrary length.
135
- No special formatting is supported other than using newlines to start a new
136
- paragraph.
149
+ The text is formatted using
150
+ [Markdown](http://daringfireball.net/projects/markdown/syntax).
137
151
 
138
152
  *description is a mandatory attribute*
139
153
 
@@ -158,7 +172,7 @@ The flag has to be one of the following identifiers:
158
172
  recommended for production use
159
173
  * "alpha": preview releases, not suitable for production use
160
174
 
161
- *maturity is a mandatory attribute*
175
+ *maturity is a mandatory attribute, it's optional in the generic schema*
162
176
 
163
177
  ### platforms
164
178
 
@@ -190,7 +204,8 @@ package. The following types are supported:
190
204
  This is the source code of the release. It has one URL to the file, which
191
205
  can be used to download the code.
192
206
 
193
- *source is a mandatory package attribute*
207
+ *source is a mandatory package attribute in the release schema, it's optional
208
+ in the proprietary-release schema*
194
209
 
195
210
  #### openSUSE
196
211
 
@@ -0,0 +1,54 @@
1
+ {
2
+ "id": "http://inqlude.org/schema/generic-manifest-v1#",
3
+ "$schema": "http://json-schema.org/draft-04/schema#",
4
+ "title": "Generic Inqlude Manifest Schema",
5
+ "type": "object",
6
+ "properties": {
7
+ "name": {
8
+ "type": "string"
9
+ },
10
+ "summary": {
11
+ "type": "string"
12
+ },
13
+ "urls": {
14
+ "type": "object",
15
+ "properties": {
16
+ "homepage": {
17
+ "type": "string"
18
+ },
19
+ "download": {
20
+ "type": "string"
21
+ }
22
+ },
23
+ "required": [ "homepage" ]
24
+ },
25
+ "licenses": {
26
+ "type": "array",
27
+ "items": {
28
+ "type": "string"
29
+ },
30
+ "minItems": 1
31
+ },
32
+ "description": {
33
+ "type": "string"
34
+ },
35
+ "authors": {
36
+ "type": "array",
37
+ "items": {
38
+ "type": "string"
39
+ }
40
+ },
41
+ "platforms": {
42
+ "type": "array",
43
+ "items": {
44
+ "type": "string"
45
+ },
46
+ "minItems": 1
47
+ },
48
+ "group": {
49
+ "type": "string"
50
+ }
51
+ },
52
+ "required": [ "$schema", "name", "summary",
53
+ "urls", "licenses", "description", "platforms" ]
54
+ }
@@ -0,0 +1,63 @@
1
+ {
2
+ "id": "http://inqlude.org/schema/release-manifest-v1#",
3
+ "$schema": "http://json-schema.org/draft-04/schema#",
4
+ "title": "Inqlude Release Manifest Schema",
5
+ "type": "object",
6
+ "properties": {
7
+ "name": {
8
+ "type": "string"
9
+ },
10
+ "release_date": {
11
+ "type": "string"
12
+ },
13
+ "version": {
14
+ "type": "string"
15
+ },
16
+ "summary": {
17
+ "type": "string"
18
+ },
19
+ "urls": {
20
+ "type": "object",
21
+ "properties": {
22
+ "homepage": {
23
+ "type": "string"
24
+ },
25
+ "download": {
26
+ "type": "string"
27
+ }
28
+ },
29
+ "required": [ "homepage" ]
30
+ },
31
+ "licenses": {
32
+ "type": "array",
33
+ "items": {
34
+ "type": "string"
35
+ },
36
+ "minItems": 1
37
+ },
38
+ "description": {
39
+ "type": "string"
40
+ },
41
+ "authors": {
42
+ "type": "array",
43
+ "items": {
44
+ "type": "string"
45
+ }
46
+ },
47
+ "maturity": {
48
+ "type": "string"
49
+ },
50
+ "platforms": {
51
+ "type": "array",
52
+ "items": {
53
+ "type": "string"
54
+ },
55
+ "minItems": 1
56
+ },
57
+ "group": {
58
+ "type": "string"
59
+ }
60
+ },
61
+ "required": [ "$schema", "name", "release_date", "version", "summary",
62
+ "urls", "licenses", "description", "maturity", "platforms" ]
63
+ }