sikuli 0.2.4 → 0.3.0

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/README.md CHANGED
@@ -6,19 +6,24 @@ Sikuli Ruby
6
6
  Requirements
7
7
  ------------
8
8
 
9
- * JRuby `rvm install jruby`
9
+ * [JRuby](http://jruby.org/download) or `rvm install jruby`
10
10
  * [Sikuli X 1.0rc3](http://sikuli.org/)
11
- * OSX
12
11
 
13
12
  Compatibility
14
13
  -------------
15
- It's recommended to use JRuby ~> 1.6.0 and run it in 1.9 mode to get unicode characters working
16
- as expected.
14
+ It's recommended to use JRuby ~> 1.6.0 and run it in 1.9 mode to get unicode characters working as expected.
17
15
 
18
16
  ```
19
17
  export JRUBY_OPTS=--1.9
20
18
  ```
21
19
 
20
+ On Windows or Linux make sure to set SIKULI_HOME to the Sikuli installation directory and to add the Sikuli installation directory and Sikuli libs directory to the include path.
21
+
22
+ ```
23
+ export SIKULI_HOME="~/bin/Sikuli-X-1.0rc3/Sikuli-IDE/"
24
+ PATH="${PATH}:~/bin/Sikuli-X-1.0rc3/Sikuli-IDE/:~/bin/Sikuli-X-1.0rc3/Sikuli-IDE/libs/"
25
+ ```
26
+
22
27
  Installation
23
28
  ------------
24
29
 
@@ -39,7 +44,7 @@ Usage
39
44
  screen.click(10, 10) # should open your apple menu
40
45
 
41
46
  app = Sikuli::App.new("iPhone Simulator")
42
- app.window.click('ui_element.png') if app.window.exists?('ui_element.png')
47
+ app.window.click('ui_element.png') if app.window.find('ui_element.png')
43
48
 
44
49
  Running the test suite
45
50
  ----------------------
@@ -1,4 +1,5 @@
1
- require "sikuli/sikuli-script.jar"
1
+ require "sikuli/platform"
2
+ require Sikuli::Platform.sikuli_script_path
2
3
  require "sikuli/version"
3
4
 
4
5
  require "sikuli/app"
@@ -6,4 +7,4 @@ require "sikuli/exception"
6
7
  require "sikuli/region"
7
8
  require "sikuli/screen"
8
9
  require "sikuli/key_code"
9
- require "sikuli/config"
10
+ require "sikuli/config"
@@ -0,0 +1,34 @@
1
+ # Detect the platform we're running on so we can tweak behaviour
2
+ # in various places.
3
+
4
+ module Sikuli
5
+ class Platform
6
+
7
+ WINDOWS = RbConfig::CONFIG['host_os'] =~ /mswin/
8
+ LINUX = RbConfig::CONFIG['host_os'] =~ /linux/
9
+ MINGW = RbConfig::CONFIG['host_os'] =~ /mingw/
10
+ OS_X = RbConfig::CONFIG['host_os'] =~ /darwin/
11
+
12
+ def self.sikuli_script_path
13
+ if OS_X
14
+ path = "/Applications/Sikuli-IDE.app/Contents/Resources/Java/sikuli-script.jar"
15
+ else
16
+ raise LoadError, no_sikuli_home_err_msg if ENV['SIKULI_HOME'].nil?
17
+ path = "#{ENV['SIKULI_HOME']}/sikuli-script.jar"
18
+ end
19
+ unless File.exist?(path)
20
+ raise LoadError, "Failed to load '#{path}'\nIs Sikuli installed?"
21
+ end
22
+ path
23
+ end
24
+
25
+ private
26
+
27
+ def self.no_sikuli_home_err_msg
28
+ err = "Failed to load 'sikuli-script.jar' from the Sikuli home directory"
29
+ return err + "\nMake sure %SIKULI_HOME% is set!" if WINDOWS
30
+ return err + "\nMake sure $SIKULI_HOME is set!" if LINUX
31
+ err + "\nMake sure %SIKULI_HOME% or $SIKULI_HOME is set!"
32
+ end
33
+ end
34
+ end
@@ -1,3 +1,3 @@
1
1
  module Sikuli
2
- VERSION = "0.2.4"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: sikuli
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.4
5
+ version: 0.3.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Chas Lemley
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-05-09 00:00:00 Z
13
+ date: 2012-05-12 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -43,10 +43,10 @@ files:
43
43
  - lib/sikuli/config.rb
44
44
  - lib/sikuli/exception.rb
45
45
  - lib/sikuli/key_code.rb
46
+ - lib/sikuli/platform.rb
46
47
  - lib/sikuli/region.rb
47
48
  - lib/sikuli/screen.rb
48
49
  - lib/sikuli/searchable.rb
49
- - lib/sikuli/sikuli-script.jar
50
50
  - lib/sikuli/typeable.rb
51
51
  - lib/sikuli/version.rb
52
52
  - sikuli.gemspec
Binary file