rb-scpt 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rb-scpt-1.0.1.gem +0 -0
  3. data/extconf.rb +12 -12
  4. data/rb-scpt.gemspec +10 -10
  5. data/sample/AB_export_vcard.rb +16 -16
  6. data/sample/AB_list_people_with_emails.rb +4 -4
  7. data/sample/Add_iCal_event.rb +12 -12
  8. data/sample/Create_daily_iCal_todos.rb +28 -28
  9. data/sample/Export_Address_Book_phone_numbers.rb +52 -52
  10. data/sample/Hello_world.rb +10 -10
  11. data/sample/List_iTunes_playlist_names.rb +3 -3
  12. data/sample/Make_Mail_message.rb +24 -24
  13. data/sample/Open_file_in_TextEdit.rb +5 -5
  14. data/sample/Organize_Mail_messages.rb +46 -46
  15. data/sample/Print_folder_tree.rb +5 -5
  16. data/sample/Select_all_HTML_files.rb +6 -6
  17. data/sample/Set_iChat_status.rb +12 -12
  18. data/sample/Simple_Finder_GUI_Scripting.rb +6 -6
  19. data/sample/Stagger_Finder_windows.rb +9 -9
  20. data/sample/TextEdit_demo.rb +71 -71
  21. data/sample/iTunes_top40_to_html.rb +28 -30
  22. data/src/SendThreadSafe.c +293 -293
  23. data/src/SendThreadSafe.h +108 -108
  24. data/src/lib/_aem/aemreference.rb +997 -998
  25. data/src/lib/_aem/codecs.rb +609 -610
  26. data/src/lib/_aem/connect.rb +197 -197
  27. data/src/lib/_aem/encodingsupport.rb +67 -67
  28. data/src/lib/_aem/findapp.rb +75 -75
  29. data/src/lib/_aem/mactypes.rb +241 -242
  30. data/src/lib/_aem/send.rb +268 -268
  31. data/src/lib/_aem/typewrappers.rb +52 -52
  32. data/src/lib/_appscript/defaultterminology.rb +266 -266
  33. data/src/lib/_appscript/referencerenderer.rb +230 -233
  34. data/src/lib/_appscript/reservedkeywords.rb +106 -106
  35. data/src/lib/_appscript/safeobject.rb +125 -125
  36. data/src/lib/_appscript/terminology.rb +448 -449
  37. data/src/lib/aem.rb +238 -238
  38. data/src/lib/kae.rb +1487 -1487
  39. data/src/lib/osax.rb +647 -647
  40. data/src/lib/rb-scpt.rb +1065 -1065
  41. data/src/rbae.c +595 -595
  42. data/test/test_aemreference.rb +104 -107
  43. data/test/test_appscriptcommands.rb +131 -134
  44. data/test/test_appscriptreference.rb +96 -99
  45. data/test/test_codecs.rb +166 -168
  46. data/test/test_findapp.rb +13 -16
  47. data/test/test_mactypes.rb +70 -72
  48. data/test/test_osax.rb +46 -48
  49. data/test/testall.sh +4 -4
  50. metadata +8 -7
@@ -1,26 +1,23 @@
1
1
  #!/usr/bin/ruby -w
2
2
 
3
- begin; require 'rubygems'; rescue LoadError; end
4
-
5
3
  require 'test/unit'
6
4
  require "_aem/findapp"
7
5
 
8
6
 
9
7
  class TC_FindApp < Test::Unit::TestCase
10
8
 
