Sha256: 78ab31326c7973defd0440c58c120c3329c564fc72177f21c45617f490e7256b

Contents?: true

Size: 1.57 KB

Versions: 8

Compression:

Stored size: 1.57 KB

Contents

require 'rvm/capistrano/base'

rvm_with_capistrano do

  namespace :rvm do

    desc <<-EOF
      Import file contents to the current RVM ruby gemset.

      The gemset filename must match :rvm_ruby_string.gems and be located in :rvm_gemset_path.
      :rvm_gemset_path defaults to :rvm_path/gemsets

      The gemset can be created with 'cap rvm:gemset_export'.
    EOF
    rvm_task :import_gemset do
      ruby, gemset = fetch(:rvm_ruby_string_evaluated).to_s.strip.split(/@/)
      if %w( release_path default ).include? "#{ruby}"
        raise "gemset can not be imported when using :rvm_ruby_string => :#{ruby}"
      else
        if gemset
          ruby = fetch(:rvm_ruby_string_evaluated)
          run_rvm("rvm gemset import #{File.join(rvm_gemset_path, "#{ruby}.gems")}", :with_ruby => ruby)
        end
      end
    end

    desc <<-EOF
      Export the current RVM ruby gemset contents to a file.

      The gemset filename will match :rvm_ruby_string.gems and be located in :rvm_gemset_path.
      :rvm_gemset_path defaults to :rvm_path/gemsets

      The gemset can be imported with 'cap rvm:gemset_import'.
    EOF
    rvm_task :export_gemset do
      ruby, gemset = fetch(:rvm_ruby_string_evaluated).to_s.strip.split(/@/)
      if %w( release_path default ).include? "#{ruby}"
        raise "gemset can not be exported when using :rvm_ruby_string => :#{ruby}"
      else
        if gemset
          ruby = fetch(:rvm_ruby_string_evaluated)
          run_rvm("rvm gemset export > #{File.join(rvm_gemset_path, "#{ruby}.gems")}", :with_ruby => ruby)
        end
      end
    end

  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rvm-capistrano-1.5.6 lib/rvm/capistrano/gemset_import_export.rb
rvm-capistrano-1.5.5 lib/rvm/capistrano/gemset_import_export.rb
rvm-capistrano-1.5.4 lib/rvm/capistrano/gemset_import_export.rb
rvm-capistrano-1.5.3 lib/rvm/capistrano/gemset_import_export.rb
rvm-capistrano-1.5.2 lib/rvm/capistrano/gemset_import_export.rb
rvm-capistrano-1.5.1 lib/rvm/capistrano/gemset_import_export.rb
rvm-capistrano-1.5.0 lib/rvm/capistrano/gemset_import_export.rb
rvm-capistrano-1.5.0.rc1 lib/rvm/capistrano/gemset_import_export.rb