Guest User

Untitled

a guest
Jan 24th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. desc "osx", "create distribution package for Mac OS X"
  2. method_option :dmg, :type => :boolean, :desc => "Create a DMG container instead of a zip file"
  3. def osx
  4. set_instance_variables
  5.  
  6. # clean staging folder
  7. clean
  8.  
  9. osx_copy_to_staging(@product)
  10.  
  11. # get version info directly from JSON in staging folder in case this was build off a different version
  12. version_filename = File.join(STAGING_FOLDER, @product, 'version.txt')
  13. version = read_version_string(version_filename)
  14. label = options[:label]
  15. label = read_version_label(@product, version_filename) unless label
  16. label = ".#{label}" if label
  17.  
  18. if options[:dmg]
  19. # create the dmg file
  20. source = File.join(STAGING_FOLDER, @product, "#{@product}.app".capitalize)
  21. destination = "#{PKG_FOLDER}/#{@product}.#{version}.osx#{label}.dmg"
  22. remove_file(destination)
  23. run("hdiutil create #{destination} -volname #{@product} -size 200m -fs HFS+ -srcfolder #{source}")
  24. else
  25. source = File.join(STAGING_FOLDER, @product)
  26. destination = "#{PKG_FOLDER}/#{@product}.#{version}.osx#{label}.zip"
  27. remove_file(destination)
  28. run "7za a -mx9 #{destination} #{source}"
  29. end
  30. end
Add Comment
Please, Sign In to add comment