Class: RubyPackager::Distributors::RubyGems

Inherits:
Object
  • Object
show all
Includes:
Tools
Defined in:
lib/RubyPackager/Distributors/RubyGems.rb

Instance Method Summary collapse

Methods included from Tools

#scp, #set_ssh_options, #ssh

Instance Method Details

#check_toolsObject

Check that we can use this distributor

Return
  • Boolean: Can we use this distributor ?



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/RubyPackager/Distributors/RubyGems.rb', line 15

def check_tools
  rSuccess = true

  begin
    rSuccess = system('gem push --help')
  rescue Exception
    log_err "Error while testing \"gem push\": #{$!}. Please update your RubyGems library."
    rSuccess = false
  end

  return rSuccess
end

#distribute(iInstallerDir, iReleaseVersion, iReleaseInfo, iGeneratedFileNames, iDocDir) ⇒ Object

Distribute what has been generated

Parameters
  • iInstallerDir (String): Directory where installers are generated

  • iReleaseVersion (String): Release version

  • iReleaseInfo (ReleaseInfo): Release info

  • iGeneratedFileNames (list<String>): List of files to distribute

  • iDocDir (String): Directory where the documentation has been generated

Return
  • Boolean: Success ?



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/RubyPackager/Distributors/RubyGems.rb', line 38

def distribute(iInstallerDir, iReleaseVersion, iReleaseInfo, iGeneratedFileNames, iDocDir)
  rSuccess = true

  # Take only the Gem files
  iGeneratedFileNames.each do |iFileName|
    if (iFileName[-4..-1].upcase == '.GEM')
      change_dir(iInstallerDir) do
        if ((!system("gem push #{iFileName}")) or
            (($? != nil) and
             ($? != 0)))
          rSuccess = false
          log_err "Error while pushing #{iFileName}: #{$?}."
        end
      end
    end
  end

  return rSuccess
end