redstorm 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md CHANGED
@@ -52,3 +52,8 @@
52
52
  - gem path is always in target/gems for both local and cluster context
53
53
  - temp fix for slf4j dependencies conflict (issue #36)
54
54
  - Storm 0.7.4
55
+
56
+ # 0.6.2, 07-10-2012
57
+ - issue #39, spout on_receive block will not be evaluated if :emit => false
58
+ - issue #40, bolt fail method missing
59
+ - integration tests support
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # RedStorm v0.6.1 - JRuby on Storm
1
+ # RedStorm v0.6.2 - JRuby on Storm
2
2
 
3
3
  [![build status](https://secure.travis-ci.org/colinsurprenant/redstorm.png)](http://travis-ci.org/colinsurprenant/redstorm)
4
4
 
@@ -58,7 +58,7 @@ $ redstorm local|cluster [--1.8|--1.9] ...
58
58
 
59
59
  ``` ruby
60
60
  source :rubygems
61
- gem "redstorm", "~> 0.6.1"
61
+ gem "redstorm", "~> 0.6.2"
62
62
  ```
63
63
 
64
64
  ## Usage overview
data/bin/redstorm CHANGED
@@ -5,11 +5,11 @@ require 'rake'
5
5
 
6
6
  begin
7
7
  # will work from gem, since lib dir is in gem require_paths
8
- require 'red_storm'
8
+ require 'red_storm/application'
9
9
  rescue LoadError
10
10
  # will work within RedStorm dev project
11
11
  $:.unshift './lib'
12
- require 'red_storm'
12
+ require 'red_storm/application'
13
13
  end
14
14
 
15
- RedStorm::Application.new.run(ARGV.dup)
15
+ RedStorm::Application.run(ARGV.dup)
data/lib/red_storm.rb CHANGED
@@ -3,7 +3,6 @@ require 'rubygems'
3
3
  require 'red_storm/environment'
4
4
  require 'red_storm/version'
5
5
  require 'red_storm/configuration'
6
- require 'red_storm/application'
7
6
  require 'red_storm/simple_bolt'
8
7
  require 'red_storm/simple_spout'
9
8
  require 'red_storm/simple_topology'
@@ -1,10 +1,40 @@
1
+ require 'red_storm/version'
2
+ require 'red_storm/environment'
3
+
4
+ CWD = Dir.pwd
5
+ TARGET_DIR = "#{CWD}/target"
6
+ TARGET_LIB_DIR = "#{TARGET_DIR}/lib"
7
+ TARGET_SRC_DIR = "#{TARGET_DIR}/src"
8
+ TARGET_GEM_DIR = "#{TARGET_DIR}/gems/gems"
9
+ TARGET_SPECS_DIR = "#{TARGET_DIR}/gems/specifications"
10
+ TARGET_CLASSES_DIR = "#{TARGET_DIR}/classes"
11
+ TARGET_DEPENDENCY_DIR = "#{TARGET_DIR}/dependency"
12
+ TARGET_DEPENDENCY_UNPACKED_DIR = "#{TARGET_DIR}/dependency-unpacked"
13
+ TARGET_CLUSTER_JAR = "#{TARGET_DIR}/cluster-topology.jar"
14
+
15
+ REDSTORM_JAVA_SRC_DIR = "#{RedStorm::REDSTORM_HOME}/src/main"
16
+ REDSTORM_LIB_DIR = "#{RedStorm::REDSTORM_HOME}/lib"
17
+
18
+ SRC_EXAMPLES = "#{RedStorm::REDSTORM_HOME}/examples"
19
+ DST_EXAMPLES = "#{CWD}/examples"
20
+
21
+
1
22
  module RedStorm
2
23
 
3
24
  class Application
4
25
  TASKS_FILE = "#{RedStorm::REDSTORM_HOME}/lib/tasks/red_storm.rake"
5
26
 
6
- def usage
7
- puts("usage: redstorm install")
27
+ def self.local_storm_command(class_file, ruby_mode = nil)
28
+ "java -Djruby.compat.version=#{RedStorm.jruby_mode_token(ruby_mode)} -cp \"#{TARGET_CLASSES_DIR}:#{TARGET_DEPENDENCY_DIR}/*\" redstorm.TopologyLauncher local #{class_file}"
29
+ end
30
+
31
+ def self.cluster_storm_command(class_file, ruby_mode = nil)
32
+ "storm jar #{TARGET_CLUSTER_JAR} -Djruby.compat.version=#{RedStorm.jruby_mode_token(ruby_mode)} redstorm.TopologyLauncher cluster #{class_file}"
33
+ end
34
+
35
+ def self.usage
36
+ puts("usage: redstorm version")
37
+ puts(" redstorm install")
8
38
  puts(" redstorm deps")
9
39
  puts(" redstorm build")
10
40
  puts(" redstorm examples")
@@ -15,9 +45,12 @@ module RedStorm
15
45
  exit(1)
16
46
  end
17
47
 
18
- def run(args)
48
+ def self.run(args)
19
49
  if args.size > 0
20
- if ["install", "examples", "jar", "bundle", "deps", "build"].include?(args[0])
50
+ if args[0] == "version"
51
+ puts("RedStorm v#{VERSION}")
52
+ exit
53
+ elsif ["install", "examples", "jar", "bundle", "deps", "build"].include?(args[0])
21
54
  load(TASKS_FILE)
22
55
  Rake::Task[args.shift].invoke(args.join(":"))
23
56
  exit
@@ -53,10 +53,15 @@ module RedStorm
53
53
  @collector.ack(tuple)
54
54
  end
55
55
 
56
+ def fail(tuple)
57
+ @collector.fail(tuple)
58
+ end
59
+
56
60
  # Bolt proxy interface
57
61
 
58
62
  def execute(tuple)
59
- if (output = instance_exec(tuple, &self.class.on_receive_block)) && self.class.emit?
63
+ output = instance_exec(tuple, &self.class.on_receive_block)
64
+ if output && self.class.emit?
60
65
  values_list = !output.is_a?(Array) ? [[output]] : !output.first.is_a?(Array) ? [output] : output
61
66
  values_list.each{|values| self.class.anchor? ? anchored_emit(tuple, *values) : unanchored_emit(*values)}
62
67
  @collector.ack(tuple) if self.class.ack?
@@ -1,3 +1,3 @@
1
1
  module RedStorm
2
- VERSION = '0.6.1'
2
+ VERSION = '0.6.2'
3
3
  end
@@ -2,27 +2,11 @@ require 'ant'
2
2
  require 'jruby/jrubyc'
3
3
  require 'pompompom'
4
4
  require 'red_storm'
5
-
5
+ require 'red_storm/application'
6
+
6
7
  INSTALL_STORM_VERSION = "0.7.4"
7
8
  INSTALL_JRUBY_VERSION = "1.6.7.2"
8
9
 
9
- CWD = Dir.pwd
10
- TARGET_DIR = "#{CWD}/target"
11
- TARGET_LIB_DIR = "#{TARGET_DIR}/lib"
12
- TARGET_SRC_DIR = "#{TARGET_DIR}/src"
13
- TARGET_GEM_DIR = "#{TARGET_DIR}/gems/gems"
14
- TARGET_SPECS_DIR = "#{TARGET_DIR}/gems/specifications"
15
- TARGET_CLASSES_DIR = "#{TARGET_DIR}/classes"
16
- TARGET_DEPENDENCY_DIR = "#{TARGET_DIR}/dependency"
17
- TARGET_DEPENDENCY_UNPACKED_DIR = "#{TARGET_DIR}/dependency-unpacked"
18
- TARGET_CLUSTER_JAR = "#{TARGET_DIR}/cluster-topology.jar"
19
-
20
- REDSTORM_JAVA_SRC_DIR = "#{RedStorm::REDSTORM_HOME}/src/main"
21
- REDSTORM_LIB_DIR = "#{RedStorm::REDSTORM_HOME}/lib"
22
-
23
- SRC_EXAMPLES = "#{RedStorm::REDSTORM_HOME}/examples"
24
- DST_EXAMPLES = "#{CWD}/examples"
25
-
26
10
  module JavaZip
27
11
  import 'java.util.zip.ZipFile'
28
12
  end
@@ -33,13 +17,13 @@ task :launch, :env, :ruby_mode, :class_file do |t, args|
33
17
 
34
18
  command = case args[:env]
35
19
  when "local"
36
- "java -Djruby.compat.version=#{version_token} -cp \"#{TARGET_CLASSES_DIR}:#{TARGET_DEPENDENCY_DIR}/*\" redstorm.TopologyLauncher local #{args[:class_file]}"
20
+ RedStorm::Application.local_storm_command(args[:class_file], args[:ruby_mode])
37
21
  when "cluster"
38
22
  unless File.exist?(TARGET_CLUSTER_JAR)
39
23
  puts("cluster jar file #{TARGET_CLUSTER_JAR} not found. Generate it using $redstorm jar DIR1 [DIR2, ...]")
40
24
  exit(1)
41
25
  end
42
- "storm jar #{TARGET_CLUSTER_JAR} -Djruby.compat.version=#{version_token} redstorm.TopologyLauncher cluster #{args[:class_file]}"
26
+ RedStorm::Application.cluster_storm_command(args[:class_file], args[:ruby_mode])
43
27
  end
44
28
 
45
29
  puts("launching #{command}")
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: redstorm
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.6.1
5
+ version: 0.6.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Colin Surprenant
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-08 00:00:00.000000000 Z
12
+ date: 2012-07-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec