Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix maven clean and installation

  • Loading branch information...
commit e75fc17f5f295363b15c59d0682322131c2a5498 1 parent 3f0f1d7
Justin S. Leitgeb authored
48 Rakefile
View
@@ -1,26 +1,38 @@
task :clean do
- system "rm -rf ~/.m2/repository/{schedule, jruby}"
+ system "rm -rf ~/.m2/repository/com/steelcity"
+ system "rm -rf ~/.m2/repository/jruby"
+
+ system "rm -rf speaker_selector/lib/*"
+
+ system "cd speaker_selector && lein clean"
+
+ system "rm -rf build"
+ mkdir_p "build/jar"
end
-task :compile => :clean do
- system "jrubyc --javac steel_city/schedule.rb -t build/"
- system "jrubyc build/com/steelcity/schedule.java"
+task :compile_ruby do
+ system "cd steel_city && jrubyc --javac schedule.rb -t ../build"
- system "jar -cf lib/schedule.jar build/com/steelcity/schedule.class"
- system "cp \`which jruby | sed 's/bin\\/jruby//'\`/lib/jruby.jar lib/"
+ system "cd build && jar -cf jar/schedule.jar com/steelcity/Schedule.class"
+ system "cp \`which jruby | sed 's/bin\\/jruby//'\`/lib/jruby.jar build/jar/"
end
+task :compile => [:clean, :compile_ruby]
+
task :install => :compile do
- [['schedule', '0.0.0'], ['jruby', '1.6.7.2']].each do |(package, version)|
- cmd = <<-CMD
- mvn install:install-file \
- -DgroupId=#{package} \
- -DartifactId=#{package} \
- -Dversion=#{version} \
- -Dpackaging=jar \
- -Dfile=./lib/#{package}.jar
- CMD
-
- system cmd
- end
+ system <<-CMD
+ cd speaker_selector &&
+ mvn install:install-file -DgroupId=com.steelcity -DartifactId=schedule -Dversion=0.0.0 -Dpackaging=jar -Dfile=../build/jar/schedule.jar
+ CMD
+
+ system <<-CMD
+ cd speaker_selector &&
+ mvn install:install-file -DgroupId=jruby -DartifactId=jruby -Dversion=1.6.7.2 -Dpackaging=jar -Dfile=../build/jar/jruby.jar
+ CMD
+
+ system "cd speaker_selector && lein deps"
+end
+
+task :run => :install do
+ system "cd speaker_selector && lein repl"
end
0  build/.gitignore
View
No changes.
0  lib/.gitignore
View
No changes.
3  speaker_selector/project.clj
View
@@ -2,4 +2,5 @@
:description "Selects a top speaker from the schedule"
:dependencies [[org.clojure/clojure "1.3.0"]
[jruby "1.6.7.2"]
- [com.steelcity.schedule "0.0.0"]])
+ [com.steelcity/schedule "0.0.0"]]
+ :main speaker-selector.core)
87 steel_city/com/steelcity/Schedule.java
View
@@ -1,87 +0,0 @@
-package com.steelcity;
-
-import org.jruby.Ruby;
-import org.jruby.RubyObject;
-import org.jruby.javasupport.util.RuntimeHelpers;
-import org.jruby.runtime.builtin.IRubyObject;
-import org.jruby.javasupport.JavaUtil;
-import org.jruby.RubyClass;
-
-
-public class Schedule extends RubyObject {
- private static final Ruby __ruby__ = Ruby.getGlobalRuntime();
- private static final RubyClass __metaclass__;
-
- static {
- String source = new StringBuilder("# -*- coding: utf-8 -*-\n" +
- "require 'java'\n" +
- "java_package 'com.steelcity'\n" +
- "\n" +
- "class Schedule\n" +
- " attr_reader :day\n" +
- "\n" +
- " PRESENTERS = {\n" +
- " 'Friday' => ['Corey Haines', 'Josh Susser', 'Andrew Clay Shafer', \n" +
- " 'Steve Klabnik & Lindsey Bieda', 'Mattt Thompson', \n" +
- " 'Jeff Casimir'],\n" +
- " 'Saturday' => ['Aaron Patterson', 'Jennifer Payne', 'Jim Weirich', \n" +
- " 'Joe O’Brien'] \n" +
- " }\n" +
- "\n" +
- " def initialize(day)\n" +
- " raise \"Invalid day\" unless [\"Friday\", \"Saturday\"].include?(day)\n" +
- "\n" +
- " @day = day\n" +
- " end\n" +
- "\n" +
- " def speakers\n" +
- " PRESENTERS[day]\n" +
- " end\n" +
- "end\n" +
- "").toString();
- __ruby__.executeScript(source, "schedule.rb");
- RubyClass metaclass = __ruby__.getClass("Schedule");
- metaclass.setRubyStaticAllocator(Schedule.class);
- if (metaclass == null) throw new NoClassDefFoundError("Could not load Ruby class: Schedule");
- __metaclass__ = metaclass;
- }
-
- /**
- * Standard Ruby object constructor, for construction-from-Ruby purposes.
- * Generally not for user consumption.
- *
- * @param ruby The JRuby instance this object will belong to
- * @param metaclass The RubyClass representing the Ruby class of this object
- */
- private Schedule(Ruby ruby, RubyClass metaclass) {
- super(ruby, metaclass);
- }
-
- /**
- * A static method used by JRuby for allocating instances of this object
- * from Ruby. Generally not for user comsumption.
- *
- * @param ruby The JRuby instance this object will belong to
- * @param metaclass The RubyClass representing the Ruby class of this object
- */
- public static IRubyObject __allocate__(Ruby ruby, RubyClass metaClass) {
- return new Schedule(ruby, metaClass);
- }
-
-
- public Schedule(Object day) {
- this(__ruby__, __metaclass__);
- IRubyObject ruby_day = JavaUtil.convertJavaToRuby(__ruby__, day);
- RuntimeHelpers.invoke(__ruby__.getCurrentContext(), this, "initialize", ruby_day);
-
- }
-
-
- public Object speakers() {
-
- IRubyObject ruby_result = RuntimeHelpers.invoke(__ruby__.getCurrentContext(), this, "speakers");
- return (Object)ruby_result.toJava(Object.class);
-
- }
-
-}
8 steel_city/schedule.rb
View
@@ -6,11 +6,11 @@ class Schedule
attr_reader :day
PRESENTERS = {
- 'Friday' => ['Corey Haines', 'Josh Susser', 'Andrew Clay Shafer',
- 'Steve Klabnik & Lindsey Bieda', 'Mattt Thompson',
+ 'Friday' => ['Corey Haines', 'Josh Susser', 'Andrew Clay Shafer',
+ 'Steve Klabnik & Lindsey Bieda', 'Mattt Thompson',
'Jeff Casimir'],
- 'Saturday' => ['Aaron Patterson', 'Jennifer Payne', 'Jim Weirich',
- 'Joe O’Brien']
+ 'Saturday' => ['Aaron Patterson', 'Jennifer Payne', 'Jim Weirich',
+ "Joe O'Brien"]
}
def initialize(day)
Please sign in to comment.
Something went wrong with that request. Please try again.