From ef99bb40de44d921c6711a7b65903f32cf76c33c Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Thu, 16 Jun 2016 21:55:39 -0400 Subject: [PATCH] version bump --- builtins.cpp | 5 ++--- make-version.rb | 31 +++++++++++++++++++++++++++++++ mpw-shell.cpp | 16 +++++++++------- pathnames.rl | 6 ++++++ phase2.rl | 2 ++ 5 files changed, 50 insertions(+), 10 deletions(-) create mode 100644 make-version.rb diff --git a/builtins.cpp b/builtins.cpp index d507453..17fd84a 100644 --- a/builtins.cpp +++ b/builtins.cpp @@ -19,8 +19,7 @@ //MAXPATHLEN #include -#define VERSION "0.1" - +#include "version.h" namespace ToolBox { std::string MacToUnix(const std::string path); @@ -847,6 +846,6 @@ int builtin_aboutbox(Environment &env, const std::vector &tokens, c "| |\n" "| (c) 2016 Kelvin W Sherlock |\n" "+--------------------------------------+\n" - ,VERSION); + , VERSION); return 0; } diff --git a/make-version.rb b/make-version.rb new file mode 100644 index 0000000..176c648 --- /dev/null +++ b/make-version.rb @@ -0,0 +1,31 @@ +#!/usr/bin/env ruby -w + +# make-version version + +def q(x) + # quote a string + '"' + x.gsub(/[\"]/, '\\\1' ) + '"' +end + +unless ARGV.length == 1 + puts("Usage: make-version version") + exit(1) +end + + +VERSION = ARGV[0] + +File.open("version.h", "w") {|f| + + f.puts("#ifndef __version_h__") + f.puts("#define __version_h__") + f.puts("#define VERSION #{q(VERSION)}") + f.puts("#define VERSION_DATE #{q(Time.new.ctime)}") + f.puts("#endif") +} + +ok = system(*%w(cmake --build build)) +ok = system(*%w(git add version.h)) +ok = system(*%w(git commit -m), "Bump Version: #{VERSION}") +ok = system(*%w(git tag), "r#{VERSION}") +exit 0 \ No newline at end of file diff --git a/mpw-shell.cpp b/mpw-shell.cpp index 574db95..c938e4c 100644 --- a/mpw-shell.cpp +++ b/mpw-shell.cpp @@ -31,6 +31,8 @@ #include #include +#include "version.h" + namespace fs = filesystem; @@ -59,9 +61,9 @@ fs::path root() { void init(Environment &env) { env.set("mpw", root()); - env.set("status", std::string("0")); - env.set("exit", std::string("1")); // terminate script on error. - env.set("echo", std::string("1")); + env.set("status", 0); + env.set("exit", 1); // terminate script on error. + env.set("echo", 1); } @@ -112,8 +114,8 @@ int read_make(phase1 &p1, phase2 &p2, Environment &env, const std::vector