Class: RubyPackager::Distributors::SourceForge

Inherits:
Object
  • Object
show all
Includes:
Tools
Defined in:
lib/RubyPackager/Distributors/SourceForge.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
27
28
29
30
31
32
33
34
35
36
# File 'lib/RubyPackager/Distributors/SourceForge.rb', line 15

def check_tools
  rSuccess = true

  begin
    require 'net/ssh'
  rescue Exception
    log_err 'Missing net/ssh library. gem install net-ssh.'
    rSuccess = false
  end
  begin
    require 'net/scp'
  rescue Exception
    log_err 'Missing net/scp library. gem install net-scp.'
    rSuccess = false
  end
  if (!system('zip -v'))
    log_err 'Missing zip command-line utility.'
    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 ?



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/RubyPackager/Distributors/SourceForge.rb', line 48

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

  @InstallerDir, @ReleaseVersion, @ReleaseInfo, @GeneratedFileNames, @DocDir = iInstallerDir, iReleaseVersion, iReleaseInfo, iGeneratedFileNames, iDocDir
  @SFLogin = "#{@ReleaseInfo.sf_info[:login]},#{@ReleaseInfo.sf_info[:project_unix_name]}"
  @SFReleaseDir = "/home/frs/project/#{@ReleaseInfo.sf_info[:project_unix_name][0..0]}/#{@ReleaseInfo.sf_info[:project_unix_name][0..1]}/#{@ReleaseInfo.sf_info[:project_unix_name]}/#{@ReleaseVersion}"
  set_ssh_options('shell.sourceforge.net', @SFLogin, @ReleaseInfo.sf_info)
  ssh('create')
  createReleaseOnSFNET
  # It is possible that the RDoc has not been generated
  if (File.exists?("#{@DocDir}/rdoc"))
    uploadRDocOnSFNET
  end
  uploadFilesOnSFNET

  return rSuccess
end