movewin 1.8 → 1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/ext/movewin/extconf.rb +95 -27
- data/lib/movewin.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NWFkNzU4Yzc0MzdjNGJhMDhmOTIxMzdmNDVmNGZmMjI4MTQ2ODIxNA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2VmYjRiN2M5NzEyZWI3MzAzYTU5ZDExZjNkNjlkN2MwMTQ4NWRjZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTMwZWRiNWUzNzYxMDUzNmQ3NjkwZmM1ZGRjYTcxZmU2ODU0ZjE1ODYwMDJj
|
10
|
+
ZDUwZjYyNDZkYzVlM2ZlZDM2MDI2N2I5NGYxYmI5MTg1Y2FlYmExNTcyMWE5
|
11
|
+
ZTZiZThlMzFhZWVkMjFjYzFkMDE1MWQ5NzczY2RhZWU5MDk4NTE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWEyY2IyMTgxOWNiNzE0NjQ0Njc3NWRlNjdjNDNiMGFhNDJjNjM2ZjFhMTY5
|
14
|
+
NjIyMjAwMzIwN2Y5N2YyMDUwMmUxOTQ4ZGIxNjJjMjA3NjVhYTc3MjU4MTVk
|
15
|
+
ZDExYmY0MTlkMTMyN2ZmZTUxMGUwOWViN2I5ZTEzNTJmY2YwYmE=
|
data/ext/movewin/extconf.rb
CHANGED
@@ -22,48 +22,116 @@ def yosemite_or_newer?
|
|
22
22
|
Gem::Version.new(`sw_vers -productVersion`) >= Gem::Version.new('10.10')
|
23
23
|
end
|
24
24
|
|
25
|
-
# Return true if our compiler is GCC (not
|
25
|
+
# Return true if our compiler is GCC (not Clang), as for RVM installed Ruby
|
26
26
|
def using_gcc?
|
27
|
-
|
27
|
+
# Match gcc, /usr/local/bin/gcc-4.2, etc. (Clang is "xcrun cc")
|
28
|
+
File.basename(RbConfig::MAKEFILE_CONFIG["CC"]).match(/\Agcc\b/)
|
28
29
|
end
|
29
30
|
|
30
31
|
# Building with GCC on Yosemite (OS X 10.10) results in an error
|
31
32
|
# (https://github.com/andrewgho/movewin-ruby/issues/1).
|
32
33
|
# Patch header file to work around this issue.
|
33
34
|
def fix_dispatch_object_header!
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
File.
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
35
|
+
$stdout.print 'Creating patched copy of dispatch/object.h... '
|
36
|
+
$stdout.flush
|
37
|
+
status = 'failed'
|
38
|
+
if (srcfile = find_header_file('dispatch/object.h'))
|
39
|
+
tmpfile = "#{File.dirname(__FILE__)}/dispatch/object.h.tmp.#{$$}"
|
40
|
+
begin
|
41
|
+
patched = false
|
42
|
+
File.open(tmpfile, 'w') do |tmpfh|
|
43
|
+
File.open(srcfile, 'r').each do |srcline|
|
44
|
+
patched ||= srcline.sub!(
|
45
|
+
/\Atypedef void \(\^dispatch_block_t\)\(void\);/,
|
46
|
+
'typedef void* dispatch_block_t;'
|
47
|
+
)
|
48
|
+
tmpfh.print(srcline)
|
49
|
+
end
|
45
50
|
end
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
51
|
+
if patched
|
52
|
+
destfile = "#{File.dirname(__FILE__)}/dispatch/object.h"
|
53
|
+
File.rename(tmpfile, destfile)
|
54
|
+
if $CFLAGS.nil? || $CFLAGS.empty?
|
55
|
+
$CFLAGS = "-I#{File.dirname(__FILE__)}"
|
56
|
+
else
|
57
|
+
$CFLAGS += " -I#{File.dirname(__FILE__)}"
|
58
|
+
end
|
59
|
+
set_constant! :CLEANINGS,
|
60
|
+
"DISTCLEANFILES += dispatch/object.h\n" + CLEANINGS
|
61
|
+
status = "patched #{destfile}"
|
52
62
|
else
|
53
|
-
|
63
|
+
status = 'skipped'
|
54
64
|
end
|
55
|
-
|
56
|
-
|
65
|
+
ensure
|
66
|
+
File.unlink(tmpfile) if File.exists?(tmpfile)
|
57
67
|
end
|
58
|
-
|
59
|
-
|
68
|
+
else
|
69
|
+
status = 'header not found'
|
60
70
|
end
|
71
|
+
$stdout.puts status
|
72
|
+
$stdout.flush
|
61
73
|
end
|
62
74
|
|
63
|
-
# Given an #include <
|
75
|
+
# Given an #include <dispatch/object.h>, return actual filename
|
76
|
+
# /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/dispatch/object.h
|
64
77
|
def find_header_file(header)
|
65
|
-
|
66
|
-
|
78
|
+
filename = nil
|
79
|
+
header_include_paths.each do |path|
|
80
|
+
maybe_filename = "#{path}/#{header}"
|
81
|
+
if File.exists?(maybe_filename)
|
82
|
+
filename = maybe_filename
|
83
|
+
break
|
84
|
+
end
|
85
|
+
end
|
86
|
+
filename
|
87
|
+
end
|
88
|
+
|
89
|
+
# Return GCC header include path
|
90
|
+
# (http://stackoverflow.com/a/19839946, http://stackoverflow.com/a/19852298)
|
91
|
+
# gcc -Wp,-v -xc /dev/null -fsyntax-only 2>&1
|
92
|
+
def header_include_paths
|
93
|
+
cmd = RbConfig::MAKEFILE_CONFIG["CC"]
|
94
|
+
args = %w{-Wp,-v -xc /dev/null -fsyntax-only}
|
95
|
+
paths = []
|
96
|
+
reading_paths = false
|
97
|
+
run_command(cmd, *args) do |line|
|
98
|
+
line.chomp!
|
99
|
+
if reading_paths
|
100
|
+
if line == 'End of search list.'
|
101
|
+
reading_paths = false
|
102
|
+
elsif line.match(/\A /)
|
103
|
+
line.strip!
|
104
|
+
line.sub!(/\s+\(framework directory\)\Z/, '')
|
105
|
+
paths << line
|
106
|
+
end
|
107
|
+
elsif line == '#include <...> search starts here:'
|
108
|
+
reading_paths = true
|
109
|
+
end
|
110
|
+
end
|
111
|
+
paths
|
112
|
+
end
|
113
|
+
|
114
|
+
# Safely run a command with no shell escapes, pass output lines to callback
|
115
|
+
def run_command(cmd, *args)
|
116
|
+
raise ArgumentError.new('missing required cmd to run') if cmd.nil?
|
117
|
+
rd, wr = IO.pipe
|
118
|
+
if fork
|
119
|
+
wr.close
|
120
|
+
if block_given?
|
121
|
+
rd.each { |line| yield(line) }
|
122
|
+
else
|
123
|
+
rd.read
|
124
|
+
end
|
125
|
+
rd.close
|
126
|
+
Process.wait
|
127
|
+
else
|
128
|
+
rd.close
|
129
|
+
$stdout.reopen(wr)
|
130
|
+
$stderr.reopen(wr)
|
131
|
+
exec cmd, *args
|
132
|
+
raise "exec #{cmd} failed"
|
133
|
+
end
|
134
|
+
$? == 0 # return a bool indicating a successful exit
|
67
135
|
end
|
68
136
|
|
69
137
|
# Redefine constant without warning (http://stackoverflow.com/q/3375360)
|
data/lib/movewin.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: movewin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.9'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Ho
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: List and move OS X windows from Ruby via the OS X accessibility APIs.
|
14
14
|
email: andrew@zeuscat.com
|