gem-nice-install 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -8,6 +8,14 @@ You don't need to do nothing special, just use 'gem install' as you always do. g
8
8
 
9
9
  Please note, that the currently, only Fedora is supported. However, it should be pretty forward to add support for your favorite system in similar manner.
10
10
 
11
+ ## bundler
12
+
13
+ To make bundler to use this gem as well, you need to load the rubygems_plugin before. The easiest way is to make an alias in your `~/.bashrc` or so:
14
+
15
+ ```
16
+ alias bundle='RUBYOPT="-rrubygems/nice_install" bundle'
17
+ ```
18
+
11
19
  ## license
12
20
 
13
21
  This software is licensed under terms of MIT license.
@@ -11,6 +11,8 @@ module Gem
11
11
  module Nice
12
12
  require 'rubygems/nice_install/distro_guesser'
13
13
 
14
+ include Gem::UserInteraction
15
+
14
16
  def build_extensions
15
17
  super
16
18
  rescue ExtensionBuildError => e
@@ -29,6 +31,7 @@ module Gem
29
31
  end
30
32
 
31
33
  unless missing_deps.empty?
34
+ say "Installing native dependencies for Gem '#{spec.name}': #{missing_deps.join ' '}"
32
35
  unless ext_installer.install_ext_dependencies_for(spec.name, missing_deps)
33
36
  raise Gem::InstallError, "Failed to install native dependencies for '#{spec.name}'."
34
37
  end
@@ -1,6 +1,8 @@
1
1
  require 'yaml'
2
2
  module Gem::Installer::Nice
3
3
  class BaseExtInstaller
4
+ include Gem::UserInteraction
5
+
4
6
  def default_ext_dependencies
5
7
  raise NotImplementedError
6
8
  end
@@ -28,7 +30,7 @@ module Gem::Installer::Nice
28
30
 
29
31
  def get_deps(gem)
30
32
  load_dep_files
31
- @deps["gems"][gem]
33
+ @deps["gems"][gem] || []
32
34
  end
33
35
 
34
36
  private
@@ -18,9 +18,29 @@ module Gem::Installer::Nice
18
18
  end
19
19
 
20
20
  def install_ext_dependencies_for gem_name, deps
21
- puts "Yum installing these native dependencies for Gem '#{gem_name}':"
22
- puts deps.join ' '
23
- system("sudo yum install #{deps.join ' '}")
21
+ install_using_packagekit deps
24
22
  end
23
+
24
+ private
25
+
26
+ def install_using_yum(names=[])
27
+ system "su -c 'yum install #{names.join(' ')}'"
28
+ end
29
+
30
+ def install_using_packagekit(names=[])
31
+ begin
32
+ require 'dbus'
33
+ session_bus = DBus::SessionBus.instance
34
+ pkg_kit = session_bus.introspect("org.freedesktop.PackageKit", "/org/freedesktop/PackageKit")
35
+ pkg_kit['org.freedesktop.PackageKit.Modify'].InstallPackageNames(0, names, 'show-confirm-install')
36
+ # DBus is not availabe in non-X environment.
37
+ rescue Errno::ENOENT
38
+ install_using_yum names
39
+ rescue LoadError
40
+ say "To use PackageKit installation, 'ruby-dbus' package needs to be installed. (yum install rubygem-ruby-dbus)"
41
+ install_using_yum names
42
+ end
43
+ end
44
+
25
45
  end
26
46
  end
metadata CHANGED
@@ -1,17 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem-nice-install
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Vít Ondruch
9
9
  - Bohuslav Kabrda
10
10
  - Ivan Nečas
11
+ - Michal Fojtik
11
12
  autorequire:
12
13
  bindir: bin
13
14
  cert_chain: []
14
- date: 2012-10-16 00:00:00.000000000 Z
15
+ date: 2012-10-26 00:00:00.000000000 Z
15
16
  dependencies: []
16
17
  description: ! 'A RubyGems plugin that improves gem installation user experience.
17
18
  If binary extension build fails,
@@ -27,9 +28,9 @@ files:
27
28
  - README.md
28
29
  - MIT
29
30
  - data/fedora.yml
30
- - lib/rubygems/nice_install/fedora_ext_installer.rb
31
- - lib/rubygems/nice_install/base_ext_installer.rb
32
31
  - lib/rubygems/nice_install/distro_guesser.rb
32
+ - lib/rubygems/nice_install/base_ext_installer.rb
33
+ - lib/rubygems/nice_install/fedora_ext_installer.rb
33
34
  - lib/rubygems/nice_install.rb
34
35
  - lib/rubygems_plugin.rb
35
36
  homepage: https://github.com/voxik/gem-nice-install