inqlude 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/.travis.yml +7 -3
  4. data/CHANGELOG.md +9 -0
  5. data/Gemfile +4 -0
  6. data/README.md +4 -0
  7. data/lib/cli.rb +24 -26
  8. data/lib/cli_controller.rb +24 -0
  9. data/lib/inqlude.rb +1 -0
  10. data/lib/kde_frameworks_release.rb +6 -1
  11. data/lib/manifest_handler.rb +44 -1
  12. data/lib/verifier.rb +4 -0
  13. data/lib/version.rb +1 -1
  14. data/lib/view.rb +62 -15
  15. data/manifest-format.md +30 -5
  16. data/spec/data/inqlude-all.json +11 -2
  17. data/spec/data/manifests/awesomelib/awesomelib.2013-09-08.manifest +4 -2
  18. data/spec/data/manifests/bleedingedge/bleedingedge.2012-01-01.manifest +3 -0
  19. data/spec/data/manifests/commercial/commercial.manifest +3 -0
  20. data/spec/data/manifests/newlib/newlib.manifest +1 -0
  21. data/spec/data/missing-topics/miss-topics/miss-topics.manifest +2 -1
  22. data/spec/integration/cli_verify_spec.rb +2 -0
  23. data/spec/integration/cli_view_spec.rb +102 -0
  24. data/spec/integration/spec_helper.rb +3 -0
  25. data/spec/online/cli_view_spec.rb +64 -0
  26. data/spec/online/spec_helper.rb +5 -0
  27. data/spec/stubs/qmake/qmake +2 -0
  28. data/spec/unit/cli_controller_spec.rb +51 -0
  29. data/spec/unit/kde_frameworks_release_spec.rb +36 -23
  30. data/spec/unit/manifest_handler_spec.rb +15 -1
  31. data/spec/unit/manifest_spec.rb +1 -1
  32. data/spec/unit/spec_helper.rb +10 -0
  33. data/spec/unit/view_spec.rb +68 -0
  34. data/topics/Manifest_updater/README.md +19 -0
  35. data/topics/Manifest_updater/app.js +43 -0
  36. data/topics/Manifest_updater/manifests/example/example.manifest +20 -0
  37. data/topics/Manifest_updater/package.json +9 -0
  38. data/topics/Manifest_updater/topics.csv +1 -0
  39. data/topics/Manifest_updater/update_manifests/example/example.manifest +24 -0
  40. data/topics/topics.csv +3 -0
  41. data/view/{about.html.haml → one-column/about.html.haml} +0 -0
  42. data/view/{all.html.haml → one-column/all.html.haml} +0 -0
  43. data/view/{commercial.html.haml → one-column/commercial.html.haml} +0 -0
  44. data/view/{contribute.html.haml → one-column/contribute.html.haml} +0 -0
  45. data/view/{development.html.haml → one-column/development.html.haml} +0 -0
  46. data/view/{favicon.ico → one-column/favicon.ico} +0 -0
  47. data/view/{get.html.haml → one-column/get.html.haml} +0 -0
  48. data/view/{group.html.haml → one-column/group.html.haml} +0 -0
  49. data/view/{index.html.haml → one-column/index.html.haml} +0 -0
  50. data/view/{layout.html.haml → one-column/layout.html.haml} +0 -0
  51. data/view/{library.html.haml → one-column/library.html.haml} +1 -1
  52. data/view/{public → one-column/public}/inqlude.css +0 -0
  53. data/view/{search.html.haml → one-column/search.html.haml} +0 -0
  54. data/view/{unreleased.html.haml → one-column/unreleased.html.haml} +0 -0
  55. data/view/two-column/about.html.haml +34 -0
  56. data/view/two-column/all.html.haml +47 -0
  57. data/view/two-column/contribute.html.haml +49 -0
  58. data/view/two-column/favicon.ico +0 -0
  59. data/view/two-column/get.html.haml +57 -0
  60. data/view/two-column/group.html.haml +52 -0
  61. data/view/two-column/index.html.haml +194 -0
  62. data/view/two-column/ios.ico +0 -0
  63. data/view/two-column/layout.html.haml +102 -0
  64. data/view/two-column/library.html.haml +64 -0
  65. data/view/two-column/public/inqlude.css +265 -0
  66. data/view/two-column/search.html.haml +20 -0
  67. data/view/two-column/topic.html.haml +47 -0
  68. metadata +41 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dfb73e8e83eb6e2b8e86b2e7289be7934d3c5967
4
- data.tar.gz: 43279f4302b345f134218d48aebb844031c9b8a2
3
+ metadata.gz: b71cfe26a50e95a5925b48324ff91b084b0bcd7e
4
+ data.tar.gz: 3a07f9ec5fd189e2d258f5de6871dccb8cc44ab0
5
5
  SHA512:
6
- metadata.gz: d177de51fd1b3d7161adad5eef36ff8bdb47e7aeae565f48a6728ba8beefd2be19537bba03bd0134c2a24e5df102717492de7cfa1196d24f214c2e72e3f77eca
7
- data.tar.gz: 8638a6c79f6c7400f577e010b7273022130d51d9ea7457d2e0bc5db48ba124098cdb4da83d85f0d5946512e32529781fdc2bb9a597a4a9e4b2f85871db42790e
6
+ metadata.gz: 0665295254b87ab55b65dcd8e95c5e9406f467186684e551e989b2955bd460f92f2c62873dbed355a94f76f23a7bee76124c59e7eae38cda6bff462329fac7bc
7
+ data.tar.gz: 704e0a8c7584a2c4ba13524dc5b8c1e62c593341bccb70d2a10171225c4bc8c974e380bb7a8df9867cacaa8bc281263776a0ce7b7985da31827f6cd5817d1508
data/.rspec CHANGED
@@ -1 +1,2 @@
1
1
  --color
2
+ --format=doc
@@ -1,6 +1,10 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "2.1.9"
4
- - "2.2.5"
5
- - "2.3.1"
3
+ - 2.1.9
4
+ - 2.2.5
5
+ - 2.3.1
6
6
  script: bundle exec rspec spec
7
+ addons:
8
+ code_climate:
9
+ repo_token:
10
+ secure: x4ET3gWdfwTC66ExUDoYFdJ3AvCTbms7dokF7RaUrf7xnr3PInHnRgzZP7hICkEYW4t20JPjwiJUUdifk5XUcMSlQ5AAPKjFXP4wyQYPvpizI5FvRsX0a62/Fv1juXxs9hPFmXITqN861iT1rkqC383evyR9KxPDZMOi0VEOjAs=
@@ -1,5 +1,14 @@
1
1
  # Change log of Inqlude
2
2
 
3
+ ## Version 0.9.0
4
+
5
+ * Put out progress when creating release manifests
6
+ * Prototype for new layout of the website as alternative view template
7
+ * Better error when view templates directory does not exist
8
+ * Show topics in view
9
+ * Add validation for display_name attribute
10
+ * Gracefully fail in --version when Qt is not installed
11
+
3
12
  ## Version 0.8.0
4
13
 
5
14
  * Add topic attribute to manifest specification and adapt validator to allow topic attribute as an optional parameter. The validator reports missing topics as a warning for each manifest which does not have a topic attribute, but not fail.
data/Gemfile CHANGED
@@ -1,3 +1,7 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
+
5
+ gem "codeclimate-test-reporter", group: :test, require: nil
6
+ gem "travis", group: :test, require: nil
7
+ gem "nokogiri"
data/README.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Inqlude - the Qt library archive
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/inqlude.svg)](https://badge.fury.io/rb/inqlude)
3
4
  [![Build Status](https://travis-ci.org/cornelius/inqlude.svg?branch=master)](https://travis-ci.org/cornelius/inqlude)
5
+ [![Dependency Status](https://dependencyci.com/github/cornelius/inqlude/badge)](https://dependencyci.com/github/cornelius/inqlude)
6
+ [![Code Climate](https://codeclimate.com/github/cornelius/inqlude/badges/gpa.svg)](https://codeclimate.com/github/cornelius/inqlude)
7
+ [![Test Coverage](https://codeclimate.com/github/cornelius/inqlude/badges/coverage.svg)](https://codeclimate.com/github/cornelius/inqlude/coverage)
4
8
 
5
9
  ## Overview
6
10
 
data/lib/cli.rb CHANGED
@@ -26,29 +26,10 @@ class Cli < Thor
26
26
  @@settings = s
27
27
  end
28
28
 
29
- def self.distro
30
- @@distro if @@distro
31
-
32
- @@distro = Distro.detect
33
- if !@@distro
34
- STDERR.puts "Warning: unable to detect distro."
35
- end
36
- end
37
-
38
29
  desc "global", "Global options", :hide => true
39
30
  def global
40
31
  if options[:version]
41
- puts "Inqlude: #{@@settings.version}"
42
-
43
- qmake_out = `qmake -v`
44
- qmake_out =~ /Qt version (.*) in/
45
- puts "Qt: #{$1}"
46
-
47
- if self.distro
48
- puts "OS: #{self.distro.name} #{self.distro.version}"
49
- else
50
- puts "OS: unknown"
51
- end
32
+ CliController.print_versions(Distro.detect)
52
33
  else
53
34
  Cli.help shell
54
35
  end
@@ -68,7 +49,7 @@ class Cli < Thor
68
49
  puts library.name + " (" + library.versions.join(", ") + ")"
69
50
  end
70
51
  else
71
- manifests = self.distro.installed handler
52
+ manifests = Distro.detect.installed handler
72
53
  manifests.each do |manifest|
73
54
  puts manifest["name"]
74
55
  end
@@ -85,20 +66,37 @@ class Cli < Thor
85
66
  actual domain."
86
67
  method_option :disable_search, :type => :boolean,
87
68
  :desc => "Disable Google based search."
69
+ method_option :templates, :type => :string, :aliases => "-t", :default => "one-column",
70
+ :desc => "Switch templates", :required => false
88
71
  def view
89
72
  process_global_options options
90
73
 
74
+ output_dir = options[:output_dir]
75
+
91
76
  if options[:manifest_dir]
92
77
  @@settings.manifest_path = options[:manifest_dir]
93
78
  end
94
79
 
95
80
  manifest_handler = ManifestHandler.new(@@settings)
81
+
96
82
  manifest_handler.read_remote
97
83
 
98
84
  view = View.new(manifest_handler)
99
- view.enable_disqus = options[:enable_disqus]
100
- view.enable_search = !options[:disable_search]
101
- view.create options[:output_dir]
85
+
86
+ view.templates = options[:templates]
87
+
88
+ if !view.template_directory_exists?
89
+ STDERR.puts "Error: Templates directory doesn't exist"
90
+ exit 1
91
+ else
92
+ puts "Creating web site in '#{output_dir}' from '#{manifest_handler.settings.manifest_path}'"
93
+
94
+ view.enable_disqus = options[:enable_disqus]
95
+ view.enable_search = !options[:disable_search]
96
+
97
+ view.create output_dir
98
+ end
99
+
102
100
  end
103
101
 
104
102
  desc "show <library_name>", "Show library details"
@@ -273,7 +271,7 @@ actual domain."
273
271
  if !manifest
274
272
  STDERR.puts "Manifest for '#{name}' not found"
275
273
  else
276
- self.distro.uninstall manifest
274
+ Distro.detect.uninstall manifest
277
275
  end
278
276
  end
279
277
 
@@ -286,7 +284,7 @@ actual domain."
286
284
  if !manifest
287
285
  STDERR.puts "Manifest for '#{name}' not found"
288
286
  else
289
- self.distro.install manifest, :dry_run => options[:dry_run]
287
+ Distro.detect.install manifest, :dry_run => options[:dry_run]
290
288
  end
291
289
  end
292
290
 
@@ -0,0 +1,24 @@
1
+ class CliController
2
+ def self.print_versions(distro)
3
+ puts "Inqlude: #{Inqlude::VERSION}"
4
+
5
+ if find_executable("qmake")
6
+ qmake_out = `qmake -v`
7
+ qmake_out =~ /Qt version (.*) in/
8
+ puts "Qt: #{$1}"
9
+ else
10
+ puts "Qt: not found"
11
+ end
12
+
13
+ if distro
14
+ puts "OS: #{distro.name} #{distro.version}"
15
+ else
16
+ puts "OS: unknown"
17
+ end
18
+ end
19
+
20
+ def self.find_executable(executable)
21
+ `which #{executable}`
22
+ $?.success?
23
+ end
24
+ end
@@ -29,3 +29,4 @@ require_relative("manifest")
29
29
  require_relative("kde_frameworks_creator")
30
30
  require_relative("kde_frameworks_release")
31
31
  require_relative("downloader")
32
+ require_relative("cli_controller")
@@ -40,23 +40,28 @@ class KdeFrameworksRelease
40
40
  end
41
41
 
42
42
  def read_generic_manifests
43
+ puts "Reading generic manifests from '#{@handler.settings.manifest_path}'..."
43
44
  @generic_manifests = Array.new
44
45
  @handler.read_remote
45
46
  @handler.group("kde-frameworks").each do |library|
46
47
  @generic_manifests.push library.generic_manifest
47
48
  end
49
+ puts "Read #{@generic_manifests.count} manifests."
48
50
  @generic_manifests
49
51
  end
50
52
 
51
53
  def write_release_manifests release_date, version
54
+ puts "Writing release manifests for version '#{version}'..."
52
55
  @generic_manifests.each do |generic_manifest|
53
56
  release_manifest = KdeFrameworksRelease.create_release_manifest(
54
57
  generic_manifest, release_date, version )
55
58
  path = @handler.manifest_path( release_manifest )
56
59
  File.open( path, "w" ) do |file|
60
+ puts " #{path}"
57
61
  file.write release_manifest.to_json
58
62
  end
59
- end
63
+ end
64
+ puts "Written #{@generic_manifests.count} manifests."
60
65
  end
61
66
 
62
67
  end
@@ -53,7 +53,28 @@ class ManifestHandler
53
53
  manifest.licenses.include? "Commercial"
54
54
  end
55
55
  end
56
-
56
+
57
+ def latest_libraries
58
+ releases = Array.new
59
+ is_kde_added = false
60
+
61
+ libraries.select do |library|
62
+ if library.latest_manifest.has_version? && library.latest_manifest.group != "kde-frameworks"
63
+ releases.push library
64
+ elsif library.latest_manifest.has_version? && library.latest_manifest.group == "kde-frameworks"
65
+ if !is_kde_added
66
+ is_kde_added = true
67
+ releases.push library
68
+ end
69
+ end
70
+ end
71
+
72
+ releases.sort! {|a,b| a.latest_manifest.release_date <=> b.latest_manifest.release_date}
73
+ releases.reverse!
74
+
75
+ return releases[0 .. 4]
76
+ end
77
+
57
78
  def group name
58
79
  return @libraries.select do |l|
59
80
  manifest = l.latest_manifest
@@ -79,6 +100,28 @@ class ManifestHandler
79
100
  raise InqludeError.new("Unable to find manifest '#{name}'")
80
101
  end
81
102
 
103
+ def topic name
104
+ return @libraries.select do |l|
105
+ manifest = l.latest_manifest
106
+ if manifest.topics
107
+ manifest.topics.include? name
108
+ end
109
+ end
110
+ end
111
+
112
+ def no_of_libraries topic
113
+ count =0;
114
+ @libraries.each do |l|
115
+ topics = l.latest_manifest.topics
116
+ if topics
117
+ if l.latest_manifest.topics.include? topic
118
+ count = count + 1
119
+ end
120
+ end
121
+ end
122
+ count
123
+ end
124
+
82
125
  def read_remote
83
126
  @libraries.clear
84
127
  @manifests.clear
@@ -88,6 +88,10 @@ class Verifier
88
88
  @result.errors.push "Schema validation error: #{error}"
89
89
  end
90
90
 
91
+ if manifest.display_name.nil?
92
+ @result.warnings.push "Warning: missing `display_name` attribute"
93
+ end
94
+
91
95
  topics = manifest.topics
92
96
  if topics.nil?
93
97
  @result.warnings.push "Warning: missing `topics` attribute"
@@ -1,3 +1,3 @@
1
1
  module Inqlude
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
@@ -16,7 +16,7 @@
16
16
 
17
17
  class View
18
18
 
19
- attr_accessor :enable_disqus,:enable_search,:manifest,:library,:group_name
19
+ attr_accessor :enable_disqus,:enable_search,:manifest,:library,:group_name,:templates
20
20
  attr_reader :root
21
21
 
22
22
  def initialize handler
@@ -24,11 +24,13 @@ class View
24
24
  end
25
25
 
26
26
  def create output_dir
27
- puts "Creating web site in '#{output_dir}' from '#{@manifest_handler.settings.manifest_path}'"
28
-
29
27
  assert_dir output_dir
30
28
 
31
29
  system "cp #{view_dir}/favicon.ico #{output_dir}"
30
+
31
+ if templates == "two-column"
32
+ system "cp #{view_dir}/ios.ico #{output_dir}"
33
+ end
32
34
 
33
35
  assert_dir "#{output_dir}/public"
34
36
  system "cp #{view_dir}/public/* #{output_dir}/public/"
@@ -38,19 +40,15 @@ class View
38
40
 
39
41
  create_inqlude_all(output_dir)
40
42
 
41
-
42
43
  @root = ""
43
44
 
44
- render_template "index", output_dir
45
- render_template "development", output_dir
46
- render_template "unreleased", output_dir
47
- render_template "commercial", output_dir
48
- render_template "all", output_dir
49
- render_template "about", output_dir
50
- render_template "get", output_dir
51
- render_template "contribute", output_dir
52
- render_template "search", output_dir
53
-
45
+ Dir.glob("#{view_dir}*.html.haml") do |file|
46
+ template_name = (File.basename file).split(".").first
47
+
48
+ if !["layout","group","library"].include? template_name
49
+ render_template template_name, output_dir
50
+ end
51
+ end
54
52
 
55
53
  groups_path = "#{output_dir}/groups/"
56
54
  assert_dir groups_path
@@ -73,6 +71,19 @@ class View
73
71
  file_name = "libraries/" + library.name
74
72
  render_template "library", output_dir, file_name
75
73
  end
74
+
75
+ if templates == 'two-column'
76
+ topics_path = "#{output_dir}/topics/"
77
+ assert_dir topics_path
78
+
79
+ @root = "../"
80
+
81
+ topics.each do |topic|
82
+ @topic = topic
83
+ file_name = "topics/" + topic
84
+ render_template "topic", output_dir, file_name
85
+ end
86
+ end
76
87
  end
77
88
 
78
89
  def create_inqlude_all(output_dir)
@@ -81,6 +92,10 @@ class View
81
92
  end
82
93
  end
83
94
 
95
+ def template_directory_exists?
96
+ File.directory?(view_dir) ? true : false
97
+ end
98
+
84
99
  def render_template name, output_dir, file_name = nil
85
100
  layout = template "layout"
86
101
  layout_engine = Haml::Engine.new layout
@@ -112,10 +127,18 @@ class View
112
127
  @manifest
113
128
  end
114
129
 
130
+ def t
131
+ @topic
132
+ end
133
+
115
134
  def link_to_manifest name
116
135
  "<a href=\"#{@root}libraries/#{name}.html\">#{name}</a>"
117
136
  end
118
137
 
138
+ def link_to_library name, display_name
139
+ "<a href=\"#{@root}libraries/#{name}.html\">#{display_name}</a>"
140
+ end
141
+
119
142
  def link url
120
143
  "<a href=\"#{url}\" target=\"_blank\">#{url}</a>"
121
144
  end
@@ -127,6 +150,14 @@ class View
127
150
  "<a href=\"#{url}\">#{title}</a>"
128
151
  end
129
152
 
153
+ def link_to_group name, display_name
154
+ "<a href=\"#{@root}groups/#{name}.html\">#{display_name}</a>"
155
+ end
156
+
157
+ def link_to_topic name
158
+ "<a href=\"#{@root}topics/#{name}.html\">#{name}</a>"
159
+ end
160
+
130
161
  def list_attribute attribute
131
162
  attr = @manifest.send(attribute)
132
163
  return "" if !attr || attr.size == 0
@@ -217,6 +248,10 @@ class View
217
248
  @manifest_handler.commercial_libraries
218
249
  end
219
250
 
251
+ def latest_libraries
252
+ @manifest_handler.latest_libraries
253
+ end
254
+
220
255
  def group_title
221
256
  if @group_name == "kde-frameworks"
222
257
  return "KDE Frameworks"
@@ -227,6 +262,14 @@ class View
227
262
  def group
228
263
  @manifest_handler.group(@group_name)
229
264
  end
265
+
266
+ def topic name
267
+ @manifest_handler.topic(name)
268
+ end
269
+
270
+ def no_of_libraries topic
271
+ @manifest_handler.no_of_libraries(topic)
272
+ end
230
273
 
231
274
  def disqus_enabled?
232
275
  @enable_disqus
@@ -261,6 +304,10 @@ class View
261
304
  doc.to_html
262
305
  end
263
306
 
307
+ def topics
308
+ ['API', 'Artwork', 'Bindings', 'Communication', 'Data', 'Desktop', 'Development', 'Graphics', 'Logging', 'Mobile', 'Multimedia', 'Printing', 'QML', 'Scripting', 'Security', 'Text', 'Web', 'Widgets']
309
+ end
310
+
264
311
  private
265
312
 
266
313
  def assert_dir name
@@ -272,7 +319,7 @@ class View
272
319
  end
273
320
 
274
321
  def view_dir
275
- File.expand_path( File.dirname( __FILE__ ) + "/../view/" ) + "/"
322
+ File.expand_path( File.dirname( __FILE__ ) + "/../view/#{templates}" ) + "/"
276
323
  end
277
324
 
278
325
  def schema_dir