mtk 0.0.3.1 → 0.0.3.2

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/DEVELOPMENT_NOTES.md CHANGED
@@ -81,10 +81,11 @@ You shouldn't need to worry about the dependencies too much. A Gemfile is provid
81
81
  Documentation
82
82
  -------------
83
83
 
84
- Gem 0.0.3.1: http://rdoc.info/gems/mtk/0.0.3.1/frames
84
+ Generate with:
85
85
 
86
- Latest for source: http://rubydoc.info/github/adamjmurray/mtk/master/frames
86
+ bundle exec rake doc
87
87
 
88
+ Or view online @ http://rubydoc.info/github/adamjmurray/mtk/master/frames
88
89
 
89
90
 
90
91
  Development Notes
data/README.md CHANGED
@@ -19,8 +19,6 @@ Features
19
19
  Getting Started
20
20
  ---------------
21
21
 
22
- # NOTE: This project is not ready yet, these instructions will not work! Please check back in a little while once I have mtk version 0.0.3 released to rubygems.org.
23
-
24
22
  MTK works with Ruby 1.9, Ruby 2.0, and JRuby
25
23
 
26
24
  0. Install
@@ -35,11 +33,11 @@ MTK works with Ruby 1.9, Ruby 2.0, and JRuby
35
33
 
36
34
  mtk --help
37
35
 
38
- 0. Learn the MTK syntax: TODO... documentation forthcoming. In the meantime, see the unit tests @ https://github.com/adamjmurray/mtk/blob/master/spec/mtk/lang/grammar_spec.rb
36
+ 0. Learn the MTK syntax: TODO... documentation forthcoming. In the meantime, see the unit tests @ https://github.com/adamjmurray/mtk/blob/master/spec/mtk/lang/parser_spec.rb
39
37
 
40
38
  0. Check out examples: https://github.com/adamjmurray/mtk/tree/master/examples
41
39
 
