Sha256: 1881d90f290ed877dfe5bc1b25a399f1475cfdf9d53d19f5ab6674bc2227cbdc
Contents?: true
Size: 1.84 KB
Versions: 4
Compression:
Stored size: 1.84 KB
Contents
module GemManager def self.installed?(gemname, version) gem_path = File.join(Conf.gem_dir, "gems", "#{gemname}-#{version}") exists = File.exist?(gem_path) Ramaze::Log.info "checking existance of #{gem_path}.. #{exists}" exists end def self.install_file(path) begin # make symlink newpath = "/tmp/#{File.basename(path, ".gem")}.gem" File.symlink(path, newpath) # install cmd = [ Conf.gem_command, "install", newpath, "-i", Conf.gem_dir, "-n", Conf.gem_bin_dir, Conf.gem_install_option ].join(" ") Ramaze::Log.info cmd # execute result = `#{cmd}` # make data dir spec = YAML.load(`gem spec #{path}`) data_dir = File.join(Conf.data_dir, "#{spec.name}-#{spec.version}") unless File.directory?(data_dir) Dir.mkdir(data_dir) Ramaze::Log.info "made data dir for the gem: #{data_dir}" end [result, spec.name, spec.version.to_s] ensure File.unlink(newpath) end end def self.install_gem(name) # install cmd = [ Conf.gem_command, "install", name, "-i", Conf.gem_dir, "-n", Conf.gem_bin_dir, Conf.gem_install_option ].join(" ") Ramaze::Log.info cmd # execute result = `#{cmd}` # make data dir raise "installation failed" unless result =~ /installed #{name}-(.*)/ version = $1 data_dir = File.join(Conf.data_dir, "#{name}-#{version}") unless File.directory?(data_dir) Dir.mkdir(data_dir) Ramaze::Log.info "made data dir for the gem: #{data_dir}" end [result, name, version] end def self.uninstall(name, version) cmd = [ Conf.gem_command, "uninstall", name, "-v", version, "-i", Conf.gem_dir, "-n", Conf.gem_bin_dir ].join(" ") Ramaze::Log.info cmd `#{cmd}` end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ruby-station-0.1.3 | util/gem_manager.rb |
ruby-station-0.1.2 | util/gem_manager.rb |
ruby-station-0.1.1 | util/gem_manager.rb |
ruby-station-0.1.0 | util/gem_manager.rb |