11
- def test_find
12
- [
13
- ['/Applications/iCal.app', '/Applications/iCal.app'],
14
- ['ical.app', '/Applications/iCal.app'],
15
- ['ICAL', '/Applications/iCal.app'],
16
- ].each do |val, res|
17
- assert_equal(res, FindApp.by_name(val))
18
- end
19
- assert_equal('/Applications/TextEdit.app', FindApp.by_creator('ttxt'))
20
- assert_equal('/System/Library/CoreServices/Finder.app', FindApp.by_id('com.apple.finder'))
21
- assert_raises(FindApp::ApplicationNotFoundError) { FindApp.by_name('NON-EXISTENT-APP') }
9
+ def test_find
10
+ [
11
+ ['/Applications/iCal.app', '/Applications/iCal.app'],
12
+ ['ical.app', '/Applications/iCal.app'],
13
+ ['ICAL', '/Applications/iCal.app'],
14
+ ].each do |val, res|
15
+ assert_equal(res, FindApp.by_name(val))
16
+ end
17
+ assert_equal('/Applications/TextEdit.app', FindApp.by_creator('ttxt'))
18
+ assert_equal('/System/Library/CoreServices/Finder.app', FindApp.by_id('com.apple.finder'))
19
+ assert_raises(FindApp::ApplicationNotFoundError) { FindApp.by_name('NON-EXISTENT-APP') }
22
20
 
23
- # assert_equal("/Users/has/\306\222\303\270u\314\210.app", FindApp.by_name("\306\222\303\270u\314\210.app")) # utf8 paths work ok
24
- end
21
+ # assert_equal("/Users/has/\306\222\303\270u\314\210.app", FindApp.by_name("\306\222\303\270u\314\210.app")) # utf8 paths work ok
22
+ end
25
23
  end
26
-
@@ -1,79 +1,77 @@
1
1
  #!/usr/bin/ruby -w
2
2
 
3
- begin; require 'rubygems'; rescue LoadError; end
4
-
5
3
  require 'test/unit'
6
4
  require "_aem/mactypes"
7
5
 
8
6
 
9
7
  class TC_MacTypes < Test::Unit::TestCase
