Sha256: c88690371a180dc70befb4d5891a490667b16a10748114529ce7dbac00bfdb5a

Contents?: true

Size: 837 Bytes

Versions: 7

Compression:

Stored size: 837 Bytes

Contents

require 'rbconfig'

class Jeweler
  module Commands
    class InstallGem
      attr_accessor :gemspec_helper, :output

      def initialize
        self.output = $stdout
      end


      def run
        command = "gem install #{gemspec_helper.gem_path}"
        output.puts "Executing #{command.inspect}:"

        sh sudo_wrapper(command) # TODO where does sh actually come from!? - rake, apparently
      end

      def sudo_wrapper(command)
        use_sudo? ? "sudo #{command}" : command
      end

      def use_sudo?
        host_os !~ /mswin|windows|cygwin/i
      end

      def host_os
        Config::CONFIG['host_os']
      end

      def self.build_for(jeweler)
        command = new
        command.output = jeweler.output
        command.gemspec_helper = jeweler.gemspec_helper
        command
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 4 rubygems

Version Path
dima-jeweler-1.2.0 lib/jeweler/commands/install_gem.rb
mcornick-jeweler-1.2.0 lib/jeweler/commands/install_gem.rb
technicalpickles-jeweler-1.1.0 lib/jeweler/commands/install_gem.rb
technicalpickles-jeweler-1.2.1 lib/jeweler/commands/install_gem.rb
jeweler-1.2.1 lib/jeweler/commands/install_gem.rb
jeweler-1.2.0 lib/jeweler/commands/install_gem.rb
jeweler-1.1.0 lib/jeweler/commands/install_gem.rb