rb-scpt 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +2 -0
  3. data/.gitignore +6 -0
  4. data/Manifest.txt +96 -0
  5. data/Rakefile +10 -23
  6. data/{src → ext/ae}/SendThreadSafe.c +1 -1
  7. data/{src/rbae.c → ext/ae/ae.c} +7 -4
  8. data/{extconf.rb → ext/ae/extconf.rb} +6 -33
  9. data/{src/lib → lib}/_aem/aemreference.rb +2 -1
  10. data/{src/lib → lib}/_aem/codecs.rb +4 -4
  11. data/{src/lib → lib}/_aem/connect.rb +6 -6
  12. data/{src/lib → lib}/_aem/findapp.rb +4 -4
  13. data/{src/lib → lib}/_aem/send.rb +10 -12
  14. data/{src/lib → lib}/_appscript/defaultterminology.rb +3 -3
  15. data/{src/lib → lib}/_appscript/referencerenderer.rb +2 -2
  16. data/{src/lib → lib}/_appscript/safeobject.rb +4 -4
  17. data/{src/lib → lib}/_appscript/terminology.rb +4 -4
  18. data/{src/lib → lib}/aem.rb +5 -5
  19. data/{src/lib → lib}/rb-scpt.rb +0 -2
  20. data/lib/version.rb +3 -0
  21. data/rb-scpt.gemspec +15 -10
  22. data/test/test_aemreference.rb +3 -3
  23. data/test/test_appscriptcommands.rb +16 -18
  24. data/test/test_appscriptreference.rb +1 -1
  25. data/test/test_codecs.rb +13 -8
  26. data/test/test_findapp.rb +9 -9
  27. data/test/test_mactypes.rb +5 -3
  28. data/test/test_osax.rb +25 -13
  29. data.tar.gz.sig +0 -0
  30. metadata +62 -41
  31. metadata.gz.sig +0 -0
  32. data/Makefile +0 -327
  33. data/bin/rb-scpt-1.0.0.gem +0 -0
  34. data/bin/rb-scpt-1.0.1.gem +0 -0
  35. data/rb-scpt-1.0.2.gem +0 -0
  36. /data/{src → ext/ae}/SendThreadSafe.h +0 -0
  37. /data/{src/lib → lib}/_aem/encodingsupport.rb +0 -0
  38. /data/{src/lib → lib}/_aem/mactypes.rb +0 -0
  39. /data/{src/lib → lib}/_aem/typewrappers.rb +0 -0
  40. /data/{src/lib → lib}/_appscript/reservedkeywords.rb +0 -0
  41. /data/{src/lib → lib}/kae.rb +0 -0
  42. /data/{src/lib → lib}/osax.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a608f6dc1d35cf6fcc4b5fd167a47577c09d8cb94b2e60b28e4583154b5d422a
4
- data.tar.gz: f248e1a01ff3f3f13dc3e8d3e804d815c15e557fa26d7bb78601fb30e8adb89f
3
+ metadata.gz: 0c86266e32295b553a490fc58c5b22a62a1bca4b2df975e46d7909c3f72bc901
4
+ data.tar.gz: 61347116bed121e3bc825768dbb5420ab878f1476d3fba6f50f3a8517977c9a5
5
5
  SHA512:
