Skip to content

Commit

Permalink
Tweak versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
BGMP committed Feb 20, 2022
1 parent bfdc888 commit 77693d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
7 changes: 4 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require_relative 'data'
task default: %i[clean package version]

task :clean do
File.delete("#{RVACars::NAME}.zip") if File.exist?("#{RVACars::NAME}.zip")
deleted_bytes = 0.0.to_f

# Remove unnecessary directories
Expand Down Expand Up @@ -55,9 +54,11 @@ end

task :package do
zipfile_name = "#{RVACars::NAME}.zip"
File.delete(zipfile_name) if File.exist?(zipfile_name)

puts "Packaging into #{zipfile_name} ..."

exclude = %w[. .. Gemfile Gemfile.lock Rakefile .git .gitignore .idea data.rb README.md]
exclude = %w[. .. Gemfile Gemfile.lock Rakefile .git .gitignore .idea data.rb README.md packages.json]
zf = ZipFileGenerator.new('.', zipfile_name, exclude)
zf.write

Expand All @@ -74,7 +75,7 @@ task version: [:package] do
"\t\"rva_cars\":",
"\t{",
"\t\t\"description\": \"#{RVACars::DESCRIPTION}\",",
"\t\t\"version\": #{RVACars::VERSION},",
"\t\t\"version\": \"#{RVACars::VERSION}\",",
"\t\t\"checksum\": \"#{checksum}\",",
"\t\t\"url\": \"#{RVACars::URL}\"",
"\t}",
Expand Down
7 changes: 5 additions & 2 deletions data.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# frozen_string_literal: true

TIME = Time.now
NOW = Time.now

module RVACars
NAME = 'rva_cars'
DESCRIPTION = "Re-Volt America's Cars Pack"
VERSION = "#{TIME.year.digits[0]}#{TIME.year.digits[1]}.#{TIME.month}#{TIME.day}"
YEAR = "#{NOW.year.digits[0]}#{NOW.year.digits[1]}"
MONTH = NOW.month < 10 ? "0#{NOW.month}" : NOW.month.to_s
DAY = NOW.day < 10 ? "0#{NOW.day}" : NOW.day.to_s
VERSION = "#{YEAR}.#{MONTH}#{DAY}"
URL = 'https://distribute.revolt-america.com/rva/rva_cars.zip'
end

0 comments on commit 77693d8

Please sign in to comment.