inqlude 0.0.8 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/Gemfile +3 -0
- data/README +35 -1
- data/TODO +50 -15
- data/inqlude.gemspec +7 -2
- data/lib/cli.rb +70 -6
- data/lib/creator.rb +32 -8
- data/lib/git_hub_tool.rb +92 -0
- data/lib/inqlude.rb +7 -0
- data/lib/kde_frameworks_creator.rb +173 -0
- data/lib/kde_frameworks_release.rb +61 -0
- data/lib/library.rb +26 -1
- data/lib/manifest.rb +43 -0
- data/lib/manifest_handler.rb +59 -17
- data/lib/rpm_manifestizer.rb +2 -2
- data/lib/settings.rb +21 -10
- data/lib/verifier.rb +29 -18
- data/lib/version.rb +1 -1
- data/lib/view.rb +55 -10
- data/manifest-format.md +27 -12
- data/schema/generic-manifest-v1 +54 -0
- data/schema/proprietary-release-manifest-v1 +63 -0
- data/schema/release-manifest-v1 +73 -0
- data/spec/creator_spec.rb +94 -34
- data/spec/data/awesomelib/awesomelib.2013-09-08.manifest +14 -6
- data/spec/data/bleedingedge/bleedingedge.2012-01-01.manifest +3 -2
- data/spec/data/commercial/commercial.manifest +13 -0
- data/spec/data/karchive-generic.manifest +22 -0
- data/spec/data/karchive-release-beta.manifest +29 -0
- data/spec/data/karchive-release.manifest +29 -0
- data/spec/data/karchive-release2.manifest +29 -0
- data/spec/data/karchive.authors +10 -0
- data/spec/data/karchive.readme +35 -0
- data/spec/data/kservice-generic.manifest +22 -0
- data/spec/data/kservice.readme +9 -0
- data/spec/data/newlib/newlib.manifest +13 -0
- data/spec/data/proprietarylib/proprietarylib.2013-12-22.manifest +16 -0
- data/spec/data/rendertest-generic.manifest +20 -0
- data/spec/data/testcontent +1 -0
- data/spec/kde_frameworks_creator_spec.rb +263 -0
- data/spec/kde_frameworks_release_spec.rb +72 -0
- data/spec/library_spec.rb +54 -2
- data/spec/manifest_handler_spec.rb +102 -8
- data/spec/manifest_spec.rb +63 -0
- data/spec/rpm_manifestizer_spec.rb +2 -2
- data/spec/settings_spec.rb +53 -4
- data/spec/spec_helper.rb +40 -1
- data/spec/verifier_spec.rb +53 -22
- data/spec/view_spec.rb +145 -0
- data/view/all.html.haml +24 -0
- data/view/commercial.html.haml +17 -0
- data/view/contribute.html.haml +7 -3
- data/view/development.html.haml +36 -0
- data/view/favicon.ico +0 -0
- data/view/group.html.haml +20 -0
- data/view/index.html.haml +11 -1
- data/view/layout.html.haml +0 -5
- data/view/library.html.haml +4 -4
- data/view/public/inqlude.css +2 -2
- data/view/unreleased.html.haml +18 -0
- metadata +172 -97
- data/view/edge.html.haml +0 -9
data/lib/inqlude.rb
CHANGED
@@ -4,6 +4,9 @@ require "thor"
|
|
4
4
|
require "json"
|
5
5
|
require "haml"
|
6
6
|
require "date"
|
7
|
+
require "json-schema"
|
8
|
+
require "kramdown"
|
9
|
+
require "xdg"
|
7
10
|
|
8
11
|
require File.expand_path('../version', __FILE__)
|
9
12
|
require File.expand_path('../cli', __FILE__)
|
@@ -16,3 +19,7 @@ require File.expand_path('../upstream', __FILE__)
|
|
16
19
|
require File.expand_path('../verifier', __FILE__)
|
17
20
|
require File.expand_path('../library', __FILE__)
|
18
21
|
require File.expand_path('../creator', __FILE__)
|
22
|
+
require File.expand_path('../git_hub_tool', __FILE__)
|
23
|
+
require File.expand_path('../manifest', __FILE__)
|
24
|
+
require File.expand_path('../kde_frameworks_creator', __FILE__)
|
25
|
+
require File.expand_path('../kde_frameworks_release', __FILE__)
|
@@ -0,0 +1,173 @@
|
|
1
|
+
# Copyright (C) 2014 Cornelius Schumacher <schumacher@kde.org>
|
2
|
+
#
|
3
|
+
# This program is free software; you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation; either version 2 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License along
|
14
|
+
# with this program; if not, write to the Free Software Foundation, Inc.,
|
15
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
16
|
+
|
17
|
+
class KdeFrameworksCreator
|
18
|
+
|
19
|
+
attr_reader :warnings, :errors
|
20
|
+
|
21
|
+
def initialize
|
22
|
+
@frameworks = Hash.new
|
23
|
+
end
|
24
|
+
|
25
|
+
def parse_checkout dir_name, options = {}
|
26
|
+
@warnings = []
|
27
|
+
@errors = []
|
28
|
+
Dir.entries( dir_name ).each do |entry|
|
29
|
+
next if entry =~ /^\./
|
30
|
+
next if entry == "kapidox"
|
31
|
+
next if entry == "kde4support"
|
32
|
+
|
33
|
+
@frameworks[entry] = {}
|
34
|
+
parse_readme File.join(dir_name,entry), options
|
35
|
+
parse_authors File.join(dir_name,entry)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def frameworks
|
40
|
+
@frameworks.keys
|
41
|
+
end
|
42
|
+
|
43
|
+
def framework name
|
44
|
+
f = @frameworks[name]
|
45
|
+
raise "Unable to read '#{name}'" if !f
|
46
|
+
f
|
47
|
+
end
|
48
|
+
|
49
|
+
def parse_readme path, options = {}
|
50
|
+
@errors = [] if !@errors
|
51
|
+
|
52
|
+
name = extract_name( path )
|
53
|
+
framework = @frameworks[name] || {}
|
54
|
+
|
55
|
+
state = nil
|
56
|
+
File.open(File.join(path,"README.md")).each_line do |line|
|
57
|
+
if line =~ /^# (.*)/
|
58
|
+
framework["title"] = $1
|
59
|
+
state = :parse_summary
|
60
|
+
next
|
61
|
+
elsif line =~ /^## Introduction/
|
62
|
+
framework["introduction"] = ""
|
63
|
+
state = :parse_introduction
|
64
|
+
next
|
65
|
+
elsif line =~ /^## Links/
|
66
|
+
state = :parse_links
|
67
|
+
next
|
68
|
+
end
|
69
|
+
|
70
|
+
if state == :parse_summary
|
71
|
+
if line =~ /^##/
|
72
|
+
state = nil
|
73
|
+
else
|
74
|
+
if !line.strip.empty?
|
75
|
+
framework["summary"] = line.strip
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
if state == :parse_introduction
|
81
|
+
if line =~ /^##/
|
82
|
+
framework["introduction"].strip!
|
83
|
+
state = nil
|
84
|
+
else
|
85
|
+
framework["introduction"] += line
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
if state == :parse_links
|
90
|
+
if line =~ /^##/
|
91
|
+
state = nil
|
92
|
+
else
|
93
|
+
if line =~ /- (.*): (.*)/
|
94
|
+
link_name = $1
|
95
|
+
url = $2
|
96
|
+
link_name = link_name.downcase.gsub(/ /,"_")
|
97
|
+
if url =~ /<(.*)>/
|
98
|
+
url = $1
|
99
|
+
end
|
100
|
+
framework["link_#{link_name}"] = url
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
required_fields = []
|
107
|
+
[ "title", "summary", "introduction", "link_home_page" ].each do |field|
|
108
|
+
if !options[:ignore_errors] || !options[:ignore_errors].include?(field)
|
109
|
+
required_fields.push field
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
required_fields.each do |field|
|
114
|
+
if !framework.has_key?(field) || framework[field].strip.empty?
|
115
|
+
@errors.push( { :name => name, :issue => "missing_" + field } )
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
@frameworks[name] = framework
|
120
|
+
end
|
121
|
+
|
122
|
+
def parse_authors path
|
123
|
+
name = extract_name( path )
|
124
|
+
|
125
|
+
authors_path = File.join(path,"AUTHORS")
|
126
|
+
if ( !File.exists?( authors_path ) )
|
127
|
+
@warnings.push( { :name => name, :issue => "missing_file",
|
128
|
+
:details => "AUTHORS" } )
|
129
|
+
return
|
130
|
+
end
|
131
|
+
|
132
|
+
authors = []
|
133
|
+
File.open(authors_path).each_line do |line|
|
134
|
+
if line =~ /(.* <.*@.*>)/
|
135
|
+
authors.push $1
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
framework = @frameworks[name] || {}
|
140
|
+
|
141
|
+
framework["authors"] = authors
|
142
|
+
|
143
|
+
@frameworks[name] = framework
|
144
|
+
end
|
145
|
+
|
146
|
+
def extract_name path
|
147
|
+
path.split("/").last
|
148
|
+
end
|
149
|
+
|
150
|
+
def create_manifests output_dir
|
151
|
+
settings = Settings.new
|
152
|
+
settings.manifest_path = output_dir
|
153
|
+
@frameworks.each do |name,framework|
|
154
|
+
creator = Creator.new settings, name
|
155
|
+
manifest = creator.create_generic_manifest
|
156
|
+
fill_in_data framework, manifest
|
157
|
+
creator.create_dir
|
158
|
+
creator.write_manifest manifest
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def fill_in_data framework, manifest
|
163
|
+
manifest["display_name"] = framework["title"]
|
164
|
+
manifest["summary"] = framework["summary"]
|
165
|
+
manifest["description"] = framework["introduction"]
|
166
|
+
manifest["urls"]["vcs"] = framework["link_git_repository"]
|
167
|
+
manifest["urls"]["homepage"] = framework["link_home_page"]
|
168
|
+
manifest["urls"]["mailing_list"] = framework["link_mailing_list"]
|
169
|
+
manifest["licenses"] = [ "LGPLv2.1+" ]
|
170
|
+
manifest["authors"] = [ "The KDE Community" ]
|
171
|
+
manifest["group"] = "kde-frameworks"
|
172
|
+
end
|
173
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# Copyright (C) 2014 Cornelius Schumacher <schumacher@kde.org>
|
2
|
+
#
|
3
|
+
# This program is free software; you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU General Public License as published by
|
5
|
+
# the Free Software Foundation; either version 2 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU General Public License along
|
14
|
+
# with this program; if not, write to the Free Software Foundation, Inc.,
|
15
|
+
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
16
|
+
|
17
|
+
class KdeFrameworksRelease
|
18
|
+
|
19
|
+
attr_reader :generic_manifests
|
20
|
+
|
21
|
+
def initialize handler
|
22
|
+
@handler = handler
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.create_release_manifest generic_manifest, release_date, version
|
26
|
+
m = generic_manifest
|
27
|
+
name = m["name"]
|
28
|
+
download_url = "http://download.kde.org/stable/frameworks/#{version}/"
|
29
|
+
m["$schema"] = Manifest.release_schema_id
|
30
|
+
m["schema_type"] = "release"
|
31
|
+
m["urls"]["download"] = download_url
|
32
|
+
m["maturity"] = "stable"
|
33
|
+
m["release_date"] = release_date
|
34
|
+
m["version"] = version
|
35
|
+
m["packages"] = {
|
36
|
+
"source" => "#{download_url}#{name}-#{version}.tar.xz"
|
37
|
+
}
|
38
|
+
m
|
39
|
+
end
|
40
|
+
|
41
|
+
def read_generic_manifests
|
42
|
+
@generic_manifests = Array.new
|
43
|
+
@handler.read_remote
|
44
|
+
@handler.group("kde-frameworks").each do |library|
|
45
|
+
@generic_manifests.push library.generic_manifest
|
46
|
+
end
|
47
|
+
@generic_manifests
|
48
|
+
end
|
49
|
+
|
50
|
+
def write_release_manifests release_date, version
|
51
|
+
@generic_manifests.each do |generic_manifest|
|
52
|
+
release_manifest = KdeFrameworksRelease.create_release_manifest(
|
53
|
+
generic_manifest, release_date, version )
|
54
|
+
path = @handler.manifest_path( release_manifest )
|
55
|
+
File.open( path, "w" ) do |file|
|
56
|
+
file.write Manifest.to_json( release_manifest )
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
data/lib/library.rb
CHANGED
@@ -4,7 +4,32 @@ class Library
|
|
4
4
|
attr_accessor :manifests
|
5
5
|
|
6
6
|
def versions
|
7
|
-
versions =
|
7
|
+
versions = release_manifests.map { |m| m["version"] }
|
8
8
|
end
|
9
9
|
|
10
|
+
def generic_manifest
|
11
|
+
@manifests.each do |m|
|
12
|
+
if m["schema_type"] == "generic"
|
13
|
+
return m
|
14
|
+
end
|
15
|
+
end
|
16
|
+
nil
|
17
|
+
end
|
18
|
+
|
19
|
+
def release_manifests
|
20
|
+
result = @manifests.reject { |m| m["schema_type"] == "generic" }
|
21
|
+
result.sort! do |m1,m2|
|
22
|
+
m1["release_date"] <=> m2["release_date"]
|
23
|
+
end
|
24
|
+
result
|
25
|
+
end
|
26
|
+
|
27
|
+
def latest_manifest
|
28
|
+
if release_manifests.empty?
|
29
|
+
return generic_manifest
|
30
|
+
else
|
31
|
+
return release_manifests.last
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
10
35
|
end
|
data/lib/manifest.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
class Manifest
|
2
|
+
|
3
|
+
def self.generic_schema_id
|
4
|
+
"http://inqlude.org/schema/generic-manifest-v1#"
|
5
|
+
end
|
6
|
+
|
7
|
+
def self.release_schema_id
|
8
|
+
"http://inqlude.org/schema/release-manifest-v1#"
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.proprietary_release_schema_id
|
12
|
+
"http://inqlude.org/schema/proprietary-release-manifest-v1#"
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.parse_file path
|
16
|
+
manifest = JSON File.read path
|
17
|
+
filename = File.basename path
|
18
|
+
manifest["filename"] = filename
|
19
|
+
filename =~ /^(.*?)\./
|
20
|
+
manifest["libraryname"] = $1
|
21
|
+
manifest["schema_type"],manifest["schema_version"] =
|
22
|
+
Manifest.parse_schema_id manifest["$schema"]
|
23
|
+
manifest
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.to_json manifest
|
27
|
+
m = manifest.clone
|
28
|
+
m.delete "filename"
|
29
|
+
m.delete "libraryname"
|
30
|
+
m.delete "schema_type"
|
31
|
+
m.delete "schema_version"
|
32
|
+
JSON.pretty_generate m
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.parse_schema_id schema_id
|
36
|
+
schema_id =~ /^http:\/\/inqlude\.org\/schema\/(.*)-manifest-v(.*)\#$/
|
37
|
+
type = $1
|
38
|
+
version = $2.to_i
|
39
|
+
raise "Unable to parse schema id '{schema_id}'" if !type || !version
|
40
|
+
return type, version
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
data/lib/manifest_handler.rb
CHANGED
@@ -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
|
@@ -25,19 +25,64 @@ class ManifestHandler
|
|
25
25
|
@manifests = Array.new
|
26
26
|
end
|
27
27
|
|
28
|
+
def manifest_path manifest
|
29
|
+
if manifest["schema_type"] == "release"
|
30
|
+
return File.join( @settings.manifest_path, manifest["name"],
|
31
|
+
"#{manifest["name"]}.#{manifest["release_date"]}.manifest" )
|
32
|
+
else
|
33
|
+
return File.join( @settings.manifest_path, manifest["name"],
|
34
|
+
"#{manifest["name"]}.manifest" )
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
28
38
|
def libraries maturity = nil
|
29
39
|
if !maturity
|
30
40
|
return @libraries
|
31
41
|
else
|
32
|
-
return @libraries.select
|
33
|
-
|
42
|
+
return @libraries.select do |l|
|
43
|
+
manifest = l.latest_manifest
|
44
|
+
manifest["maturity"] == maturity.to_s &&
|
45
|
+
manifest["licenses"] != [ "Commercial" ]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def unreleased_libraries
|
51
|
+
return @libraries.select do |l|
|
52
|
+
manifest = l.latest_manifest
|
53
|
+
manifest["schema_type"] == "generic" &&
|
54
|
+
manifest["licenses"] != [ "Commercial" ]
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def commercial_libraries
|
59
|
+
return @libraries.select do |l|
|
60
|
+
manifest = l.latest_manifest
|
61
|
+
manifest["licenses"].include? "Commercial"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def group name
|
66
|
+
return @libraries.select do |l|
|
67
|
+
manifest = l.latest_manifest
|
68
|
+
manifest["group"] == name
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def library name
|
73
|
+
@libraries.each do |library|
|
74
|
+
if library.name == name
|
75
|
+
return library
|
76
|
+
end
|
77
|
+
end
|
78
|
+
nil
|
34
79
|
end
|
35
80
|
|
36
81
|
def manifest name
|
37
82
|
read_remote
|
38
83
|
@libraries.each do |library|
|
39
84
|
if library.name == name
|
40
|
-
return library.
|
85
|
+
return library.latest_manifest
|
41
86
|
end
|
42
87
|
end
|
43
88
|
raise "Unable to find manifest '#{name}'"
|
@@ -58,13 +103,9 @@ class ManifestHandler
|
|
58
103
|
library.name = File.basename dirname
|
59
104
|
local_manifests = Array.new
|
60
105
|
Dir.glob( "#{dirname}/*.manifest" ).sort.each do |filename|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
manifest["libraryname"] = library.name
|
65
|
-
local_manifests.push manifest
|
66
|
-
manifests.push manifest
|
67
|
-
end
|
106
|
+
manifest = Manifest.parse_file filename
|
107
|
+
local_manifests.push manifest
|
108
|
+
manifests.push manifest
|
68
109
|
end
|
69
110
|
library.manifests = local_manifests
|
70
111
|
libraries.push library
|
@@ -72,14 +113,15 @@ class ManifestHandler
|
|
72
113
|
end
|
73
114
|
|
74
115
|
def fetch_remote
|
75
|
-
if
|
76
|
-
if File.exists? @settings.manifest_path
|
77
|
-
|
116
|
+
if File.exists? @settings.manifest_path
|
117
|
+
if !File.exists? @settings.manifest_path + "/.git"
|
118
|
+
raise "Can't fetch data into '#{@settings.manifest_path}' because it's not a git repository."
|
119
|
+
else
|
120
|
+
system "cd #{@settings.manifest_path}; git pull >/dev/null"
|
78
121
|
end
|
79
|
-
system "git clone https://github.com/cornelius/inqlude-data.git " +
|
80
|
-
"#{@settings.manifest_path}"
|
81
122
|
else
|
82
|
-
system "
|
123
|
+
system "git clone git://anongit.kde.org/websites/inqlude-data " +
|
124
|
+
"#{@settings.manifest_path}"
|
83
125
|
end
|
84
126
|
end
|
85
127
|
|
data/lib/rpm_manifestizer.rb
CHANGED
@@ -122,11 +122,11 @@ class RpmManifestizer
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def is_library? rpm_name
|
125
|
-
rpm_name =~ /^lib/
|
125
|
+
!!(rpm_name =~ /^lib/)
|
126
126
|
end
|
127
127
|
|
128
128
|
def is_32bit? rpm_name
|
129
|
-
rpm_name =~ /\-32bit/
|
129
|
+
!!(rpm_name =~ /\-32bit/)
|
130
130
|
end
|
131
131
|
|
132
132
|
def cut_off_number_suffix name
|