6
- metadata.gz: c2d9919603636037c41a428db960639f7d22aada5c84ddda19b4c894278b6f2d3d3933082b56eee84713607eed5e2950f8862472b6dc175fa97b6f52aceaa39c
7
- data.tar.gz: 9c17df5bf5fa209d61e10b86e6575b30acca7bbd78fa1fc914ed9e63a913545b57ff97a70dc8128389386159e2f1bb0cc4472990ed5a68108e5cac752b2cfee7
6
+ metadata.gz: 7d8639d9d502df996be3a2ff8332e6f48696cd3e95726efd3c6cd3260451313b3c89eb484fd2a6a879d4bef62fe08fbdd95107112c0da000dcb733ed0d611063
7
+ data.tar.gz: 707bed2d8d0f09b0814ff9a66295f5041836ac66f15dfb9f06ccab9bc24a840ed271f81d5a3c7e928e3ebb7fa9246d3f54a978a75e70b532eed532e47c90f6a6
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ N�Isʧ�����*��o�
2
+ �m���r��7�Q�b�UP��r��;��q��I7�=�+A�6�#�(@�t�Ҽ��] z-���C"�
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ /lib/*.bundle
2
+ *.swp
3
+ *.swo
4
+ *.DS_STORE
5
+ /tmp/
6
+ /rb-scpt-*.gem
data/Manifest.txt ADDED
@@ -0,0 +1,96 @@
1
+ .gitignore
2
+ CHANGES
3
+ Manifest.txt
4
+ README.md
5
+ Rakefile
6
+ doc/aem-manual/01_introduction.html
7
+ doc/aem-manual/02_apioverview.html
8
+ doc/aem-manual/03_packingandunpackingdata.html
9
+ doc/aem-manual/04_references.html
10
+ doc/aem-manual/05_targetingapplications.html
11
+ doc/aem-manual/06_buildingandsendingevents.html
12
+ doc/aem-manual/07_findapp.html
13
+ doc/aem-manual/08_examples.html
14
+ doc/aem-manual/aemreferenceinheritance.gif
15
+ doc/aem-manual/index.html
16
+ doc/appscript-manual/01_introduction.html
17
+ doc/appscript-manual/02_aboutappscripting.html
18
+ doc/appscript-manual/03_quicktutorial.html
19
+ doc/appscript-manual/04_gettinghelp.html
20
+ doc/appscript-manual/05_keywordconversion.html
21
+ doc/appscript-manual/06_classesandenums.html
22
+ doc/appscript-manual/07_applicationobjects.html
23
+ doc/appscript-manual/08_realvsgenericreferences.html
24
+ doc/appscript-manual/09_referenceforms.html
25
+ doc/appscript-manual/10_referenceexamples.html
26
+ doc/appscript-manual/11_applicationcommands.html
27
+ doc/appscript-manual/12_commandexamples.html
28
+ doc/appscript-manual/13_performanceissues.html
29
+ doc/appscript-manual/14_notes.html
30
+ doc/appscript-manual/application_architecture.gif
31
+ doc/appscript-manual/application_architecture2.gif
32
+ doc/appscript-manual/finder_to_textedit_event.gif
33
+ doc/appscript-manual/index.html
34
+ doc/appscript-manual/relationships_example.gif
35
+ doc/appscript-manual/ruby_to_itunes_event.gif
36
+ doc/full.css
37
+ doc/index.html
38
+ doc/mactypes-manual/01_introduction.html
39
+ doc/mactypes-manual/02_aliasclass.html
40
+ doc/mactypes-manual/03_fileurlclass.html
41
+ doc/mactypes-manual/04_unitsclass.html
42
+ doc/mactypes-manual/index.html
43
+ doc/osax-manual/01_introduction.html
44
+ doc/osax-manual/02_interface.html
45
+ doc/osax-manual/03_examples.html
46
+ doc/osax-manual/04_notes.html
47
+ doc/osax-manual/index.html
48
+ doc/rb-appscript-logo.png
49
+ ext/ae/ae.c
50
+ ext/ae/SendThreadSafe.c
51
+ ext/ae/SendThreadSafe.h
52
+ ext/ae/extconf.rb
53
+ lib/_aem/aemreference.rb
54
+ lib/_aem/codecs.rb
55
+ lib/_aem/connect.rb
56
+ lib/_aem/encodingsupport.rb
57
+ lib/_aem/findapp.rb
58
+ lib/_aem/mactypes.rb
59
+ lib/_aem/send.rb
60
+ lib/_aem/typewrappers.rb
61
+ lib/_appscript/defaultterminology.rb
62
+ lib/_appscript/referencerenderer.rb
63
+ lib/_appscript/reservedkeywords.rb
64
+ lib/_appscript/safeobject.rb
65
+ lib/_appscript/terminology.rb
66
+ lib/aem.rb
67
+ lib/kae.rb
68
+ lib/osax.rb
69
+ lib/rb-scpt.rb
70
+ lib/version.rb
71
+ rb-scpt.gemspec
72
+ sample/AB_export_vcard.rb
73
+ sample/AB_list_people_with_emails.rb
74
+ sample/Add_iCal_event.rb
75
+ sample/Create_daily_iCal_todos.rb
76
+ sample/Export_Address_Book_phone_numbers.rb
77
+ sample/Hello_world.rb
78
+ sample/List_iTunes_playlist_names.rb
79
+ sample/Make_Mail_message.rb
80
+ sample/Open_file_in_TextEdit.rb
81
+ sample/Organize_Mail_messages.rb
82
+ sample/Print_folder_tree.rb
83
+ sample/Select_all_HTML_files.rb
84
+ sample/Set_iChat_status.rb
85
+ sample/Simple_Finder_GUI_Scripting.rb
86
+ sample/Stagger_Finder_windows.rb
87
+ sample/TextEdit_demo.rb
88
+ sample/iTunes_top40_to_html.rb
89
+ test/README
90
+ test/test_aemreference.rb
91
+ test/test_appscriptcommands.rb
92
+ test/test_appscriptreference.rb
93
+ test/test_codecs.rb
94
+ test/test_findapp.rb
95
+ test/test_mactypes.rb
96
+ test/test_osax.rb
data/Rakefile CHANGED
@@ -1,31 +1,18 @@
1
- require "rake/testtask"
1
+ require "rake/extensiontask"
2
+ Rake::ExtensionTask.new "ae"
2
3
 
3
4
  task :default => :test
4
5
 
5
- task :default => :build
6
- task :test => :build
6
+ task :test => :compile
7
7
 
8
- task :build do
9
- sh "make"
8
+ task :clean do
9
+ rm_f Dir["**/*~", "*.gem", "**/*.bundle"]
10
10
  end
11
11
 
12
- task :build => %w[Makefile ae.bundle]
13
-
14
- file "Makefile" do
15
- ruby "extconf.rb"
16
- end
17
-
18
- deps = %w[SendThreadSafe rbae]
19
-
20
- file "ae.bundle" => deps.map { |dep| "#{dep}.o" }
21
-
22
- deps.each do |dep|
23
- file "#{dep}.o" => "src/#{dep}.c"
12
+ desc "build the gem"
13
+ task :gem => [:clean, :clobber] do
14
+ system "gem build"
24
15
  end
25
16
 
26
- Rake::TestTask.new do |t|
27
- t.libs << "src/lib" << "."
28
- t.test_files = FileList['test/test_*.rb']
29
- t.verbose = true
30
- t.loader = :direct
31
- end
17
+ require "minitest/test_task"
18
+ Minitest::TestTask.create
@@ -359,7 +359,7 @@ OSStatus SendMessageThreadSafe(
359
359
  assert(eventPtr != NULL);
360
360
  assert(replyPtr != NULL);
361
361
 
362
- if (sendMode && kAEWaitReply) {
362
+ if (sendMode & kAEWaitReply) {
363
363
  replyPort = MACH_PORT_NULL;
364
364
 
365
365
  // Set up the reply port if necessary.
@@ -9,7 +9,7 @@
9
9
  * - Jordan Breeding (64-bit support patch)
10
10
  */
