osaka 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc ADDED
@@ -0,0 +1,85 @@
1
+
2
+ Osaka - apple OSA script Kontrolling the Application (OSAKA :P)
3
+ This is a Ruby 1.9 library for automating work via GUI on Mac (using OSA/Applescript)
4
+
5
+ = How to install
6
+
7
+ $ sudo gem install osaka
8
+
9
+ = How to use
10
+
11
+ Examples:
12
+
13
+ #### Example: Controlling Keynote
14
+
15
+ require 'osaka'
16
+
17
+ # Create a new application-specific wrapper
18
+ app = Osaka::Keynote.new
19
+
20
+ # Open a keynote file
21
+ app.open "presentation.key"
22
+
23
+ # Show a print dialog
24
+ dialog = app.print_dialog
25
+
26
+ # Save as PDF
27
+ dialog.save_as_pdf("presentation.pdf")
28
+
29
+ # Quit
30
+ app.quit
31
+
32
+ #### Example: Controlling Numbers
33
+
34
+ require 'osaka'
35
+
36
+ # Create a new application-specific wrapper
37
+ app = Osaka::Numbers.new
38
+
39
+ # Open a file
40
+ app.open "Numbers.numbers"
41
+
42
+ # Change a field
43
+ app.fill_cell(1, 4, "Hello World!")
44
+
45
+ # Save and quit
46
+ app.save
47
+ app.quit
48
+
49
+ #### Example: Using the Application Wrapper (lower-level)
50
+
51
+ require 'osaka'
52
+
53
+ # Create an application wrapper
54
+ calculator = Osaka::ApplicationWrapper.new("Calculator")
55
+
56
+ # Start the application
57
+ calculator.activate
58
+
59
+ # Control the calculator
60
+ calculator.click('button "1" of group 2 of window "Calculator"')
61
+ calculator.click('button "+" of group 2 of window "Calculator"')
62
+ calculator.click('button "4" of group 2 of window "Calculator"')
63
+ calculator.click('button "=" of group 2 of window "Calculator"')
64
+
65
+ calculator.quit
66
+
67
+ API document: To be done.
68
+
69
+ = Source code
70
+
71
+ https://github.com/basvodde/osaka
72
+
73
+ The license of this source is "BSD Licence"
74
+
75
+ = Note on current version (0.1.1)
76
+
77
+ Currently the functionality is fairly limited. It can be easily expanded by writing more application wrappers with convenient interfaces for controlling specific application. If you write some for common application or extend the ones, please submit a merge request :)
78
+
79
+ = Supported environments
80
+
81
+ 1.9.x.
82
+
83
+ = Author
84
+
85
+ Bas Vodde - basv AT odd-e.com
data/lib/osaka/keynote.rb CHANGED
@@ -12,7 +12,7 @@ module Osaka
12
12
  end
13
13
 
14
14
  def create_print_dialog(location)
15
- KeynotePrintDialog.new(location, app)
15
+ KeynotePrintDialog.new(location, @wrapper)
16
16
  end
17
17
  end
18
18
  end
data/lib/osaka/numbers.rb CHANGED
@@ -6,7 +6,7 @@ module Osaka
6
6
  super "Numbers"
7
7
  end
8
8
 
9
- def fill_cell(row, column, value)
9
+ def fill_cell(column, row, value)
10
10
  @wrapper.tell("tell document 1; tell sheet 1; tell table 1; set value of cell #{column} of row #{row} to \"#{value}\"; end tell; end tell; end tell")
11
11
  end
12
12
  end
@@ -40,7 +40,7 @@ module Osaka
40
40
  end
41
41
 
42
42
  def create_save_dialog(location, app)
43
- GenericSaveDialog.new(location, app)
43
+ TypicalSaveDialog.new(location, app)
44
44
  end
45
45
 
46
46
  def save_as_pdf(filename)
data/lib/osaka/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Osaka
3
- VERSION = "0.1.0"
4
- end
3
+ VERSION = "0.1.1"
4
+ end
data/spec/numbers_spec.rb CHANGED
@@ -10,7 +10,7 @@ describe "Osaka::Numbers" do
10
10
  end
11
11
 
12
12
  it "Should be able to fill in data in cells" do
13
- subject.wrapper.should_receive(:tell).with('tell document 1; tell sheet 1; tell table 1; set value of cell 2 of row 1 to "30"; end tell; end tell; end tell')
13
+ subject.wrapper.should_receive(:tell).with('tell document 1; tell sheet 1; tell table 1; set value of cell 1 of row 2 to "30"; end tell; end tell; end tell')
14
14
  subject.fill_cell(1, 2, "30")
15
15
  end
16
16
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: osaka
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.0
5
+ version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Bas Vodde
@@ -44,7 +44,7 @@ extensions: []
44
44
  extra_rdoc_files: []
45
45
 
46
46
  files:
47
- - README
47
+ - README.rdoc
48
48
  - Rakefile
49
49
  - lib/osaka.rb
50
50
  - lib/osaka/applicationwrapper.rb
data/README DELETED
File without changes