swt 0.5-java → 0.6-java

Sign up to get free protection for your applications and to get access to all the features.
data/bin/swt_cucumber ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'java'
5
+ $:.unshift(File.expand_path("../../lib", __FILE__))
6
+ require 'swt'
7
+
8
+ runner = Swt::CucumberRunner.new
9
+ runner.run_features(ARGV)
10
+ Swt.event_loop { runner.tests_finished? }
11
+
@@ -9,7 +9,7 @@ module Cucumber
9
9
  def invoke_with_swt(step_mother, options)
10
10
  block = Swt::RRunnable.new { invoke_without_swt(step_mother, options) }
11
11
 
12
- Redcar::ApplicationSWT.display.syncExec(block)
12
+ Swt.sync_exec(&block)
13
13
  sleep ENV["SLOW_CUKES"].to_f if ENV["SLOW_CUKES"]
14
14
  sleep(Cucumber::Ast::StepInvocation.wait_time || 0)
15
15
  Cucumber::Ast::StepInvocation.wait_time = nil
@@ -2,6 +2,10 @@ module Swt
2
2
  class CucumberRunner
3
3
  START_DELAY = 1
4
4
 
5
+ def tests_finished?
6
+ @tests_finished
7
+ end
8
+
5
9
  def run_features(args)
6
10
  require "cucumber/cli/main"
7
11
  require "cucumber"
@@ -12,7 +16,7 @@ module Swt
12
16
  sleep START_DELAY
13
17
  main = Cucumber::Cli::Main.new(args)
14
18
  main.execute!
15
- Redcar.app.quit
19
+ @tests_finished = true
16
20
  rescue Object => e
17
21
  puts e.message
18
22
  puts e.backtrace
data/lib/swt/minimal.rb CHANGED
@@ -77,4 +77,31 @@ module Swt
77
77
  end
78
78
 
79
79
  display # must be created before we import the Clipboard class.
80
+
81
+ def self.event_loop(&stop_condition)
82
+ stop_conditions << stop_condition
83
+ run_event_loop
84
+ end
85
+
86
+ def self.stop_conditions
87
+ @stop_conditions ||= []
88
+ end
89
+
90
+ def self.event_loop_running?
91
+ @event_loop_running
92
+ end
93
+
94
+ def self.run_event_loop
95
+ return if event_loop_running?
96
+ @event_loop_running = true
97
+ display = Swt::Widgets::Display.current
98
+ until stop_conditions.any? {|c| c[] }
99
+ display.sleep unless display.read_and_dispatch
100
+ end
101
+ display.dispose
102
+ true
103
+ end
80
104
  end
105
+
106
+
107
+
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: swt
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: "0.5"
5
+ version: "0.6"
6
6
  platform: java
7
7
  authors:
8
8
  - Daniel Lucraft
@@ -17,13 +17,14 @@ dependencies: []
17
17
  description: Includes SWT jars and imports SWT classes into Ruby.
18
18
  email:
19
19
  - dan@fluentradical.com
20
- executables: []
21
-
20
+ executables:
21
+ - swt_cucumber
22
22
  extensions: []
23
23
 
24
24
  extra_rdoc_files: []
25
25
 
26
26
  files:
27
+ - bin/swt_cucumber
27
28
  - lib/swt.rb
28
29
  - lib/swt/cucumber_patches.rb
29
30
  - lib/swt/cucumber_runner.rb