mac-robot 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: edc6e87fc1245c56f21333a503d6bf2c03d3e21f
4
+ data.tar.gz: 02170c5fe27e1c2d2211728863f9e56e8e4011f3
5
+ SHA512:
6
+ metadata.gz: f653d30947967f518872d69ed9954016db82db32eb07b0ff645d8f834e287f650bc44feccfd9303309f8f8a6cee72ede3bfb58520a1ece72b2ad864a268d4975
7
+ data.tar.gz: 1bd8092214b9d1828145ad9dbadf1d269f3d199ddf57838aef36f836ef03eef4bfa48694f6c6c4dc9e1a53a80171e78703536e1248953645fd39abce482a6147
data/Gemfile CHANGED
@@ -8,5 +8,5 @@ source "http://rubygems.org"
8
8
  group :development do
9
9
  gem "rspec", "~> 2.8.0"
10
10
  gem "bundler"
11
- gem "jeweler", "~> 1.8.3"
11
+ gem "jeweler", "~> 2.0.0"
12
12
  end
@@ -1,17 +1,50 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
+ addressable (2.3.5)
5
+ builder (3.2.2)
6
+ descendants_tracker (0.0.4)
7
+ thread_safe (~> 0.3, >= 0.3.1)
4
8
  diff-lcs (1.1.3)
9
+ faraday (0.8.9)
10
+ multipart-post (~> 1.2.0)
5
11
  git (1.2.5)
6
- jeweler (1.8.3)
7
- bundler (~> 1.0)
12
+ github_api (0.11.3)
13
+ addressable (~> 2.3)
14
+ descendants_tracker (~> 0.0.1)
15
+ faraday (~> 0.8, < 0.10)
16
+ hashie (>= 1.2)
17
+ multi_json (>= 1.7.5, < 2.0)
18
+ nokogiri (~> 1.6.0)
19
+ oauth2
20
+ hashie (2.0.5)
21
+ highline (1.6.21)
22
+ jeweler (2.0.1)
23
+ builder
24
+ bundler (>= 1.0)
8
25
  git (>= 1.2.5)
26
+ github_api
27
+ highline (>= 1.6.15)
28
+ nokogiri (>= 1.5.10)
9
29
  rake
10
30
  rdoc
11
- json (1.6.5)
12
- rake (0.9.2.2)
13
- rdoc (3.12)
14
- json (~> 1.4)
31
+ jwt (0.1.11)
32
+ multi_json (>= 1.5)
33
+ mini_portile (0.5.2)
34
+ multi_json (1.8.4)
35
+ multi_xml (0.5.5)
36
+ multipart-post (1.2.0)
37
+ nokogiri (1.6.1)
38
+ mini_portile (~> 0.5.0)
39
+ oauth2 (0.9.3)
40
+ faraday (>= 0.8, < 0.10)
41
+ jwt (~> 0.1.8)
42
+ multi_json (~> 1.3)
43
+ multi_xml (~> 0.5)
44
+ rack (~> 1.2)
45
+ rack (1.5.2)
46
+ rake (0.9.6)
47
+ rdoc (4.0.0)
15
48
  rspec (2.8.0)
16
49
  rspec-core (~> 2.8.0)
17
50
  rspec-expectations (~> 2.8.0)
@@ -20,11 +53,12 @@ GEM
20
53
  rspec-expectations (2.8.0)
21
54
  diff-lcs (~> 1.1.2)
22
55
  rspec-mocks (2.8.0)
56
+ thread_safe (0.3.3)
23
57
 
24
58
  PLATFORMS
25
59
  ruby
26
60
 
27
61
  DEPENDENCIES
28
62
  bundler
29
- jeweler (~> 1.8.3)
63
+ jeweler (~> 2.0.0)
30
64
  rspec (~> 2.8.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.5.0
@@ -47,6 +47,21 @@ static VALUE mUtil_get_display_pixel_size(int argc, VALUE *argv, VALUE self)
47
47
  return result;
48
48
  }
49
49
 
