Class: RedStorm::Application
- Inherits:
-
Object
- Object
- RedStorm::Application
- Defined in:
- lib/red_storm/application.rb
Constant Summary collapse
- TASKS_FILE =
"#{RedStorm::REDSTORM_HOME}/lib/tasks/red_storm.rake"
Class Method Summary collapse
- .cluster_storm_command(class_file, ruby_mode = nil) ⇒ Object
- .local_storm_command(class_file, ruby_mode = nil) ⇒ Object
- .run(args) ⇒ Object
- .subshell(command) ⇒ Object
- .usage ⇒ Object
Class Method Details
.cluster_storm_command(class_file, ruby_mode = nil) ⇒ Object
40 41 42 |
# File 'lib/red_storm/application.rb', line 40 def self.cluster_storm_command(class_file, ruby_mode = nil) "storm jar #{TARGET_CLUSTER_JAR} -Djruby.compat.version=#{RedStorm.jruby_mode_token(ruby_mode)} redstorm.TopologyLauncher cluster #{class_file}" end |
.local_storm_command(class_file, ruby_mode = nil) ⇒ Object
35 36 37 38 |
# File 'lib/red_storm/application.rb', line 35 def self.local_storm_command(class_file, ruby_mode = nil) src_dir = File.(File.dirname(class_file)) "java -Djruby.compat.version=#{RedStorm.jruby_mode_token(ruby_mode)} -cp \"#{TARGET_CLASSES_DIR}:#{TARGET_DEPENDENCY_DIR}/storm/default/*:#{TARGET_DEPENDENCY_DIR}/topology/default/*:#{src_dir}/\" redstorm.TopologyLauncher local #{class_file}" end |
.run(args) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/red_storm/application.rb', line 57 def self.run(args) if args.size > 0 if args[0] == "version" puts("RedStorm v#{VERSION}") exit elsif ["install", "examples", "jar", "bundle", "deps", "build"].include?(args[0]) load(TASKS_FILE) Rake::Task[args.shift].invoke(args.join(":")) exit elsif args.size >= 2 && ["local", "cluster"].include?(args[0]) env = args.delete_at(0) version = args.delete("--1.8") || args.delete("--1.9") if args.size == 1 file = args[0] load(TASKS_FILE) Rake::Task['launch'].invoke(env, version, file) exit end end end usage end |
.subshell(command) ⇒ Object
80 81 82 83 |
# File 'lib/red_storm/application.rb', line 80 def self.subshell(command) out = IO.popen(command, STDERR => STDOUT) {|io| io.read} [!!$?.success?, out] end |
.usage ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/red_storm/application.rb', line 44 def self.usage puts("usage: redstorm version") puts(" redstorm install") puts(" redstorm deps") puts(" redstorm build") puts(" redstorm examples") puts(" redstorm bundle [BUNDLER_GROUP]") puts(" redstorm jar DIR1, [DIR2, ...]") puts(" redstorm local [--1.8|--1.9] TOPOLOGY_CLASS_PATH") puts(" redstorm cluster [--1.8|--1.9] TOPOLOGY_CLASS_PATH") exit(1) end |