1.hello.rb
position:  /home/pt/test/hello.rb
content:
class  Hihi
 def self.hello
  puts   "HELLO"
 end
end
2.hello.gemspec
position:  /home/pt/test/hello.gemspec
content:
 Gem::Specification.new do |s|
     s.name = 'hello'
     s.version = '0.1.0'
     s.summary = 'hello gems'
     s.files = ["/home/pt/test/hello.rb"]
     s.summary='output  hello'
     s.description='output hello'
 end
3.gem build
pt@pt-laptop:~$gem build /home/pt/test/hello.gemspec
WARNING:  no author specified
WARNING:  no email specified
WARNING:  no homepage specified
WARNING:  no rubyforge_project specified
  Successfully built RubyGem
  Name: hello
  Version: 0.1.0
  File: hello-0.1.0.gem
pt@pt-laptop:~$ gem install  hello
WARNING:  Installing to ~/.gem since /var/lib/gems/1.8 and
    /var/lib/gems/1.8/bin aren't both writable.
WARNING:  You don't have /home/pt/.gem/ruby/1.8/bin in your PATH,
    gem executables will not run.
ERROR:  Error installing hello:
  attempt to install file into "/home/pt/test/hello.rb"
pt@pt-laptop:~$ irb
irb(main):001:0> require  'hello'
LoadError: no such file to load -- hello
  from (irb):1:in `require'
  from (irb):1
  from :0
irb(main):002:0> require  '/home/pt/test/hello'
=> true
irb(main):003:0> Hihi.hello
HELLO
=> nil
irb(main):004:0>

problem:
Would you be kind enough to solve this  problem for me ?
1.why  in my system
/var/lib/gems/1.8 and  /var/lib/gems/1.8/bin aren't both writable.
how to make them writable?
2.how can i use require command this way:  require  'hello'  not 
require  '/home/pt/test/hello'?

-- 
Posted via http://www.ruby-forum.com/.