50
+ static VALUE mUtil_get_mouse_current_location(int argc, VALUE *argv, VALUE self)
51
+ {
52
+ VALUE result;
53
+ CGEventRef event;
54
+
55
+ event = CGEventCreate(NULL);
56
+ CGPoint loc = CGEventGetLocation(event);
57
+
58
+ result = rb_ary_new();
59
+ rb_ary_push(result, INT2NUM(loc.x));
60
+ rb_ary_push(result, INT2NUM(loc.y));
61
+
62
+ return result;
63
+ }
64
+
50
65
  void Init_util(void){
51
66
  VALUE rb_mMac, rb_cRobot, rb_mUtil;
52
67
 
@@ -55,4 +70,5 @@ void Init_util(void){
55
70
  rb_mUtil = rb_define_module_under(rb_cRobot, "Util");
56
71
  rb_define_singleton_method(rb_mUtil, "get_pixel_color", mUtil_get_pixel_color, -1);
57
72
  rb_define_singleton_method(rb_mUtil, "get_display_pixel_size", mUtil_get_display_pixel_size, -1);
73
+ rb_define_singleton_method(rb_mUtil, "get_mouse_current_location", mUtil_get_mouse_current_location, -1);
58
74
  }
@@ -17,6 +17,7 @@ module Mac
17
17
  def initialize
18
18
  @x = 0
19
19
  @y = 0
20
+
20
21
  @state = :mouse_up
21
22
  @dispatcher = EventDispatcher.new
22
23
  end
@@ -44,6 +45,11 @@ module Mac
44
45
 
45
46
  mouse_event(:left, :mouse_drag)
46
47
  end
48
+
49
+ def mouse_current_location
50
+ loc = Util.get_mouse_current_location
51
+ Struct.new(:x, :y).new(*loc)
52
+ end
47
53
 
48
54
  def key_press(keycode)
49
55
  keyboard_event(keycode, 1)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "mac-robot"
8
- s.version = "0.4.1"
8
+ s.version = "0.5.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["youpy"]
12
- s.date = "2014-03-04"
12
+ s.date = "2014-04-10"
13
13
  s.description = "A Library to Automate User Interactions"
14
14
  s.email = "youpy@buycheapviagraonlinenow.com"
15
15
  s.extensions = ["ext/event_dispatcher/extconf.rb", "ext/util/extconf.rb"]
@@ -41,25 +41,25 @@ Gem::Specification.new do |s|
41
41
  s.homepage = "http://github.com/youpy/mac-robot"
42
42
  s.licenses = ["MIT"]
43
43
  s.require_paths = ["lib"]
44
- s.rubygems_version = "1.8.24"
44
+ s.rubygems_version = "2.0.14"
45
45
  s.summary = "A Library to Automate User Interactions"
46
46
 
47
47
  if s.respond_to? :specification_version then
48
- s.specification_version = 3
48
+ s.specification_version = 4
49
49
 
50
50
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
51
51
  s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
52
52
  s.add_development_dependency(%q<bundler>, [">= 0"])
53
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
53
+ s.add_development_dependency(%q<jeweler>, ["~> 2.0.0"])
54
54
  else
55
55
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
56
56
  s.add_dependency(%q<bundler>, [">= 0"])
57
- s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
57
+ s.add_dependency(%q<jeweler>, ["~> 2.0.0"])
58
58
  end
59
59
  else
60
60
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
61
61
  s.add_dependency(%q<bundler>, [">= 0"])
62
- s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
62
+ s.add_dependency(%q<jeweler>, ["~> 2.0.0"])
63
63
  end
64
64
  end
65
65
 
@@ -64,4 +64,12 @@ describe Mac::Robot do
64
64
  color.alpha.should be_a_kind_of(Float)
65
65
  end
66
66
  end
67
+
68
+ describe 'current mouse location' do
69
+ it 'should have current mouse location' do
70
+ subject.mouse_move(20, 0)
71
+ subject.mouse_current_location.x.should eql(20)
72
+ subject.mouse_current_location.y.should eql(0)
73
+ end
74
+ end
67
75
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mac-robot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
5
- prerelease:
4
+ version: 0.5.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - youpy
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-03-04 00:00:00.000000000 Z
11
+ date: 2014-04-10 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rspec
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,35 +27,31 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: bundler
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: jeweler
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
53
- version: 1.8.3
47
+ version: 2.0.0
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
61
- version: 1.8.3
54
+ version: 2.0.0
62
55
  description: A Library to Automate User Interactions
63
56
  email: youpy@buycheapviagraonlinenow.com
64
57
  executables: []
@@ -91,29 +84,25 @@ files:
91
84
  homepage: http://github.com/youpy/mac-robot
92
85
  licenses:
93
86
  - MIT
87
+ metadata: {}
94
88
  post_install_message:
95
89
  rdoc_options: []
96
90
  require_paths:
97
91
  - lib
98
92
  required_ruby_version: !ruby/object:Gem::Requirement
99
- none: false
100
93
  requirements:
101
- - - ! '>='
94
+ - - '>='
102
95
  - !ruby/object:Gem::Version
103
96
  version: '0'
104
- segments:
105
- - 0
106
- hash: 734346980075355748
107
97
  required_rubygems_version: !ruby/object:Gem::Requirement
108
- none: false
109
98
  requirements:
110
- - - ! '>='
99
+ - - '>='
111
100
  - !ruby/object:Gem::Version
112
101
  version: '0'
113
102
  requirements: []
114
103
  rubyforge_project:
115
- rubygems_version: 1.8.24
104
+ rubygems_version: 2.0.14
116
105
  signing_key:
117
- specification_version: 3
106
+ specification_version: 4
118
107
  summary: A Library to Automate User Interactions
119
108
  test_files: []