Skip to content

Commit

Permalink
Update version
Browse files Browse the repository at this point in the history
  • Loading branch information
alem0lars committed May 30, 2016
1 parent b8c4546 commit a4d8fdb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
45 changes: 29 additions & 16 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -175,24 +175,30 @@ end
# ├────────────────────────────────────────────────────────────────────────────┤
# ├→ Task `package` ───────────────────────────────────────────────────────────┤

def runtimes_names
def runtimes_info
build_cfg = load_build_cfg
archs = build_cfg["traveling_ruby"]["archs"]
traveling_vers = build_cfg["traveling_ruby"]["vers"]
ruby_vers = build_cfg["traveling_ruby"]["ruby_vers"]

runtimes = []
runtimes_info = []
archs.each do |os, archs|
archs = [nil] if archs.nil?
archs.each do |arch|
runtimes << runtime_name(traveling_vers, ruby_vers, os, arch)
name = runtime_name(traveling_vers, ruby_vers, os, arch)
path = TMP_PATH.join("#{name}.tar.gz")
runtimes_info << {
traveling_vers: traveling_vers,
ruby_vers: ruby_vers,
os: os,
arch: arch,
name: name,
path: path,
rel_path: path.relative_path_from(ROOT_PATH)
}
end
end
runtimes
end

def runtimes_paths
runtimes_names.map{|runtime_name| TMP_PATH.join("#{runtime_name}.tar.gz")}
runtimes_info
end

def runtime_name(traveling_vers, ruby_vers, os, arch)
Expand All @@ -215,7 +221,7 @@ def download_runtime(runtime_name, dst_path)
end
end

def create_package(runtime, runtime_path)
def create_package(runtime, runtime_path, dst_path)
package_path = TMP_PATH.join("#{runtime}_tmp")
package_lib_path = package_path.join("lib")
package_app_path = package_lib_path.join("app")
Expand All @@ -226,7 +232,6 @@ def create_package(runtime, runtime_path)
gemfile_path = ROOT_PATH.join("Gemfile")
gemfile_lock_path = ROOT_PATH.join("Gemfile.lock")
tmp_vendor_path = TMP_PATH.join("vendor")
dst_path = PKG_PATH.join(runtime_path.basename)

# Remove previous package.
package_path.rmtree if package_path.exist?
Expand Down Expand Up @@ -294,17 +299,25 @@ def create_package(runtime, runtime_path)
end

# Download archives
runtimes_names.zip(runtimes_paths).each do |runtime_name, runtime_path|
file runtime_path.relative_path_from(ROOT_PATH) do
download_runtime(runtime_name, runtime_path)
runtimes_info.each do |runtime_info|
file runtime_info[:rel_path] do
download_runtime(runtime_info[:name], runtime_info[:path])
end
end

task :package => [:build] + runtimes_paths.map{|rp| rp.relative_path_from(ROOT_PATH)} do
task :package => [:build] + runtimes_info.map{|r_i| r_i[:rel_path]} do
info("Packaging started")

runtimes_names.zip(runtimes_paths).each do |runtime_name, runtime_path|
create_package(runtime_name, runtime_path)
build_cfg = load_build_cfg

runtimes_info.each do |runtime_info|
dst_package_path = PKG_PATH.join([
"fizzy-v#{build_cfg["version"]}",
"ruby-v#{runtime_info[:ruby_vers]}",
runtime_info[:os],
runtime_info[:arch]
].compact.join("_") + ".tar.gz")
create_package(runtime_info[:name], runtime_info[:path], dst_package_path)
end

info("Packaging successfully completed", success: true)
Expand Down
2 changes: 1 addition & 1 deletion build-cfg.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Current Fizzy version.
version: 2.1.0
version: 2.2.0

traveling_ruby:
vers: 20150715
Expand Down

0 comments on commit a4d8fdb

Please sign in to comment.