11
11
 
12
- #include "osx_ruby.h"
12
+ #include "ruby/ruby.h"
13
13
  #include <Carbon/Carbon.h>
14
14
  #include <CoreFoundation/CoreFoundation.h>
15
15
  #include "SendThreadSafe.h"
@@ -222,7 +222,8 @@ rbAE_AEDesc_newUnflatten(VALUE class, VALUE data)
222
222
  AEDesc desc;
223
223
 
224
224
  Check_Type(data, T_STRING);
225
- err = AEUnflattenDesc(RSTRING_PTR(data), &desc);
225
+
226
+ err = AEUnflattenDescFromBytes(RSTRING_PTR(data), RSTRING_LEN(data), &desc);
226
227
  if (err != noErr) rbAE_raiseMacOSError("Can't create AEDesc.", err);
227
228
  return rbAE_wrapAEDesc(&desc);
228
229
  }
@@ -746,8 +747,9 @@ rbAE_GenericEventHandler(const AppleEvent *request, AppleEvent *reply, SRefCon r
746
747
  /*******/
747
748
 
748
749
  static VALUE
749
- rbAE_AEInstallEventHandler(VALUE self, VALUE eventClass, VALUE eventID, SRefCon handler)
750
+ rbAE_AEInstallEventHandler(VALUE self, VALUE eventClass, VALUE eventID, VALUE _handler)
750
751
  {
752
+ SRefCon handler = (SRefCon)_handler;
751
753
  /*
752
754
  * eventClass and eventID must be four-character code strings
753
755
  *
@@ -821,8 +823,9 @@ rbAE_GenericCoercionHandler(const AEDesc *fromDesc, DescType toType, SRefCon ref
821
823
  /*******/
822
824
 
823
825
  static VALUE
824
- rbAE_AEInstallCoercionHandler(VALUE self, VALUE fromType, VALUE toType, SRefCon handler)
826
+ rbAE_AEInstallCoercionHandler(VALUE self, VALUE fromType, VALUE toType, VALUE _handler)
825
827
  {
828
+ SRefCon handler = (SRefCon)_handler;
826
829
  /*
827
830
  * fromType and toType must be four-character code strings
828
831
  *
@@ -3,19 +3,19 @@
3
3
  # Original copyright below:
4
4
  #
5
5
  # Copyright (c) 2006, Apple Computer, Inc. All rights reserved.
6
- #
6
+ #
7
7
  # Redistribution and use in source and binary forms, with or without
8
8
  # modification, are permitted provided that the following conditions
9
9
  # are met:
10
10
  # 1. Redistributions of source code must retain the above copyright
11
- # notice, this list of conditions and the following disclaimer.
11
+ # notice, this list of conditions and the following disclaimer.
12
12
  # 2. Redistributions in binary form must reproduce the above copyright
13
13
  # notice, this list of conditions and the following disclaimer in the
14
- # documentation and/or other materials provided with the distribution.
14
+ # documentation and/or other materials provided with the distribution.
15
15
  # 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
16
16
  # its contributors may be used to endorse or promote products derived
17
- # from this software without specific prior written permission.
18
- #
17
+ # from this software without specific prior written permission.
18
+ #
19
19
  # THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
20
20
  # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
21
  # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -29,35 +29,8 @@
29
29
  # POSSIBILITY OF SUCH DAMAGE.
30
30
 
31
31
  require 'mkmf'
32
- require 'rbconfig'
33
32
 
34
33
  $CFLAGS << ' -Wall'
35
34
  $LDFLAGS << ' -framework Carbon -framework ApplicationServices'
36
35
 
37
- # Avoid `ID' and `T_DATA' symbol collisions between Ruby and Carbon.
38
- # (adapted code from RubyAEOSA - FUJIMOTO Hisakuni <hisa -at- fobj - com>)
39
-
40
- maj, min = RUBY_VERSION.split('.')
41
- is_ruby_18 = (maj <= '1' and min.to_i < 9)
42
- if is_ruby_18
43
- header_path = RbConfig::CONFIG['archdir']
44
- else
45
- header_path = File.join(RbConfig::CONFIG['rubyhdrdir'], 'ruby')
46
- end
47
- ruby_h = File.join(header_path, 'ruby.h')
48
- intern_h = File.join(header_path, 'intern.h')
49
- new_filename_prefix = 'osx_'
50
-
51
- [ ruby_h, intern_h ].each do |src_path|
52
- dst_fname = File.join('./src', new_filename_prefix + File.basename(src_path))
53
- $stderr.puts "create #{File.expand_path(dst_fname)} ..."
54
- File.open(dst_fname, 'w') do |dstfile|
55
- IO.foreach(src_path) do |line|
56
- line = line.gsub(/\b(?:ruby\/)?intern.h\b/, "#{new_filename_prefix}intern.h")
57
- line = line.gsub('#include "defines.h"', '#include "ruby/defines.h"') if not is_ruby_18
58
- dstfile.puts line
59
- end
60
- end
61
- end
62
-
63
- create_makefile('ae', 'src')
36
+ create_makefile "ae"
@@ -190,7 +190,8 @@ module AEMReference
190
190
  end
191
191
 
192
192
  def AEM_resolve(obj)
193
- return @_container.AEM_resolve(obj).send(@_keyname) end
193
+ return @_container.AEM_resolve(obj).send(@_keyname)
194
+ end
194
195
  end
195
196
 
196
197
 
@@ -72,9 +72,9 @@ class UnitTypeCodecs
72
72
 
73
73
  def add_types(type_defs)
74
74
  # type_defs is a list of lists, where each sublist is of form:
75
- # [typename, typecode, packproc, unpackproc]
75
+ # [typename, typecode, packproc, unpackproc]
76
76
  # or:
77
- # [typename, typecode]
77
+ # [typename, typecode]
78
78
  # If optional packproc and unpackproc are omitted, default pack/unpack procs
79
79
  # are used instead; these pack/unpack AEDesc data as a double precision float.
80
80
  type_defs.each do |name, code, packer, unpacker|
@@ -191,7 +191,7 @@ class Codecs
191
191
  # them into AEDescs of typeUTF8Text. To force the old-style behaviour where
192
192
  # strings are treated as byte strings containing UTF-8 data, call:
193
193
  #
194
- # some_application.AS_app_data.use_ascii_8bit_strings
194
+ # some_application.AS_app_data.use_ascii_8bit_strings
195
195
  #
196
196
  # This will cause Strings to use the binary ASCII-8BIT encoding; as in Ruby 1.8,
197
197
  # the user is responsible for ensuring that strings contain UTF-8 data.
@@ -294,7 +294,7 @@ class Codecs
294
294
  # (assuming target app knows how to handle new UInt64 type):
295
295
  #
296
296
  # def pack_uint64(val)
297
- # AE::AEDesc.new(KAE::TypeUInt64, [val.to_f].pack('Q'))
297
+ # AE::AEDesc.new(KAE::TypeUInt64, [val.to_f].pack('Q'))
298
298
  # end
299
299
  AE::AEDesc.new(KAE::TypeFloat, [val.to_f].pack('d')) # pack as 64-bit float for compatibility (lossy conversion)
300
300
  end
@@ -169,8 +169,8 @@ module Connect
169
169
 
170
170
  def Connect.local_app(path)
171
171
  # Make an AEAddressDesc identifying a local application. (Application will be launched if not already running.)
172
- # path : string -- full path to application, e.g. '/Applications/TextEdit.app'
173
- # Result : AEAddressDesc
172
+ # path : string -- full path to application, e.g. '/Applications/TextEdit.app'
173
+ # Result : AEAddressDesc
174
174
  #
175
175
  # Always creates AEAddressDesc by process serial number; that way there's no confusion if multiple versions of the same app are running.
176
176
  path = @@encoding_support.to_utf8_string(path)
@@ -189,16 +189,16 @@ module Connect
189
189
 
190
190
  def Connect.local_app_by_pid(pid)
191
191
  # Make an AEAddressDesc identifying a running application by Unix process id.
192
- # pid : integer -- unsigned 32-bit integer
193
- # Result : AEAddressDesc
192
+ # pid : integer -- unsigned 32-bit integer
193
+ # Result : AEAddressDesc
194
194
  return AE::AEDesc.new(KAE::TypeKernelProcessID, [pid].pack('L'))
195
195
  end
196
196
 
197
197
  def Connect.remote_app(url)
198
198
  url = @@encoding_support.to_utf8_string(url)
199
199
  # Make an AEAddressDesc identifying a running application on another machine.
200
- # url : string -- URL for remote application, e.g. 'eppc://user:password@0.0.0.1/TextEdit'
201
- # Result : AEAddressDesc
200
+ # url : string -- URL for remote application, e.g. 'eppc://user:password@0.0.0.1/TextEdit'
201
+ # Result : AEAddressDesc
202
202
  raise ArgumentError, "Invalid url: #{url}" if not url.include?(':') # workaround: process will crash if no colon in URL (OS bug)
203
203
  return AE::AEDesc.new(KAE::TypeApplicationURL, url)
204
204
  end
@@ -42,8 +42,8 @@ module FindApp
42
42
  # Absolute paths are also accepted. An '.app' suffix is optional.
43
43
  #
44
44
  # Examples:
45
- # FindApp.by_name('TextEdit')
46
- # FindApp.by_name('Finder.app')
45
+ # FindApp.by_name('TextEdit')
46
+ # FindApp.by_name('Finder.app')
47
47
  #
48
48
  if name[0, 1] != '/' # application name only, not its full path
49
49
  begin
@@ -69,7 +69,7 @@ module FindApp
69
69
  # Find the application with the given bundle id and return its full path.
70
70
  #
71
71
  # Examples:
72
- # FindApp.by_id('com.apple.textedit')
72
+ # FindApp.by_id('com.apple.textedit')
73
73
  #
74
74
  return _find_app(nil, id, nil)
75
75
  end
@@ -78,7 +78,7 @@ module FindApp
78
78
  # Find the application with the given creator type and return its full path.
79
79
  #
80
80
  # Examples:
81
- # FindApp.by_creator('ttxt')
81
+ # FindApp.by_creator('ttxt')
82
82
  #
83
83
  return _find_app(creator, nil, nil)
84
84
  end
@@ -61,11 +61,11 @@ module Send
61
61
  #
62
62
  # [1] Should be the sum of zero or more of the following kae module constants:
63
63
  #
64
- # KAENoReply | KAEQueueReply | KAEWaitReply
65
- # KAEDontReconnect
66
- # KAEWantReceipt
67
- # KAENeverInteract | KAECanInteract | KAEAlwaysInteract
68
- # KAECanSwitchLayer
64
+ # KAENoReply | KAEQueueReply | KAEWaitReply
65
+ # KAEDontReconnect
66
+ # KAEWantReceipt
67
+ # KAENeverInteract | KAECanInteract | KAEAlwaysInteract
68
+ # KAECanSwitchLayer
69
69
 
70
70
  begin
71
71
  reply_event = _send_apple_event(flags, timeout)
@@ -75,11 +75,9 @@ module Send
75
75
  end
76
76
  else # Decode application's reply, if any. May be a return value, error number (and optional message), or nothing.
77
77
  if reply_event.type != KAE::TypeNull
78
- event_result = {}
79
- reply_event.length.times do |i|
80
- key, value = reply_event.get_item(i + 1, KAE::TypeWildCard)
81
- event_result[key] = value
82
- end
78
+ event_result = reply_event.length.times.to_h { |i|
79
+ reply_event.get_item(i.next, KAE::TypeWildCard)
80
+ }
83
81
  if event_result.has_key?(KAE::KeyErrorNumber) # The application raised an error.
84
82
  # Error info is unpacked using default codecs for reliability.
85
83
  e_num = DefaultCodecs.unpack(event_result[KAE::KeyErrorNumber])
@@ -103,8 +101,8 @@ module Send
103
101
  # Represents an error raised by the Apple Event Manager or target application when a command fails.
104
102
  #
105
103
  # Methods:
106
- # number : integer -- MacOS error number
107
- # message : string -- application error message if any, or default error description if available
104
+ # number : integer -- MacOS error number
105
+ # message : string -- application error message if any, or default error description if available
108
106
 
109
107
  # Most applications don't provide error description strings, so define default descriptions for the common ones.
110
108
  # Following default error descriptions are cribbed from the AppleScript Language Guide/MacErrors.h:
@@ -189,9 +189,9 @@ module DefaultTerminology
189
189
  }
190
190
 
191
191
  Properties = {
192
- 'pcls' => :class_,
193
- 'pALL' => :properties_,
194
- 'ID ' => :id_,
192
+ 'pcls' => :class_,
193
+ 'pALL' => :properties_,
194
+ 'ID ' => :id_,
195
195
  }
196
196
 
197
197
  Elements = {
@@ -221,12 +221,12 @@ class ReferenceRenderer
221
221
  def ReferenceRenderer.render(app_data, aem_reference)
222
222
  # Take an aem reference, e.g.:
223
223
  #
224
- # app.elements('docu').by_index(1).property('ctxt')
224
+ # app.elements('docu').by_index(1).property('ctxt')
225
225
  #
226
226
  # and an AppData instance containing application's location and terminology,
227
227
  # and render an appscript-style reference string, e.g.:
228
228
  #
229
- # "AS.app('/Applications/TextEdit.app').documents[1].text"
229
+ # "AS.app('/Applications/TextEdit.app').documents[1].text"
230
230
  #
231
231
  # Used by AS::Reference#to_s
232
232
  #
@@ -24,10 +24,10 @@
24
24
  # require 'appscript'
25
25
  #
26
26
  # module X
27
- # def name
28
- # puts 'X.name was called'
29
- # return 999
30
- # end
27
+ # def name
28
+ # puts 'X.name was called'
29
+ # return 999
30
+ # end
31
31
  # end
32
32
  # include X
33
33
  #
@@ -447,15 +447,15 @@ module Terminology
447
447
  #
448
448
  # Call the #dump method to dump faulty aetes to Ruby module, e.g.:
449
449
  #
450
- # Terminology.dump('MyApp', 'MyAppGlue', '/path/to/ruby/modules/myappglue.rb')
450
+ # Terminology.dump('MyApp', 'MyAppGlue', '/path/to/ruby/modules/myappglue.rb')
451
451
  #
452
452
  # Patch any errors by hand, then import the patched module into your script
453
453
  # and pass it to appscript's app() constructor via its 'terms' argument, e.g.:
454
454
  #
455
- # require 'appscript'; include Appscript
456
- # require 'myappglue'
455
+ # require 'appscript'; include Appscript
456
+ # require 'myappglue'
457
457
  #
458
- # myapp = app('MyApp', terms => MyAppGlue)
458
+ # myapp = app('MyApp', terms => MyAppGlue)
459
459
  #
460
460
  # Note that dumped terminologies aren't used by appscript's built-in help system.
461
461
  #
@@ -210,11 +210,11 @@ module AEM
210
210
 
211
211
  def event(event, params={}, atts={}, return_id=KAE::KAutoGenerateReturnID, codecs=DefaultCodecs)
212
212
  # Construct an Apple event targetted at this application.
213
- # event : string -- 8-letter code indicating event's class, e.g. 'coregetd'
214
- # params : hash -- a dict of form {AE_code:anything,...} containing zero or more event parameters (message arguments)
215
- # atts : hash -- a dict of form {AE_code:anything,...} containing zero or more event attributes (event info)
216
- # return_id : integer -- reply event's ID
217
- # codecs : Codecs -- codecs object to use when packing/unpacking this event
213
+ # event : string -- 8-letter code indicating event's class, e.g. 'coregetd'
214
+ # params : hash -- a dict of form {AE_code:anything,...} containing zero or more event parameters (message arguments)
215
+ # atts : hash -- a dict of form {AE_code:anything,...} containing zero or more event attributes (event info)
216
+ # return_id : integer -- reply event's ID
217
+ # codecs : Codecs -- codecs object to use when packing/unpacking this event
218
218
  return self.class::Event.new(@address_desc, event, params, atts, @_transaction, return_id, codecs)
219
219
  end
220
220
 
@@ -9,8 +9,6 @@ require "_aem/mactypes"
9
9
 
10
10
  module Appscript
11
11
 
12
- Version = '1.0.1'
13
-
14
12
  # The following methods and classes are of interest to end users:
15
13
  # app, con, its, CommandError, ApplicationNotFoundError, CantLaunchApplicationError
16
14
  # Other classes are only of interest to implementors who need to hook in their own code.
data/lib/version.rb ADDED
@@ -0,0 +1,3 @@
1
+ module Appscript
2
+ Version = "1.0.4"
3
+ end
data/rb-scpt.gemspec CHANGED
@@ -1,14 +1,19 @@
1
1
  require "rubygems"
2
2
 
3
+ require "./lib/version.rb"
4
+
3
5
  Gem::Specification.new do |s|
4
- s.name = "rb-scpt"
5
- s.version = "1.0.3"
6
- s.homepage = "https://github.com/BrendanThompson/rb-scpt"
7
- s.summary="This is a fork of the original rb-appscript. Ruby AppleScript (rb-scpt) is a high-level, user-friendly Apple event bridge that allows you to control scriptable Mac OS X applications using ordinary Ruby scripts."
8
- s.files = Dir["**/*"].delete_if { |name| ["MakeFile", "ae.bundle", "mkmf.log", "rbae.o", "SendThreadSafe.o", "src/osx_ruby.h", "src/osx_intern.h"].include?(name) }
9
- s.extensions = "extconf.rb"
10
- s.test_files = Dir["test/test_*.rb"]
11
- s.authors = ["hhas","Brendan Thompson"]
12
- s.email = 'brendan@btsystems.com.au'
13
- s.required_ruby_version = ">= 1.8"
6
+ s.name = "rb-scpt"
7
+ s.version = Appscript::Version
8
+ s.homepage = "https://github.com/BrendanThompson/rb-scpt"
9
+ s.summary = "This is a fork of the original rb-appscript. Ruby AppleScript (rb-scpt) is a high-level, user-friendly Apple event bridge that allows you to control scriptable Mac OS X applications using ordinary Ruby scripts."
10
+ s.files = File.readlines("Manifest.txt", chomp:true)
11
+ s.extensions = s.files.grep(/extconf.rb/)
12
+ s.test_files = s.files.grep(/^test/)
13
+ s.authors = ["hhas","Brendan Thompson"]
14
+ s.email = 'brendan@btsystems.com.au'
15
+
16
+ s.license = "AML"
17
+
18
+ s.required_ruby_version = ">= 2.7"
14
19
  end
@@ -93,11 +93,11 @@ class TC_AEMReferences < Minitest::Test
93
93
  val2 = DefaultCodecs.unpack(d)
94
94
  assert_equal(val, val2)
95
95
  val2 = DefaultCodecs.unpack(d)
96
- assert_predicate val, :eql?, val2
96
+ assert_operator val, :eql?, val2
97
97
  val2 = DefaultCodecs.unpack(d)
98
98
  assert_equal(val2, val)
99
99
  val2 = DefaultCodecs.unpack(d)
100
- assert_predicate val2, :eql?, val
100
+ assert_operator val2, :eql?, val
101
101
  rescue
102
102
  puts 'EXPECTED: ' + res
103
103
  raise
@@ -108,7 +108,7 @@ class TC_AEMReferences < Minitest::Test
108
108
  refute_equal(AEMReference::App.elements('ctxt').property('ctxt'), AEMReference::App.property('ctxt').property('ctxt'))
109
109
  refute_equal(AEMReference::App.elements('ctxt').property('ctxt'), 333)
110
110
  refute_equal(333, AEMReference::App.property('ctxt').property('ctxt'))
111
- # # by-filter references do basic type checking to ensure an its-based reference is given
111
+ # by-filter references do basic type checking to ensure an its-based reference is given
112
112
  assert_raises(TypeError) { AEMReference::App.elements('docu').by_filter(1) }
113
113
 
114
114
  end