Permalink
Browse files

Add -Xversion command

  • Loading branch information...
1 parent 1ce8c7d commit 0918010d94c220e7bfa6376041e25709c6b0354b @nicksieger nicksieger committed Apr 12, 2010
Showing with 51 additions and 20 deletions.
  1. +30 −15 Rakefile
  2. +1 −4 argnames.h
  3. +4 −0 argparser.cpp
  4. +1 −1 lib/jruby-launcher.rb
  5. +4 −0 spec/launcher_spec.rb
  6. +11 −0 version.h
View
@@ -6,22 +6,37 @@ Spec::Rake::SpecTask.new
task :default => :spec
-load './lib/jruby-launcher.rb'
+file './lib/jruby-launcher.rb' => 'version.h' do |t|
+ version = nil
+ IO.readlines(t.prerequisites.first).grep(/LAUNCHER_VERSION\s+"([^"]+)"/) {|l| version = $1 }
+ ruby = IO.readlines(t.name)
+ File.open(t.name, "wb") do |f|
+ ruby.each do |l|
+ f << l.sub(/VERSION\s*=\s*"([^"]*)"/, "VERSION = \"#{version}\"")
+ end
+ end
+end
-gemspec = Gem::Specification.new do |s|
- s.name = %q{jruby-launcher}
- s.platform = Gem::Platform.new("java")
- s.version = JRubyLauncher::VERSION
- s.authors = ["Nick Sieger", "Vladimir Sizikov"]
- s.date = Date.today.to_s
- s.description = %q{Builds and installs a native launcher for JRuby on your system}
- s.summary = %q{Native launcher for JRuby}
- s.email = ["nick@nicksieger.com", "vsizikov@gmail.com"]
- s.extensions = ["extconf.rb"]
- s.files = FileList["COPYING", "README.txt", "Makefile", "Rakefile", "*.c", "*.cpp", "*.h", "inc/*.*", "**/*.rb", "resources/*.*"]
- s.homepage = %q{http://jruby.org}
- s.rubyforge_project = %q{jruby-extras}
+task :gemspec => './lib/jruby-launcher.rb' do
+ @gemspec ||= Gem::Specification.new do |s|
+ load './lib/jruby-launcher.rb'
+ s.name = %q{jruby-launcher}
+ s.platform = Gem::Platform.new("java")
+ s.version = JRubyLauncher::VERSION
+ s.authors = ["Nick Sieger", "Vladimir Sizikov"]
+ s.date = Date.today.to_s
+ s.description = %q{Builds and installs a native launcher for JRuby on your system}
+ s.summary = %q{Native launcher for JRuby}
+ s.email = ["nick@nicksieger.com", "vsizikov@gmail.com"]
+ s.extensions = ["extconf.rb"]
+ s.files = FileList["COPYING", "README.txt", "Makefile", "Rakefile", "*.c", "*.cpp", "*.h", "inc/*.*", "**/*.rb", "resources/*.*"]
+ s.homepage = %q{http://jruby.org}
+ s.rubyforge_project = %q{jruby-extras}
+ end
end
-Rake::GemPackageTask.new(gemspec) do |pkg|
+task :package => :gemspec do
+ Rake::GemPackageTask.new(@gemspec) do |pkg|
+ end
+ Rake::Task['gem'].invoke
end
View
@@ -1,8 +1,5 @@
/*
- * File: argnames.h
- * Author: Holy
- *
- * Created on 4. prosinec 2008, 14:13
+ * Copyright 2009-2010 JRuby Team (www.jruby.org).
*/
#ifndef _ARGNAMES_H
View
@@ -8,6 +8,7 @@
#include "utilsfuncs.h"
#include "argparser.h"
#include "argnames.h"
+#include "version.h"
#ifndef WIN32
#include <sys/types.h>
@@ -319,6 +320,9 @@ bool ArgParser::parseArgs(int argc, char *argv[]) {
printToConsole(appendHelp.c_str());
}
return false;
+ } else if (strcmp(it->c_str(), "-Xversion") == 0) {
+ printToConsole("JRuby Launcher Version " JRUBY_LAUNCHER_VERSION "\n");
+ return false;
} else {
progArgs.push_back(*it);
}
View
@@ -1,3 +1,3 @@
module JRubyLauncher
- VERSION = "1.0"
+ VERSION = "1.0.1"
end
View
@@ -160,4 +160,8 @@
it "should include a bare : at the end of the classpath, to include PWD in the path" do
jruby_launcher_args("-Xnobootclasspath -e true").grep(/java\.class\.path/).first.should =~ /:$/
end
+
+ it "should print the version" do
+ jruby_launcher("-Xversion 2>&1").should =~ /Launcher Version [0-9.]+/
+ end
end
View
@@ -0,0 +1,11 @@
+/*
+ * Copyright 2009-2010 JRuby Team (www.jruby.org).
+ */
+
+
+#ifndef _VERSION_H_
+#define _VERSION_H_
+
+#define JRUBY_LAUNCHER_VERSION "1.0.1"
+
+#endif // ! _VERSION_H_

0 comments on commit 0918010

Please sign in to comment.