Aliases: How to make a gem, Packaging gems, Gem creation
Contents |
> sudo gem install --local pkg/OurExtensions-0.0.1.gem --rdoc # So you can test that the rdoc installs properly --test # So you can ensure that all the tests pass still --force # In case it's already installed Attempting local installation of 'pkg/OurExtensions-0.0.1.gem' Successfully installed OurExtensions, version 0.0.1 Installing RDoc documentation for OurExtensions-0.0.1... [runs tests for you...]
(Hint: You can always do --install-dir ./some_local_dir/ if you don't have sudo.)
This should huncover any installation problems that your users might have. If you specified an incorrect autorequire file in your gemspec, for example, you will find out about it here.
And if you want to clean up afterwards...
> sudo gem uninstall OurExtensions Attempting to uninstall gem 'OurExtensions' Successfully uninstalled OurExtensions version 0.0.1
Put it on RubyForge!
...
No, not that I know of.
What would you want your 'installer' script to do?
Since RubyGems can't do it for you, you'll have to either
It looks like that's the route vim-ruby chose to go... Their installation directions go like this:
# gem install vim-ruby --remote # vim-ruby-install.rb
vim-ruby-install.rb is an executable that RubyGems installed for you and placed at /usr/bin/vim-ruby-install.rb (or equivalent) so it should be in your path already.
If you create an installer script, keep in mind:
bin/_svn_command_post_install
#!/usr/bin/env ruby
require 'fileutils'
if ARGV.include?('--dry-run')
include FileUtils::DryRun
else
include FileUtils::Verbose
end
bin_dir = File.expand_path(File.dirname(__FILE__))
chmod 0755, Dir["#{bin_dir}/*"]
path_command = "export PATH=`ls -dt --color=never /usr/lib/ruby/gems/1.8/gems/svn-command* | head -n1`/bin:$PATH"
system "grep gems/svn-command ~/.bash_profile || " +
"echo '#{path_command}' >> ~/.bash_profile"
/usr/lib/ruby/gems/1.8/gems/railsbench-0.9.1/INSTALL
Since gem packages don't support running postinstall scripts, you will need to make the scripts executable by running sudo railsbench postinstall
/usr/lib/ruby/gems/1.8/gems/railsbench-0.9.1/INSTALL
Alternatively, add the railsbench script directory to your search
path. The exact place can be found running
railsbench base
which prints the script directory path. Another option is to run
eval `railsbench path`
> railsbench path PATH=/usr/lib/ruby/gems/1.8/gems/railsbench-0.9.1/script:$PATH > railsbench base railsbench is installed in: /usr/lib/ruby/gems/1.8/gems/railsbench-0.9.1
/usr/lib/ruby/gems/1.8/gems/railsbench-0.9.1/bin/railsbench
RAILSBENCH_BASE = File.expand_path(File.dirname(__FILE__) + '/..')
case real_cmd
when 'base'
puts "railsbench is installed in: #{RAILSBENCH_BASE}"
exit
when 'help', 'readme'
File.open("#{RAILSBENCH_BASE}/README").each_line{|l| puts l}
exit
when 'path'
puts "PATH=#{RAILSBENCH_BASE}/script:$PATH"
exit