Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Culled a lot of packaging code.

  • Loading branch information...
commit c71601d75400d81454ac73b19ca42350c8938d90 1 parent 6d80635
@Spooner authored
Showing with 6 additions and 198 deletions.
  1. +6 −83 Rakefile
  2. +0 −115 build/rake_osx_package.rb
View
89 Rakefile
@@ -1,104 +1,27 @@
-Config = RbConfig if defined? RbConfig
+Config = RbConfig if RUBY_VERSION > '1.9.2' # Hack to allow stuff that isn't compatible with 1.9.3 to work.
require 'rake/clean'
-require 'redcloth'
APP = "zed_and_ginger"
+APP_READABLE = "Zed and Ginger"
require_relative "lib/version"
-
RELEASE_VERSION = ZedAndGinger::VERSION
-SOURCE_FOLDERS = %w[bin lib media build]
-
-EXECUTABLE = "#{APP}.exe"
-
-SOURCE_FOLDER_FILES = FileList[SOURCE_FOLDERS.map {|f| "#{f}/**/*"}]
-EXTRA_SOURCE_FILES = %w[.gitignore Rakefile README.textile Gemfile Gemfile.lock]
-RELEASE_FOLDER = 'pkg'
-RELEASE_FOLDER_BASE = File.join(RELEASE_FOLDER, "#{APP}_v#{RELEASE_VERSION.gsub(/\./, '_')}")
-RELEASE_FOLDER_WIN32 = "#{RELEASE_FOLDER_BASE}_WIN32"
-RELEASE_FOLDER_SOURCE = "#{RELEASE_FOLDER_BASE}_SOURCE"
+OSX_GEMS = [] # Ray can't be released as OSX.
-README_TEXTILE = "README.textile"
-README_HTML = "README.html"
+# My scripts which help me package games.
+require_relative "../release_packager/lib/release_packager"
-CHANGELOG = "CHANGELOG.txt"
CLEAN.include("*.log")
-CLOBBER.include("doc/**/*", EXECUTABLE, RELEASE_FOLDER, README_HTML)
+CLOBBER.include("doc/**/*")
-require_relative 'build/rake_osx_package'
desc "Generate Yard docs."
task :yard do
system "yard doc lib"
end
-# Making a release.
-file EXECUTABLE => :ocra
-
-desc "Use Ocra to generate #{EXECUTABLE} (Windows only) v#{RELEASE_VERSION}"
-task ocra: SOURCE_FOLDER_FILES do
- system "ocra bin/#{APP}.rbw --windows --icon media/icon.ico lib/**/*.* media/**/*.* config/**/*.* bin/**/*.*"
-end
-
-# Making a release.
-
-def compress(package, folder, option = '')
- puts "Compressing #{package}"
- rm package if File.exist? package
- cd 'pkg'
- puts File.basename(package)
- puts %x[7z a #{option} "#{File.basename(package)}" "#{File.basename(folder)}"]
- cd '..'
-end
-
-desc "Create release packages v#{RELEASE_VERSION} (Not OSX)"
-task release: [:release_source, :release_win32]
-
-desc "Create source releases v#{RELEASE_VERSION}"
-task release_source: [:source_zip, :source_7z]
-
-desc "Create win32 releases v#{RELEASE_VERSION}"
-task release_win32: [:win32_zip] # No point making a 7z, since it is same size.
-
-# Create folders for release.
-file RELEASE_FOLDER_WIN32 => [EXECUTABLE, README_HTML] do
- mkdir_p RELEASE_FOLDER_WIN32
- cp EXECUTABLE, RELEASE_FOLDER_WIN32
- cp CHANGELOG, RELEASE_FOLDER_WIN32
- cp README_HTML, RELEASE_FOLDER_WIN32
-end
-
-file RELEASE_FOLDER_SOURCE => README_HTML do
- mkdir_p RELEASE_FOLDER_SOURCE
- SOURCE_FOLDERS.each {|f| cp_r f, RELEASE_FOLDER_SOURCE }
- cp EXTRA_SOURCE_FILES, RELEASE_FOLDER_SOURCE
- cp CHANGELOG, RELEASE_FOLDER_SOURCE
- cp README_HTML, RELEASE_FOLDER_SOURCE
-end
-
-{ "7z" => '', :zip => '-tzip' }.each_pair do |compression, option|
- { source: RELEASE_FOLDER_SOURCE, win32: RELEASE_FOLDER_WIN32}.each_pair do |name, folder|
- package = "#{folder}.#{compression}"
- desc "Create #{package}"
- task :"#{name}_#{compression}" => package
- file package => folder do
- compress(package, folder, option)
- end
- end
-end
-
-# Generate a friendly readme
-file README_HTML => :readme
-desc "Convert readme to HTML"
-task :readme => README_TEXTILE do
- puts "Converting readme to HTML"
- File.open(README_HTML, "w") do |file|
- file.write RedCloth.new(File.read(README_TEXTILE)).to_html
- end
-end
-
desc "Run all our tests"
task :test do
begin
View
115 build/rake_osx_package.rb
@@ -1,115 +0,0 @@
-# Rake file to make the OS X release
-#
-# APP, RELEASE_VERSION and RELEASE_FOLDER_BASE must be defined elsewhere.
-
-GAME_URL = "com.github.spooner.#{APP}"
-OSX_APP = "#{APP.capitalize}.app"
-
-OSX_GEMS = %w[chingu]
-
-RELEASE_FOLDER_OSX = "#{RELEASE_FOLDER_BASE}_OSX_10_6"
-
-OSX_BUILD_DIR = File.join(File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))), "gosu_wrappers")
-BASE_OSX_APP = File.join(OSX_BUILD_DIR, "RubyGosu App.app")
-TMP_OSX_PKG_DIR = File.join(OSX_BUILD_DIR, File.basename(RELEASE_FOLDER_OSX))
-TMP_OSX_APP = File.join(TMP_OSX_PKG_DIR, OSX_APP)
-TMP_OSX_SOURCE_DIR = File.join(TMP_OSX_APP, "Contents", "Resources", APP) # Where I copy my game source.
-TMP_OSX_GEM_DIR = File.join(TMP_OSX_APP, "Contents", "Resources", 'lib') # Gem location.
-TMP_OSX_INFO_FILE = File.join(TMP_OSX_APP, "Contents", "Info.plist")
-TMP_OSX_MAIN_FILE = File.join(TMP_OSX_APP, "Contents", "Resources", "Main.rb")
-TMP_OSX_RUBY = File.join(TMP_OSX_APP, "Contents", "MacOS", "RubyGosu App")
-
-RUN_FILE_OLD = File.join(TMP_OSX_SOURCE_DIR, "bin/#{APP}.rbw")
-RUN_FILE_NEW = RUN_FILE_OLD.sub('.rbw', '.rb')
-
-desc "Create OS X releases v#{RELEASE_VERSION}"
-task release_osx: [:osx_app]
-
-# Create folders for release.
-file RELEASE_FOLDER_OSX => [OSX_APP, README_HTML] do
- mkdir_p RELEASE_FOLDER_OSX
- cp OSX_APP, RELEASE_FOLDER_OSX
- cp CHANGELOG, RELEASE_FOLDER_OSX
- cp README_HTML, RELEASE_FOLDER_OSX
-end
-
-file OSX_APP => :osx_app
-
-desc "Generate #{OSX_APP} (OS X 10.6) v#{RELEASE_VERSION}"
-task osx_app: :readme do
- puts "--- Copying App"
- mkdir_p TMP_OSX_PKG_DIR
-
- cp_r BASE_OSX_APP, TMP_OSX_APP
-
- # Copy my source files.
- puts "--- Copying source"
- mkdir_p TMP_OSX_SOURCE_DIR
- SOURCE_FOLDERS.each {|f| cp_r f, TMP_OSX_SOURCE_DIR }
- cp README_HTML, TMP_OSX_PKG_DIR
- cp CHANGELOG, TMP_OSX_PKG_DIR
-
-
- # Copy my gems.
- puts "--- Copying gems"
- OSX_GEMS.each do |gem|
- gem_path = File.join(%x[bundle show #{gem}].chomp, 'lib', '.')
- cp_r gem_path, TMP_OSX_GEM_DIR
-
- # Some gems use files outside of /lib, which is not supported by the .app!
- extra_folders = case gem
- when 'fidgit'
- %w[config media]
- when 'r18n-core'
- %w[base locales]
- else
- []
- end
-
- extra_folders.each do |folder|
- cp_r File.expand_path(File.join(gem_path, '..', folder)), File.dirname(TMP_OSX_GEM_DIR)
- end
- end
-
- # Something for the .app to run -> just a little redirection file.
- puts "--- Creating Main.rb"
- mv RUN_FILE_OLD, RUN_FILE_NEW
- File.open(TMP_OSX_MAIN_FILE, "w") do |file|
- file.puts <<END_TEXT
-OSX_EXECUTABLE_FOLDER = File.dirname(File.dirname(File.dirname(__FILE__)))
-require_relative File.join('#{APP}', 'bin', '#{File.basename(RUN_FILE_NEW)}')
-END_TEXT
- end
-
- # Edit the info file to be specific for my game.
- puts "--- Editing init"
- info = File.read(TMP_OSX_INFO_FILE)
- info.sub!('org.libgosu.UntitledGame', GAME_URL)
- File.open(TMP_OSX_INFO_FILE, "w") {|f| f.puts info }
-
- # Ensure execute access to the startup file.
- puts "--- Setting execution privilege App"
- chmod 0755, TMP_OSX_RUBY
-
- puts "--- Compressing"
- old_dir = pwd
- cd OSX_BUILD_DIR
- package_dir = TMP_OSX_PKG_DIR.sub(OSX_BUILD_DIR, '').sub(/^\//, '')
-
- tar_package = "#{package_dir}.tar.bz2"
- system "tar -jcvf #{tar_package} #{package_dir}"
-
- seven_z_package = "#{package_dir}.7z"
- system "7z a #{seven_z_package} #{package_dir}"
-
- zip_package = "#{package_dir}.zip"
- system "7z a -tzip #{zip_package} #{package_dir}"
-
- cd old_dir
-
- mkdir_p RELEASE_FOLDER
-
- mv File.join(OSX_BUILD_DIR, tar_package), RELEASE_FOLDER
- mv File.join(OSX_BUILD_DIR, seven_z_package), RELEASE_FOLDER
- mv File.join(OSX_BUILD_DIR, zip_package), RELEASE_FOLDER
-end
Please sign in to comment.
Something went wrong with that request. Please try again.