rebuild 0.0.4.pre → 0.0.4.pre2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 161e98d3124980dad705d57d12bf58f4a16dfea3
4
- data.tar.gz: 8704a6e0a69dd76caac6f4b9260fbd3694a35165
3
+ metadata.gz: da34f65654ea09206c1a18d1fec63ebf9274b34a
4
+ data.tar.gz: c8a201cf52c50cc9655c8be049e4f900d6abb9c4
5
5
  SHA512:
6
- metadata.gz: 05123b168b5b6c6283aab7e7a7920c739852f9cad42eba2cf72520078e8945a8b7154a16d66c44b444e6a6ad08f277baa5e6b91f9b418ec070a0397704759478
7
- data.tar.gz: 6b6f59b63d8db6c416cff9f5ffcc4ec298a1c5b0f6829d1016be0a244a9d19170a2ac3b64915dfe4edd1fca72925cfbac3647ffd7c5ac386cb706c61941be66d
6
+ metadata.gz: 885b27c6a14d30a1922bbb49b3c92db3b6d457d230421bb29044f7dbafb00912a0b9c9df3422746750650e3f58cf3c68760c000c0874ba04b1474e61b4395107
7
+ data.tar.gz: c9ea0ed8a1fef477d8b465a1fb099c0f9d01bc9c2839805af56ed95fdd77bc5b7c9fa8f47af8ce39ce6a2cf26dcbbf511272fecf4015141e4a80b067e35daac6
@@ -3,12 +3,16 @@ require 'open3'
3
3
 
4
4
  module Rebuild
5
5
  class Bootstrap
6
+ DATABASE = '/Library/Application\ Support/com.apple.TCC/TCC.db'
7
+ BUNDLE_IDENTIFIER = 'com.apple.Terminal'
8
+
6
9
  def installed?
7
10
  system('xcode-select -p > /dev/null')
8
11
  end
9
12
 
10
13
  def install
11
14
  return if installed?
15
+ obtain_accesibility
12
16
 
13
17
  `xcode-select --install`
14
18
  execute_scpt('click_install')
@@ -20,6 +24,16 @@ module Rebuild
20
24
 
21
25
  private
22
26
 
27
+ # Enable Security & Privacy > Privacy > Accessibility for Terminal.app.
28
+ def obtain_accesibility
29
+ puts "Require accessibility for Terminal.app to click buttons"
30
+ sql = <<-SQL
31
+ INSERT OR REPLACE INTO access
32
+ VALUES('kTCCServiceAccessibility','#{BUNDLE_IDENTIFIER}',0,1,0,NULL);
33
+ SQL
34
+ `sudo sqlite3 #{DATABASE} "#{sql}"`
35
+ end
36
+
23
37
  def execute_scpt(name)
24
38
  script_dir = File.expand_path('../../../script', __FILE__)
25
39
  script_path = File.join(script_dir, "#{name}.scpt")
@@ -1,3 +1,3 @@
1
1
  module Rebuild
2
- VERSION = '0.0.4.pre'
2
+ VERSION = '0.0.4.pre2'
3
3
  end
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/env osascript
2
2
 
3
3
  -- Fist: Click Install Button
4
- delay 2.0
5
-
6
4
  set timeoutSeconds to 2.0
7
5
  set uiScript to "click UI Element 4 of window 1 of application process \"Install Command Line Developer Tools\""
8
6
  my doWithTimeout(uiScript, timeoutSeconds)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rebuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4.pre
4
+ version: 0.0.4.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun