inqlude 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/TODO CHANGED
@@ -1,20 +1,16 @@
1
1
  * Smarter match for source RPMs, which contain more than one library
2
- * Install a library
3
2
  * Show documentation of an library
4
3
  * Add "How to use" data
5
- * Generate web page of all libraries
6
4
  * Define maturity scale
7
5
  * Retrieve data from qt-apps and kde-apps
8
6
  * "How to package libraries"
9
7
  * Add tags for searching
10
- * Sync local repo with remote repo
11
8
  * Look for local search
12
- * Only look at devel packages when creating RPM based list
13
9
  * Get manifests from build service
14
10
  * Add option to verify given or all manifests
15
11
  * Add show option for showing library details
16
12
  * List libraries with available packages
17
13
  * Update manifest data to have complete package data
18
- * Add tests
19
14
  * Properly identify repository (use vendor?)
20
15
  * One-click install for SUSE systems
16
+ * Don't duplicate partials in views
data/bin/inqlude CHANGED
@@ -19,14 +19,6 @@
19
19
 
20
20
  require File.expand_path('../../lib/inqlude',__FILE__)
21
21
 
22
- def get_involved text, id = nil
23
- puts "You can help and get involved:"
24
- puts text
25
- if id
26
- puts "More info: https://github.com/cornelius/inqlude/issues/#{id}"
27
- end
28
- end
29
-
30
22
  distro = Distro.detect
31
23
  if !distro
32
24
  STDERR.puts "Warning: unable to detect distro."
data/lib/cli.rb CHANGED
@@ -79,12 +79,12 @@ class Cli < Thor
79
79
 
80
80
  desc "show <library_name>", "Show library details"
81
81
  def show name
82
- get_involved "Add command for showing library details"
82
+ Upstream.get_involved "Add command for showing library details", 1
83
83
  end
84
84
 
85
85
  desc "verify", "Verify manifests"
86
86
  def verify
87
- get_involved "Add command for verifying manifests"
87
+ Upstream.get_involved "Add command for verifying manifests", 2
88
88
  end
89
89
 
90
90
  desc "create", "Create manifest"
@@ -111,20 +111,29 @@ class Cli < Thor
111
111
 
112
112
  desc "get_involved", "Information about how to get involved"
113
113
  def get_involved
114
- puts
115
- puts "If you would like to help with development of the Inqlude tool,"
116
- puts "have a look at the git repository, in particular the list of open"
117
- puts "issues: https://github.com/cornelius/inqlude/issues"
118
- puts
119
- puts "If you would like to contribute information about a Qt based"
120
- puts "library, have a look at the git repository containing the library"
121
- puts "meta data: https://github.com/cornelius/inqlude_data"
122
- puts
123
- puts "Your help is appreciated."
124
- puts
125
- puts "If you have questions or comments, please let me know:"
126
- puts "Cornelius Schumacher <schumacher@kde.org>"
127
- puts
114
+ Upstream.print_info
115
+ end
116
+
117
+ desc "uninstall", "Uninstall library"
118
+ def uninstall name
119
+ handler = ManifestHandler.new @@settings
120
+ manifest = handler.manifest name
121
+ if !manifest
122
+ STDERR.puts "Manifest for '#{name}' not found"
123
+ else
124
+ @@distro.uninstall manifest
125
+ end
126
+ end
127
+
128
+ desc "install", "Install library"
129
+ def install name
130
+ handler = ManifestHandler.new @@settings
131
+ manifest = handler.manifest name
132
+ if !manifest
133
+ STDERR.puts "Manifest for '#{name}' not found"
134
+ else
135
+ @@distro.install manifest
136
+ end
128
137
  end
129
138
 
130
139
  end
data/lib/distros/suse.rb CHANGED
@@ -57,10 +57,51 @@ class Suse
57
57
  unknown -= 1
58
58
  end
59
59
  end
60
-
61
- STDERR.puts "Warning: #{unknown} libraries don't have package information"
62
-
60
+
61
+ if unknown > 0
62
+ STDERR.puts "Warning: #{unknown} libraries don't have package information"
63
+ end
64
+
63
65
  installed
64
66
  end
65
67
 
68
+ def uninstall manifest
69
+ package_name = get_package_name manifest
70
+ if package_name
71
+ system "sudo zypper rm #{package_name}"
72
+ end
73
+ end
74
+
75
+ def install manifest
76
+ package_name = get_package_name manifest
77
+ if package_name
78
+ system "sudo zypper install #{package_name}"
79
+ end
80
+ end
81
+
82
+ def get_package_name manifest
83
+ package_section = manifest["packages"]
84
+ if !package_section
85
+ STDERR.puts "No packages section in metadata"
86
+ else
87
+ name_section = package_section[name]
88
+ if !name_section
89
+ STDERR.puts "No section '#{name}' found in packages section."
90
+ else
91
+ version_section = name_section[version]
92
+ if !version_section
93
+ STDERR.puts "No section '#{version}' found in section '#{name}'"
94
+ else
95
+ package_name = version_section["package_name"]
96
+ if !package_name || package_name.empty?
97
+ STDERR.puts "No package name found"
98
+ else
99
+ return package_name
100
+ end
101
+ end
102
+ end
103
+ end
104
+ nil
105
+ end
106
+
66
107
  end
data/lib/inqlude.rb CHANGED
@@ -11,3 +11,4 @@ require File.expand_path('../view', __FILE__)
11
11
  require File.expand_path('../distro', __FILE__)
12
12
  require File.expand_path('../rpm_manifestizer', __FILE__)
13
13
  require File.expand_path('../settings', __FILE__)
14
+ require File.expand_path('../upstream', __FILE__)
@@ -24,12 +24,36 @@ class ManifestHandler
24
24
  @manifests = Array.new
25
25
  end
26
26
 
27
+ def manifest name
28
+ read_remote
29
+ @manifests.each do |manifest|
30
+ if manifest["name"] == name
31
+ return manifest
32
+ end
33
+ end
34
+ nil
35
+ end
36
+
27
37
  def read_remote
28
- Dir.glob( "#{@settings.manifest_dir}/*.manifest" ).sort.each do |filename|
38
+ fetch_remote
39
+
40
+ Dir.glob( "#{@settings.manifest_path}/*.manifest" ).sort.each do |filename|
29
41
  File.open filename do |file|
30
42
  manifests.push JSON file.read
31
43
  end
32
44
  end
33
45
  end
34
46
 
47
+ def fetch_remote
48
+ if !File.exists? @settings.manifest_path + "/.git"
49
+ if File.exists? @settings.manifest_path
50
+ system "rm -r #{@settings.manifest_path}"
51
+ end
52
+ system "git clone https://github.com/cornelius/inqlude_data.git " +
53
+ "#{@settings.manifest_path}"
54
+ else
55
+ system "cd #{@settings.manifest_path}; git pull"
56
+ end
57
+ end
58
+
35
59
  end
@@ -173,7 +173,7 @@ class RpmManifestizer
173
173
 
174
174
  def create_source_cache
175
175
  puts "Creating cache of RPM meta data"
176
- get_involved "Create more friendly progress display for cache creation"
176
+ Upstream.get_involved "Create more friendly progress display for cache creation", 3
177
177
  sources = Hash.new
178
178
  IO.popen "rpmqpack" do |f|
179
179
  while line = f.gets do
data/lib/settings.rb CHANGED
@@ -16,8 +16,8 @@
16
16
 
17
17
  class Settings
18
18
 
19
- def manifest_dir
20
- local_dir "manifests"
19
+ def manifest_path
20
+ local_path "manifests"
21
21
  end
22
22
 
23
23
  def cache_dir
@@ -30,10 +30,14 @@ class Settings
30
30
 
31
31
  private
32
32
 
33
- def local_dir dirname
33
+ def local_path dirname
34
34
  home = ENV["HOME"] + "/.inqlude/"
35
35
  Dir::mkdir home unless File.exists? home
36
- path = home + dirname
36
+ home + dirname
37
+ end
38
+
39
+ def local_dir dirname
40
+ path = local_path dirname
37
41
  Dir::mkdir path unless File.exists? path
38
42
  path
39
43
  end
data/lib/upstream.rb ADDED
@@ -0,0 +1,44 @@
1
+ # Copyright (C) 2011 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 Upstream
18
+
19
+ def self.get_involved text, id = nil
20
+ puts "You can help and get involved:"
21
+ puts text
22
+ if id
23
+ puts "More info: https://github.com/cornelius/inqlude/issues/#{id}"
24
+ end
25
+ end
26
+
27
+ def self.print_info
28
+ puts
29
+ puts "If you would like to help with development of the Inqlude tool,"
30
+ puts "have a look at the git repository, in particular the list of open"
31
+ puts "issues: https://github.com/cornelius/inqlude/issues"
32
+ puts
33
+ puts "If you would like to contribute information about a Qt based"
34
+ puts "library, have a look at the git repository containing the library"
35
+ puts "meta data: https://github.com/cornelius/inqlude_data"
36
+ puts
37
+ puts "Your help is appreciated."
38
+ puts
39
+ puts "If you have questions or comments, please let me know:"
40
+ puts "Cornelius Schumacher <schumacher@kde.org>"
41
+ puts
42
+ end
43
+
44
+ end
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Inqlude
2
2
 
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
 
5
5
  end
data/lib/view.rb CHANGED
@@ -28,12 +28,10 @@ class View
28
28
  assert_dir "#{output_dir}/public"
29
29
  system "cp #{view_dir}/public/* #{output_dir}/public/"
30
30
 
31
- index = template "index"
32
- engine = Haml::Engine.new index
33
-
34
- File.open "#{output_dir}/index.html", "w" do |file|
35
- file.puts engine.render( binding )
36
- end
31
+ render_template "index", output_dir
32
+ render_template "about", output_dir
33
+ render_template "get", output_dir
34
+ render_template "contribute", output_dir
37
35
 
38
36
  library_path = "#{output_dir}/libraries/"
39
37
  assert_dir library_path
@@ -46,7 +44,15 @@ class View
46
44
  file.puts engine.render( binding )
47
45
  end
48
46
  end
47
+ end
48
+
49
+ def render_template name, output_dir
50
+ page = template name
51
+ engine = Haml::Engine.new page
49
52
 
53
+ File.open "#{output_dir}/#{name}.html", "w" do |file|
54
+ file.puts engine.render( binding )
55
+ end
50
56
  end
51
57
 
52
58
  def m attr
@@ -61,6 +67,13 @@ class View
61
67
  "<a href=\"#{url}\" target=\"_blank\">#{url}</a>"
62
68
  end
63
69
 
70
+ def link_to title, url
71
+ if url !~ /^mailto:/ && url !~ /^http:/
72
+ url += ".html"
73
+ end
74
+ "<a href=\"#{url}\">#{title}</a>"
75
+ end
76
+
64
77
  def manifests
65
78
  if @manifest_handler.manifests.empty?
66
79
  @manifest_handler.read_remote
@@ -0,0 +1,46 @@
1
+ %head
2
+ %link{ :rel => "stylesheet", :type => "text/css",
3
+ :href => "public/inqlude.css" }
4
+ <link href='http://fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'>
5
+ %body
6
+ .header.center
7
+ %h1
8
+ %span.logo><
9
+ \#in
10
+ %span.logo.green><
11
+ q
12
+ %span.logo><
13
+ lude
14
+ %span.subtitle
15
+ The Qt library archive
16
+
17
+ .menu.center
18
+ %span.menu_items
19
+ = link_to "How to get libraries", "get"
20
+ |
21
+ = link_to "How to contribute", "contribute"
22
+ |
23
+ = link_to "About", "about"
24
+
25
+ .content.center
26
+ %p
27
+ Inqlude is the independent archive of Qt based libraries. Its mission is
28
+ to make it as easy as possible for developers using Qt to find and use
29
+ libraries, in particular 3rd party ones.
30
+ %p
31
+ Inqlude comes with a command line client for handling libraries. See the
32
+ = link_to "instructions how to get libraries", "get"
33
+ for more details.
34
+ %p
35
+ Inqlude tries to be a complete archive of all available Qt based
36
+ libraries. If you notice that there is some information missing, outdated
37
+ or inaccurate, please consider contributing the missing data. See the
38
+ = link_to "instructions how to contribute", "contribute"
39
+ for more details.
40
+ %p
41
+ %em
42
+ Note that Inqlude is currently a proof-of-concept. It's not ready for
43
+ production use yet. Feedback and input is appreciated.
44
+ %p
45
+ If you have questions of comments please feel free to contact
46
+ = link_to( "Cornelius Schumacher", "mailto:schumacher@kde.org" ) + "."
@@ -0,0 +1,57 @@
1
+ %head
2
+ %link{ :rel => "stylesheet", :type => "text/css",
3
+ :href => "public/inqlude.css" }
4
+ <link href='http://fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'>
5
+ %body
6
+ .header.center
7
+ %h1
8
+ %span.logo><
9
+ \#in
10
+ %span.logo.green><
11
+ q
12
+ %span.logo><
13
+ lude
14
+ %span.subtitle
15
+ The Qt library archive
16
+
17
+ .menu.center
18
+ %span.menu_items
19
+ = link_to "How to get libraries", "get"
20
+ |
21
+ = link_to "How to contribute", "contribute"
22
+ |
23
+ = link_to "About", "about"
24
+
25
+ .content.center
26
+ %h2 Contributing data about libraries
27
+
28
+ %p
29
+ To get a complete overview about all available Qt based libraries, we need
30
+ to collect data about these libraries. This includes descriptions,
31
+ instructions how to use them, as well as links to sources or installable
32
+ packages.
33
+ %p
34
+ The meta data used by Inqlude is collected in a git repository at
35
+ = link( "http://github.com/cornelius/inqlude_data" ) + "."
36
+ It contains a manifest file in JSON format for each library, which has the
37
+ meta data in a structured machine-readable form. JSON is easy enough for
38
+ humans to read and edit as well.
39
+ %p
40
+ You can contribute meta data by providing patches to the inqlude_data
41
+ repository. Use the github mechanisms or just send patches by email.
42
+ Contributions are welcome.
43
+
44
+ %h2 Contributing to the Inqlude tools
45
+
46
+ %p
47
+ The command line tool is developed in another git repository at
48
+ = link( "http://github.com/cornelius/inqlude" ) + "."
49
+ It's still in a proof-of-concept state, so there is quite a bit work left.
50
+ Have a look at the
51
+ = link_to "list of open issues", "http://github.com/cornelius/inqlude/issues"
52
+ or read the source and come up with your own ideas what to improve.
53
+ %p
54
+ Especially welcome are contributions for adding support for native
55
+ package systems on the variety of Linux distributions and other systems
56
+ out there.
57
+
@@ -0,0 +1,67 @@
1
+ %head
2
+ %link{ :rel => "stylesheet", :type => "text/css",
3
+ :href => "public/inqlude.css" }
4
+ <link href='http://fonts.googleapis.com/css?family=Droid+Sans' rel='stylesheet' type='text/css'>
5
+ %body
6
+ .header.center
7
+ %h1
8
+ %span.logo><
9
+ \#in
10
+ %span.logo.green><
11
+ q
12
+ %span.logo><
13
+ lude
14
+ %span.subtitle
15
+ The Qt library archive
16
+
17
+ .menu.center
18
+ %span.menu_items
19
+ = link_to "How to get libraries", "get"
20
+ |
21
+ = link_to "How to contribute", "contribute"
22
+ |
23
+ = link_to "About", "about"
24
+
25
+ .content.center
26
+ %p
27
+ This page is about how to use Inqlude as a user, a developer using Qt
28
+ based libraries in her projects.
29
+ %p
30
+ First you can just use the web site. Find the information about libraries
31
+ here, and get the libraries manually with the provided links. This works,
32
+ but there is a more convenient way.
33
+ %p
34
+ You can also use the command line client. This client makes it easy to get
35
+ the libraries you need with just a few commands, without having to know
36
+ URLs, or how libraries are packages.
37
+ %p
38
+ First you need to get the command line client. It's available as a Ruby
39
+ gem, so when you have rubygems installed you can simply do a
40
+ .code
41
+ sudo gem install inqlude
42
+ (For instructions how to get rubygems, see
43
+ = link_to( "rubygems.org", "http://rubygems.org" ) + ")."
44
+ %p
45
+ Once you have the client, you can get help about the available commands
46
+ with
47
+ .code
48
+ inqlude
49
+ get a list of available libraries with
50
+ .code
51
+ inqlude list -r
52
+
53
+ install a library with
54
+ .code
55
+ inqlude install <library_name>
56
+
57
+ and get a list of installed libraries with
58
+ .code
59
+ inqlude list
60
+ %p
61
+ The command line client uses your native package management system. In
62
+ case there is no meta data available for your system, the client falls
63
+ back to handling sources. Please consider helping to get your system
64
+ supported by contributing meta data or implementing a backend for your
65
+ system. See the
66
+ = link_to "instructions how to contribute", "contribute"
67
+ for more details.
data/view/index.html.haml CHANGED
@@ -15,6 +15,12 @@
15
15
  The Qt library archive
16
16
 
17
17
  .menu.center
18
+ %span.menu_items
19
+ = link_to "How to get libraries", "get"
20
+ |
21
+ = link_to "How to contribute", "contribute"
22
+ |
23
+ = link_to "About", "about"
18
24
 
19
25
  .content.center
20
26
  %table
@@ -15,6 +15,12 @@
15
15
  The Qt library archive
16
16
 
17
17
  .menu.center
18
+ %span.menu_items
19
+ = link_to "How to get libraries", "get"
20
+ |
21
+ = link_to "How to contribute", "contribute"
22
+ |
23
+ = link_to "About", "about"
18
24
 
19
25
  .content.center
20
26
  %h2
@@ -40,8 +40,19 @@ h1 .subtitle {
40
40
 
41
41
  .menu {
42
42
  width: 85%;
43
- height: 20px;
44
43
  background-color: green;
44
+ padding-top: 4px;
45
+ padding-bottom: 6px;
46
+ padding-right: 10px;
47
+ text-align: right;
48
+ }
49
+
50
+ .menu_items {
51
+ color: white;
52
+ }
53
+
54
+ .menu_items a {
55
+ color: white;
45
56
  }
46
57
 
47
58
  .content {
@@ -50,6 +61,14 @@ h1 .subtitle {
50
61
  padding: 10px;
51
62
  }
52
63
 
64
+ .code {
65
+ background-color: black;
66
+ color: white;
67
+ padding: 10px;
68
+ font-family: monospace;
69
+ margin: 6px;
70
+ }
71
+
53
72
  table {
54
73
  margin: auto;
55
74
  }
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inqlude
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Cornelius Schumacher
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-13 00:00:00 +02:00
18
+ date: 2011-06-14 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -106,10 +106,14 @@ files:
106
106
  - lib/manifest_handler.rb
107
107
  - lib/rpm_manifestizer.rb
108
108
  - lib/settings.rb
109
+ - lib/upstream.rb
109
110
  - lib/version.rb
110
111
  - lib/view.rb
111
112
  - test/rpm_manifestizer_test.rb
112
113
  - test/test_helper.rb
114
+ - view/about.html.haml
115
+ - view/contribute.html.haml
116
+ - view/get.html.haml
113
117
  - view/index.html.haml
114
118
  - view/library.html.haml
115
119
  - view/public/inqlude.css