10
-
11
- def setup
12
- @path1 = `mktemp -t codecs-test`.chomp
13
- dir, fname = File.split(@path1)
14
- @path2 = File.join(dir, 'moved-' + fname)
15
- # puts "path: #{@path1}" # e.g. /tmp/codecs-test.HWr1EnE3
16
- end
17
-
18
- def normalize(path)
19
- return path.gsub(/\/+/, '/') # quick-n-dirty
20
- end
21
-
22
- def test_alias
23
- # make alias
24
- f = MacTypes::Alias.path(@path1)
25
-
26
-
27
- assert_equal(MacTypes::Alias.path(@path1), f)
28
-
29
- # get path
30
- # note that initial /tmp/codecs-test... path will automatically change to /private/tmp/codecs-test...
31
- p1 = normalize('/private'+@path1)
32
- p2 = normalize('/private'+@path2)
33
-
34
- assert_equal(p1, normalize(f.path))
35
-
36
- #puts "alias path 1: #{f}" # e.g. /private/tmp/codecs-test.HWr1EnE3
37
- assert_equal(p1, f.to_s)
38
-
39
- # get desc
40
- #puts f.desc.type, f.desc.data # alis, [binary data]
41
- assert_equal('alis', f.desc.type)
42
-
43
-
44
- # check alias keeps track of moved file
45
- `mv #{@path1} #{@path2}`
46
- # puts "alias path 2: #{f}" # /private/tmp/moved-codecs-test.HWr1EnE3
47
- assert_equal(p2, f.to_s)
48
-
49
- assert_equal(p2, normalize(f.path))
50
-
51
- # check a FileNotFoundError is raised if getting path/FileURL for a filesystem object that no longer exists
52
- `rm #{@path2}`
53
- assert_raises(MacTypes::FileNotFoundError) { f.to_s } # File not found.
54
- assert_raises(MacTypes::FileNotFoundError) { f.to_file_url } # File not found.
55
-
56
- assert_equal(MacTypes::Alias.path("/Library/Scripts/"), MacTypes::Alias.path("/Library/Scripts/"))
57
- assert_not_equal(MacTypes::Alias.path("/Library/Scripts/"), MacTypes::Alias.path("/Applications/"))
58
- end
59
-
60
-
61
- def test_file_url
62
-
63
- g = MacTypes::FileURL.path('/non/existent path')
64
-
65
- assert_equal('/non/existent path', g.to_s)
66
-
67
- assert_equal('furl', g.desc.type)
68
- assert_equal('file://localhost/non/existent%20path', g.desc.data)
69
-
70
- assert_equal('MacTypes::FileURL.path("/non/existent path")', g.to_file_url.inspect)
71
-
72
- # check a not-found error is raised if getting Alias for a filesystem object that doesn't exist
73
- assert_raises(MacTypes::FileNotFoundError) { g.to_alias } # File "/non/existent path" not found.
74
-
75
- assert_equal(MacTypes::FileURL.path("/Library/Scripts/"), MacTypes::FileURL.path("/Library/Scripts/"))
76
- assert_not_equal(MacTypes::FileURL.path("/Library/Scripts/"), MacTypes::FileURL.path("/Applications/"))
77
- assert_not_equal(MacTypes::FileURL.path("/Library/Scripts/"), MacTypes::Alias.path("/Library/Scripts/"))
78
- end
79
- end
8
+
9
+ def setup
10
+ @path1 = `mktemp -t codecs-test`.chomp
11
+ dir, fname = File.split(@path1)
12
+ @path2 = File.join(dir, 'moved-' + fname)
13
+ # puts "path: #{@path1}" # e.g. /tmp/codecs-test.HWr1EnE3
14
+ end
15
+
16
+ def normalize(path)
17
+ return path.gsub(/\/+/, '/') # quick-n-dirty
18
+ end
19
+
20
+ def test_alias
21
+ # make alias
22
+ f = MacTypes::Alias.path(@path1)
23
+
24
+
25
+ assert_equal(MacTypes::Alias.path(@path1), f)
26
+
27
+ # get path
28
+ # note that initial /tmp/codecs-test... path will automatically change to /private/tmp/codecs-test...
29
+ p1 = normalize('/private'+@path1)
30
+ p2 = normalize('/private'+@path2)
31
+
32
+ assert_equal(p1, normalize(f.path))
33
+
34
+ #puts "alias path 1: #{f}" # e.g. /private/tmp/codecs-test.HWr1EnE3
35
+ assert_equal(p1, f.to_s)
36
+
37
+ # get desc
38
+ #puts f.desc.type, f.desc.data # alis, [binary data]
39
+ assert_equal('alis', f.desc.type)
40
+
41
+
42
+ # check alias keeps track of moved file
43
+ `mv #{@path1} #{@path2}`
44
+ # puts "alias path 2: #{f}" # /private/tmp/moved-codecs-test.HWr1EnE3
45
+ assert_equal(p2, f.to_s)
46
+
47
+ assert_equal(p2, normalize(f.path))
48
+
49
+ # check a FileNotFoundError is raised if getting path/FileURL for a filesystem object that no longer exists
50
+ `rm #{@path2}`
51
+ assert_raises(MacTypes::FileNotFoundError) { f.to_s } # File not found.
52
+ assert_raises(MacTypes::FileNotFoundError) { f.to_file_url } # File not found.
53
+
54
+ assert_equal(MacTypes::Alias.path("/Library/Scripts/"), MacTypes::Alias.path("/Library/Scripts/"))
55
+ assert_not_equal(MacTypes::Alias.path("/Library/Scripts/"), MacTypes::Alias.path("/Applications/"))
56
+ end
57
+
58
+
59
+ def test_file_url
60
+
61
+ g = MacTypes::FileURL.path('/non/existent path')
62
+
63
+ assert_equal('/non/existent path', g.to_s)
64
+
65
+ assert_equal('furl', g.desc.type)
66
+ assert_equal('file://localhost/non/existent%20path', g.desc.data)
67
+
68
+ assert_equal('MacTypes::FileURL.path("/non/existent path")', g.to_file_url.inspect)
69
+
70
+ # check a not-found error is raised if getting Alias for a filesystem object that doesn't exist
71
+ assert_raises(MacTypes::FileNotFoundError) { g.to_alias } # File "/non/existent path" not found.
72
+
73
+ assert_equal(MacTypes::FileURL.path("/Library/Scripts/"), MacTypes::FileURL.path("/Library/Scripts/"))
74
+ assert_not_equal(MacTypes::FileURL.path("/Library/Scripts/"), MacTypes::FileURL.path("/Applications/"))
75
+ assert_not_equal(MacTypes::FileURL.path("/Library/Scripts/"), MacTypes::Alias.path("/Library/Scripts/"))
76
+ end
77
+ end
@@ -1,54 +1,52 @@
1
1
  #!/usr/bin/ruby -w
2
2
 
3
- begin; require 'rubygems'; rescue LoadError; end
4
-
5
3
  require 'test/unit'
6
4
  require 'osax'
7
5
 
8
6
  class TC_OSAX < Test::Unit::TestCase
9
-
10
- def test_1
11
- sa = OSAX.osax('Standardadditions')
12
-
13
- assert_equal(65, sa.ASCII_number('A'))
14
-
15
- assert_equal(MacTypes::Alias.path("/Applications/"), sa.path_to(:applications_folder))
16
-
17
- assert_equal(MacTypes::Alias.path("/Library/Scripts/"),
18
- sa.path_to(:scripts_folder, :from=>:local_domain))
19
-
20
- assert_raises(RuntimeError) { sa.non_existent_command }
21
- end
22
-
23
- def test_2
24
- sa = OSAX.osax('Standardadditions').by_name('Finder')
25
- assert_equal(65, sa.ASCII_number('A'))
26
- assert_equal(MacTypes::Alias.path("/System/Library/CoreServices/Finder.app/"), sa.path_to(nil))
27
- end
28
-
29
- def test_3
30
- sa = OSAX.osax('Standardadditions').by_creator('MACS')
31
- assert_equal(65, sa.ASCII_number('A'))
32
- assert_equal(MacTypes::Alias.path("/System/Library/CoreServices/Finder.app/"), sa.path_to(nil))
33
- end
34
-
35
- def test_4
36
- sa = OSAX.osax('Standardadditions').by_id('com.apple.finder')
37
- assert_equal(65, sa.ASCII_number('A'))
38
- assert_equal(MacTypes::Alias.path("/System/Library/CoreServices/Finder.app/"), sa.path_to(nil))
39
- end
40
-
41
- def test_5
42
- sa = OSAX.osax('Standardadditions').by_pid(`top -l1 | grep Finder | awk '{ print $1 }'`.to_i)
43
- assert_equal(MacTypes::Alias.path("/System/Library/CoreServices/Finder.app/"), sa.path_to(nil))
44
- assert_equal(65, sa.ASCII_number('A'))
45
- end
46
-
47
- def test_6
48
- sa = OSAX.osax('Standardadditions').by_aem_app(AEM::Application.by_path("/System/Library/CoreServices/Finder.app/"))
49
- assert_equal(65, sa.ASCII_number('A'))
50
- assert_equal(MacTypes::Alias.path("/System/Library/CoreServices/Finder.app/"), sa.path_to(nil))
51
- end
52
-
53
-
54
- end
7
+
8
+ def test_1
9
+ sa = OSAX.osax('Standardadditions')
10
+
11
+ assert_equal(65, sa.ASCII_number('A'))
12
+
13
+ assert_equal(MacTypes::Alias.path("/Applications/"), sa.path_to(:applications_folder))
14
+
15
+ assert_equal(MacTypes::Alias.path("/Library/Scripts/"),
16
+ sa.path_to(:scripts_folder, :from=>:local_domain))
17
+
18
+ assert_raises(RuntimeError) { sa.non_existent_command }
19
+ end
20
+
21
+ def test_2
22
+ sa = OSAX.osax('Standardadditions').by_name('Finder')
23
+ assert_equal(65, sa.ASCII_number('A'))
24
+ assert_equal(MacTypes::Alias.path("/System/Library/CoreServices/Finder.app/"), sa.path_to(nil))
25
+ end
26
+
27
+ def test_3
28
+ sa = OSAX.osax('Standardadditions').by_creator('MACS')
29
+ assert_equal(65, sa.ASCII_number('A'))
30
+ assert_equal(MacTypes::Alias.path("/System/Library/CoreServices/Finder.app/"), sa.path_to(nil))
31
+ end
32
+
33
+ def test_4
34
+ sa = OSAX.osax('Standardadditions').by_id('com.apple.finder')
35
+ assert_equal(65, sa.ASCII_number('A'))
36
+ assert_equal(MacTypes::Alias.path("/System/Library/CoreServices/Finder.app/"), sa.path_to(nil))
37
+ end
38
+
39
+ def test_5
40
+ sa = OSAX.osax('Standardadditions').by_pid(`top -l1 | grep Finder | awk '{ print $1 }'`.to_i)
41
+ assert_equal(MacTypes::Alias.path("/System/Library/CoreServices/Finder.app/"), sa.path_to(nil))
42
+ assert_equal(65, sa.ASCII_number('A'))
43
+ end
44
+
45
+ def test_6
46
+ sa = OSAX.osax('Standardadditions').by_aem_app(AEM::Application.by_path("/System/Library/CoreServices/Finder.app/"))
47
+ assert_equal(65, sa.ASCII_number('A'))
48
+ assert_equal(MacTypes::Alias.path("/System/Library/CoreServices/Finder.app/"), sa.path_to(nil))
49
+ end
50
+
51
+
52
+ end
@@ -2,9 +2,9 @@
2
2
 
3
3
  for f in `ls | grep '^test_'`;
4
4
  do
5
- echo $f
6
- /usr/bin/ruby -w $f
7
- echo
8
- echo
5
+ echo $f
6
+ /usr/bin/ruby -w $f
7
+ echo
8
+ echo
9
9
  done
10
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rb-scpt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - hhas
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-07-14 00:00:00.000000000 Z
12
+ date: 2017-10-15 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: brendan@btsystems.com.au
@@ -20,6 +20,7 @@ extra_rdoc_files: []
20
20
  files:
21
21
  - CHANGES
22
22
  - bin/rb-scpt-1.0.0.gem
23
+ - bin/rb-scpt-1.0.1.gem
23
24
  - doc/aem-manual/01_introduction.html
24
25
  - doc/aem-manual/02_apioverview.html
25
26
  - doc/aem-manual/03_packingandunpackingdata.html
@@ -130,17 +131,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
131
  version: '0'
131
132
  requirements: []
132
133
  rubyforge_project:
133
- rubygems_version: 2.4.5
134
+ rubygems_version: 2.6.13
134
135
  signing_key:
135
136
  specification_version: 4
136
137
  summary: This is a fork of the original rb-appscript. Ruby AppleScript (rb-scpt) is
137
138
  a high-level, user-friendly Apple event bridge that allows you to control scriptable
138
139
  Mac OS X applications using ordinary Ruby scripts.
139
140
  test_files:
140
- - test/test_aemreference.rb
141
- - test/test_appscriptcommands.rb
142
- - test/test_appscriptreference.rb
143
141
  - test/test_codecs.rb
144
- - test/test_findapp.rb
145
142
  - test/test_mactypes.rb
143
+ - test/test_appscriptcommands.rb
144
+ - test/test_aemreference.rb
146
145
  - test/test_osax.rb
146
+ - test/test_findapp.rb
147
+ - test/test_appscriptreference.rb