42
- 0. Read the [MTK Ruby library documentation](http://rdoc.info/gems/mtk/0.0.3.1/frames)
40
+ 0. Read the [MTK Ruby library documentation](http://rubydoc.info/github/adamjmurray/mtk/master/frames)
43
41
 
44
42
 
45
43
  About this project
@@ -66,56 +66,70 @@ end
66
66
  # MONKEY PATCHING for https://github.com/arirusso/ffi-coremidi/pull/2
67
67
  # This can be removed once that pull request is released.
68
68
 
69
- # @private
70
- module CoreMIDI
71
- class Device
72
- def initialize(id, device_pointer, options = {})
73
- include_if_offline = options[:include_offline] || false
74
- @id = id
75
- @resource = device_pointer
76
- @entities = []
77
-
78
- prop = Map::CF.CFStringCreateWithCString( nil, "name", 0 )
79
- begin
80
- name_ptr = FFI::MemoryPointer.new(:pointer)
81
- Map::MIDIObjectGetStringProperty(@resource, prop, name_ptr)
82
- name = name_ptr.read_pointer
83
- len = Map::CF.CFStringGetMaximumSizeForEncoding(Map::CF.CFStringGetLength(name), :kCFStringEncodingUTF8)
84
- bytes = FFI::MemoryPointer.new(len + 1)
85
- raise RuntimeError.new("CFStringGetCString") unless Map::CF.CFStringGetCString(name, bytes, len, :kCFStringEncodingUTF8)
86
- @name = bytes.read_string
87
- ensure
88
- Map::CF.CFRelease(name) unless name.nil? || name.null?
89
- Map::CF.CFRelease(prop) unless prop.null?
90
- end
91
- populate_entities(:include_offline => include_if_offline)
92
- end
69
+ if RbConfig::CONFIG['host_os'] =~ /darwin/
70
+ # We're running on OS X
93
71
 
72
+ begin
73
+ ffi_coremidi_exists = !CoreMIDI::Map::CF.nil?
74
+ rescue NameError
75
+ ffi_coremidi_exists = false
94
76
  end
95
77
 
96
- module Map
97
- module CF
78
+ if ffi_coremidi_exists
79
+
80
+ # @private
81
+ module CoreMIDI
82
+ class Device
83
+ def initialize(id, device_pointer, options = {})
84
+ include_if_offline = options[:include_offline] || false
85
+ @id = id
86
+ @resource = device_pointer
87
+ @entities = []
88
+
89
+ prop = Map::CF.CFStringCreateWithCString( nil, "name", 0 )
90
+ begin
91
+ name_ptr = FFI::MemoryPointer.new(:pointer)
92
+ Map::MIDIObjectGetStringProperty(@resource, prop, name_ptr)
93
+ name = name_ptr.read_pointer
94
+ len = Map::CF.CFStringGetMaximumSizeForEncoding(Map::CF.CFStringGetLength(name), :kCFStringEncodingUTF8)
95
+ bytes = FFI::MemoryPointer.new(len + 1)
96
+ raise RuntimeError.new("CFStringGetCString") unless Map::CF.CFStringGetCString(name, bytes, len, :kCFStringEncodingUTF8)
97
+ @name = bytes.read_string
98
+ ensure
99
+ Map::CF.CFRelease(name) unless name.nil? || name.null?
100
+ Map::CF.CFRelease(prop) unless prop.null?
101
+ end
102
+ populate_entities(:include_offline => include_if_offline)
103
+ end
104
+
105
+ end
98
106
 
99
- extend FFI::Library
100
- ffi_lib '/System/Library/Frameworks/CoreFoundation.framework/Versions/Current/CoreFoundation'
107
+ module Map
108
+ module CF
101
109
 
102
- typedef :pointer, :CFStringRef
103
- typedef :long, :CFIndex
104
- enum :CFStringEncoding, [ :kCFStringEncodingUTF8, 0x08000100 ]
110
+ extend FFI::Library
111
+ ffi_lib '/System/Library/Frameworks/CoreFoundation.framework/Versions/Current/CoreFoundation'
105
112
 
106
- # CFString* CFStringCreateWithCString( ?, CString, encoding)
107
- attach_function :CFStringCreateWithCString, [:pointer, :string, :int], :pointer
108
- # CString* CFStringGetCStringPtr(CFString*, encoding)
109
- attach_function :CFStringGetCStringPtr, [:pointer, :int], :pointer
113
+ typedef :pointer, :CFStringRef
114
+ typedef :long, :CFIndex
115
+ enum :CFStringEncoding, [ :kCFStringEncodingUTF8, 0x08000100 ]
110
116
 
111
- attach_function :CFStringGetLength, [ :CFStringRef ], :CFIndex
117
+ # CFString* CFStringCreateWithCString( ?, CString, encoding)
118
+ attach_function :CFStringCreateWithCString, [:pointer, :string, :int], :pointer
119
+ # CString* CFStringGetCStringPtr(CFString*, encoding)
120
+ attach_function :CFStringGetCStringPtr, [:pointer, :int], :pointer
112
121
 
113
- attach_function :CFStringGetMaximumSizeForEncoding, [ :CFIndex, :CFStringEncoding ], :long
122
+ attach_function :CFStringGetLength, [ :CFStringRef ], :CFIndex
114
123
 
115
- attach_function :CFStringGetCString, [ :CFStringRef, :pointer, :CFIndex, :CFStringEncoding ], :bool
124
+ attach_function :CFStringGetMaximumSizeForEncoding, [ :CFIndex, :CFStringEncoding ], :long
116
125
 
117
- attach_function :CFRelease, [ :pointer ], :void
126
+ attach_function :CFStringGetCString, [ :CFStringRef, :pointer, :CFIndex, :CFStringEncoding ], :bool
118
127
 
128
+ attach_function :CFRelease, [ :pointer ], :void
129
+
130
+ end
131
+ end
119
132
  end
133
+
120
134
  end
121
135
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mtk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3.1
4
+ version: 0.0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: